test/restart_when_test.rb in ruote-0.9.18 vs test/restart_when_test.rb in ruote-0.9.19
- old
+ new
@@ -17,96 +17,96 @@
require 'rutest_utils'
class RestartWhenTest < Test::Unit::TestCase
- #def setup
- # @engine = $WORKFLOW_ENGINE_CLASS.new()
- #end
+ #def setup
+ # @engine = $WORKFLOW_ENGINE_CLASS.new()
+ #end
- #def teardown
- #end
+ #def teardown
+ #end
- class RestartWhenDefinition0 < OpenWFE::ProcessDefinition
- concurrence do
- _when :test => "${v:done} == true", :frequency => "1s" do
- #_when :test => "${v:done} == true" do
- _print "when triggered"
- end
- sequence do
- _sleep "2s"
- _set :variable => "done", :value => "true"
- _print "done"
- end
- end
+ class RestartWhenDefinition0 < OpenWFE::ProcessDefinition
+ concurrence do
+ _when :test => "${v:done} == true", :frequency => "1s" do
+ #_when :test => "${v:done} == true" do
+ _print "when triggered"
+ end
+ sequence do
+ _sleep "2s"
+ _set :variable => "done", :value => "true"
+ _print "done"
+ end
end
+ end
- def test_0
- dotest OpenWFE::FilePersistedEngine
- end
- def test_1
- dotest OpenWFE::CachedFilePersistedEngine
- end
+ def test_0
+ dotest OpenWFE::FilePersistedEngine
+ end
+ def test_1
+ dotest OpenWFE::CachedFilePersistedEngine
+ end
- protected
+ protected
- def dotest (engine_class)
+ def dotest (engine_class)
- engine = new_engine engine_class
+ engine = new_engine engine_class
- li = OpenWFE::LaunchItem.new RestartWhenDefinition0
+ li = OpenWFE::LaunchItem.new RestartWhenDefinition0
- engine.launch li
+ engine.launch li
- sleep 1
+ sleep 1
- engine.stop
+ engine.stop
- $OWFE_LOG.warn " === stopped the engine"
- #display_pool :one
+ $OWFE_LOG.warn " === stopped the engine"
+ #display_pool :one
- old_engine = engine
- engine = new_engine engine_class
+ old_engine = engine
+ engine = new_engine engine_class
- $OWFE_LOG.warn " === started the new engine"
- #display_pool :two
+ $OWFE_LOG.warn " === started the new engine"
+ #display_pool :two
- sleep 3
- #display_pool :three
+ sleep 3
+ #display_pool :three
- s_old = old_engine.application_context["__tracer"].to_s
- s_now = engine.application_context["__tracer"].to_s
+ s_old = old_engine.application_context["__tracer"].to_s
+ s_now = engine.application_context["__tracer"].to_s
- #uts "__ s_old >>>#{s_old}<<<"
- #uts "__ s_now >>>#{s_now}<<<"
+ #uts "__ s_old >>>#{s_old}<<<"
+ #uts "__ s_now >>>#{s_now}<<<"
- assert \
- (s_old == "" and s_now == "done\nwhen triggered"),
- "old : '#{s_old}' / new : '#{s_now}' BAD for #{engine_class}"
+ assert \
+ (s_old == "" and s_now == "done\nwhen triggered"),
+ "old : '#{s_old}' / new : '#{s_now}' BAD for #{engine_class}"
- engine.stop
- end
+ engine.stop
+ end
- #def display_pool (msg)
- # puts
- # puts ".... #{msg}"
- # puts `ls -R work`
- # puts
- #end
+ #def display_pool (msg)
+ # puts
+ # puts ".... #{msg}"
+ # puts `ls -R work`
+ # puts
+ #end
- def new_engine (engine_class)
+ def new_engine (engine_class)
- engine = engine_class.new :definition_in_launchitem_allowed => true
+ engine = engine_class.new :definition_in_launchitem_allowed => true
- #$OWFE_LOG.level = Logger::DEBUG
+ #$OWFE_LOG.level = Logger::DEBUG
- tracer = Tracer.new
- engine.application_context["__tracer"] = tracer
+ tracer = Tracer.new
+ engine.application_context["__tracer"] = tracer
- #engine.reschedule
- engine.reload
+ #engine.reschedule
+ engine.reload
- engine
- end
+ engine
+ end
end