test/ft_59_ps.rb in openwferu-0.9.16 vs test/ft_59_ps.rb in openwferu-0.9.17

- old
+ new

@@ -30,25 +30,24 @@ store_a store_b end end - #def xxxx_0 def test_0 sa = @engine.register_participant("store_a", OpenWFE::HashParticipant) sb = @engine.register_participant("store_b", OpenWFE::HashParticipant) fei = @engine.launch Def59 - sleep 0.250 + sleep 0.350 - ps = @engine.list_process_status + ps = @engine.process_statuses #puts ps - assert_equal ps[fei.wfid].expressions.size, 2 - assert_equal ps[fei.wfid].errors.size, 0 + assert_equal 2, ps[fei.wfid].expressions.size + assert_equal 0, ps[fei.wfid].errors.size @engine.cancel_process fei end # @@ -59,25 +58,24 @@ alpha bravo end end - #def xxxx_0b def test_0b - a = @engine.register_participant(:alpha, OpenWFE::HashParticipant) - b = @engine.register_participant(:bravo, OpenWFE::HashParticipant) + a = @engine.register_participant :alpha, OpenWFE::HashParticipant + b = @engine.register_participant :bravo, OpenWFE::HashParticipant fei = @engine.launch Def59b - sleep 0.250 + sleep 0.350 - ps = @engine.list_process_status + ps = @engine.process_statuses #puts ps - assert_equal ps[fei.wfid].expressions.size, 1 - assert_equal ps[fei.wfid].errors.size, 0 + assert_equal 1, ps[fei.wfid].expressions.size + assert_equal 0, ps[fei.wfid].errors.size @engine.cancel_process fei end # @@ -96,22 +94,57 @@ # nothing end fei = @engine.launch Def59_1 - sleep 0.250 + sleep 0.350 - ps = @engine.list_process_status + ps = @engine.process_statuses #puts ps #puts ps[fei.wfid].errors - assert_equal ps[fei.wfid].expressions.size, 1 - assert_equal ps[fei.wfid].errors.size, 1 + assert_equal 1, ps[fei.wfid].expressions.size + assert_equal 1, ps[fei.wfid].branches + assert_equal 1, ps[fei.wfid].errors.size #puts #puts ps.to_s @engine.cancel_process fei.wfid + end + + # + # TEST 2 + + class Def59c < ProcessDefinition + sequence do + bravo + alpha + end + end + + def test_2 + + a = @engine.register_participant :alpha, OpenWFE::HashParticipant + b = @engine.register_participant :bravo, OpenWFE::HashParticipant + + feis = [] + feis << @engine.launch(Def59b) + feis << @engine.launch(Def59b) + feis << @engine.launch(Def59c) + + sleep 0.350 + + assert_equal 3, @engine.list_processes(:wfname => "Def").size + assert_equal 2, @engine.list_processes(:wfrevision => "59b").size + assert_equal 1, @engine.list_processes(:wfrevision => "59c").size + assert_equal 2, @engine.list_processes(:wfname => "Def", :wfrevision => "59b").size + + feis.each do |fei| + @engine.cancel_process fei + end + + sleep 0.350 end end