# # Testing OpenWFEru # # John Mettraux at openwfe.org # # Sun Oct 29 15:41:44 JST 2006 # # somewhere between Philippina and the Japan # require 'test/unit' require 'workitem' require 'ru/engine' require 'ru/rudefinitions' require 'ru/participants' require 'rutest_utils' class FlowTestBase < Test::Unit::TestCase #def setup #end #def teardown #end def default_test () assert true end protected def dotest (flowDef, expectedTrace, sleepTime=0) engine = OpenWFEru::Engine.new() engine.application_context["__tracer"] = Tracer.new engine.register_participant('test-.*', OpenWFEru::PrintParticipant.new()) # register unique tracing participant li = OpenWFE::LaunchItem.new() li.workflowDefinitionUrl = "field:__definition" li.attributes['__definition'] = flowDef engine.launch(li) sleep(sleepTime) trace = engine.application_context["__tracer"].to_s #puts "...'#{trace}' ?= '#{expectedTrace}'" if expectedTrace.kind_of?([].class) result = true expectedTrace.each do |etrace| result = result and trace == etrace end assert \ result, "flow failed : trace doesn't correspond to any expected traces" else assert \ trace == expectedTrace, \ "flow failed : '#{trace}' != '#{expectedTrace}'" end exp_storage = \ engine.application_context[OpenWFEru::S_EXPRESSION_STORAGE] if exp_storage.length != 1 puts puts exp_storage.to_s puts end assert \ exp_storage.length == 1, "there are expressions remaining in the expression pool" end end