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_codec.rb
CHANGED
@@ -20,6 +20,7 @@ class TestCodec < Test::Unit::TestCase
|
|
20
20
|
# Data for multi_thread tests
|
21
21
|
@max_threads = 20
|
22
22
|
@max_msgs = 100
|
23
|
+
@tcodbg = ENV['TCODBG'] ? true : false
|
23
24
|
end
|
24
25
|
|
25
26
|
def teardown
|
@@ -28,6 +29,9 @@ class TestCodec < Test::Unit::TestCase
|
|
28
29
|
|
29
30
|
# Test that the codec does nothing to strings that do not need encoding.
|
30
31
|
def test_1000_check_notneeded
|
32
|
+
mn = "test_1000_check_notneeded" if @tcodbg
|
33
|
+
p [ "01", mn, "starts" ] if @tcodbg
|
34
|
+
|
31
35
|
test_data = [
|
32
36
|
"a",
|
33
37
|
"abcdefghijklmnopqrstuvwxyz",
|
@@ -46,10 +50,14 @@ class TestCodec < Test::Unit::TestCase
|
|
46
50
|
assert_equal s_decoded_a, s_reencoded, "Sanity check reencode: #{s_decoded_a} | #{s_reencoded}"
|
47
51
|
#
|
48
52
|
end
|
53
|
+
p [ "99", mn, "ends" ] if @tcodbg
|
49
54
|
end
|
50
55
|
|
51
56
|
# Test the basic encoding / decoding requirements.
|
52
57
|
def test_1010_basic_encode_decode
|
58
|
+
mn = "test_1010_basic_encode_decode" if @tcodbg
|
59
|
+
p [ "01", mn, "starts" ] if @tcodbg
|
60
|
+
|
53
61
|
test_data = [
|
54
62
|
[ "\\\\\\\\", "\\\\" ], # [encoded, decoded]
|
55
63
|
[ "\\\\", "\\" ], # [encoded, decoded]
|
@@ -84,10 +92,14 @@ class TestCodec < Test::Unit::TestCase
|
|
84
92
|
s_encoded_b = Stomp::HeaderCodec::encode(s_decoded_a)
|
85
93
|
assert_equal encoded_orig, s_encoded_b, "Sanity check 2 encode: #{encoded_orig} | #{s_encoded_b}"
|
86
94
|
end
|
95
|
+
p [ "99", mn, "ends" ] if @tcodbg
|
87
96
|
end
|
88
97
|
|
89
98
|
# Test more complex strings with the codec.
|
90
99
|
def test_1020_fancier
|
100
|
+
mn = "test_1020_fancier" if @tcodbg
|
101
|
+
p [ "01", mn, "starts" ] if @tcodbg
|
102
|
+
|
91
103
|
test_data = [
|
92
104
|
[ "a\\\\b", "a\\b" ], # [encoded, decoded]
|
93
105
|
[ "\\\\\\n\\c", "\\\n:" ],
|
@@ -113,6 +125,7 @@ class TestCodec < Test::Unit::TestCase
|
|
113
125
|
s_encoded_b = Stomp::HeaderCodec::encode(s_decoded_a)
|
114
126
|
assert_equal encoded_orig, s_encoded_b, "Sanity check 2 encode: #{encoded_orig} | #{s_encoded_b}"
|
115
127
|
end
|
128
|
+
p [ "99", mn, "ends" ] if @tcodbg
|
116
129
|
end
|
117
130
|
|
118
131
|
end # of class
|
data/test/test_connection.rb
CHANGED
@@ -20,6 +20,7 @@ class TestConnection < Test::Unit::TestCase
|
|
20
20
|
# Data for multi_thread tests
|
21
21
|
@max_threads = 20
|
22
22
|
@max_msgs = 100
|
23
|
+
@tcndbg = ENV['TCNDBG'] ? true : false
|
23
24
|
end
|
24
25
|
|
25
26
|
def teardown
|
@@ -28,21 +29,29 @@ class TestConnection < Test::Unit::TestCase
|
|
28
29
|
|
29
30
|
# Test basic connection creation.
|
30
31
|
def test_connection_exists
|
32
|
+
mn = "test_connection_exists" if @tcndbg
|
33
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
31
34
|
assert_not_nil @conn
|
35
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
32
36
|
end
|
33
37
|
|
34
38
|
# Test asynchronous polling.
|
35
39
|
def test_poll_async
|
40
|
+
mn = "test_poll_async" if @tcndbg
|
41
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
36
42
|
sq = ENV['STOMP_ARTEMIS'] ? "jms.queue.queue.do.not.put.messages.on.this.queue" :
|
37
43
|
"/queue/do.not.put.messages.on.this.queue"
|
38
44
|
@conn.subscribe(sq, :id => "a.no.messages.queue")
|
39
45
|
# If the test 'hangs' here, Connection#poll is broken.
|
40
46
|
m = @conn.poll
|
41
47
|
assert m.nil?
|
48
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
42
49
|
end
|
43
50
|
|
44
51
|
# Test suppression of content length header.
|
45
52
|
def test_no_length
|
53
|
+
mn = "test_no_length" if @tcndbg
|
54
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
46
55
|
conn_subscribe make_destination
|
47
56
|
#
|
48
57
|
@conn.publish make_destination, "test_stomp#test_no_length",
|
@@ -55,34 +64,46 @@ class TestConnection < Test::Unit::TestCase
|
|
55
64
|
msg2 = @conn.receive
|
56
65
|
assert_equal "test_stomp#test_", msg2.body
|
57
66
|
checkEmsg(@conn)
|
67
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
58
68
|
end unless ENV['STOMP_RABBIT']
|
59
69
|
|
60
70
|
# Test direct / explicit receive.
|
61
71
|
def test_explicit_receive
|
72
|
+
mn = "test_explicit_receive" if @tcndbg
|
73
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
62
74
|
conn_subscribe make_destination
|
63
75
|
@conn.publish make_destination, "test_stomp#test_explicit_receive"
|
64
76
|
msg = @conn.receive
|
65
77
|
assert_equal "test_stomp#test_explicit_receive", msg.body
|
78
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
66
79
|
end
|
67
80
|
|
68
81
|
# Test asking for a receipt.
|
69
82
|
def test_receipt
|
83
|
+
mn = "test_receipt" if @tcndbg
|
84
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
70
85
|
conn_subscribe make_destination, :receipt => "abc"
|
71
86
|
msg = @conn.receive
|
72
87
|
assert_equal "abc", msg.headers['receipt-id']
|
73
88
|
checkEmsg(@conn)
|
89
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
74
90
|
end
|
75
91
|
|
76
92
|
# Test asking for a receipt on disconnect.
|
77
93
|
def test_disconnect_receipt
|
94
|
+
mn = "test_disconnect_receipt" if @tcndbg
|
95
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
78
96
|
@conn.disconnect :receipt => "abc123"
|
79
97
|
assert_not_nil(@conn.disconnect_receipt, "should have a receipt")
|
80
98
|
assert_equal(@conn.disconnect_receipt.headers['receipt-id'],
|
81
99
|
"abc123", "receipt sent and received should match")
|
100
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
82
101
|
end
|
83
102
|
|
84
103
|
# Test ACKs for Stomp 1.0
|
85
104
|
def test_client_ack_with_symbol_10
|
105
|
+
mn = "test_client_ack_with_symbol_10" if @tcndbg
|
106
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
86
107
|
if @conn.protocol != Stomp::SPL_10
|
87
108
|
assert true
|
88
109
|
return
|
@@ -95,10 +116,13 @@ class TestConnection < Test::Unit::TestCase
|
|
95
116
|
# matching the message-id for the MESSAGE being acknowledged.
|
96
117
|
@conn.ack msg.headers['message-id']
|
97
118
|
checkEmsg(@conn)
|
119
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
98
120
|
end
|
99
121
|
|
100
122
|
# Test ACKs for Stomp 1.1
|
101
123
|
def test_client_ack_with_symbol_11
|
124
|
+
mn = "test_client_ack_with_symbol_11" if @tcndbg
|
125
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
102
126
|
if @conn.protocol != Stomp::SPL_11
|
103
127
|
assert true
|
104
128
|
return
|
@@ -114,10 +138,13 @@ class TestConnection < Test::Unit::TestCase
|
|
114
138
|
# id header.
|
115
139
|
@conn.ack msg.headers['message-id'], :subscription => msg.headers['subscription']
|
116
140
|
checkEmsg(@conn)
|
141
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
117
142
|
end
|
118
143
|
|
119
144
|
# Test ACKs for Stomp 1.2
|
120
145
|
def test_client_ack_with_symbol_12
|
146
|
+
mn = "test_client_ack_with_symbol_12" if @tcndbg
|
147
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
121
148
|
if @conn.protocol != Stomp::SPL_12
|
122
149
|
assert true
|
123
150
|
return
|
@@ -131,33 +158,45 @@ class TestConnection < Test::Unit::TestCase
|
|
131
158
|
# of the MESSAGE being acknowledged.
|
132
159
|
@conn.ack msg.headers['ack']
|
133
160
|
checkEmsg(@conn)
|
161
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
134
162
|
end
|
135
163
|
|
136
164
|
# Test a message with 0x00 embedded in the body.
|
137
165
|
def test_embedded_null
|
166
|
+
mn = "test_embedded_null" if @tcndbg
|
167
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
138
168
|
conn_subscribe make_destination
|
139
169
|
@conn.publish make_destination, "a\0"
|
140
170
|
msg = @conn.receive
|
141
171
|
assert_equal "a\0" , msg.body
|
142
172
|
checkEmsg(@conn)
|
173
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
143
174
|
end
|
144
175
|
|
145
176
|
# Test connection open checking.
|
146
177
|
def test_connection_open?
|
178
|
+
mn = "test_connection_open?" if @tcndbg
|
179
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
147
180
|
assert_equal true , @conn.open?
|
148
181
|
@conn.disconnect
|
149
182
|
assert_equal false, @conn.open?
|
183
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
150
184
|
end
|
151
185
|
|
152
186
|
# Test connection closed checking.
|
153
187
|
def test_connection_closed?
|
188
|
+
mn = "test_connection_closed?" if @tcndbg
|
189
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
154
190
|
assert_equal false, @conn.closed?
|
155
191
|
@conn.disconnect
|
156
192
|
assert_equal true, @conn.closed?
|
193
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
157
194
|
end
|
158
195
|
|
159
196
|
# Test that methods detect a closed connection.
|
160
197
|
def test_closed_checks_conn
|
198
|
+
mn = "test_closed_checks_conn" if @tcndbg
|
199
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
161
200
|
@conn.disconnect
|
162
201
|
#
|
163
202
|
assert_raise Stomp::Error::NoCurrentConnection do
|
@@ -203,33 +242,45 @@ class TestConnection < Test::Unit::TestCase
|
|
203
242
|
assert_raise Stomp::Error::NoCurrentConnection do
|
204
243
|
_ = @conn.poll
|
205
244
|
end
|
245
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
206
246
|
end
|
207
247
|
|
208
248
|
# Test that we receive a Stomp::Message.
|
209
249
|
def test_response_is_instance_of_message_class
|
250
|
+
mn = "test_response_is_instance_of_message_class" if @tcndbg
|
251
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
210
252
|
conn_subscribe make_destination
|
211
253
|
@conn.publish make_destination, "a\0"
|
212
254
|
msg = @conn.receive
|
213
255
|
assert_instance_of Stomp::Message , msg
|
214
256
|
checkEmsg(@conn)
|
257
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
215
258
|
end
|
216
259
|
|
217
260
|
# Test converting a Message to a string.
|
218
261
|
def test_message_to_s
|
262
|
+
mn = "test_message_to_s" if @tcndbg
|
263
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
219
264
|
conn_subscribe make_destination
|
220
265
|
@conn.publish make_destination, "a\0"
|
221
266
|
msg = @conn.receive
|
222
267
|
assert_match(/^<Stomp::Message headers=/ , msg.to_s)
|
223
268
|
checkEmsg(@conn)
|
269
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
224
270
|
end
|
225
271
|
|
226
272
|
# Test that a connection frame is present.
|
227
273
|
def test_connection_frame
|
274
|
+
mn = "test_connection_frame" if @tcndbg
|
275
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
228
276
|
assert_not_nil @conn.connection_frame
|
277
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
229
278
|
end
|
230
279
|
|
231
280
|
# Test messages with multiple line ends.
|
232
281
|
def test_messages_with_multipleLine_ends
|
282
|
+
mn = "test_messages_with_multipleLine_ends" if @tcndbg
|
283
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
233
284
|
conn_subscribe make_destination
|
234
285
|
@conn.publish make_destination, "a\n\n"
|
235
286
|
@conn.publish make_destination, "b\n\na\n\n"
|
@@ -240,10 +291,13 @@ class TestConnection < Test::Unit::TestCase
|
|
240
291
|
assert_equal "a\n\n", msg_a.body
|
241
292
|
assert_equal "b\n\na\n\n", msg_b.body
|
242
293
|
checkEmsg(@conn)
|
294
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
243
295
|
end
|
244
296
|
|
245
297
|
# Test publishing multiple messages.
|
246
298
|
def test_publish_two_messages
|
299
|
+
mn = "test_publish_two_messages" if @tcndbg
|
300
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
247
301
|
conn_subscribe make_destination
|
248
302
|
@conn.publish make_destination, "a\0"
|
249
303
|
@conn.publish make_destination, "b\0"
|
@@ -253,14 +307,18 @@ class TestConnection < Test::Unit::TestCase
|
|
253
307
|
assert_equal "a\0", msg_a.body
|
254
308
|
assert_equal "b\0", msg_b.body
|
255
309
|
checkEmsg(@conn)
|
310
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
256
311
|
end
|
257
312
|
|
258
313
|
def test_thread_hang_one
|
314
|
+
mn = "test_thread_hang_one" if @tcndbg
|
315
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
259
316
|
received = nil
|
260
317
|
Thread.new(@conn) do |amq|
|
261
318
|
no_rep_error()
|
262
319
|
while true
|
263
320
|
received = amq.receive
|
321
|
+
Thread::exit if received
|
264
322
|
end
|
265
323
|
end
|
266
324
|
#
|
@@ -271,10 +329,13 @@ class TestConnection < Test::Unit::TestCase
|
|
271
329
|
assert_not_nil received
|
272
330
|
assert_equal message, received.body
|
273
331
|
checkEmsg(@conn)
|
332
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
274
333
|
end
|
275
334
|
|
276
335
|
# Test polling with a single thread.
|
277
336
|
def test_thread_poll_one
|
337
|
+
mn = "test_thread_poll_one" if @tcndbg
|
338
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
278
339
|
received = nil
|
279
340
|
max_sleep = (RUBY_VERSION =~ /1\.8/) ? 10 : 1
|
280
341
|
Thread.new(@conn) do |amq|
|
@@ -294,10 +355,13 @@ class TestConnection < Test::Unit::TestCase
|
|
294
355
|
assert_not_nil received
|
295
356
|
assert_equal message, received.body
|
296
357
|
checkEmsg(@conn)
|
358
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
297
359
|
end
|
298
360
|
|
299
361
|
# Test receiving with multiple threads.
|
300
362
|
def test_multi_thread_receive
|
363
|
+
mn = "test_multi_thread_receive" if @tcndbg
|
364
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
301
365
|
lock = Mutex.new
|
302
366
|
msg_ctr = 0
|
303
367
|
dest = make_destination
|
@@ -334,10 +398,13 @@ class TestConnection < Test::Unit::TestCase
|
|
334
398
|
end
|
335
399
|
assert_equal @max_msgs, msg_ctr
|
336
400
|
checkEmsg(@conn)
|
401
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
337
402
|
end unless RUBY_ENGINE =~ /jruby/
|
338
403
|
|
339
404
|
# Test polling with multiple threads.
|
340
405
|
def test_multi_thread_poll
|
406
|
+
mn = "test_multi_thread_poll" if @tcndbg
|
407
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
341
408
|
#
|
342
409
|
lock = Mutex.new
|
343
410
|
msg_ctr = 0
|
@@ -380,20 +447,26 @@ class TestConnection < Test::Unit::TestCase
|
|
380
447
|
end
|
381
448
|
assert_equal @max_msgs, msg_ctr
|
382
449
|
checkEmsg(@conn)
|
450
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
383
451
|
end unless RUBY_ENGINE =~ /jruby/
|
384
452
|
|
385
453
|
# Test using a nil body.
|
386
454
|
def test_nil_body
|
455
|
+
mn = "test_nil_body" if @tcndbg
|
456
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
387
457
|
dest = make_destination
|
388
458
|
@conn.publish dest, nil
|
389
459
|
conn_subscribe dest
|
390
460
|
msg = @conn.receive
|
391
461
|
assert_equal "", msg.body
|
392
462
|
checkEmsg(@conn)
|
463
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
393
464
|
end
|
394
465
|
|
395
466
|
# Test transaction message sequencing.
|
396
467
|
def test_transaction
|
468
|
+
mn = "test_transaction" if @tcndbg
|
469
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
397
470
|
conn_subscribe make_destination
|
398
471
|
|
399
472
|
@conn.begin "txA"
|
@@ -408,10 +481,13 @@ class TestConnection < Test::Unit::TestCase
|
|
408
481
|
msg = @conn.receive
|
409
482
|
assert_equal "txn message", msg.body
|
410
483
|
checkEmsg(@conn)
|
484
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
411
485
|
end unless ENV['STOMP_ARTEMIS'] # See Artemis docs for 1.3, page 222
|
412
486
|
|
413
487
|
# Test duplicate subscriptions.
|
414
488
|
def test_duplicate_subscription
|
489
|
+
mn = "test_duplicate_subscription" if @tcndbg
|
490
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
415
491
|
@conn.disconnect # not reliable
|
416
492
|
@conn = Stomp::Connection.open(user, passcode, host, port, true) # reliable
|
417
493
|
dest = make_destination
|
@@ -421,18 +497,24 @@ class TestConnection < Test::Unit::TestCase
|
|
421
497
|
conn_subscribe dest
|
422
498
|
end
|
423
499
|
checkEmsg(@conn)
|
500
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
424
501
|
end
|
425
502
|
|
426
503
|
# Test nil 1.1 connection parameters.
|
427
504
|
def test_nil_connparms
|
505
|
+
mn = "test_nil_connparms" if @tcndbg
|
506
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
428
507
|
@conn.disconnect
|
429
508
|
#
|
430
509
|
@conn = Stomp::Connection.open(user, passcode, host, port, false, 5, nil)
|
431
510
|
checkEmsg(@conn)
|
511
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
432
512
|
end
|
433
513
|
|
434
514
|
# Basic NAK test.
|
435
515
|
def test_nack11p_0010
|
516
|
+
mn = "test_nack11p_0010" if @tcndbg
|
517
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
436
518
|
if @conn.protocol == Stomp::SPL_10
|
437
519
|
assert_raise Stomp::Error::UnsupportedProtocolError do
|
438
520
|
@conn.nack "dummy msg-id"
|
@@ -465,6 +547,7 @@ class TestConnection < Test::Unit::TestCase
|
|
465
547
|
msg2 = @conn.receive
|
466
548
|
assert_equal smsg, msg2.body
|
467
549
|
checkEmsg(@conn)
|
550
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
468
551
|
end
|
469
552
|
end unless (ENV['STOMP_AMQ11'] || ENV['STOMP_ARTEMIS'])
|
470
553
|
|
@@ -472,6 +555,8 @@ class TestConnection < Test::Unit::TestCase
|
|
472
555
|
# fail only when connecting to a pure STOMP 1.0 server that does not
|
473
556
|
# return a 'version' header at all.
|
474
557
|
def test_conn10_simple
|
558
|
+
mn = "test_conn10_simple" if @tcndbg
|
559
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
475
560
|
@conn.disconnect
|
476
561
|
#
|
477
562
|
vhost = ENV['STOMP_RABBIT'] ? "/" : host
|
@@ -494,19 +579,25 @@ class TestConnection < Test::Unit::TestCase
|
|
494
579
|
c = nil
|
495
580
|
c = Stomp::Connection.new(hash)
|
496
581
|
c.disconnect if c
|
582
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
497
583
|
end
|
498
584
|
|
499
585
|
# test JRuby detection
|
500
586
|
def test_jruby_presence
|
587
|
+
mn = "test_jruby_presence" if @tcndbg
|
588
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
501
589
|
if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
|
502
590
|
assert @conn.jruby
|
503
591
|
else
|
504
592
|
assert !@conn.jruby
|
505
593
|
end
|
594
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
506
595
|
end
|
507
596
|
|
508
597
|
# Test that methods detect an empty header key.
|
509
598
|
def test_empty_header_key
|
599
|
+
mn = "test_empty_header_key" if @tcndbg
|
600
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
510
601
|
#
|
511
602
|
bad_headers = {"a" => "11", "" => "emptykey", :c => "ccc"}
|
512
603
|
#
|
@@ -545,11 +636,14 @@ class TestConnection < Test::Unit::TestCase
|
|
545
636
|
assert_raise Stomp::Error::ProtocolErrorEmptyHeaderKey do
|
546
637
|
@conn.disconnect(bad_headers)
|
547
638
|
end
|
639
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
548
640
|
end
|
549
641
|
|
550
642
|
# Test that methods detect an empty header value.
|
551
643
|
# STOMP 1.0 only.
|
552
644
|
def test_empty_header_value
|
645
|
+
mn = "test_empty_header_value" if @tcndbg
|
646
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
553
647
|
if @conn.protocol != Stomp::SPL_10
|
554
648
|
assert true
|
555
649
|
return
|
@@ -592,10 +686,13 @@ class TestConnection < Test::Unit::TestCase
|
|
592
686
|
assert_raise Stomp::Error::ProtocolErrorEmptyHeaderValue do
|
593
687
|
@conn.disconnect(bad_headers)
|
594
688
|
end
|
689
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
595
690
|
end
|
596
691
|
|
597
692
|
# test issue99, OK values
|
598
693
|
def test_con_iss99_ok
|
694
|
+
mn = "test_con_iss99_ok" if @tcndbg
|
695
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
599
696
|
return unless host() == "localhost" && port() == 61613
|
600
697
|
#
|
601
698
|
ok_vals = dflt_data_ok()
|
@@ -603,24 +700,34 @@ class TestConnection < Test::Unit::TestCase
|
|
603
700
|
conn = Stomp::Connection.new(hsv)
|
604
701
|
conn.disconnect
|
605
702
|
end
|
703
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
606
704
|
end
|
607
705
|
|
608
706
|
def test_conn_nodest_sub
|
707
|
+
mn = "test_conn_nodest_sub" if @tcndbg
|
708
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
609
709
|
assert_raise Stomp::Error::DestinationRequired do
|
610
710
|
@conn.subscribe(nil)
|
611
711
|
end
|
712
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
612
713
|
end
|
613
714
|
|
614
715
|
def test_conn_nodest_unsub
|
716
|
+
mn = "test_conn_nodest_unsub" if @tcndbg
|
717
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
615
718
|
assert_raise Stomp::Error::DestinationRequired do
|
616
719
|
@conn.unsubscribe(nil)
|
617
720
|
end
|
721
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
618
722
|
end
|
619
723
|
|
620
724
|
def test_conn_nodest_pub
|
725
|
+
mn = "test_conn_nodest_pub" if @tcndbg
|
726
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
621
727
|
assert_raise Stomp::Error::DestinationRequired do
|
622
728
|
@conn.publish(nil, "msg")
|
623
729
|
end
|
730
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
624
731
|
end
|
625
732
|
|
626
733
|
end
|