Sha256: 1f4d3a3a8bc92f6e8a016921cc7219271c98040ec601d5da8c3b1e1816fe0766
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
# # Testing OpenWFE # # John Mettraux at openwfe.org # # Sun Oct 29 16:18:25 JST 2006 # require 'test/unit' #require 'openwfe/otime' require 'openwfe/util/scheduler' # # testing otime and the scheduler # class SchedulerTest < Test::Unit::TestCase #def setup #end #def teardown #end def test_scheduler_0 $var = nil scheduler = OpenWFE::Scheduler.new() scheduler.start sid = scheduler.schedule_in('2s', TestSchedulable.new, nil) assert \ sid, "scheduler_0 did not return a job id" assert \ (not $var), "scheduler_0 is blocking but should not" sleep(2.5) scheduler.do_stop #puts ">#{$var}<" assert \ ($var == "ok"), "scheduler_0 didn't work" end def test_scheduler_1 $var = nil scheduler = OpenWFE::Scheduler.new() scheduler.start sid = scheduler.schedule_in('1s') do $var = "ok..1" end assert \ sid, "scheduler_1 did not return a job id" assert \ (not $var), "scheduler_1 is blocking but should not" sleep(2) scheduler.do_stop #puts ">#{$var}<" assert \ ($var == "ok..1"), "scheduler_1 didn't work" end protected class TestSchedulable include OpenWFE::Schedulable def trigger (params) $var = "ok" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
openwferu-0.9.3 | test/scheduler_test.rb |
openwferu-0.9.4 | test/scheduler_test.rb |