_acs-tcl__sec_lookup_property_not_cached_db (private)

 _acs-tcl__sec_lookup_property_not_cached_db

Defined in packages/acs-tcl/tcl/test/security-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
aa_equals aa_equals (public) aa_log aa_log (public) aa_log_result aa_log_result (public) aa_run_with_teardown aa_run_with_teardown (public) aa_true aa_true (public) _acs-tcl__sec_lookup_property_not_cached_db _acs-tcl__sec_lookup_property_not_cached_db _acs-tcl__sec_lookup_property_not_cached_db->aa_equals _acs-tcl__sec_lookup_property_not_cached_db->aa_log _acs-tcl__sec_lookup_property_not_cached_db->aa_log_result _acs-tcl__sec_lookup_property_not_cached_db->aa_run_with_teardown _acs-tcl__sec_lookup_property_not_cached_db->aa_true

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
        aa_run_with_teardown -rollback -test_code {
            set id [db_nextval sec_id_seq]
            set other_id [db_nextval sec_id_seq]
            set module "lookup-test"
            set name "property"
            db_dml insert_lookup_property {
                insert into sec_session_properties
                    (session_id, module, property_name, property_value, secure_p, last_hit)
                values (:id, :module, :name, 'value', 't', 1)
            }
            db_dml insert_other_module {
                insert into sec_session_properties
                    (session_id, module, property_name, property_value, secure_p, last_hit)
                values (:id, 'lookup-other', :name, 'other', 'f', 1)
            }
            db_dml insert_other_name {
                insert into sec_session_properties
                    (session_id, module, property_name, property_value, secure_p, last_hit)
                values (:id, :module, 'other', 'other', 'f', 1)
            }
            db_dml insert_other_session {
                insert into sec_session_properties
                    (session_id, module, property_name, property_value, secure_p, last_hit)
                values (:other_id, :module, :name, 'other', 'f', 1)
            }

            set before [clock seconds]
            aa_equals "Value and secure flag are returned"  [sec_lookup_property_not_cached $id $module $name] {value t}
            set hit [db_string lookup_hit {
                select last_hit from sec_session_properties
                where session_id = :id and module = :module and property_name = :name
            }]
            aa_true "Matching property timestamp is refreshed" {
                $hit >= $before && $hit <= [clock seconds]
            }
            aa_equals "Other modules, names and sessions remain untouched"  [db_string untouched_properties {
                    select count(*) from sec_session_properties
                    where session_id in (:id, :other_id) and last_hit = 1
                }] 3
            aa_equals "Repeated lookup still returns the property"  [sec_lookup_property_not_cached $id $module $name] {value t}

            # SQL NULL represents an empty Tcl property on both backends.
            db_dml empty_lookup_property {
                update sec_session_properties set property_value = null, secure_p = 'f'
                where session_id = :id and module = :module and property_name = :name
            }
            aa_equals "Empty property remains a two-element result"  [sec_lookup_property_not_cached $id $module $name] [list "" f]
            aa_equals "Missing property returns empty"  [sec_lookup_property_not_cached $id $module missing] ""
            aa_equals "Missing module returns empty"  [sec_lookup_property_not_cached $id missing $name] ""
            aa_equals "Lookup never inserts properties"  [db_string lookup_property_count {
                    select count(*) from sec_session_properties
                    where session_id in (:id, :other_id)
                }] 4
        }
    }} {
          aa_log "Running testcase body $body_count"
          set ::__aa_test_indent [info level]
          set catch_val [catch $testcase_body msg]
          if {$catch_val != 0 && $catch_val != 2} {
              aa_log_result "fail" "sec_lookup_property_not_cached_db (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo"
          }
          incr body_count
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: