test/restart_paused_test.rb in ruote-0.9.18 vs test/restart_paused_test.rb in ruote-0.9.19
- old
+ new
@@ -4,10 +4,12 @@
# John Mettraux at openwfe.org
#
# Thu Feb 7 15:26:57 JST 2008
#
+require 'rubygems'
+
require 'test/unit'
require 'openwfe/workitem'
require 'openwfe/engine/file_persisted_engine'
require 'openwfe/def'
@@ -15,84 +17,87 @@
require 'rutest_utils'
class RestartPauseTest < Test::Unit::TestCase
- #def setup
- #end
+ #def setup
+ #end
- #def teardown
- #end
+ #def teardown
+ #end
- #
- # sleep tests
+ #
+ # sleep tests
- class SleepDef < OpenWFE::ProcessDefinition
- _sleep :for => "1M"
- end
+ class SleepDef < OpenWFE::ProcessDefinition
+ _sleep :for => "1M"
+ end
- def test_restart_0
- dotest OpenWFE::FilePersistedEngine, SleepDef
- end
- def test_restart_1
- dotest OpenWFE::CachedFilePersistedEngine, SleepDef
- end
+ def test_restart_0
+ dotest OpenWFE::FilePersistedEngine, SleepDef
+ end
+ def test_restart_1
+ dotest OpenWFE::CachedFilePersistedEngine, SleepDef
+ end
- protected
+ protected
- def dotest (engine_class, def_class)
+ def dotest (engine_class, def_class)
- #require 'fileutils'
- #FileUtils.remove_dir "work" if File.exist? "work"
+ #require 'fileutils'
+ #FileUtils.remove_dir "work" if File.exist? "work"
- engine = new_engine engine_class
+ engine = new_engine engine_class
- #$OWFE_LOG.level = Logger::DEBUG
+ #$OWFE_LOG.level = Logger::DEBUG
- li = OpenWFE::LaunchItem.new def_class
+ li = OpenWFE::LaunchItem.new def_class
- fei = engine.launch li
+ fei = engine.launch li
- sleep 0.350
+ sleep 0.350
- engine.pause_process fei.wfid
+ engine.pause_process fei.wfid
- sleep 0.350
+ sleep 0.350
- engine.stop
+ engine.stop
- $OWFE_LOG.warn "stopped the engine"
+ $OWFE_LOG.warn "stopped the engine"
- old_engine = engine
- engine = new_engine engine_class
+ old_engine = engine
+ engine = new_engine engine_class
- #$OWFE_LOG.level = Logger::DEBUG
+ #$OWFE_LOG.level = Logger::DEBUG
- $OWFE_LOG.warn "started the new engine"
+ $OWFE_LOG.warn "started the new engine"
- sleep 0.350
+ sleep 0.350
- assert_equal(
- true, engine.get_expression_pool.paused_instances[fei.wfid])
+ assert_equal(
+ true, engine.get_expression_pool.paused_instances[fei.wfid])
- engine.stop
+ ps = engine.process_status(fei.wfid)
+ assert ps.paused?
- sleep 0.350
- end
+ engine.stop
- def new_engine (engine_class)
+ sleep 0.350
+ end
- engine = engine_class.new :definition_in_launchitem_allowed => true
+ def new_engine (engine_class)
- tracer = Tracer.new
- engine.application_context["__tracer"] = tracer
+ engine = engine_class.new :definition_in_launchitem_allowed => true
- #engine.register_participant :nemo, NullParticipant
+ tracer = Tracer.new
+ engine.application_context["__tracer"] = tracer
- #engine.reschedule
- engine.reload
+ #engine.register_participant :nemo, NullParticipant
- engine
- end
+ #engine.reschedule
+ engine.reload
+
+ engine
+ end
end