acs::test::require_package_instance (public)
acs::test::require_package_instance -package_key package_key \ [ -instance_name instance_name ] [ -empty ]
Defined in packages/acs-automated-testing/tcl/aa-test-procs.tcl
Returns a test instance of specified package_key mounted under specified name. Will create it if it is not found. It is currently assumed the instance will be mounted under the main subsite.
- Switches:
- -package_key (required)
- package to be instantiated
- -instance_name (optional)
- name of the site-node this instance will be mounted to. Will default to
-test - -empty (optional, boolean)
- require an empty instance. If an existing instance is found, it will be deleted. If a package different than
is found, it won't be deleted and the proc will return an error - Returns:
- a package_id
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- package_normalize_path, includelet_toc, includelet_childresources, link_tests, slot_interactions, path_resolve, create_form_with_form_instance, create_form_with_numeric, form_validate, nested_self_references
Source code: set main_node_id [site_node::get_element -url / -element node_id] set instance_name [expr {$instance_name eq "" ? "${package_key}-test" : [string trim $instance_name /]}] set package_exists_p [db_0or1row lookup_test_package { select node_id, object_id as package_id from site_nodes where parent_id = :main_node_id and name = :instance_name and object_id is not null }] if {$package_exists_p} { set existing_package_key [apm_package_key_from_id $package_id] if {$existing_package_key ne $package_key} { error "An instance of '$existing_package_key' is already mounted at '$instance_name'" } elseif {$empty_p} { site_node::delete -node_id $node_id -delete_package } } if {!$package_exists_p || $empty_p} { set package_id [site_node::instantiate_and_mount -package_name $instance_name -node_name $instance_name -package_key $package_key] } return $package_idXQL Not present: Generic, PostgreSQL, Oracle