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

- old
+ new

@@ -17,61 +17,61 @@ require 'openwfe/participants/storeparticipants' class ConcurrenceAndParticipantTest < Test::Unit::TestCase - def setup - @engine = OpenWFE::Engine.new({ - :definition_in_launchitem_allowed => true }) - end + def setup + @engine = OpenWFE::Engine.new({ + :definition_in_launchitem_allowed => true }) + end - #def teardown - #end + #def teardown + #end - # - # concurrence test + # + # concurrence test - class Hpc0 < OpenWFE::ProcessDefinition - concurrence do - #participant :alice - #participant :bob - alice - bob - end + class Hpc0 < OpenWFE::ProcessDefinition + concurrence do + #participant :alice + #participant :bob + alice + bob end + end - def test_hpc_0 + def test_hpc_0 - @hpAlice = OpenWFE::HashParticipant.new - @hpBob = OpenWFE::HashParticipant.new + @hpAlice = OpenWFE::HashParticipant.new + @hpBob = OpenWFE::HashParticipant.new - @engine.register_participant :alice, @hpAlice - @engine.register_participant :bob, @hpBob + @engine.register_participant :alice, @hpAlice + @engine.register_participant :bob, @hpBob - @engine.launch Hpc0 + @engine.launch Hpc0 - sleep 0.100 + sleep 0.100 - assert_equal @hpAlice.size, 1 - assert_equal @hpBob.size, 1 - end + assert_equal @hpAlice.size, 1 + assert_equal @hpBob.size, 1 + end - def test_1 + def test_1 - @engine.register_participant :alice do |workitem| - puts "alice in" - sleep 0.100 - puts "alice out" - end - @engine.register_participant :bob do |workitem| - puts "bob in" - sleep 0.100 - puts "bob out" - end + @engine.register_participant :alice do |workitem| + puts "alice in" + sleep 0.100 + puts "alice out" + end + @engine.register_participant :bob do |workitem| + puts "bob in" + sleep 0.100 + puts "bob out" + end - @engine.launch Hpc0 + @engine.launch Hpc0 - sleep 2 - end + sleep 2 + end end