Sha256: b4e5c47aa635e9e884b9a62063109ba1d6b1cbde70ef1a5887977cb191504ee8

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

#
# Testing OpenWFEru
#
# John Mettraux at openwfe.org
#

require 'flowtestbase'
require 'openwfe/def'


class FlowTest21 < 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

        @engine.register_participant(:cron_event) do
            puts "    :(    cron_event at #{Time.now.to_s}"
            @tracer << "cron_event"
        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)

        @engine.cancel_process fei

        sleep 0.350

        assert_nil @engine.process_status(fei)
        assert_equal 1, @engine.get_expression_storage.size
    end

    #
    # Test 1
    #

    class TestDefinition1 < OpenWFE::ProcessDefinition
        concurrence :count => 1 do
            cron :every => "1s500" do
                participant :cron_event
            end
            _sleep "7s"
        end
    end

    def test_1

        #log_level_to_debug

        @engine.register_participant(:cron_event) do
            @tracer << "x"
        end

        dotest TestDefinition1, [ "xxxx", "xxxxx" ]
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-0.9.18 test/ft_21_cron.rb