test/ft_9b_cursor.rb in ruote-0.9.18 vs test/ft_9b_cursor.rb in ruote-0.9.19
- old
+ new
@@ -10,96 +10,96 @@
require 'flowtestbase'
require 'openwfe/def'
class FlowTest9b < Test::Unit::TestCase
- include FlowTestBase
+ include FlowTestBase
- #def setup
- #end
+ #def setup
+ #end
- #def teardown
- #end
+ #def teardown
+ #end
- #
- # Test 0
- #
+ #
+ # Test 0
+ #
- class Test0 < OpenWFE::ProcessDefinition
- cursor do
- set :v => "v0", :val => "x"
- _print "${v0}"
- end
+ class Test0 < OpenWFE::ProcessDefinition
+ cursor do
+ set :v => "v0", :val => "x"
+ _print "${v0}"
end
+ end
- def test_0
+ def test_0
- dotest Test0, "x"
- end
+ dotest Test0, "x"
+ end
- #
- # Test 1
- #
+ #
+ # Test 1
+ #
- #class Test1 < OpenWFE::ProcessDefinition
- # cursor do
- # my_participant
- # end
- #end
- #def test_1
- # @engine.register_participant :my_participant do |fexp, wi|
- # #puts fexp.to_s
- # #puts fexp.environment_id.to_s
- # @tracer << "ok0\n" if fexp.environment_id.expid != fexp.fei.expid
- # @tracer << "ok1\n" if fexp.environment_id.expid == "0.0"
- # @tracer << "ok2\n" if fexp.environment_id.wfid + ".0" == fexp.fei.wfid
- # end
- # dotest Test1, "ok0\nok1\nok2"
- #end
+ #class Test1 < OpenWFE::ProcessDefinition
+ # cursor do
+ # my_participant
+ # end
+ #end
+ #def test_1
+ # @engine.register_participant :my_participant do |fexp, wi|
+ # #puts fexp.to_s
+ # #puts fexp.environment_id.to_s
+ # @tracer << "ok0\n" if fexp.environment_id.expid != fexp.fei.expid
+ # @tracer << "ok1\n" if fexp.environment_id.expid == "0.0"
+ # @tracer << "ok2\n" if fexp.environment_id.wfid + ".0" == fexp.fei.wfid
+ # end
+ # dotest Test1, "ok0\nok1\nok2"
+ #end
- #
- # Test 2
- #
+ #
+ # Test 2
+ #
- class Test2 < OpenWFE::ProcessDefinition
- cursor do
- my_participant
- end
+ class Test2 < OpenWFE::ProcessDefinition
+ cursor do
+ my_participant
end
- class MyParticipant
- include OpenWFE::LocalParticipant
+ end
+ class MyParticipant
+ include OpenWFE::LocalParticipant
- def initialize (tracer)
- @tracer = tracer
- end
- def consume (workitem)
- @tracer << "consume\n"
- @workitem = workitem
- end
- def cancel (cancelitem)
- @tracer << "cancel\n"
- end
+ def initialize (tracer)
+ @tracer = tracer
end
+ def consume (workitem)
+ @tracer << "consume\n"
+ @workitem = workitem
+ end
+ def cancel (cancelitem)
+ @tracer << "cancel\n"
+ end
+ end
- def test_2
+ def test_2
- #log_level_to_debug
+ #log_level_to_debug
- @engine.register_participant :my_participant, MyParticipant.new(@tracer)
+ @engine.register_participant :my_participant, MyParticipant.new(@tracer)
- fei = launch Test2
+ fei = launch Test2
- sleep 0.350
+ sleep 0.350
- @engine.cancel_process fei
+ @engine.cancel_process fei
- sleep 0.350
+ sleep 0.350
- assert(
- [ "consume\ncancel",
- "consume\ncancel\ncancel" ].include?(@tracer.to_s))
+ assert(
+ [ "consume\ncancel",
+ "consume\ncancel\ncancel" ].include?(@tracer.to_s))
- assert_equal 1, @engine.get_expression_storage.size
- end
+ assert_equal 1, @engine.get_expression_storage.size
+ end
end