# # Testing OpenWFEru # # John Mettraux at openwfe.org # require 'flowtestbase' require 'openwfe/def' include OpenWFE class FlowTest45 < Test::Unit::TestCase include FlowTestBase #def setup #end #def teardown #end # # Test 0 # class TestCase45a0 < ProcessDefinition sequence do concurrent_iterator :on_value => "1, 2", :to_variable => "v" do _print "${r:fei.sub_instance_id} - ${v}" end _print "done." end end def test_0 dotest( TestCase45a0, [ """ .0 - 1 .1 - 2 done. """.strip, """ .1 - 2 .0 - 1 done. """.strip ]) end # # Test 1 # class TestCase45a1 < ProcessDefinition sequence do concurrent_iterator :on_value => "1, 2", :to_field => "f" do _print "${r:fei.sub_instance_id} - ${f:f}" end _print "done." end end def test_1 dotest( TestCase45a1, [ """ .0 - 1 .1 - 2 done. """.strip, """ .1 - 2 .0 - 1 done. """.strip ]) end # # Test 2 # class TestCase45a2 < 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 end # test 'parked' for now def _test_2 dotest( TestCase45a2, """ .0 - 1 .1 - 2 done. """.strip) end # # Test 3 # class TestCase45a3 < 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 # # Test 4 # class TestCase45a4 < 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 dotest( TestCase45a4, %w{ a b c 1 2 1 2 1 2 }.join("\n") + "\ndone.") end # # Test 5 # class TestCase45a5 < 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 dotest( TestCase45a5, %w{ 1 2 1 2 }.join("\n") + "\ndone.") end end