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

- old
+ new

@@ -8,207 +8,207 @@ require 'flowtestbase' require 'openwfe/def' class FlowTest45 < Test::Unit::TestCase - include FlowTestBase + include FlowTestBase - #def setup - #end + #def setup + #end - #def teardown - #end + #def teardown + #end - # - # Test 0 - # + # + # Test 0 + # - class TestCase45a0 < OpenWFE::ProcessDefinition - sequence do - concurrent_iterator :on_value => "1, 2", :to_variable => "v" do - _print "${r:fei.expid} - ${v}" - end - _print "done." - end + class TestCase45a0 < OpenWFE::ProcessDefinition + sequence do + concurrent_iterator :on_value => "1, 2", :to_variable => "v" do + _print "${r:fei.expid} - ${v}" + end + _print "done." end + end - def test_0 - dotest( - TestCase45a0, - [ """ + def test_0 + dotest( + TestCase45a0, + [ """ 0.0.0.0 - 1 0.0.0.1 - 2 done. - """.strip, - """ + """.strip, + """ 0.0.0.1 - 2 0.0.0.0 - 1 done. - """.strip - ]) - end + """.strip + ]) + end - # - # Test 1 - # + # + # Test 1 + # - class TestCase45a1 < OpenWFE::ProcessDefinition - sequence do - concurrent_iterator :on_value => "1, 2", :to_field => "f" do - _print "${r:fei.expid} - ${f:f}" - end - _print "done." - end + class TestCase45a1 < OpenWFE::ProcessDefinition + sequence do + concurrent_iterator :on_value => "1, 2", :to_field => "f" do + _print "${r:fei.expid} - ${f:f}" + end + _print "done." end + end - def test_1 - dotest( - TestCase45a1, - [ """ + def test_1 + dotest( + TestCase45a1, + [ """ 0.0.0.0 - 1 0.0.0.1 - 2 done. - """.strip, - """ + """.strip, + """ 0.0.0.1 - 2 0.0.0.0 - 1 done. - """.strip - ]) - end + """.strip + ]) + end - # - # Test 2 - # + # + # Test 2 + # - class TestCase45a2 < OpenWFE::ProcessDefinition - sequence do - concurrent_iterator \ - :on_value => "1, 2", - :to_field => "f", - :over_if => "${f:__ip__} == 0" do + class TestCase45a2 < OpenWFE::ProcessDefinition + sequence do + concurrent_iterator \ + :on_value => "1, 2", + :to_field => "f", + :over_if => "${f:__ip__} == 0" do - _print "${r:fei.sub_instance_id} - ${f:f}" - end - _print "done." - end + _print "${r:fei.sub_instance_id} - ${f:f}" + end + _print "done." end + end - # test 'parked' for now + # test 'parked' for now - def _test_2 - dotest( - TestCase45a2, - """ + def _test_2 + dotest( + TestCase45a2, + """ .0 - 1 .1 - 2 done. - """.strip) - end + """.strip) + end - # - # Test 3 - # + # + # Test 3 + # - class TestCase45a3 < OpenWFE::ProcessDefinition - sequence do - concurrent_iterator :on_value => "", :to_field => "f" do - _print "${r:fei.sub_instance_id} - ${f:f}" - end - _print "done." - end + class TestCase45a3 < OpenWFE::ProcessDefinition + sequence do + concurrent_iterator :on_value => "", :to_field => "f" do + _print "${r:fei.sub_instance_id} - ${f:f}" + end + _print "done." end + end - def test_3 - dotest TestCase45a3, "done." - end + def test_3 + dotest TestCase45a3, "done." + end - # - # Test 4 - # + # + # Test 4 + # - class TestCase45a4 < OpenWFE::ProcessDefinition - sequence do - concurrent_iterator :on => "a, b, c", :to_field => "f" do - _print "${f:f}" - end - set :var => "v", :value => "1, 2" - concurrent_iterator :on_variable_value => "v", :to_field => "f" do - _print "${f:f}" - end - concurrent_iterator :on_var_value => "v", :to_field => "f" do - _print "${f:f}" - end - concurrent_iterator :on_var => "v", :to_field => "f" do - _print "${f:f}" - end - _print "done." - end + class TestCase45a4 < OpenWFE::ProcessDefinition + sequence do + concurrent_iterator :on => "a, b, c", :to_field => "f" do + _print "${f:f}" + end + set :var => "v", :value => "1, 2" + concurrent_iterator :on_variable_value => "v", :to_field => "f" do + _print "${f:f}" + end + concurrent_iterator :on_var_value => "v", :to_field => "f" do + _print "${f:f}" + end + concurrent_iterator :on_var => "v", :to_field => "f" do + _print "${f:f}" + end + _print "done." end + end - def test_4 + def test_4 - dotest( - TestCase45a4, - %w{ a b c 1 2 1 2 1 2 }.join("\n") + "\ndone.") - end + dotest( + TestCase45a4, + %w{ a b c 1 2 1 2 1 2 }.join("\n") + "\ndone.") + end - # - # Test 5 - # + # + # Test 5 + # - class TestCase45a5 < OpenWFE::ProcessDefinition - sequence do - set :f => "f0", :value => "1, 2" - concurrent_iterator :on_f => "f0", :to_field => "f" do - _print "${f:f}" - end - concurrent_iterator :on_f => :f0, :to_field => "f" do - _print "${f:f}" - end - _print "done." - end + class TestCase45a5 < OpenWFE::ProcessDefinition + sequence do + set :f => "f0", :value => "1, 2" + concurrent_iterator :on_f => "f0", :to_field => "f" do + _print "${f:f}" + end + concurrent_iterator :on_f => :f0, :to_field => "f" do + _print "${f:f}" + end + _print "done." end + end - def test_5 + def test_5 - dotest( - TestCase45a5, - %w{ 1 2 1 2 }.join("\n") + "\ndone.") - end + dotest( + TestCase45a5, + %w{ 1 2 1 2 }.join("\n") + "\ndone.") + end - # - # Test 6 - # + # + # Test 6 + # - class Test6 < OpenWFE::ProcessDefinition - concurrent_iterator :on => "a, b, c, d", :to_field => "f" do - participant "${f:f}" - end + class Test6 < OpenWFE::ProcessDefinition + concurrent_iterator :on => "a, b, c, d", :to_field => "f" do + participant "${f:f}" end + end - def test_6 + def test_6 - @engine.register_participant ".", OpenWFE::NullParticipant + @engine.register_participant ".", OpenWFE::NullParticipant - fei = launch Test6 + fei = launch Test6 - sleep 0.350 + sleep 0.350 - #puts @engine.get_expression_storage - assert_equal 12, @engine.get_expression_storage.size + #puts @engine.get_expression_storage + assert_equal 12, @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 end