public
Description: A fork of backgroundrb for MERB
Clone URL: git://github.com/GeorgePalmer/backgroundrb_merb.git
Search Repo:
Commit Master Worker Testcases
gnufied (author)
Sat Mar 01 18:23:28 -0800 2008
commit  f18b5c9f6c33c68a7593307c9353031b26a4951c
tree    abde080bafa221af5c67b8b2cb14824d8d61f077
parent  ab7711294a121dfff3bfbf7793ce7fc88290d6c8
...
1
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
4
5
...
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
...
87
88
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,5 +1,43 @@
0
 require File.join(File.dirname(__FILE__) + "/bdrb_test_helper")
0
 
0
+context "Master proxy for reloadable workers" do
0
+ BackgrounDRb::Config::RAILS_ENV = "production"
0
+ CONFIG_FILE = {:schedules=>
0
+ {
0
+ :foo_worker => { :barbar => {:trigger_args=>"*/10 * * * * *", :data =>"Hello World" }},
0
+ :bar_worker => { :do_job => {:trigger_args=>"*/10 * * * * *", :data =>"Hello World" }}
0
+ },
0
+ :backgroundrb=> {:log=>"foreground", :lazy_load=>true, :debug_log=>false, :environment=>"production", :port=>11006, :ip=>"localhost"}
0
+ }
0
+
0
+ setup do
0
+ Packet::Reactor.stubs(:run)
0
+ @master_proxy = BackgrounDRb::MasterProxy.new
0
+ end
0
+
0
+ specify "should load schedule of workers which are reloadable" do
0
+ @master_proxy.find_reloadable_worker
0
+ @master_proxy.reloadable_workers.should.not.be []
0
+ @master_proxy.reloadable_workers.should == [BarWorker]
0
+ @master_proxy.worker_triggers.should.not.be {}
0
+ assert @master_proxy.worker_triggers.keys.include?(:bar_worker)
0
+ assert @master_proxy.worker_triggers[:bar_worker].keys.include?(:do_job)
0
+ @master_proxy.worker_triggers[:bar_worker][:do_job].should.not.be { }
0
+ end
0
+
0
+ specify "load schedule should load schedule of worker specified" do
0
+ require "bar_worker"
0
+ @master_proxy.load_reloadable_schedule(BarWorker).should.not.be { }
0
+ end
0
+
0
+ specify "should invoke worker methods which are ready to run" do
0
+
0
+ end
0
+
0
+ specify "should not run worker methods which are not ready to run" do
0
+
0
+ end
0
+end
0
 
0
 context "Master Worker in general should" do
0
   specify "read data according to binary protocol and recreate objects" do
0
@@ -49,41 +87,3 @@ context "Master Worker in general should" do
0
   end
0
 end
0
 
0
-context "Master proxy for reloadable workers" do
0
- BackgrounDRb::Config::RAILS_ENV = "production"
0
- CONFIG_FILE = {:schedules=>
0
- {
0
- :foo_worker => { :barbar => {:trigger_args=>"*/10 * * * * *", :data =>"Hello World" }},
0
- :bar_worker => { :do_job => {:trigger_args=>"*/10 * * * * *", :data =>"Hello World" }}
0
- },
0
- :backgroundrb=> {:log=>"foreground", :lazy_load=>true, :debug_log=>false, :environment=>"production", :port=>11006, :ip=>"localhost"}
0
- }
0
-
0
- setup do
0
- Packet::Reactor.stubs(:run)
0
- @master_proxy = BackgrounDRb::MasterProxy.new
0
- end
0
-
0
- specify "should load schedule of workers which are reloadable" do
0
- @master_proxy.find_reloadable_worker
0
- @master_proxy.reloadable_workers.should.not.be []
0
- @master_proxy.reloadable_workers.should == [BarWorker]
0
- @master_proxy.worker_triggers.should.not.be {}
0
- assert @master_proxy.worker_triggers.keys.include?(:bar_worker)
0
- assert @master_proxy.worker_triggers[:bar_worker].keys.include?(:do_job)
0
- @master_proxy.worker_triggers[:bar_worker][:do_job].should.not.be { }
0
- end
0
-
0
- specify "load schedule should load schedule of worker specified" do
0
- require "bar_worker"
0
- @master_proxy.load_reloadable_schedule(BarWorker).should.not.be { }
0
- end
0
-
0
- specify "should invoke worker methods which are ready to run" do
0
-
0
- end
0
-
0
- specify "should not run worker methods which are not ready to run" do
0
-
0
- end
0
-end

Comments

    No one has commented yet.