test/restart_sleep_test.rb in openwferu-0.9.13 vs test/restart_sleep_test.rb in openwferu-0.9.14

- old
+ new

@@ -26,11 +26,14 @@ #end #def teardown #end - class RestartDefinition0 < ProcessDefinition + # + # sleep tests + + class SleepDef < ProcessDefinition def make process_definition :name => "rs0", :revision => "0" do sequence do _sleep :for => "10s" _print "after" @@ -38,30 +41,59 @@ end end end def test_restart_0 + dotest FilePersistedEngine, SleepDef + end + def test_restart_1 + dotest CachedFilePersistedEngine, SleepDef + end - dotest FilePersistedEngine + # + # participant timeout tests + + class TimeoutDef < ProcessDefinition + sequence do + nemo :timeout => "10s" + _print "after" + end end - def test_restart_1 + def test_timeout_0 + dotest FilePersistedEngine, TimeoutDef + end + def test_timeout_1 + dotest CachedFilePersistedEngine, TimeoutDef + end - dotest CachedFilePersistedEngine + TDEF = ''' +<process-definition name="timeouttest" revision="1"> + <sequence> + <participant ref="nemo" timeout="10s" /> + <print>after</print> + </sequence> +</process-definition> +'''.strip + + def test_timeout_0b + dotest FilePersistedEngine, TDEF end protected - def dotest (engine_class) + def dotest (engine_class, def_class) #require 'fileutils' #FileUtils.remove_dir "work" if File.exist? "work" engine = new_engine(engine_class) - li = LaunchItem.new(RestartDefinition0) + #$OWFE_LOG.level = Logger::DEBUG + li = LaunchItem.new(def_class) + engine.launch(li) sleep(1) engine.stop() @@ -69,10 +101,12 @@ $OWFE_LOG.warn "stopped the engine" old_engine = engine engine = new_engine(engine_class) + #$OWFE_LOG.level = Logger::DEBUG + $OWFE_LOG.warn "started the new engine" sleep(11) #sleep(21) @@ -80,10 +114,12 @@ s_now = engine.application_context["__tracer"].to_s #puts "__ s_old >>>#{s_old}<<<" #puts "__ s_now >>>#{s_now}<<<" + $OWFE_LOG.level = Logger::INFO + assert \ (s_old == "" and s_now == "after"), "old : '#{s_old}' / new : '#{s_now}' BAD for #{engine_class}" end @@ -91,9 +127,11 @@ engine = engine_class.new() tracer = Tracer.new engine.application_context["__tracer"] = tracer + + engine.register_participant :nemo, NullParticipant #engine.reschedule engine.reload engine