Sha256: ae7a0b70321b4a544a0865170c2d2e5b0a8596dc114e775a325adb8e65fc132e

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

#
# Testing OpenWFE
#
# John Mettraux at openwfe.org
#
# Sun Oct 29 15:41:44 JST 2006
#

require 'test/unit'

require 'openwfe/workitem'
require 'openwfe/engine/file_persisted_engine'
require 'openwfe/expressions/raw_prog'

require 'rutest_utils'

include OpenWFE


class RestartTest < Test::Unit::TestCase

    #def setup
    #    @engine = $WORKFLOW_ENGINE_CLASS.new()
    #end

    #def teardown
    #end

    class RestartDefinition0 < ProcessDefinition
        def make
            process_definition :name => "rs0", :revision => "0" do
                cron :tab => "* * * * *", :name => "//cron" do
                    participant :cron_event
                end
            end
        end
    end

    def test_restart_0

        engine = FilePersistedEngine.new

        count = 0

        participant = lambda do
            #puts "______________________ :cron_event"
            count = count + 1
        end

        engine.register_participant(:cron_event, &participant)

        engine.launch(RestartDefinition0)

        sleep(60)

        engine.stop()

        #puts "___restarting to new engine"

        old_engine = engine
        engine = FilePersistedEngine.new

        engine.register_participant(:cron_event, &participant)

        sleep(60)

        engine.stop()

        #puts "_count : #{count}"

        assert \
            count == 2,
            "the cron expression should have counted to 2, "+
            "but it counted to #{count}"
    end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
openwferu-0.9.3 test/restart_cron_test.rb
openwferu-0.9.4 test/restart_cron_test.rb
openwferu-0.9.5 test/restart_cron_test.rb
openwferu-0.9.6 test/restart_cron_test.rb