Sha256: 09fe98286367bbb7878b40faa3a0bf82c949cbf2770517e5a5ece622ece2735d

Contents?: true

Size: 949 Bytes

Versions: 9

Compression:

Stored size: 949 Bytes

Contents

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

require 'test/unit'

require 'openwfe/util/otime'
require 'openwfe/util/scheduler'


#
# testing otime and the scheduler (its cron aspect)
#
class CronTest < Test::Unit::TestCase

    #def setup
    #end

    #def teardown
    #end

    def test_cron_0
        $var = 0

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

        sid = scheduler.schedule('* * * * *', nil, 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

9 entries across 9 versions & 1 rubygems

Version Path
openwferu-0.9.10 test/cron_test.rb
openwferu-0.9.10.653 test/cron_test.rb
openwferu-0.9.3 test/cron_test.rb
openwferu-0.9.4 test/cron_test.rb
openwferu-0.9.5 test/cron_test.rb
openwferu-0.9.6 test/cron_test.rb
openwferu-0.9.7 test/cron_test.rb
openwferu-0.9.8 test/cron_test.rb
openwferu-0.9.9 test/cron_test.rb