Sha256: 55ef443ea8f70af948ba94d74929e91550af3ee62f883a879841ed65866f9c89

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

#
# Testing OpenWFEru
#
# John Mettraux at openwfe.org
#
# Sun Mar 23 13:26:15 JST 2008
#

require 'flowtestbase'
require 'openwfe/def'


class FlowTest21b < Test::Unit::TestCase
    include FlowTestBase

    #def setup
    #end

    #def teardown
    #end

    #
    # Test 0
    #

    class TestDefinition0 < OpenWFE::ProcessDefinition
        cron :tab => "* * * * * *", :name => "cron" do
            participant :cron_event
        end
    end

    #
    # this one tests whether a cron event is removed when his process
    # terminates, as should be.
    #
    def test_0

        #log_level_to_debug

        counter = 0

        @engine.register_participant(:cron_event) do
            counter += 1
        end

        #puts "start at #{Time.now.to_s}"
        #dotest TestDefinition0, "", 62

        fei = launch TestDefinition0

        sleep 0.350

        assert_equal "", @tracer.to_s
        assert_not_nil @engine.process_status(fei)

        sleep 3

        @engine.pause_process fei.wfid

        assert_equal 3, counter

        sleep 3

        assert_equal 3, counter
        assert_equal 0, @engine.process_status(fei).errors.size

        @engine.resume_process fei.wfid

        sleep 3

        assert_equal 6, counter

        @engine.cancel_process fei.wfid

        sleep 0.350

        assert_nil @engine.process_status(fei)
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-0.9.18 test/ft_21b_cron_pause.rb