_workflow__parallel_simple_workflow (private)
_workflow__parallel_simple_workflow
Defined in packages/workflow/tcl/test/workflow-test-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 { #---------------------------------------------------------------------- # Create parallel workflow #---------------------------------------------------------------------- # action_id | trigger | s1 | s2 | done | # ---------------------------+----------+------+------+-------+ # inti | init | | | | # task_one | parallel | X | | | # para_a | user | | | | # para_b | user | | | | # task_two | user | | X | | set workflow_id [workflow::fsm::new_from_spec -package_key "acs-automated-testing" -spec { parallel_simple { pretty_name "Simple Parallel" states { s1 { pretty_name "S1" enabled_actions { task_one } } s2 { pretty_name "S2" enabled_actions { task_two } } done { pretty_name "Done" } } roles { role1 { pretty_name "Role1" } role2 { pretty_name "Role2" } } actions { init { pretty_name "Open" new_state "s1" trigger_type init } task_one { pretty_name "Task 1 (parallel)" new_state "s2" trigger_type parallel } para_a { pretty_name "Para A (user)" parent_action "task_one" assigned_role role1 } para_b { pretty_name "Para B (user)" parent_action "task_one" assigned_role role2 } task_two { pretty_name "Task 2 (user)" new_state "done" assigned_role role1 } } } }] #---------------------------------------------------------------------- # Test the state-action map #---------------------------------------------------------------------- array set state_action_map { s1 { task_one } s2 { task_two } done {} } foreach state [array names state_action_map] { set state_id [workflow::state::fsm::get_id -workflow_id $workflow_id -short_name $state] set enabled_actions [workflow::state::fsm::get_element -state_id $state_id -element enabled_actions] aa_true "Enabled actions in state $state are $enabled_actions, should be $state_action_map($state)" [util_sets_equal_p $state_action_map($state) $enabled_actions] } #---------------------------------------------------------------------- # Start a case of the workflow #---------------------------------------------------------------------- aa_log "Starting case." set case_id [workflow::case::new -workflow_id $workflow_id -object_id [workflow::test::workflow_object_id] -user_id [workflow::test::admin_owner_id]] workflow::test::assert_case_state -workflow_id $workflow_id -case_id $case_id -expect_current_state { "s1" } -expect_enabled_actions { "para_a" "para_b" } #---------------------------------------------------------------------- # Execute 'para_b' #---------------------------------------------------------------------- workflow::case::action::execute -case_id $case_id -action_id [workflow::action::get_id -workflow_id $workflow_id -short_name "para_b"] -user_id [workflow::test::admin_owner_id] workflow::test::assert_case_state -workflow_id $workflow_id -case_id $case_id -expect_current_state { "s1" } -expect_enabled_actions "para_a" #---------------------------------------------------------------------- # Execute 'para_a' #---------------------------------------------------------------------- aa_log "Executing: para_a" workflow::case::action::execute -case_id $case_id -action_id [workflow::action::get_id -workflow_id $workflow_id -short_name "para_a"] -user_id [workflow::test::admin_owner_id] workflow::test::assert_case_state -workflow_id $workflow_id -case_id $case_id -expect_current_state { "s2" } -expect_enabled_actions "task_two" #---------------------------------------------------------------------- # Execute 'task_two' #---------------------------------------------------------------------- aa_log "Executing: task_two" workflow::case::action::execute -case_id $case_id -action_id [workflow::action::get_id -workflow_id $workflow_id -short_name "task_two"] -user_id [workflow::test::admin_owner_id] #---------------------------------------------------------------------- # 'done', Nothing enabled #---------------------------------------------------------------------- workflow::test::assert_case_state -workflow_id $workflow_id -case_id $case_id -expect_current_state { "done" } -expect_enabled_actions [list] } }} { 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" "parallel_simple_workflow (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle