Sha256: 7176842548c795a470cba41801171e44d9c7b5ce89c54a1878b5c7bdbd1dcd1b

Contents?: true

Size: 1.95 KB

Versions: 2

Compression:

Stored size: 1.95 KB

Contents

#
# Testing OpenWFE
#
# John Mettraux at openwfe.org
#
# Mon Oct  9 22:19:44 JST 2006
#

require 'openwfe/def'

require 'flowtestbase'

require 'openwfe/expool/journal'



class FlowTest32c < Test::Unit::TestCase
    include FlowTestBase
    include JournalTestBase

    #def teardown
    #end

    #def setup
    #end


    #
    # TEST 0

    class Test0 < ProcessDefinition
        sequence do
            participant :alpha
            participant :nada
            participant :bravo
        end
    end

    #def xxxx_0
    def test_0

        @engine.application_context[:keep_journals] = true

        @engine.init_service("journal", Journal)

        @engine.register_participant(:alpha) do |wi|
            @tracer << "alpha\n"
        end

        class << get_journal
            public :flush_buckets
        end

        #fei = dotest(Test0, "alpha", 0.500, true)
        li = LaunchItem.new Test0
        fei = @engine.launch li

        sleep 0.500

        get_journal.flush_buckets

        fn = get_journal.workdir + "/" + fei.wfid + ".journal"

        #require 'pp'; pp get_journal.load_events(fn)[-1]

        error_event = get_journal.load_events(fn)[-1]

        assert_equal error_event[0], :error
        assert_equal error_event[2].wfid, fei.wfid
        assert_equal error_event[3], :do_apply

        #
        # replaying the error (should occur a second time)

        get_journal.replay_at_error error_event

        sleep 0.500

        assert_equal 2, get_error_count(fei.wfid)

        #
        # fixing the cause of the error and then replaying the error
        # (should not occur)

        @engine.register_participant(:nada) do |wi|
            @tracer << "nada\n"
        end
        @engine.register_participant(:bravo) do |wi|
            @tracer << "bravo\n"
        end

        assert_equal @tracer.to_s, "alpha"

        get_journal.replay_at_error error_event

        sleep 1.0

        assert_equal @tracer.to_s, "alpha\nnada\nbravo"
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openwferu-0.9.16 test/ft_32c_journal.rb
openwferu-0.9.17 test/ft_32c_journal.rb