_acs-tcl__ad_context_bar (private)
_acs-tcl__ad_context_bar
Defined in packages/acs-tcl/tcl/test/navigation-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ aa_run_with_teardown -rollback -test_code { set main_node [site_node::get -url /] set this_package_id [ad_conn package_id] set this_package_name [db_string get_name { select instance_name from apm_packages where package_id = :this_package_id }] # Setup nodes from the context bar, create two random nodes to include set separator "-" set random1 [ad_generate_random_string] set testnode_1 [list "/$random1/" $this_package_name] set random2 [ad_generate_random_string] set testnode_2 [list "[lindex $testnode_1 0]$random2/" $this_package_name] set leave_node "ref_final" set root_node [list "/" [dict get $main_node instance_name]] if { [string match "admin/*" [ad_conn extra_url]] } { set admin_node [list "[ad_conn package_url]admin/" [_ acs-tcl.Administration]] } else { set admin_node "" } # Create hierarchy from the random created nodes set idp [dict get $main_node node_id] set idr_1 [site_node::new -name $random1 -parent_id $idp] set idr_2 [site_node::new -name $random2 -parent_id $idr_1] site_node::mount -node_id $idr_1 -object_id $this_package_id site_node::mount -node_id $idr_2 -object_id $this_package_id aa_log "Created two test sites nodes: testnode_1 = [lindex $testnode_1 1],\n testnode_2 = [lindex $testnode_2 1]n testnode_2 is a child of testnode_1" array set node [site_node::get -node_id $idp] array set node1 [site_node::get -node_id $idr_1] array set node2 [site_node::get -node_id $idr_2] set msg "" append msg "node0 $idp parent $node(parent_id) url $node(url) object_id $node(object_id)" "\nnode1 $idr_1 parent $node1(parent_id) url $node1(url) object_id $node1(object_id)" "\nnode2 $idr_2 parent $node2(parent_id) url $node2(url) object_id $node2(object_id)" aa_log $msg #----------------------------------------------------------------------- # Case 1: node_id = testnode_1 #----------------------------------------------------------------------- aa_log "Case 1: node_id = testnode_1 <$testnode_1>" set bar_components [list $root_node $testnode_1] if {$admin_node ne ""} { lappend bar_components $admin_node } #aa_log "bar_components $bar_components" set context_barp "" foreach value $bar_components { append context_barp [subst {<a href="[ns_quotehtml [lindex $value 0]]">[ns_quotehtml [lindex $value 1]]</a> $separator }] } append context_barp "$leave_node" set context_bar [ad_context_bar -node_id $idr_1 -separator $separator $leave_node] # Test set msg [ns_quotehtml "ad_context_bar 1: '$context_bar'\nad_context_bar 2: '$context_barp'"] aa_log "<pre>$msg</pre>" aa_equals "Context_bar = $context_barp" $context_bar $context_barp #----------------------------------------------------------------------- # Case 2: node_id = testnode_2 (testnode2 is a testnode_1 children) #----------------------------------------------------------------------- aa_log "Case 2: node_id = testnode_2 (testnode2 is a testnode_1 children)" set bar_components [list $root_node $testnode_1 $testnode_2] if {$admin_node ne ""} { lappend bar_components $admin_node } set context_barp "" foreach value $bar_components { append context_barp [subst {<a href="[ns_quotehtml [lindex $value 0]]">[ns_quotehtml [lindex $value 1]]</a> $separator }] } append context_barp "$leave_node" set context_bar [ad_context_bar -node_id $idr_2 -separator $separator $leave_node] set msg [ns_quotehtml "ad_context_bar 1: '$context_bar'\nad_context_bar 2: '$context_barp'"] aa_log "<pre>$msg</pre>" aa_equals "Context_bar = $context_barp" $context_bar $context_barp #---------------------------------------------------------------------------- # Case 3: from_node = testnode_1 and node_id = testnode_2 #---------------------------------------------------------------------------- aa_log "Case 3: from_node = testnode_1 and node_id = testnode_2" set bar_components [list $testnode_1 $testnode_2] if {$admin_node ne ""} { lappend bar_components $admin_node } set context_barp "" foreach value $bar_components { append context_barp [subst {<a href="[lindex $value 0]">[lindex $value 1]</a> $separator }] } append context_barp "$leave_node" set context_bar [ad_context_bar -from_node $idr_1 -node_id $idr_2 -separator $separator $leave_node] aa_equals "Context_bar = $context_barp" $context_bar $context_barp } }} { 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" "ad_context_bar (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle