test/functional/eft_32_lose.rb in ruote-2.2.0 vs test/functional/eft_32_lose.rb in ruote-2.3.0

- old
+ new

@@ -3,11 +3,11 @@ # testing ruote # # Thu Nov 25 10:05:28 JST 2010 # -require File.join(File.dirname(__FILE__), 'base') +require File.expand_path('../base', __FILE__) require 'ruote/participant' class EftLoseTest < Test::Unit::TestCase @@ -17,20 +17,20 @@ pdef = Ruote.process_definition do lose end - #@engine.noisy = true + #@dashboard.noisy = true - wfid = @engine.launch(pdef) + wfid = @dashboard.launch(pdef) - @engine.wait_for(2) + @dashboard.wait_for(2) # wait until the process reaches the 'lose' expression sleep 0.500 - ps = @engine.process(wfid) + ps = @dashboard.process(wfid) assert_equal 0, ps.errors.size assert_equal 2, ps.expressions.size # the process is just stuck at the 'lose' expression @@ -43,19 +43,19 @@ alpha end charly end - @engine.register_participant '.+' do |wi| - @tracer << wi.participant_name + @dashboard.register_participant '.+' do |wi| + tracer << wi.participant_name end - #@engine.noisy = true + #@dashboard.noisy = true - wfid = @engine.launch(pdef) + wfid = @dashboard.launch(pdef) - @engine.wait_for(7) + @dashboard.wait_for(7) # wait until 'alpha' replies to its parent 'lose' sleep 0.500 assert_equal 'alpha', @tracer.to_s @@ -67,27 +67,53 @@ lose do alpha end end - @engine.register_participant '.+', Ruote::StorageParticipant + @dashboard.register_participant '.+', Ruote::StorageParticipant - #@engine.noisy = true + #@dashboard.noisy = true - wfid = @engine.launch(pdef) + wfid = @dashboard.launch(pdef) - @engine.wait_for(6) + @dashboard.wait_for(6) # wait until 'alpha' replies to its parent 'lose' - sleep 0.500 + assert_equal 1, @dashboard.storage_participant.size - assert_equal 1, @engine.storage_participant.size + @dashboard.cancel_process(wfid) - @engine.cancel_process(wfid) + @dashboard.wait_for(wfid) - sleep 0.500 + assert_equal 0, @dashboard.storage_participant.size + assert_nil @dashboard.process(wfid) + end - assert_equal 0, @engine.storage_participant.size - assert_nil @engine.process(wfid) + def test_multi + + pdef = Ruote.define do + lose do + alpha + bravo + end + end + + @dashboard.register '.+', Ruote::StorageParticipant + + #@dashboard.noisy = true + + wfid = @dashboard.launch(pdef) + + @dashboard.wait_for(9) + + assert_equal 2, @dashboard.storage_participant.size + assert_equal 0, @dashboard.ps(wfid).errors.size + assert_equal 4, @dashboard.ps(wfid).expressions.size + + @dashboard.cancel(wfid) + + @dashboard.wait_for(wfid) + + assert_nil @dashboard.ps(wfid) end end