Sha256: 26169987e03b39a05e9ed376151a40912bf842424cd6dc4572b2dc44ab7b825c

Contents?: true

Size: 1.48 KB

Versions: 4

Compression:

Stored size: 1.48 KB

Contents

#
# Testing OpenWFE
#
# John Mettraux at openwfe.org
#
# Sun Oct 29 15:41:44 JST 2006
#
# somewhere between Philippina and the Japan
#

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
                sequence do
                    _sleep :for => "10s"
                    _print "after"
                end
            end
        end
    end

    def test_restart_0
        engine = new_engine

        li = LaunchItem.new(RestartDefinition0)

        engine.launch(li)

        sleep(1)

        engine.stop()

        $OWFE_LOG.warn "stopped the engine"

        old_engine = engine
        engine = new_engine

        $OWFE_LOG.warn "started the new engine"

        sleep(11)
        #sleep(21)

        s_old = old_engine.application_context["__tracer"].to_s
        s_now = engine.application_context["__tracer"].to_s

        assert (s_old == "" and s_now == "after")
    end

    protected

        def new_engine
            engine = FilePersistedEngine.new()
            tracer = Tracer.new
            engine.application_context["__tracer"] = tracer
            return engine
        end

end

Version data entries

4 entries across 4 versions & 1 rubygems

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