test/ft_14b_subprocess.rb in ruote-0.9.18 vs test/ft_14b_subprocess.rb in ruote-0.9.19

- old
+ new

@@ -12,181 +12,181 @@ require 'openwfe/def' require 'flowtestbase' class FlowTest14b < Test::Unit::TestCase - include FlowTestBase + include FlowTestBase - #def setup - #end + #def setup + #end - #def teardown - #end + #def teardown + #end - # - # TEST 0 + # + # TEST 0 - def test_0 + def test_0 - dotest( + dotest( '''<process-definition name="subtest0" revision="0"> - <sequence> - <subprocess ref="sub0" a="A" b="B" c="C" /> - <sub0 a="A" b="B" c="C" /> - </sequence> + <sequence> + <subprocess ref="sub0" a="A" b="B" c="C" /> + <sub0 a="A" b="B" c="C" /> + </sequence> - <process-definition name="sub0"> - <print>${a}${b}${c}</print> - </process-definition> + <process-definition name="sub0"> + <print>${a}${b}${c}</print> + </process-definition> -</process-definition>''', - "ABC\nABC") - end +</process-definition>''', + "ABC\nABC") + end - # - # TEST 1 + # + # TEST 1 - class SubTest1 < OpenWFE::ProcessDefinition + class SubTest1 < OpenWFE::ProcessDefinition - sub1 "toto", :a => "A" + sub1 "toto", :a => "A" - process_definition :name => :sub1 do - _print "${0} ${a}" - end + process_definition :name => :sub1 do + _print "${0} ${a}" end + end - def test_1 + def test_1 - dotest SubTest1, "toto A" - end + dotest SubTest1, "toto A" + end - # - # TEST 1b + # + # TEST 1b - def test_1b + def test_1b - dotest( + dotest( '''<process-definition name="subtest0" revision="0"> - <sequence> - <subprocess ref="sub0" a="A">zero</subprocess> - <sub0 a="A">rei</sub0> - </sequence> + <sequence> + <subprocess ref="sub0" a="A">zero</subprocess> + <sub0 a="A">rei</sub0> + </sequence> - <process-definition name="sub0"> - <print>${0} ${a}</print> - </process-definition> + <process-definition name="sub0"> + <print>${0} ${a}</print> + </process-definition> -</process-definition>''', - "zero A\nrei A") - end +</process-definition>''', + "zero A\nrei A") + end - # - # TEST 2 + # + # TEST 2 - class SubTest2 < OpenWFE::ProcessDefinition - def make + class SubTest2 < OpenWFE::ProcessDefinition + def make - sequence do - sub1 do - "a" - end - sub1 "c", "d" - end - - process_definition :name => :sub1 do - _print "${0} ${1}" - end + sequence do + sub1 do + "a" end + sub1 "c", "d" + end + + process_definition :name => :sub1 do + _print "${0} ${1}" + end end + end - def test_2 + def test_2 - dotest SubTest2, "a \nc d" - end + dotest SubTest2, "a \nc d" + end - # - # TEST 3 + # + # TEST 3 - class SubTest3 < OpenWFE::ProcessDefinition + class SubTest3 < OpenWFE::ProcessDefinition - subprocess "c", "d", :ref => :sub1 + subprocess "c", "d", :ref => :sub1 - process_definition :name => :sub1 do - _print "${0} ${1}" - end + process_definition :name => :sub1 do + _print "${0} ${1}" end + end - def test_3 + def test_3 - dotest SubTest3, "c d" - end + dotest SubTest3, "c d" + end - # - # TEST 4 + # + # TEST 4 - class Test4 < OpenWFE::ProcessDefinition - sub0 - process_definition :name => "sub0" do - toto - end + class Test4 < OpenWFE::ProcessDefinition + sub0 + process_definition :name => "sub0" do + toto end + end - def test_4 + def test_4 - #log_level_to_debug + #log_level_to_debug - @engine.register_participant "toto", OpenWFE::NullParticipant + @engine.register_participant "toto", OpenWFE::NullParticipant - fei = launch Test4 + fei = launch Test4 - sleep 0.350 + sleep 0.350 - #puts @engine.get_expression_storage - assert_equal 8, @engine.get_expression_storage.size + #puts @engine.get_expression_storage + assert_equal 8, @engine.get_expression_storage.size - @engine.cancel_process fei + @engine.cancel_process fei - sleep 0.350 + sleep 0.350 - assert_equal 1, @engine.get_expression_storage.size - end + assert_equal 1, @engine.get_expression_storage.size + end - # - # TEST 5 + # + # TEST 5 - class Test5 < OpenWFE::ProcessDefinition - sub0 :forget => true - process_definition :name => "sub0" do - toto - end + class Test5 < OpenWFE::ProcessDefinition + sub0 :forget => true + process_definition :name => "sub0" do + toto end + end - def test_5 + def test_5 - #log_level_to_debug + #log_level_to_debug - @engine.register_participant "toto", OpenWFE::NullParticipant + @engine.register_participant "toto", OpenWFE::NullParticipant - fei = launch Test5 + fei = launch Test5 - sleep 0.350 + sleep 0.350 - #puts @engine.get_expression_storage - assert_equal 4, @engine.get_expression_storage.size + #puts @engine.get_expression_storage + assert_equal 4, @engine.get_expression_storage.size - @engine.cancel_process fei.wfid + ".0" - # cancelling the remaining subprocess + @engine.cancel_process fei.wfid + ".0" + # cancelling the remaining subprocess - sleep 0.350 + sleep 0.350 - assert_equal 1, @engine.get_expression_storage.size - end + assert_equal 1, @engine.get_expression_storage.size + end end