test/timeout_test.rb in openwferu-0.9.3 vs test/timeout_test.rb in openwferu-0.9.4

- old
+ new

@@ -3,12 +3,10 @@ # # John Mettraux at openwfe.org # # Sun Oct 29 15:41:44 JST 2006 # -# somewhere between Philippina and the Japan -# require 'test/unit' #require 'openwfe/workitem' require 'openwfe/engine/engine' @@ -32,11 +30,11 @@ class TimeoutDefinition0 < ProcessDefinition def make process_definition :name => "to0", :revision => "0" do sequence do participant :ref => "albert", :timeout => "500" - _print "over" + _print "over ${f:done}" end end end end @@ -56,18 +54,62 @@ sleep(2) s = engine.application_context["__tracer"].to_s + engine.stop + #puts "trace is >#{s}<" #puts "albert.size is #{albert.size}" assert \ albert.size == 0, "workitem was not removed from workitem store" assert \ s == "over", - "flow did not reacher 'over'" + "flow did not reach 'over'" + end + + def test_timeout_1 + + albert = HashParticipant.new + + engine = Engine.new + + engine.application_context["__tracer"] = Tracer.new + + engine.register_participant(:albert, albert) + + pjc = engine.get_scheduler.pending_job_count + assert \ + pjc == 0, + "0 pending_jobs_count is at #{pjc}, it should be at 0" + + li = LaunchItem.new(TimeoutDefinition0) + + engine.launch(li) + + wi = albert.list_workitems(nil)[0] + wi.done = "ok" + albert.proceed(wi) + + s = engine.application_context["__tracer"].to_s + + #puts "trace is >#{s}<" + #puts "albert.size is #{albert.size}" + + assert \ + albert.size == 0, + "workitem was not removed from workitem store" + assert \ + s == "over ok", + "flow did not reach 'over ok'" + + pjc = engine.get_scheduler.pending_job_count + + assert \ + pjc == 0, + "1 pending_jobs_count is at #{pjc}, it should be at 0" end end