Sha256: c0401b2127ba7d607921bb7677f97a089e260cd55edc89e2968f23ee13a209a3

Contents?: true

Size: 1.95 KB

Versions: 1

Compression:

Stored size: 1.95 KB

Contents

#
# 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openwferu-0.9.0 test/flowtestbase.rb