test/restart_when_test.rb in openwferu-0.9.16 vs test/restart_when_test.rb in openwferu-0.9.17
- old
+ new
@@ -10,11 +10,11 @@
require 'test/unit'
require 'openwfe/workitem'
require 'openwfe/engine/file_persisted_engine'
-require 'openwfe/expressions/raw_prog'
+require 'openwfe/def'
require 'rutest_utils'
include OpenWFE
@@ -27,26 +27,25 @@
#def teardown
#end
class RestartWhenDefinition0 < ProcessDefinition
- def make
- 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
+ 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_restart_0
+
dotest FilePersistedEngine
end
def test_restart_1
dotest CachedFilePersistedEngine
@@ -54,28 +53,31 @@
protected
def dotest (engine_class)
- engine = new_engine(engine_class)
+ engine = new_engine engine_class
- li = LaunchItem.new(RestartWhenDefinition0)
+ li = LaunchItem.new RestartWhenDefinition0
- engine.launch(li)
+ engine.launch li
- sleep(1)
+ sleep 1
- engine.stop()
+ engine.stop
- $OWFE_LOG.warn "stopped the engine"
+ $OWFE_LOG.warn " === stopped the engine"
+ #display_pool :one
old_engine = engine
- engine = new_engine(engine_class)
+ engine = new_engine engine_class
- $OWFE_LOG.warn "started the new engine"
+ $OWFE_LOG.warn " === started the new engine"
+ #display_pool :two
- sleep(3)
+ sleep 3
+ #display_pool :three
s_old = old_engine.application_context["__tracer"].to_s
s_now = engine.application_context["__tracer"].to_s
#uts "__ s_old >>>#{s_old}<<<"
@@ -86,12 +88,21 @@
"old : '#{s_old}' / new : '#{s_now}' BAD for #{engine_class}"
engine.stop
end
+ #def display_pool (msg)
+ # puts
+ # puts ".... #{msg}"
+ # puts `ls -R work`
+ # puts
+ #end
+
def new_engine (engine_class)
- engine = engine_class.new()
+ engine = engine_class.new
+
+ #$OWFE_LOG.level = Logger::DEBUG
tracer = Tracer.new
engine.application_context["__tracer"] = tracer
#engine.reschedule