modern_times 0.2.11 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +114 -80
- data/VERSION +1 -1
- data/examples/advanced_requestor/README +15 -0
- data/examples/advanced_requestor/base_request_worker.rb +13 -0
- data/examples/advanced_requestor/char_count_worker.rb +11 -0
- data/examples/advanced_requestor/exception_raiser_worker.rb +10 -0
- data/examples/advanced_requestor/length_worker.rb +9 -0
- data/examples/advanced_requestor/manager.rb +22 -0
- data/examples/advanced_requestor/modern_times.yml +32 -0
- data/examples/advanced_requestor/print_worker.rb +9 -0
- data/examples/advanced_requestor/publish.rb +46 -0
- data/examples/advanced_requestor/reverse_worker.rb +9 -0
- data/examples/advanced_requestor/triple_worker.rb +9 -0
- data/examples/requestor/request.rb +3 -3
- data/examples/requestor/reverse_echo_worker.rb +1 -2
- data/lib/modern_times.rb +1 -1
- data/lib/modern_times/base/supervisor.rb +2 -0
- data/lib/modern_times/base/worker.rb +5 -3
- data/lib/modern_times/jms.rb +2 -0
- data/lib/modern_times/jms/connection.rb +7 -0
- data/lib/modern_times/jms/publish_handle.rb +219 -0
- data/lib/modern_times/jms/publisher.rb +55 -29
- data/lib/modern_times/{jms_requestor/worker.rb → jms/request_worker.rb} +29 -51
- data/lib/modern_times/jms/supervisor.rb +30 -0
- data/lib/modern_times/jms/supervisor_mbean.rb +17 -1
- data/lib/modern_times/jms/worker.rb +43 -40
- data/lib/modern_times/manager.rb +6 -2
- data/lib/modern_times/marshal_strategy.rb +14 -17
- data/lib/modern_times/marshal_strategy/bson.rb +2 -0
- data/lib/modern_times/marshal_strategy/json.rb +3 -0
- data/lib/modern_times/marshal_strategy/ruby.rb +3 -0
- data/lib/modern_times/marshal_strategy/string.rb +3 -0
- data/lib/modern_times/marshal_strategy/yaml.rb +3 -0
- data/lib/modern_times/railsable.rb +7 -14
- data/lib/modern_times/time_track.rb +84 -0
- data/test/jms.yml +1 -0
- data/test/jms_failure_test.rb +128 -0
- data/test/jms_requestor_block_test.rb +275 -0
- data/test/jms_requestor_test.rb +71 -96
- data/test/jms_test.rb +59 -78
- data/test/marshal_strategy_test.rb +1 -3
- metadata +29 -14
- data/examples/exception_test/bar_worker.rb +0 -8
- data/examples/exception_test/base_worker.rb +0 -23
- data/examples/exception_test/manager.rb +0 -11
- data/lib/modern_times/jms_requestor.rb +0 -10
- data/lib/modern_times/jms_requestor/request_handle.rb +0 -42
- data/lib/modern_times/jms_requestor/requestor.rb +0 -56
- data/lib/modern_times/jms_requestor/supervisor.rb +0 -45
- data/lib/modern_times/jms_requestor/supervisor_mbean.rb +0 -21
data/test/jms_requestor_test.rb
CHANGED
@@ -7,47 +7,30 @@ require 'erb'
|
|
7
7
|
# NOTE: This test requires a running ActiveMQ server
|
8
8
|
|
9
9
|
module HashTest
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
end
|
22
|
-
|
23
|
-
def parse_obj(obj)
|
24
|
-
obj['answer']
|
25
|
-
end
|
10
|
+
def self.create_obj(i)
|
11
|
+
{
|
12
|
+
'foo' => 1,
|
13
|
+
'bar' => {
|
14
|
+
'message' => i,
|
15
|
+
'dummy' => "Message #{i}"
|
16
|
+
},
|
17
|
+
# Only YAML will maintain symbols
|
18
|
+
:zulu => :rugger
|
19
|
+
}
|
26
20
|
end
|
27
21
|
|
28
|
-
def self.
|
29
|
-
|
22
|
+
def self.parse_obj(obj)
|
23
|
+
obj['answer']
|
30
24
|
end
|
31
25
|
|
32
|
-
def request(obj)
|
26
|
+
def self.request(obj)
|
33
27
|
{
|
34
28
|
'answer' => obj['bar']['message']
|
35
29
|
}
|
36
30
|
end
|
37
31
|
end
|
38
32
|
|
39
|
-
module BSONTest
|
40
|
-
extend ModernTimes::MarshalStrategy::BSON
|
41
|
-
include HashTest
|
42
|
-
end
|
43
|
-
|
44
|
-
module JSONTest
|
45
|
-
extend ModernTimes::MarshalStrategy::JSON
|
46
|
-
include HashTest
|
47
|
-
end
|
48
|
-
|
49
33
|
module RubyTest
|
50
|
-
extend ModernTimes::MarshalStrategy::Ruby
|
51
34
|
|
52
35
|
class MyClass
|
53
36
|
attr_reader :i
|
@@ -64,14 +47,12 @@ module RubyTest
|
|
64
47
|
obj.i-10
|
65
48
|
end
|
66
49
|
|
67
|
-
def request(obj)
|
50
|
+
def self.request(obj)
|
68
51
|
return MyClass.new(obj.i+10)
|
69
52
|
end
|
70
53
|
end
|
71
54
|
|
72
55
|
module StringTest
|
73
|
-
extend ModernTimes::MarshalStrategy::String
|
74
|
-
|
75
56
|
def self.create_obj(i)
|
76
57
|
"Message #{i}"
|
77
58
|
end
|
@@ -84,7 +65,7 @@ module StringTest
|
|
84
65
|
end
|
85
66
|
end
|
86
67
|
|
87
|
-
def request(str)
|
68
|
+
def self.request(str)
|
88
69
|
if str =~ /^Message (\d+)$/
|
89
70
|
"Returning #{$1}"
|
90
71
|
else
|
@@ -94,12 +75,17 @@ module StringTest
|
|
94
75
|
end
|
95
76
|
|
96
77
|
class DefaultWorker
|
97
|
-
include ModernTimes::
|
78
|
+
include ModernTimes::JMS::RequestWorker
|
79
|
+
response :marshal => :yaml, :time_to_live => 10000
|
80
|
+
|
81
|
+
def request(obj)
|
82
|
+
options[:tester].request(obj)
|
83
|
+
end
|
98
84
|
end
|
99
85
|
|
100
86
|
class SleepWorker
|
101
|
-
include ModernTimes::
|
102
|
-
marshal :string
|
87
|
+
include ModernTimes::JMS::RequestWorker
|
88
|
+
response :marshal => :string, :time_to_live => 10000
|
103
89
|
|
104
90
|
def request(i)
|
105
91
|
sleep i.to_i
|
@@ -112,7 +98,7 @@ class JMSRequestorTest < Test::Unit::TestCase
|
|
112
98
|
@@server = JMX.simple_server
|
113
99
|
@@client = JMX.connect
|
114
100
|
|
115
|
-
context 'jms' do
|
101
|
+
context 'jms request' do
|
116
102
|
setup do
|
117
103
|
config = YAML.load(ERB.new(File.read(File.join(File.dirname(__FILE__), 'jms.yml'))).result(binding))
|
118
104
|
ModernTimes::JMS::Connection.init(config)
|
@@ -121,14 +107,17 @@ class JMSRequestorTest < Test::Unit::TestCase
|
|
121
107
|
teardown do
|
122
108
|
end
|
123
109
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
110
|
+
{
|
111
|
+
:bson => HashTest,
|
112
|
+
:json => HashTest,
|
113
|
+
:ruby => RubyTest,
|
114
|
+
:string => StringTest,
|
115
|
+
:yaml => HashTest
|
116
|
+
}.each do |marshal, tester|
|
117
|
+
|
118
|
+
context "marshaling with #{marshal}" do
|
130
119
|
setup do
|
131
|
-
@domain = "Uniquize_#{
|
120
|
+
@domain = "Uniquize_#{marshal}"
|
132
121
|
@manager = ModernTimes::Manager.new(:domain => @domain)
|
133
122
|
end
|
134
123
|
|
@@ -140,13 +129,12 @@ class JMSRequestorTest < Test::Unit::TestCase
|
|
140
129
|
end
|
141
130
|
|
142
131
|
should "reply correctly with multiple threads" do
|
143
|
-
DefaultWorker.
|
144
|
-
|
145
|
-
@manager.add(DefaultWorker, 10)
|
132
|
+
DefaultWorker.response(:marshal => marshal, :time_to_live => 10000)
|
133
|
+
@manager.add(DefaultWorker, 10, :tester => tester)
|
146
134
|
|
147
135
|
sleep 1
|
148
136
|
|
149
|
-
|
137
|
+
publisher = ModernTimes::JMS::Publisher.new(:queue_name => 'Default', :marshal => marshal, :response => true)
|
150
138
|
threads = []
|
151
139
|
start = Time.now
|
152
140
|
(0..9).each do |i|
|
@@ -154,10 +142,11 @@ class JMSRequestorTest < Test::Unit::TestCase
|
|
154
142
|
start = i*10
|
155
143
|
range = start..(start+9)
|
156
144
|
range.each do |x|
|
157
|
-
obj =
|
158
|
-
handle =
|
159
|
-
|
160
|
-
|
145
|
+
obj = tester.create_obj(x)
|
146
|
+
handle = publisher.publish(obj)
|
147
|
+
reply_obj = handle.read_response(2)
|
148
|
+
val = tester.parse_obj(reply_obj)
|
149
|
+
assert x == val, "#{x} does not equal #{val}"
|
161
150
|
end
|
162
151
|
end
|
163
152
|
end
|
@@ -172,7 +161,7 @@ class JMSRequestorTest < Test::Unit::TestCase
|
|
172
161
|
@manager = ModernTimes::Manager.new(:domain => @domain)
|
173
162
|
@manager.add(SleepWorker, 10)
|
174
163
|
sleep 1
|
175
|
-
@
|
164
|
+
@publisher = ModernTimes::JMS::Publisher.new(:queue_name => 'Sleep', :marshal => :string, :response => true)
|
176
165
|
end
|
177
166
|
|
178
167
|
teardown do
|
@@ -183,21 +172,19 @@ class JMSRequestorTest < Test::Unit::TestCase
|
|
183
172
|
end
|
184
173
|
|
185
174
|
should "work correctly if request is complete before the timeout" do
|
186
|
-
[[1,0,2,0.8,1.2], [2,1,3,1.
|
175
|
+
[[1,0,2,0.8,1.2], [2,1,3,1.8,2.2], [1,2,3,0.8,1.2], [3,1,2,2.8,3.2]].each do |info|
|
187
176
|
work_sleep_time, publish_sleep_time, timeout_time, min_time, max_time = info
|
188
177
|
threads = []
|
189
178
|
start_time = Time.now
|
190
179
|
(0..9).each do |i|
|
191
180
|
threads << Thread.new(i) do |i|
|
192
|
-
handle = @
|
181
|
+
handle = @publisher.publish(work_sleep_time)
|
193
182
|
sleep publish_sleep_time
|
194
183
|
if work_sleep_time < timeout_time
|
195
|
-
response = handle.read_response.to_i
|
184
|
+
response = handle.read_response(timeout_time).to_i
|
196
185
|
assert work_sleep_time == response, "#{work_sleep_time} does not equal #{response}"
|
197
186
|
else
|
198
|
-
|
199
|
-
response = handle.read_response.to_i
|
200
|
-
end
|
187
|
+
assert handle.read_response(timeout_time).nil?
|
201
188
|
actual_time = Time.now - start_time
|
202
189
|
assert timeout_time-0.1 < actual_time, "Bad timeout #{actual_time}"
|
203
190
|
assert timeout_time+0.3 > actual_time, "Bad timeout #{actual_time}"
|
@@ -215,7 +202,7 @@ class JMSRequestorTest < Test::Unit::TestCase
|
|
215
202
|
bean_max = bean.max_response_time
|
216
203
|
puts "total=#{total_time} avg=#{bean_avg} min=#{bean_min} max=#{bean_max}"
|
217
204
|
all_times = [bean_avg, bean_min, bean_max]
|
218
|
-
all_times << total_time if work_sleep_time < timeout_time
|
205
|
+
all_times << total_time if work_sleep_time > publish_sleep_time && work_sleep_time < timeout_time
|
219
206
|
all_times.each do |time_val|
|
220
207
|
assert min_time < time_val, "#{time_val} is not between #{min_time} and #{max_time}"
|
221
208
|
assert max_time > time_val, "#{time_val} is not between #{min_time} and #{max_time}"
|
@@ -224,40 +211,28 @@ class JMSRequestorTest < Test::Unit::TestCase
|
|
224
211
|
end
|
225
212
|
end
|
226
213
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
# publish(RubyTest, 300..499, :queue_name => 'MyQueueName')
|
251
|
-
# publish(RubyTest, 500..599, :virtual_topic_name => 'MyTopicName')
|
252
|
-
#
|
253
|
-
# # DefaultWorker should have 5 instances running with each worker handling between 10-30 messages in the range 100.199
|
254
|
-
# assert_worker(nil, DefaultWorker, nil, 1, 100..199, 100, 100, 1)
|
255
|
-
# assert_worker(nil, Dummy::DefaultWorker, nil, 1, 200..299, 100, 100, 1)
|
256
|
-
# assert_worker(nil, SpecifiedQueueWorker, nil, 1, 300..499, 200, 200, 1)
|
257
|
-
# assert_worker(nil, SpecifiedQueue2Worker, nil, 1, 300..499, 200, 200, 1)
|
258
|
-
# assert_worker(nil, SpecifiedTopicWorker, nil, 1, 500..599, 100, 100, 1)
|
259
|
-
# assert_worker(nil, SpecifiedTopic2Worker, nil, 1, 500..599, 100, 100, 1)
|
260
|
-
# end
|
261
|
-
# end
|
214
|
+
context 'dummy requesting' do
|
215
|
+
setup do
|
216
|
+
@tester = RubyTest
|
217
|
+
workers = [
|
218
|
+
DefaultWorker.new(:tester => @tester)
|
219
|
+
]
|
220
|
+
ModernTimes::JMS::Publisher.setup_dummy_publishing(workers)
|
221
|
+
end
|
222
|
+
|
223
|
+
teardown do
|
224
|
+
ModernTimes::JMS::Publisher.clear_dummy_publishing
|
225
|
+
end
|
226
|
+
|
227
|
+
should "directly call applicable workers" do
|
228
|
+
x=9999
|
229
|
+
obj = @tester.create_obj(x)
|
230
|
+
publisher = ModernTimes::JMS::Publisher.new(:queue_name => 'Default', :marshal => :ruby, :response => true)
|
231
|
+
handle = publisher.publish(obj)
|
232
|
+
reply_obj = handle.read_response(2)
|
233
|
+
val = @tester.parse_obj(reply_obj)
|
234
|
+
assert x == val, "#{x} does not equal #{val}"
|
235
|
+
end
|
236
|
+
end
|
262
237
|
end
|
263
238
|
end
|
data/test/jms_test.rb
CHANGED
@@ -11,6 +11,7 @@ module WorkerHelper
|
|
11
11
|
@@mutex = Mutex.new
|
12
12
|
def initialize(opts={})
|
13
13
|
super
|
14
|
+
@tester = opts[:tester]
|
14
15
|
@@mutex.synchronize do
|
15
16
|
@@workers[self.class.name] ||= []
|
16
17
|
@@workers[self.class.name] << self
|
@@ -18,6 +19,10 @@ module WorkerHelper
|
|
18
19
|
@hash = Hash.new(0)
|
19
20
|
end
|
20
21
|
|
22
|
+
def perform(obj)
|
23
|
+
add_message(@tester.translate(obj))
|
24
|
+
end
|
25
|
+
|
21
26
|
def self.workers(worker_klass)
|
22
27
|
@@workers[worker_klass.name]
|
23
28
|
end
|
@@ -41,42 +46,24 @@ module WorkerHelper
|
|
41
46
|
end
|
42
47
|
|
43
48
|
module HashTest
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
}
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.included(base)
|
59
|
-
base.extend(ModuleMethods)
|
49
|
+
def self.create_obj(i)
|
50
|
+
{
|
51
|
+
'foo' => 1,
|
52
|
+
'bar' => {
|
53
|
+
'message' => i,
|
54
|
+
'dummy' => "Message #{i}"
|
55
|
+
},
|
56
|
+
# Only YAML will maintain symbols
|
57
|
+
:zulu => :rugger
|
58
|
+
}
|
60
59
|
end
|
61
60
|
|
62
|
-
def
|
63
|
-
|
61
|
+
def self.translate(obj)
|
62
|
+
obj['bar']['message']
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
67
|
-
module BSONTest
|
68
|
-
extend ModernTimes::MarshalStrategy::BSON
|
69
|
-
include HashTest
|
70
|
-
end
|
71
|
-
|
72
|
-
module JSONTest
|
73
|
-
extend ModernTimes::MarshalStrategy::JSON
|
74
|
-
include HashTest
|
75
|
-
end
|
76
|
-
|
77
66
|
module RubyTest
|
78
|
-
extend ModernTimes::MarshalStrategy::Ruby
|
79
|
-
|
80
67
|
class MyClass
|
81
68
|
attr_reader :i
|
82
69
|
def initialize(i)
|
@@ -88,21 +75,19 @@ module RubyTest
|
|
88
75
|
MyClass.new(i)
|
89
76
|
end
|
90
77
|
|
91
|
-
def
|
92
|
-
|
78
|
+
def self.translate(obj)
|
79
|
+
obj.i
|
93
80
|
end
|
94
81
|
end
|
95
82
|
|
96
83
|
module StringTest
|
97
|
-
extend ModernTimes::MarshalStrategy::String
|
98
|
-
|
99
84
|
def self.create_obj(i)
|
100
85
|
"Message #{i}"
|
101
86
|
end
|
102
87
|
|
103
|
-
def
|
88
|
+
def self.translate(str)
|
104
89
|
if str =~ /^Message (\d+)$/
|
105
|
-
|
90
|
+
$1.to_i
|
106
91
|
else
|
107
92
|
raise "Unknown message: #{str}"
|
108
93
|
end
|
@@ -150,11 +135,11 @@ class JMSTest < Test::Unit::TestCase
|
|
150
135
|
@@server = JMX.simple_server
|
151
136
|
@@client = JMX.connect
|
152
137
|
|
153
|
-
def publish(
|
154
|
-
publisher = ModernTimes::JMS::Publisher.new(options.merge(:marshal =>
|
155
|
-
puts "Publishing #{range} to #{publisher}"
|
138
|
+
def publish(marshal, tester, range, options)
|
139
|
+
publisher = ModernTimes::JMS::Publisher.new(options.merge(:marshal => marshal))
|
140
|
+
puts "Publishing #{range} to #{publisher} via #{marshal}"
|
156
141
|
range.each do |i|
|
157
|
-
obj =
|
142
|
+
obj = tester.create_obj(i)
|
158
143
|
publisher.publish(obj)
|
159
144
|
end
|
160
145
|
end
|
@@ -170,6 +155,7 @@ class JMSTest < Test::Unit::TestCase
|
|
170
155
|
all_messages = []
|
171
156
|
workers.each do |worker|
|
172
157
|
msg_count = worker.message_count
|
158
|
+
assert msg_count
|
173
159
|
assert msg_count >= min, "#{msg_count} is not between #{min} and #{max}"
|
174
160
|
assert msg_count <= max, "#{msg_count} is not between #{min} and #{max}"
|
175
161
|
# Make sure no duplicate messages
|
@@ -202,15 +188,17 @@ class JMSTest < Test::Unit::TestCase
|
|
202
188
|
teardown do
|
203
189
|
end
|
204
190
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
191
|
+
{
|
192
|
+
:bson => HashTest,
|
193
|
+
:json => HashTest,
|
194
|
+
:ruby => RubyTest,
|
195
|
+
:string => StringTest,
|
196
|
+
:yaml => HashTest
|
197
|
+
}.each do |marshal, tester|
|
210
198
|
|
211
|
-
context "marshaling with #{
|
199
|
+
context "marshaling with #{marshal}" do
|
212
200
|
setup do
|
213
|
-
@domain = "Uniquize_#{
|
201
|
+
@domain = "Uniquize_#{marshal}"
|
214
202
|
@manager = ModernTimes::Manager.new(:domain => @domain)
|
215
203
|
end
|
216
204
|
|
@@ -223,26 +211,22 @@ class JMSTest < Test::Unit::TestCase
|
|
223
211
|
|
224
212
|
should "operate on queues and topics" do
|
225
213
|
WorkerHelper.reset_workers
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
@manager.add(
|
231
|
-
@manager.add(
|
232
|
-
@manager.add(
|
233
|
-
@manager.add(
|
234
|
-
@manager.add(
|
235
|
-
@manager.add(SpecifiedQueue2Worker, 2)
|
236
|
-
@manager.add(SpecifiedTopicWorker, 3)
|
237
|
-
@manager.add(SpecifiedTopicWorker, 2, :name => 'SpecifiedTopicClone')
|
238
|
-
@manager.add(SpecifiedTopic2Worker, 2)
|
214
|
+
@manager.add(DefaultWorker, 3, :tester => tester)
|
215
|
+
@manager.add(DefaultWorker, 2, :name => 'DefaultClone', :tester => tester)
|
216
|
+
@manager.add(Dummy::DefaultWorker, 4, :tester => tester)
|
217
|
+
@manager.add(SpecifiedQueueWorker, 3, :tester => tester)
|
218
|
+
@manager.add(SpecifiedQueueWorker, 2, :name => 'SpecifiedQueueClone', :tester => tester)
|
219
|
+
@manager.add(SpecifiedQueue2Worker, 2, :tester => tester)
|
220
|
+
@manager.add(SpecifiedTopicWorker, 3, :tester => tester)
|
221
|
+
@manager.add(SpecifiedTopicWorker, 2, :name => 'SpecifiedTopicClone', :tester => tester)
|
222
|
+
@manager.add(SpecifiedTopic2Worker, 2, :tester => tester)
|
239
223
|
|
240
224
|
sleep 1
|
241
225
|
|
242
|
-
publish(
|
243
|
-
publish(
|
244
|
-
publish(
|
245
|
-
publish(
|
226
|
+
publish(marshal, tester, 100..199, :queue_name => 'Default')
|
227
|
+
publish(marshal, tester, 200..299, :queue_name => 'Dummy_Default')
|
228
|
+
publish(marshal, tester, 300..499, :queue_name => 'MyQueueName')
|
229
|
+
publish(marshal, tester, 500..599, :virtual_topic_name => 'MyTopicName')
|
246
230
|
|
247
231
|
# Let the workers do their thing
|
248
232
|
sleep 5
|
@@ -259,18 +243,15 @@ class JMSTest < Test::Unit::TestCase
|
|
259
243
|
|
260
244
|
context 'dummy publishing' do
|
261
245
|
setup do
|
246
|
+
WorkerHelper.reset_workers
|
262
247
|
workers = [
|
263
|
-
DefaultWorker,
|
264
|
-
Dummy::DefaultWorker,
|
265
|
-
SpecifiedQueueWorker,
|
266
|
-
SpecifiedQueue2Worker,
|
267
|
-
SpecifiedTopicWorker,
|
268
|
-
SpecifiedTopic2Worker,
|
248
|
+
DefaultWorker.new(:tester => RubyTest),
|
249
|
+
Dummy::DefaultWorker.new(:tester => RubyTest),
|
250
|
+
SpecifiedQueueWorker.new(:tester => RubyTest),
|
251
|
+
SpecifiedQueue2Worker.new(:tester => RubyTest),
|
252
|
+
SpecifiedTopicWorker.new(:tester => RubyTest),
|
253
|
+
SpecifiedTopic2Worker.new(:tester => RubyTest),
|
269
254
|
]
|
270
|
-
workers.each do |worker_klass|
|
271
|
-
worker_klass.send(:include, RubyTest)
|
272
|
-
end
|
273
|
-
WorkerHelper.reset_workers
|
274
255
|
ModernTimes::JMS::Publisher.setup_dummy_publishing(workers)
|
275
256
|
end
|
276
257
|
|
@@ -279,10 +260,10 @@ class JMSTest < Test::Unit::TestCase
|
|
279
260
|
end
|
280
261
|
|
281
262
|
should "directly call applicable workers" do
|
282
|
-
publish(RubyTest, 100..199, :queue_name => 'Default')
|
283
|
-
publish(RubyTest, 200..299, :queue_name => 'Dummy_Default')
|
284
|
-
publish(RubyTest, 300..499, :queue_name => 'MyQueueName')
|
285
|
-
publish(RubyTest, 500..599, :virtual_topic_name => 'MyTopicName')
|
263
|
+
publish(:ruby, RubyTest, 100..199, :queue_name => 'Default')
|
264
|
+
publish(:ruby, RubyTest, 200..299, :queue_name => 'Dummy_Default')
|
265
|
+
publish(:ruby, RubyTest, 300..499, :queue_name => 'MyQueueName')
|
266
|
+
publish(:ruby, RubyTest, 500..599, :virtual_topic_name => 'MyTopicName')
|
286
267
|
|
287
268
|
# DefaultWorker should have 5 instances running with each worker handling between 10-30 messages in the range 100.199
|
288
269
|
assert_worker(nil, DefaultWorker, nil, 1, 100..199, 100, 100, 1)
|