stomp 1.4.5 → 1.4.10

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.
@@ -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'] || ENV['TDBGALL'] ? 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
- end
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| received = 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| receipt = 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,77 +121,104 @@ 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
- end unless RUBY_ENGINE =~ /jruby/
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
131
- @client.begin 'tx1'
132
- @client.publish make_destination, message_text, :transaction => 'tx1'
133
- @client.commit 'tx1'
169
+ mn = "test_transactional_publish" if @tcldbg
170
+ p [ "01", mn, "starts" ] if @tcldbg
171
+
172
+ tid = "tx1A"
173
+ @client.begin tid
174
+ @client.publish make_destination, message_text, :transaction => tid
175
+ @client.commit tid
134
176
 
135
177
  message = nil
136
178
  @client.subscribe(make_destination) {|m| message = m}
137
179
  sleep 0.01 until message
138
180
 
139
181
  assert_equal message_text, message.body
140
- checkEmsg(@client)
141
- end
182
+ checkEmsg(@client) unless jruby?()
183
+ p [ "99", mn, "ends" ] if @tcldbg
184
+ end unless ENV['STOMP_ARTEMIS']
142
185
 
143
186
  # Test transaction publish and abort.
144
187
  def test_transaction_publish_then_rollback
145
- @client.begin 'tx1'
146
- @client.publish make_destination, "first_message", :transaction => 'tx1'
147
- @client.abort 'tx1'
188
+ mn = "test_transaction_publish_then_rollback" if @tcldbg
189
+ p [ "01", mn, "starts" ] if @tcldbg
190
+
191
+ tid = "txrb1"
192
+ @client.begin tid
193
+ @client.publish make_destination, "first_message", :transaction => tid
194
+ @client.abort tid
148
195
 
149
- @client.begin 'tx1'
150
- @client.publish make_destination, "second_message", :transaction => 'tx1'
151
- @client.commit 'tx1'
196
+ @client.begin tid
197
+ @client.publish make_destination, "second_message", :transaction => tid
198
+ @client.commit tid
152
199
 
153
200
  message = nil
154
201
  @client.subscribe(make_destination) {|m| message = m}
155
202
  sleep 0.01 until message
156
203
  assert_equal "second_message", message.body
157
- checkEmsg(@client)
158
- end unless RUBY_ENGINE =~ /jruby/
204
+ checkEmsg(@client) unless jruby?()
205
+ p [ "99", mn, "ends" ] if @tcldbg
206
+ end unless ENV['STOMP_ARTEMIS']
159
207
 
160
208
  # Test transaction publish and abort, receive with new client.
161
209
  # New client uses ack => client.
162
210
  def test_tran_ack_abrt_newcli_cli
211
+ mn = "test_tran_ack_abrt_newcli_cli" if @tcldbg
212
+ p [ "01", mn, "starts" ] if @tcldbg
213
+
214
+ tid = "tx1B"
163
215
  @client.close if @client && @client.open? # allow tests to close
164
216
  @client = get_client()
165
217
  q = make_destination
166
218
  data = message_text
167
219
  @client.publish q, data
168
220
 
169
- @client.begin 'tx1'
221
+ @client.begin tid
170
222
  message = nil
171
223
  sid = nil
172
224
  if @client.protocol() == Stomp::SPL_10
@@ -179,24 +231,25 @@ class TestClient < Test::Unit::TestCase
179
231
  assert_equal data, message.body
180
232
  case @client.protocol()
181
233
  when Stomp::SPL_10
182
- @client.acknowledge message, :transaction => 'tx1'
183
- checkEmsg(@client)
234
+ @client.acknowledge message, :transaction => tid
235
+ checkEmsg(@client) unless jruby?()
184
236
  when Stomp::SPL_11
185
- @client.acknowledge message, :transaction => 'tx1', :subscription => message.headers['subscription']
186
- checkEmsg(@client)
237
+ @client.acknowledge message, :transaction => tid, :subscription => message.headers['subscription']
238
+ checkEmsg(@client) unless jruby?()
187
239
  else # 1.2+
188
- @client.acknowledge message, :transaction => 'tx1', :id => message.headers['ack']
189
- checkEmsg(@client)
240
+ @client.acknowledge message, :transaction => tid, :id => message.headers['ack']
241
+ checkEmsg(@client) unless jruby?()
190
242
  end
191
243
  message = nil # reset
192
- @client.abort 'tx1' # now abort
193
- checkEmsg(@client)
244
+ @client.abort tid # now abort
245
+ checkEmsg(@client) unless jruby?()
194
246
  # lets recreate the connection
195
247
  @client.close
196
248
  @client = get_client()
197
249
  sid = nil
198
250
  message2 = nil
199
- @client.begin 'tx2'
251
+ tid2 = "tx2A"
252
+ @client.begin tid2
200
253
  if @client.protocol() == Stomp::SPL_10
201
254
  @client.subscribe(q, :ack => 'client') {|m| message2 = m}
202
255
  else # 1.1 and 1.2 are the same for this
@@ -208,30 +261,35 @@ class TestClient < Test::Unit::TestCase
208
261
  assert_equal data, message2.body
209
262
  case @client.protocol()
210
263
  when Stomp::SPL_10
211
- @client.acknowledge message2, :transaction => 'tx2'
212
- checkEmsg(@client)
264
+ @client.acknowledge message2, :transaction => tid2
265
+ checkEmsg(@client) unless jruby?()
213
266
  when Stomp::SPL_11
214
- @client.acknowledge message2, :transaction => 'tx2', :subscription => message2.headers['subscription']
215
- checkEmsg(@client)
267
+ @client.acknowledge message2, :transaction => tid2, :subscription => message2.headers['subscription']
268
+ checkEmsg(@client) unless jruby?()
216
269
  else # 1.2+
217
- @client.acknowledge message2, :transaction => 'tx2', :id => message2.headers['ack']
218
- checkEmsg(@client)
270
+ @client.acknowledge message2, :transaction => tid2, :id => message2.headers['ack']
271
+ checkEmsg(@client) unless jruby?()
219
272
  end
220
- @client.commit 'tx2'
221
- checkEmsg(@client)
273
+ @client.commit tid2
274
+ checkEmsg(@client) unless jruby?()
222
275
  @client.close
276
+ p [ "99", mn, "ends" ] if @tcldbg
223
277
  end unless ENV['STOMP_ARTEMIS'] # See Artemis docs for 1.3, page 222
224
278
 
225
279
  # Test transaction publish and abort, receive with new client.
226
280
  # New client uses ack => auto.
227
281
  def test_tran_ack_abrt_newcli_auto
282
+ mn = "test_tran_ack_abrt_newcli_auto" if @tcldbg
283
+ p [ "01", mn, "starts" ] if @tcldbg
284
+
285
+ tid = "tx1C"
228
286
  @client.close if @client && @client.open? # allow tests to close
229
287
  @client = get_client()
230
288
  q = make_destination
231
289
  data = message_text
232
290
  @client.publish q, data
233
291
 
234
- @client.begin 'tx1'
292
+ @client.begin tid
235
293
  message = nil
236
294
  sid = nil
237
295
  if @client.protocol() == Stomp::SPL_10
@@ -244,25 +302,26 @@ class TestClient < Test::Unit::TestCase
244
302
  assert_equal data, message.body
245
303
  case @client.protocol()
246
304
  when Stomp::SPL_10
247
- @client.acknowledge message, :transaction => 'tx1'
248
- checkEmsg(@client)
305
+ @client.acknowledge message, :transaction => tid
306
+ checkEmsg(@client) unless jruby?()
249
307
  when Stomp::SPL_11
250
- @client.acknowledge message, :transaction => 'tx1', :subscription => message.headers['subscription']
251
- checkEmsg(@client)
308
+ @client.acknowledge message, :transaction => tid, :subscription => message.headers['subscription']
309
+ checkEmsg(@client) unless jruby?()
252
310
  else # 1.2+
253
- @client.acknowledge message, :transaction => 'tx1', :id => message.headers['ack']
254
- checkEmsg(@client)
311
+ @client.acknowledge message, :transaction => tid, :id => message.headers['ack']
312
+ checkEmsg(@client) unless jruby?()
255
313
  end
256
314
  message = nil # reset
257
- @client.abort 'tx1' # now abort
258
- checkEmsg(@client)
315
+ @client.abort tid # now abort
316
+ checkEmsg(@client) unless jruby?()
259
317
  # lets recreate the connection
260
318
  @client.close
261
319
 
262
320
  @client = get_client()
263
321
  sid = nil
264
322
  message2 = nil
265
- @client.begin 'tx2'
323
+ tid2 = "tx2C"
324
+ @client.begin tid2
266
325
  if @client.protocol() == Stomp::SPL_10
267
326
  @client.subscribe(q, :ack => 'auto') {|m| message2 = m}
268
327
  else # 1.1 and 1.2 are the same for this
@@ -272,43 +331,59 @@ class TestClient < Test::Unit::TestCase
272
331
  sleep 0.01 until message2
273
332
  assert_not_nil message2
274
333
  assert_equal data, message2.body
275
- @client.commit 'tx2'
276
- checkEmsg(@client)
334
+ @client.commit tid2
335
+ checkEmsg(@client) unless jruby?()
277
336
  @client.close
337
+ p [ "99", mn, "ends" ] if @tcldbg
278
338
  end unless ENV['STOMP_ARTEMIS'] # See Artemis docs for 1.3, page 222
279
339
 
280
340
  # Test that subscription destinations must be unique for a Client.
281
341
  def test_raise_on_multiple_subscriptions_to_same_make_destination
342
+ mn = "test_raise_on_multiple_subscriptions_to_same_make_destination" if @tcldbg
343
+ p [ "01", mn, "starts" ] if @tcldbg
344
+
282
345
  subscribe_dest = make_destination
283
346
  @client.subscribe(subscribe_dest) {|m| nil }
284
347
  assert_raise(Stomp::Error::DuplicateSubscription) do
285
348
  @client.subscribe(subscribe_dest) {|m| nil }
286
349
  end
287
- checkEmsg(@client)
350
+ checkEmsg(@client) unless jruby?()
351
+ p [ "99", mn, "ends" ] if @tcldbg
288
352
  end
289
353
 
290
354
  # Test that subscription IDs must be unique for a Client.
291
355
  def test_raise_on_multiple_subscriptions_to_same_id
356
+ mn = "test_raise_on_multiple_subscriptions_to_same_id" if @tcldbg
357
+ p [ "01", mn, "starts" ] if @tcldbg
358
+
292
359
  subscribe_dest = make_destination
293
360
  @client.subscribe(subscribe_dest, {'id' => 'myid'}) {|m| nil }
294
361
  assert_raise(Stomp::Error::DuplicateSubscription) do
295
362
  @client.subscribe(subscribe_dest, {'id' => 'myid'}) {|m| nil }
296
363
  end
297
- checkEmsg(@client)
364
+ checkEmsg(@client) unless jruby?()
365
+ p [ "99", mn, "ends" ] if @tcldbg
298
366
  end
299
367
 
300
368
  # Test that subscription IDs must be unique for a Client, mixed id specification.
301
369
  def test_raise_on_multiple_subscriptions_to_same_id_mixed
370
+ mn = "test_raise_on_multiple_subscriptions_to_same_id_mixed" if @tcldbg
371
+ p [ "01", mn, "starts" ] if @tcldbg
372
+
302
373
  subscribe_dest = make_destination
303
374
  @client.subscribe(subscribe_dest, {'id' => 'myid'}) {|m| nil }
304
375
  assert_raise(Stomp::Error::DuplicateSubscription) do
305
376
  @client.subscribe(subscribe_dest, {:id => 'myid'}) {|m| nil }
306
377
  end
307
- checkEmsg(@client)
378
+ checkEmsg(@client) unless jruby?()
379
+ p [ "99", mn, "ends" ] if @tcldbg
308
380
  end
309
381
 
310
382
  # Test wildcard subscribe. Primarily for AMQ.
311
383
  def test_asterisk_wildcard_subscribe
384
+ mn = "test_asterisk_wildcard_subscribe" if @tcldbg
385
+ p [ "01", mn, "starts" ] if @tcldbg
386
+
312
387
  queue_base_name = make_destination
313
388
  queue1 = queue_base_name + ".a"
314
389
  queue2 = queue_base_name + ".b"
@@ -336,10 +411,14 @@ class TestClient < Test::Unit::TestCase
336
411
  end
337
412
  assert results.all?{|a| a == true }
338
413
  checkEmsg(@client)
414
+ p [ "99", mn, "ends" ] if @tcldbg
339
415
  end unless ENV['STOMP_NOWILD']
340
416
 
341
417
  # Test wildcard subscribe with >. Primarily for AMQ.
342
418
  def test_greater_than_wildcard_subscribe
419
+ mn = "test_greater_than_wildcard_subscribe" if @tcldbg
420
+ p [ "01", mn, "starts" ] if @tcldbg
421
+
343
422
  queue_base_name = make_destination + "."
344
423
  queue1 = queue_base_name + "foo.a"
345
424
  queue2 = queue_base_name + "bar.a"
@@ -371,17 +450,21 @@ class TestClient < Test::Unit::TestCase
371
450
  end
372
451
  assert results.all?{|a| a == true }
373
452
  checkEmsg(@client)
453
+ p [ "99", mn, "ends" ] if @tcldbg
374
454
  end unless ENV['STOMP_NOWILD'] || ENV['STOMP_DOTQUEUE']
375
455
 
376
456
  # Test transaction with client side reacknowledge.
377
457
  def test_transaction_with_client_side_reack
458
+ mn = "test_transaction_with_client_side_reack" if @tcldbg
459
+ p [ "01", mn, "starts" ] if @tcldbg
460
+
378
461
  @client.close if @client && @client.open? # allow tests to close
379
462
  @client = get_client()
380
463
  q = make_destination
381
464
  data = message_text
382
465
  @client.publish q, data
383
-
384
- @client.begin 'tx1'
466
+ tid = "tx1D"
467
+ @client.begin tid
385
468
  message = nil
386
469
  sid = nil
387
470
  if @client.protocol() == Stomp::SPL_10
@@ -394,47 +477,56 @@ class TestClient < Test::Unit::TestCase
394
477
  assert_equal data, message.body
395
478
  case @client.protocol()
396
479
  when Stomp::SPL_10
397
- @client.acknowledge message, :transaction => 'tx1'
398
- checkEmsg(@client)
480
+ @client.acknowledge message, :transaction => tid
481
+ checkEmsg(@client) unless jruby?()
399
482
  when Stomp::SPL_11
400
- @client.acknowledge message, :transaction => 'tx1', :subscription => message.headers['subscription']
401
- checkEmsg(@client)
483
+ @client.acknowledge message, :transaction => tid, :subscription => message.headers['subscription']
484
+ checkEmsg(@client) unless jruby?()
402
485
  else # 1.2+
403
- @client.acknowledge message, :transaction => 'tx1', :id => message.headers['ack']
404
- checkEmsg(@client)
486
+ @client.acknowledge message, :transaction => tid, :id => message.headers['ack']
487
+ checkEmsg(@client) unless jruby?()
405
488
  end
406
489
  message = nil
407
- @client.abort 'tx1'
490
+ @client.abort tid
408
491
  # Wait for redlivery (Client logic)
409
492
  sleep 0.1 while message.nil?
410
493
  assert_not_nil message
411
494
  assert_equal data, message.body
412
- @client.begin 'tx2'
495
+ tid2 = "tx2D"
496
+ @client.begin tid2
413
497
  case @client.protocol()
414
498
  when Stomp::SPL_10
415
- @client.acknowledge message, :transaction => 'tx2'
416
- checkEmsg(@client)
499
+ @client.acknowledge message, :transaction => tid2
500
+ checkEmsg(@client) unless jruby?()
417
501
  when Stomp::SPL_11
418
- @client.acknowledge message, :transaction => 'tx2', :subscription => message.headers['subscription']
419
- checkEmsg(@client)
502
+ @client.acknowledge message, :transaction => tid2, :subscription => message.headers['subscription']
503
+ checkEmsg(@client) unless jruby?()
420
504
  else # 1.2+
421
- @client.acknowledge message, :transaction => 'tx2', :id => message.headers['ack']
422
- checkEmsg(@client)
505
+ @client.acknowledge message, :transaction => tid2, :id => message.headers['ack']
506
+ checkEmsg(@client) unless jruby?()
423
507
  end
424
- @client.commit 'tx2'
425
- checkEmsg(@client)
508
+ @client.commit tid2
509
+ checkEmsg(@client) unless jruby?()
426
510
  @client.close
427
511
  @client = nil
428
- end
512
+ p [ "99", mn, "ends" ] if @tcldbg
513
+ end unless ENV['STOMP_ARTEMIS']
429
514
 
430
515
  # Test that a connection frame is received.
431
516
  def test_connection_frame
517
+ mn = "test_connection_frame" if @tcldbg
518
+ p [ "01", mn, "starts" ] if @tcldbg
519
+
432
520
  assert_not_nil @client.connection_frame
433
521
  checkEmsg(@client)
522
+ p [ "99", mn, "ends" ] if @tcldbg
434
523
  end unless RUBY_ENGINE =~ /jruby/
435
524
 
436
525
  # Test basic unsubscribe.
437
526
  def test_unsubscribe
527
+ mn = "test_unsubscribe" if @tcldbg
528
+ p [ "01", mn, "starts" ] if @tcldbg
529
+
438
530
  @client.close if @client && @client.open? # close setup work
439
531
  @client = nil
440
532
  message = nil
@@ -473,12 +565,16 @@ class TestClient < Test::Unit::TestCase
473
565
  end
474
566
  assert_equal to_send, message_copy.body, "second body check"
475
567
  assert_equal message.headers['message-id'], message_copy.headers['message-id'], "header check" unless ENV['STOMP_RABBIT']
476
- checkEmsg(client)
568
+ checkEmsg(client) unless jruby?()
477
569
  client.close
570
+ p [ "99", mn, "ends" ] if @tcldbg
478
571
  end
479
572
 
480
573
  # Test subscribe from a worker thread.
481
574
  def test_thread_one_subscribe
575
+ mn = "test_thread_one_subscribe" if @tcldbg
576
+ p [ "01", mn, "starts" ] if @tcldbg
577
+
482
578
  msg = nil
483
579
  dest = make_destination
484
580
  Thread.new(@client) do |acli|
@@ -497,10 +593,14 @@ class TestClient < Test::Unit::TestCase
497
593
  sleep 1
498
594
  assert_not_nil msg
499
595
  checkEmsg(@client)
596
+ p [ "99", mn, "ends" ] if @tcldbg
500
597
  end unless RUBY_ENGINE =~ /jruby/
501
598
 
502
599
  # Test subscribe from multiple worker threads.
503
600
  def test_thread_multi_subscribe
601
+ mn = "test_thread_multi_subscribe" if @tcldbg
602
+ p [ "01", mn, "starts" ] if @tcldbg
603
+
504
604
  #
505
605
  lock = Mutex.new
506
606
  msg_ctr = 0
@@ -547,11 +647,15 @@ class TestClient < Test::Unit::TestCase
547
647
  sleep sleep_incr
548
648
  end
549
649
  assert_equal @max_msgs, msg_ctr
550
- checkEmsg(@client)
650
+ checkEmsg(@client) unless jruby?()
651
+ p [ "99", mn, "ends" ] if @tcldbg
551
652
  end
552
653
 
553
654
  # Test that methods detect no client connection is present.
554
655
  def test_closed_checks_client
656
+ mn = "test_closed_checks_client" if @tcldbg
657
+ p [ "01", mn, "starts" ] if @tcldbg
658
+
555
659
  @client.close
556
660
  #
557
661
  assert_raise Stomp::Error::NoCurrentConnection do
@@ -590,19 +694,27 @@ class TestClient < Test::Unit::TestCase
590
694
  assert_raise Stomp::Error::NoCurrentConnection do
591
695
  @client.close("dummy_data")
592
696
  end
697
+ p [ "99", mn, "ends" ] if @tcldbg
593
698
  end
594
699
 
595
700
  # test JRuby detection
596
701
  def test_jruby_presence
702
+ mn = "test_jruby_presence" if @tcldbg
703
+ p [ "01", mn, "starts" ] if @tcldbg
704
+
597
705
  if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
598
706
  assert @client.jruby?
599
707
  else
600
708
  assert !@client.jruby?
601
709
  end
710
+ p [ "99", mn, "ends" ] if @tcldbg
602
711
  end
603
712
 
604
713
  # test max redeliveries is not broken (6c2c1c1)
605
714
  def test_max_redeliveries
715
+ mn = "test_max_redeliveries" if @tcldbg
716
+ p [ "01", mn, "starts" ] if @tcldbg
717
+
606
718
  @client.close
607
719
  2.upto(2) do |max_re|
608
720
  rdmsg = "To Be Redelivered: #{max_re.to_s}"
@@ -626,12 +738,17 @@ class TestClient < Test::Unit::TestCase
626
738
  assert_equal max_re, rm_actual - 1
627
739
  @client.close
628
740
  end
741
+ p [ "99", mn, "ends" ] if @tcldbg
629
742
  end unless ENV['STOMP_ARTEMIS'] # need to investigate this, but skip
630
743
  # Artemis for now
631
744
 
632
745
  # test issue99, OK values
633
746
  def test_cli_iss99_ok
747
+
634
748
  return unless host() == "localhost" && port() == 61613
749
+ mn = "test_cli_iss99_ok" if @tcldbg
750
+ p [ "01", mn, "starts" ] if @tcldbg
751
+
635
752
  @client.close
636
753
  #
637
754
  ok_vals = dflt_data_ok()
@@ -639,11 +756,15 @@ class TestClient < Test::Unit::TestCase
639
756
  cli = Stomp::Client.open(hsv)
640
757
  cli.close
641
758
  end
759
+ p [ "99", mn, "ends" ] if @tcldbg
642
760
  end
643
761
 
644
762
  # test issue99, exception values
645
763
  def test_cli_iss99_ex
646
764
  return unless host() == "localhost" && port() == 61613
765
+ mn = "test_cli_iss99_ex" if @tcldbg
766
+ p [ "01", mn, "starts" ] if @tcldbg
767
+
647
768
  @client.close
648
769
  #
649
770
  ex_vals = dflt_data_ex()
@@ -652,24 +773,37 @@ class TestClient < Test::Unit::TestCase
652
773
  _ = Stomp::Client.open(hsv)
653
774
  end
654
775
  end
776
+ p [ "99", mn, "ends" ] if @tcldbg
655
777
  end
656
778
 
657
779
  def test_cli_nodest_sub
780
+ mn = "test_cli_nodest_sub" if @tcldbg
781
+ p [ "01", mn, "starts" ] if @tcldbg
782
+
658
783
  assert_raise Stomp::Error::DestinationRequired do
659
784
  @client.subscribe(nil) {|msg| puts msg}
660
785
  end
786
+ p [ "99", mn, "ends" ] if @tcldbg
661
787
  end
662
788
 
663
789
  def test_cli_nodest_unsub
790
+ mn = "test_cli_nodest_unsub" if @tcldbg
791
+ p [ "01", mn, "starts" ] if @tcldbg
792
+
664
793
  assert_raise Stomp::Error::DestinationRequired do
665
794
  @client.unsubscribe(nil)
666
795
  end
796
+ p [ "99", mn, "ends" ] if @tcldbg
667
797
  end
668
798
 
669
799
  def test_cli_nodest_pub
800
+ mn = "test_cli_nodest_pub" if @tcldbg
801
+ p [ "01", mn, "starts" ] if @tcldbg
802
+
670
803
  assert_raise Stomp::Error::DestinationRequired do
671
804
  @client.publish(nil, "msg")
672
805
  end
806
+ p [ "99", mn, "ends" ] if @tcldbg
673
807
  end
674
808
 
675
809
  private