Sha256: 58bfab8379321e3b754da158edf84a4fa641021eabd69f80b8ac3369f93070e7

Contents?: true

Size: 1.92 KB

Versions: 1

Compression:

Stored size: 1.92 KB

Contents

#
# Testing OpenWFE
#
# John Mettraux at openwfe.org
#
# Tue Feb 19 10:58:43 JST 2008
#

require 'test/unit'
require 'fileutils'
require 'openwfe/def'
require 'openwfe/engine/file_persisted_engine'

include OpenWFE


class Back0916Test < Test::Unit::TestCase

    WORK = 'work_back'

    def setup

        FileUtils.rm_rf WORK
        FileUtils.mkdir WORK

        `cd work_back && tar xzvf ../test/expool_20031219_0916.tgz`

        ac = { :work_directory => WORK }

        @engine = FilePersistedEngine.new ac

    end

    def teardown

        $OWFE_LOG.level = Logger::INFO
        FileUtils.rm_rf WORK
    end

    def test_0

        #$OWFE_LOG.level = Logger::DEBUG

        trace = []

        @engine.register_participant :alpha do
            trace << :alpha
        end

        @engine.reload

        ps = @engine.process_status "20080212-moshijuzuke" # an XML process
        exp = ps.expressions.first
        wi = exp.applied_workitem
        wi.message = "back from obsolesence"

        @engine.reply wi

        sleep 0.350

        assert_equal [ :alpha ], trace

        ps = @engine.process_status "20080212-moshijuzuke" # an XML process

        assert_nil ps
    end

    def test_1

        #$OWFE_LOG.level = Logger::DEBUG

        trace = []

        #@engine.register_participant :employee do
        #    trace << :assistant
        #end
        #@engine.register_participant :employee do
        #    trace << :employee
        #end
        [ :user_bob, :user_alice ].each do |p|
            @engine.register_participant p do
                trace << p
            end
        end

        @engine.reload

        ps = @engine.process_status "20080213-depejetzube" # an ruby procdef
        exp = ps.expressions.first
        wi = exp.applied_workitem

        @engine.reply wi

        sleep 0.400

        assert_equal [ :user_bob, :user_bob ], trace

        assert_nil @engine.process_status("20080213-depejetzube")
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openwferu-0.9.17 test/back_0916_test.rb