Sha256: 4ed8c3edb0f5deb2c07e3c3943b2fdf09f8a81f2ca3344adbc3c892b146f9d4c

Contents?: true

Size: 907 Bytes

Versions: 1

Compression:

Stored size: 907 Bytes

Contents

#
# Testing OpenWFE
#
# John Mettraux at openwfe.org
#
# Sun Oct 29 16:18:25 JST 2006
#

require 'test/unit'
require 'otime'
require 'ru/util/scheduler'

#
# testing otime and the scheduler
#

class TimeTest < Test::Unit::TestCase

    #def setup
    #end

    #def teardown
    #end

    def test_cron_0
        $var = 0

        scheduler = OpenWFE::Scheduler.new()
        scheduler.start

        sid = scheduler.schedule('* * * * *', CounterSchedulable.new, nil)

        assert \
            sid,
            "scheduler did not return a job id"

        sleep(120)
        scheduler.stop

        #puts ">#{$var}<"

        assert \
            ($var == 2),
            "cron_0 failed, $var is #{$var}"
    end

    protected

        class CounterSchedulable
            include OpenWFE::Schedulable

            def trigger (params)
                $var = $var + 1
            end
        end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openwferu-0.9.2 test/crontest.rb