stomp 1.4.5 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +5 -2
- data/examples/ssl/SSL.md +1 -1
- data/lib/connection/netio.rb +12 -14
- data/lib/stomp/version.rb +2 -2
- data/stomp.gemspec +3 -3
- data/test/test_anonymous.rb +91 -2
- data/test/test_client.rb +164 -37
- data/test/test_codec.rb +13 -0
- data/test/test_connection.rb +107 -0
- data/test/test_connection1p.rb +85 -1
- data/test/test_helper.rb +1 -1
- data/test/test_message.rb +28 -4
- data/test/test_ssl.rb +20 -0
- data/test/test_urlogin.rb +19 -2
- metadata +2 -2
data/test/test_client.rb
CHANGED
@@ -20,6 +20,7 @@ class TestClient < Test::Unit::TestCase
|
|
20
20
|
# Multi_thread test data
|
21
21
|
@max_threads = 20
|
22
22
|
@max_msgs = 50
|
23
|
+
@tcldbg = ENV['TCLDBG'] ? true : false
|
23
24
|
end
|
24
25
|
|
25
26
|
def teardown
|
@@ -28,17 +29,26 @@ class TestClient < Test::Unit::TestCase
|
|
28
29
|
|
29
30
|
# Test poll works.
|
30
31
|
def test_poll_async
|
32
|
+
mn = "test_poll_async" if @tcldbg
|
33
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
31
34
|
# If the test 'hangs' here, Connection#poll is broken.
|
32
35
|
m = @client.poll
|
33
36
|
assert m.nil?
|
34
|
-
|
37
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
38
|
+
end unless RUBY_ENGINE =~ /jruby/
|
35
39
|
|
36
40
|
# Test ACKs.
|
37
41
|
def test_ack_api_works
|
42
|
+
mn = "test_ack_api_works" if @tcldbg
|
43
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
38
44
|
@client.publish make_destination, message_text, {:suppress_content_length => true}
|
39
45
|
|
40
46
|
received = nil
|
41
|
-
@client.subscribe(make_destination, {:ack => 'client'}) {|msg|
|
47
|
+
@client.subscribe(make_destination, {:ack => 'client'}) {|msg|
|
48
|
+
received = msg
|
49
|
+
p [ "02", mn, "have_msg" ] if @tcldbg
|
50
|
+
}
|
51
|
+
p [ "03", mn, "sub_done" ] if @tcldbg
|
42
52
|
sleep 0.01 until received
|
43
53
|
assert_equal message_text, received.body
|
44
54
|
receipt = nil
|
@@ -46,25 +56,36 @@ class TestClient < Test::Unit::TestCase
|
|
46
56
|
if @client.protocol == Stomp::SPL_11 # 1.1 only
|
47
57
|
ack_headers["subscription"] = received.headers["subscription"]
|
48
58
|
end
|
49
|
-
@client.acknowledge(received, ack_headers) {|r|
|
59
|
+
@client.acknowledge(received, ack_headers) {|r|
|
60
|
+
receipt = r
|
61
|
+
p [ "04", mn, "have_rcpt" ] if @tcldbg
|
62
|
+
}
|
63
|
+
p [ "05", mn, "ack_sent" ] if @tcldbg
|
50
64
|
sleep 0.01 until receipt
|
51
65
|
assert_not_nil receipt.headers['receipt-id']
|
52
|
-
checkEmsg(@client)
|
66
|
+
checkEmsg(@client) unless jruby?()
|
67
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
53
68
|
end
|
54
69
|
|
55
70
|
# Test Client subscribe
|
56
71
|
def test_asynch_subscribe
|
72
|
+
mn = "test_async_subscribe" if @tcldbg
|
73
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
57
74
|
received = false
|
58
75
|
@client.subscribe(make_destination) {|msg| received = msg}
|
59
76
|
@client.publish make_destination, message_text
|
60
77
|
sleep 0.01 until received
|
61
78
|
|
62
79
|
assert_equal message_text, received.body
|
63
|
-
checkEmsg(@client)
|
80
|
+
checkEmsg(@client) unless jruby?()
|
81
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
64
82
|
end
|
65
83
|
|
66
84
|
# Test not ACKing messages.
|
67
85
|
def test_noack
|
86
|
+
mn = "test_noack" if @tcldbg
|
87
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
88
|
+
|
68
89
|
@client.publish make_destination, message_text
|
69
90
|
|
70
91
|
received = nil
|
@@ -84,10 +105,14 @@ class TestClient < Test::Unit::TestCase
|
|
84
105
|
assert_equal received.body, received2.body
|
85
106
|
assert_equal received.headers['message-id'], received2.headers['message-id'] unless ENV['STOMP_RABBIT']
|
86
107
|
checkEmsg(@client)
|
108
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
87
109
|
end unless RUBY_ENGINE =~ /jruby/
|
88
110
|
|
89
111
|
# Test obtaining a RECEIPT via a listener.
|
90
112
|
def test_receipts
|
113
|
+
mn = "test_receipts" if @tcldbg
|
114
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
115
|
+
|
91
116
|
receipt = false
|
92
117
|
@client.publish(make_destination, message_text) {|r| receipt = r}
|
93
118
|
sleep 0.1 until receipt
|
@@ -96,38 +121,54 @@ class TestClient < Test::Unit::TestCase
|
|
96
121
|
@client.subscribe(make_destination) {|m| message = m}
|
97
122
|
sleep 0.1 until message
|
98
123
|
assert_equal message_text, message.body
|
99
|
-
checkEmsg(@client)
|
124
|
+
checkEmsg(@client) unless jruby?()
|
125
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
100
126
|
end
|
101
127
|
|
102
128
|
# Test requesting a receipt on disconnect.
|
103
129
|
def test_disconnect_receipt
|
130
|
+
mn = "test_disconnect_receipt" if @tcldbg
|
131
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
132
|
+
|
104
133
|
@client.close :receipt => "xyz789"
|
105
134
|
assert_not_nil(@client.disconnect_receipt, "should have a receipt")
|
106
135
|
assert_equal(@client.disconnect_receipt.headers['receipt-id'],
|
107
136
|
"xyz789", "receipt sent and received should match")
|
137
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
108
138
|
end
|
109
139
|
|
110
140
|
# Test publish and immediate subscribe.
|
111
141
|
def test_publish_then_sub
|
142
|
+
mn = "test_publish_then_sub" if @tcldbg
|
143
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
144
|
+
|
112
145
|
@client.publish make_destination, message_text
|
113
146
|
message = nil
|
114
147
|
@client.subscribe(make_destination) {|m| message = m}
|
115
148
|
sleep 0.01 until message
|
116
149
|
|
117
150
|
assert_equal message_text, message.body
|
118
|
-
checkEmsg(@client)
|
151
|
+
checkEmsg(@client) unless jruby?()
|
152
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
119
153
|
end
|
120
154
|
|
121
155
|
# Test that Client subscribe requires a block.
|
122
156
|
def test_subscribe_requires_block
|
157
|
+
mn = "test_subscribe_requires_block" if @tcldbg
|
158
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
159
|
+
|
123
160
|
assert_raise(Stomp::Error::NoListenerGiven) do
|
124
161
|
@client.subscribe make_destination
|
125
162
|
end
|
126
|
-
checkEmsg(@client)
|
127
|
-
|
163
|
+
checkEmsg(@client) unless jruby?()
|
164
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
165
|
+
end
|
128
166
|
|
129
167
|
# Test transaction publish.
|
130
168
|
def test_transactional_publish
|
169
|
+
mn = "test_transactional_publish" if @tcldbg
|
170
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
171
|
+
|
131
172
|
@client.begin 'tx1'
|
132
173
|
@client.publish make_destination, message_text, :transaction => 'tx1'
|
133
174
|
@client.commit 'tx1'
|
@@ -137,11 +178,15 @@ class TestClient < Test::Unit::TestCase
|
|
137
178
|
sleep 0.01 until message
|
138
179
|
|
139
180
|
assert_equal message_text, message.body
|
140
|
-
checkEmsg(@client)
|
181
|
+
checkEmsg(@client) unless jruby?()
|
182
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
141
183
|
end
|
142
184
|
|
143
185
|
# Test transaction publish and abort.
|
144
186
|
def test_transaction_publish_then_rollback
|
187
|
+
mn = "test_transaction_publish_then_rollback" if @tcldbg
|
188
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
189
|
+
|
145
190
|
@client.begin 'tx1'
|
146
191
|
@client.publish make_destination, "first_message", :transaction => 'tx1'
|
147
192
|
@client.abort 'tx1'
|
@@ -154,12 +199,16 @@ class TestClient < Test::Unit::TestCase
|
|
154
199
|
@client.subscribe(make_destination) {|m| message = m}
|
155
200
|
sleep 0.01 until message
|
156
201
|
assert_equal "second_message", message.body
|
157
|
-
checkEmsg(@client)
|
158
|
-
|
202
|
+
checkEmsg(@client) unless jruby?()
|
203
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
204
|
+
end
|
159
205
|
|
160
206
|
# Test transaction publish and abort, receive with new client.
|
161
207
|
# New client uses ack => client.
|
162
208
|
def test_tran_ack_abrt_newcli_cli
|
209
|
+
mn = "test_tran_ack_abrt_newcli_cli" if @tcldbg
|
210
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
211
|
+
|
163
212
|
@client.close if @client && @client.open? # allow tests to close
|
164
213
|
@client = get_client()
|
165
214
|
q = make_destination
|
@@ -180,17 +229,17 @@ class TestClient < Test::Unit::TestCase
|
|
180
229
|
case @client.protocol()
|
181
230
|
when Stomp::SPL_10
|
182
231
|
@client.acknowledge message, :transaction => 'tx1'
|
183
|
-
checkEmsg(@client)
|
232
|
+
checkEmsg(@client) unless jruby?()
|
184
233
|
when Stomp::SPL_11
|
185
234
|
@client.acknowledge message, :transaction => 'tx1', :subscription => message.headers['subscription']
|
186
|
-
checkEmsg(@client)
|
235
|
+
checkEmsg(@client) unless jruby?()
|
187
236
|
else # 1.2+
|
188
237
|
@client.acknowledge message, :transaction => 'tx1', :id => message.headers['ack']
|
189
|
-
checkEmsg(@client)
|
238
|
+
checkEmsg(@client) unless jruby?()
|
190
239
|
end
|
191
240
|
message = nil # reset
|
192
241
|
@client.abort 'tx1' # now abort
|
193
|
-
checkEmsg(@client)
|
242
|
+
checkEmsg(@client) unless jruby?()
|
194
243
|
# lets recreate the connection
|
195
244
|
@client.close
|
196
245
|
@client = get_client()
|
@@ -209,22 +258,26 @@ class TestClient < Test::Unit::TestCase
|
|
209
258
|
case @client.protocol()
|
210
259
|
when Stomp::SPL_10
|
211
260
|
@client.acknowledge message2, :transaction => 'tx2'
|
212
|
-
checkEmsg(@client)
|
261
|
+
checkEmsg(@client) unless jruby?()
|
213
262
|
when Stomp::SPL_11
|
214
263
|
@client.acknowledge message2, :transaction => 'tx2', :subscription => message2.headers['subscription']
|
215
|
-
checkEmsg(@client)
|
264
|
+
checkEmsg(@client) unless jruby?()
|
216
265
|
else # 1.2+
|
217
266
|
@client.acknowledge message2, :transaction => 'tx2', :id => message2.headers['ack']
|
218
|
-
checkEmsg(@client)
|
267
|
+
checkEmsg(@client) unless jruby?()
|
219
268
|
end
|
220
269
|
@client.commit 'tx2'
|
221
|
-
checkEmsg(@client)
|
270
|
+
checkEmsg(@client) unless jruby?()
|
222
271
|
@client.close
|
272
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
223
273
|
end unless ENV['STOMP_ARTEMIS'] # See Artemis docs for 1.3, page 222
|
224
274
|
|
225
275
|
# Test transaction publish and abort, receive with new client.
|
226
276
|
# New client uses ack => auto.
|
227
277
|
def test_tran_ack_abrt_newcli_auto
|
278
|
+
mn = "test_tran_ack_abrt_newcli_auto" if @tcldbg
|
279
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
280
|
+
|
228
281
|
@client.close if @client && @client.open? # allow tests to close
|
229
282
|
@client = get_client()
|
230
283
|
q = make_destination
|
@@ -245,17 +298,17 @@ class TestClient < Test::Unit::TestCase
|
|
245
298
|
case @client.protocol()
|
246
299
|
when Stomp::SPL_10
|
247
300
|
@client.acknowledge message, :transaction => 'tx1'
|
248
|
-
checkEmsg(@client)
|
301
|
+
checkEmsg(@client) unless jruby?()
|
249
302
|
when Stomp::SPL_11
|
250
303
|
@client.acknowledge message, :transaction => 'tx1', :subscription => message.headers['subscription']
|
251
|
-
checkEmsg(@client)
|
304
|
+
checkEmsg(@client) unless jruby?()
|
252
305
|
else # 1.2+
|
253
306
|
@client.acknowledge message, :transaction => 'tx1', :id => message.headers['ack']
|
254
|
-
checkEmsg(@client)
|
307
|
+
checkEmsg(@client) unless jruby?()
|
255
308
|
end
|
256
309
|
message = nil # reset
|
257
310
|
@client.abort 'tx1' # now abort
|
258
|
-
checkEmsg(@client)
|
311
|
+
checkEmsg(@client) unless jruby?()
|
259
312
|
# lets recreate the connection
|
260
313
|
@client.close
|
261
314
|
|
@@ -273,42 +326,58 @@ class TestClient < Test::Unit::TestCase
|
|
273
326
|
assert_not_nil message2
|
274
327
|
assert_equal data, message2.body
|
275
328
|
@client.commit 'tx2'
|
276
|
-
checkEmsg(@client)
|
329
|
+
checkEmsg(@client) unless jruby?()
|
277
330
|
@client.close
|
331
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
278
332
|
end unless ENV['STOMP_ARTEMIS'] # See Artemis docs for 1.3, page 222
|
279
333
|
|
280
334
|
# Test that subscription destinations must be unique for a Client.
|
281
335
|
def test_raise_on_multiple_subscriptions_to_same_make_destination
|
336
|
+
mn = "test_raise_on_multiple_subscriptions_to_same_make_destination" if @tcldbg
|
337
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
338
|
+
|
282
339
|
subscribe_dest = make_destination
|
283
340
|
@client.subscribe(subscribe_dest) {|m| nil }
|
284
341
|
assert_raise(Stomp::Error::DuplicateSubscription) do
|
285
342
|
@client.subscribe(subscribe_dest) {|m| nil }
|
286
343
|
end
|
287
|
-
checkEmsg(@client)
|
344
|
+
checkEmsg(@client) unless jruby?()
|
345
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
288
346
|
end
|
289
347
|
|
290
348
|
# Test that subscription IDs must be unique for a Client.
|
291
349
|
def test_raise_on_multiple_subscriptions_to_same_id
|
350
|
+
mn = "test_raise_on_multiple_subscriptions_to_same_id" if @tcldbg
|
351
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
352
|
+
|
292
353
|
subscribe_dest = make_destination
|
293
354
|
@client.subscribe(subscribe_dest, {'id' => 'myid'}) {|m| nil }
|
294
355
|
assert_raise(Stomp::Error::DuplicateSubscription) do
|
295
356
|
@client.subscribe(subscribe_dest, {'id' => 'myid'}) {|m| nil }
|
296
357
|
end
|
297
|
-
checkEmsg(@client)
|
358
|
+
checkEmsg(@client) unless jruby?()
|
359
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
298
360
|
end
|
299
361
|
|
300
362
|
# Test that subscription IDs must be unique for a Client, mixed id specification.
|
301
363
|
def test_raise_on_multiple_subscriptions_to_same_id_mixed
|
364
|
+
mn = "test_raise_on_multiple_subscriptions_to_same_id_mixed" if @tcldbg
|
365
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
366
|
+
|
302
367
|
subscribe_dest = make_destination
|
303
368
|
@client.subscribe(subscribe_dest, {'id' => 'myid'}) {|m| nil }
|
304
369
|
assert_raise(Stomp::Error::DuplicateSubscription) do
|
305
370
|
@client.subscribe(subscribe_dest, {:id => 'myid'}) {|m| nil }
|
306
371
|
end
|
307
|
-
checkEmsg(@client)
|
372
|
+
checkEmsg(@client) unless jruby?()
|
373
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
308
374
|
end
|
309
375
|
|
310
376
|
# Test wildcard subscribe. Primarily for AMQ.
|
311
377
|
def test_asterisk_wildcard_subscribe
|
378
|
+
mn = "test_asterisk_wildcard_subscribe" if @tcldbg
|
379
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
380
|
+
|
312
381
|
queue_base_name = make_destination
|
313
382
|
queue1 = queue_base_name + ".a"
|
314
383
|
queue2 = queue_base_name + ".b"
|
@@ -336,10 +405,14 @@ class TestClient < Test::Unit::TestCase
|
|
336
405
|
end
|
337
406
|
assert results.all?{|a| a == true }
|
338
407
|
checkEmsg(@client)
|
408
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
339
409
|
end unless ENV['STOMP_NOWILD']
|
340
410
|
|
341
411
|
# Test wildcard subscribe with >. Primarily for AMQ.
|
342
412
|
def test_greater_than_wildcard_subscribe
|
413
|
+
mn = "test_greater_than_wildcard_subscribe" if @tcldbg
|
414
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
415
|
+
|
343
416
|
queue_base_name = make_destination + "."
|
344
417
|
queue1 = queue_base_name + "foo.a"
|
345
418
|
queue2 = queue_base_name + "bar.a"
|
@@ -371,10 +444,14 @@ class TestClient < Test::Unit::TestCase
|
|
371
444
|
end
|
372
445
|
assert results.all?{|a| a == true }
|
373
446
|
checkEmsg(@client)
|
447
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
374
448
|
end unless ENV['STOMP_NOWILD'] || ENV['STOMP_DOTQUEUE']
|
375
449
|
|
376
450
|
# Test transaction with client side reacknowledge.
|
377
451
|
def test_transaction_with_client_side_reack
|
452
|
+
mn = "test_transaction_with_client_side_reack" if @tcldbg
|
453
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
454
|
+
|
378
455
|
@client.close if @client && @client.open? # allow tests to close
|
379
456
|
@client = get_client()
|
380
457
|
q = make_destination
|
@@ -395,13 +472,13 @@ class TestClient < Test::Unit::TestCase
|
|
395
472
|
case @client.protocol()
|
396
473
|
when Stomp::SPL_10
|
397
474
|
@client.acknowledge message, :transaction => 'tx1'
|
398
|
-
checkEmsg(@client)
|
475
|
+
checkEmsg(@client) unless jruby?()
|
399
476
|
when Stomp::SPL_11
|
400
477
|
@client.acknowledge message, :transaction => 'tx1', :subscription => message.headers['subscription']
|
401
|
-
checkEmsg(@client)
|
478
|
+
checkEmsg(@client) unless jruby?()
|
402
479
|
else # 1.2+
|
403
480
|
@client.acknowledge message, :transaction => 'tx1', :id => message.headers['ack']
|
404
|
-
checkEmsg(@client)
|
481
|
+
checkEmsg(@client) unless jruby?()
|
405
482
|
end
|
406
483
|
message = nil
|
407
484
|
@client.abort 'tx1'
|
@@ -413,28 +490,36 @@ class TestClient < Test::Unit::TestCase
|
|
413
490
|
case @client.protocol()
|
414
491
|
when Stomp::SPL_10
|
415
492
|
@client.acknowledge message, :transaction => 'tx2'
|
416
|
-
checkEmsg(@client)
|
493
|
+
checkEmsg(@client) unless jruby?()
|
417
494
|
when Stomp::SPL_11
|
418
495
|
@client.acknowledge message, :transaction => 'tx2', :subscription => message.headers['subscription']
|
419
|
-
checkEmsg(@client)
|
496
|
+
checkEmsg(@client) unless jruby?()
|
420
497
|
else # 1.2+
|
421
498
|
@client.acknowledge message, :transaction => 'tx2', :id => message.headers['ack']
|
422
|
-
checkEmsg(@client)
|
499
|
+
checkEmsg(@client) unless jruby?()
|
423
500
|
end
|
424
501
|
@client.commit 'tx2'
|
425
|
-
checkEmsg(@client)
|
502
|
+
checkEmsg(@client) unless jruby?()
|
426
503
|
@client.close
|
427
504
|
@client = nil
|
505
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
428
506
|
end
|
429
507
|
|
430
508
|
# Test that a connection frame is received.
|
431
509
|
def test_connection_frame
|
510
|
+
mn = "test_connection_frame" if @tcldbg
|
511
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
512
|
+
|
432
513
|
assert_not_nil @client.connection_frame
|
433
514
|
checkEmsg(@client)
|
515
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
434
516
|
end unless RUBY_ENGINE =~ /jruby/
|
435
517
|
|
436
518
|
# Test basic unsubscribe.
|
437
519
|
def test_unsubscribe
|
520
|
+
mn = "test_unsubscribe" if @tcldbg
|
521
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
522
|
+
|
438
523
|
@client.close if @client && @client.open? # close setup work
|
439
524
|
@client = nil
|
440
525
|
message = nil
|
@@ -473,12 +558,16 @@ class TestClient < Test::Unit::TestCase
|
|
473
558
|
end
|
474
559
|
assert_equal to_send, message_copy.body, "second body check"
|
475
560
|
assert_equal message.headers['message-id'], message_copy.headers['message-id'], "header check" unless ENV['STOMP_RABBIT']
|
476
|
-
checkEmsg(client)
|
561
|
+
checkEmsg(client) unless jruby?()
|
477
562
|
client.close
|
563
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
478
564
|
end
|
479
565
|
|
480
566
|
# Test subscribe from a worker thread.
|
481
567
|
def test_thread_one_subscribe
|
568
|
+
mn = "test_thread_one_subscribe" if @tcldbg
|
569
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
570
|
+
|
482
571
|
msg = nil
|
483
572
|
dest = make_destination
|
484
573
|
Thread.new(@client) do |acli|
|
@@ -497,10 +586,14 @@ class TestClient < Test::Unit::TestCase
|
|
497
586
|
sleep 1
|
498
587
|
assert_not_nil msg
|
499
588
|
checkEmsg(@client)
|
589
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
500
590
|
end unless RUBY_ENGINE =~ /jruby/
|
501
591
|
|
502
592
|
# Test subscribe from multiple worker threads.
|
503
593
|
def test_thread_multi_subscribe
|
594
|
+
mn = "test_thread_multi_subscribe" if @tcldbg
|
595
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
596
|
+
|
504
597
|
#
|
505
598
|
lock = Mutex.new
|
506
599
|
msg_ctr = 0
|
@@ -547,11 +640,15 @@ class TestClient < Test::Unit::TestCase
|
|
547
640
|
sleep sleep_incr
|
548
641
|
end
|
549
642
|
assert_equal @max_msgs, msg_ctr
|
550
|
-
checkEmsg(@client)
|
643
|
+
checkEmsg(@client) unless jruby?()
|
644
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
551
645
|
end
|
552
646
|
|
553
647
|
# Test that methods detect no client connection is present.
|
554
648
|
def test_closed_checks_client
|
649
|
+
mn = "test_closed_checks_client" if @tcldbg
|
650
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
651
|
+
|
555
652
|
@client.close
|
556
653
|
#
|
557
654
|
assert_raise Stomp::Error::NoCurrentConnection do
|
@@ -590,19 +687,27 @@ class TestClient < Test::Unit::TestCase
|
|
590
687
|
assert_raise Stomp::Error::NoCurrentConnection do
|
591
688
|
@client.close("dummy_data")
|
592
689
|
end
|
690
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
593
691
|
end
|
594
692
|
|
595
693
|
# test JRuby detection
|
596
694
|
def test_jruby_presence
|
695
|
+
mn = "test_jruby_presence" if @tcldbg
|
696
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
697
|
+
|
597
698
|
if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
|
598
699
|
assert @client.jruby?
|
599
700
|
else
|
600
701
|
assert !@client.jruby?
|
601
702
|
end
|
703
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
602
704
|
end
|
603
705
|
|
604
706
|
# test max redeliveries is not broken (6c2c1c1)
|
605
707
|
def test_max_redeliveries
|
708
|
+
mn = "test_max_redeliveries" if @tcldbg
|
709
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
710
|
+
|
606
711
|
@client.close
|
607
712
|
2.upto(2) do |max_re|
|
608
713
|
rdmsg = "To Be Redelivered: #{max_re.to_s}"
|
@@ -626,12 +731,17 @@ class TestClient < Test::Unit::TestCase
|
|
626
731
|
assert_equal max_re, rm_actual - 1
|
627
732
|
@client.close
|
628
733
|
end
|
734
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
629
735
|
end unless ENV['STOMP_ARTEMIS'] # need to investigate this, but skip
|
630
736
|
# Artemis for now
|
631
737
|
|
632
738
|
# test issue99, OK values
|
633
739
|
def test_cli_iss99_ok
|
740
|
+
|
634
741
|
return unless host() == "localhost" && port() == 61613
|
742
|
+
mn = "test_cli_iss99_ok" if @tcldbg
|
743
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
744
|
+
|
635
745
|
@client.close
|
636
746
|
#
|
637
747
|
ok_vals = dflt_data_ok()
|
@@ -639,11 +749,15 @@ class TestClient < Test::Unit::TestCase
|
|
639
749
|
cli = Stomp::Client.open(hsv)
|
640
750
|
cli.close
|
641
751
|
end
|
752
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
642
753
|
end
|
643
754
|
|
644
755
|
# test issue99, exception values
|
645
756
|
def test_cli_iss99_ex
|
646
757
|
return unless host() == "localhost" && port() == 61613
|
758
|
+
mn = "test_cli_iss99_ex" if @tcldbg
|
759
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
760
|
+
|
647
761
|
@client.close
|
648
762
|
#
|
649
763
|
ex_vals = dflt_data_ex()
|
@@ -652,24 +766,37 @@ class TestClient < Test::Unit::TestCase
|
|
652
766
|
_ = Stomp::Client.open(hsv)
|
653
767
|
end
|
654
768
|
end
|
769
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
655
770
|
end
|
656
771
|
|
657
772
|
def test_cli_nodest_sub
|
773
|
+
mn = "test_cli_nodest_sub" if @tcldbg
|
774
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
775
|
+
|
658
776
|
assert_raise Stomp::Error::DestinationRequired do
|
659
777
|
@client.subscribe(nil) {|msg| puts msg}
|
660
778
|
end
|
779
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
661
780
|
end
|
662
781
|
|
663
782
|
def test_cli_nodest_unsub
|
783
|
+
mn = "test_cli_nodest_unsub" if @tcldbg
|
784
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
785
|
+
|
664
786
|
assert_raise Stomp::Error::DestinationRequired do
|
665
787
|
@client.unsubscribe(nil)
|
666
788
|
end
|
789
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
667
790
|
end
|
668
791
|
|
669
792
|
def test_cli_nodest_pub
|
793
|
+
mn = "test_cli_nodest_pub" if @tcldbg
|
794
|
+
p [ "01", mn, "starts" ] if @tcldbg
|
795
|
+
|
670
796
|
assert_raise Stomp::Error::DestinationRequired do
|
671
797
|
@client.publish(nil, "msg")
|
672
798
|
end
|
799
|
+
p [ "99", mn, "ends" ] if @tcldbg
|
673
800
|
end
|
674
801
|
|
675
802
|
private
|