stomp 1.4.5 → 1.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -1
- data/CONTRIBUTORS.md +749 -0
- data/README.md +74 -752
- data/Rakefile +1 -1
- data/examples/conn_get.rb +122 -0
- data/examples/conn_put.rb +111 -0
- data/examples/conn_put_pace.rb +117 -0
- data/examples/conn_putget.rb +8 -1
- data/examples/contributors.rb +14 -1
- data/examples/examplogger.rb +33 -11
- data/examples/logexamp.rb +3 -0
- data/examples/putget_file.rb +2 -2
- data/examples/showver.rb +4 -0
- data/examples/ssl/SSL.md +1 -1
- data/examples/ssl/ssl_common.rb +24 -0
- data/examples/ssl/uc3/{ssl_uc3.rb → ssl_uc3_from_files.rb} +0 -0
- data/examples/ssl/uc3/{ssl_uc3_ciphers.rb → ssl_uc3_from_files_ciphers.rb} +0 -0
- data/examples/ssl/uc3/ssl_uc3_without_files.rb +69 -0
- data/examples/ssl/uc3/ssl_uc3_without_files_ciphers.rb +65 -0
- data/examples/stomp_common.rb +1 -0
- data/lib/client/utils.rb +1 -0
- data/lib/connection/heartbeats.rb +1 -1
- data/lib/connection/netio.rb +81 -29
- data/lib/connection/utils.rb +1 -0
- data/lib/stomp/connection.rb +1 -0
- data/lib/stomp/sslparams.rb +19 -5
- data/lib/stomp/version.rb +5 -3
- data/spec/connection_spec.rb +1 -1
- data/stomp.gemspec +13 -6
- data/test/test_anonymous.rb +94 -3
- data/test/test_client.rb +210 -76
- data/test/test_codec.rb +13 -0
- data/test/test_connection.rb +113 -1
- data/test/test_connection1p.rb +87 -2
- data/test/test_helper.rb +1 -1
- data/test/test_message.rb +29 -5
- data/test/test_ssl.rb +54 -0
- data/test/test_urlogin.rb +19 -2
- metadata +12 -6
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'] || ENV['TDBGALL'] ? 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'] || ENV['TDBGALL'] ? 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,51 @@ 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
|
85
|
+
p [ "02", @conn.protocol ] if @tcndbg
|
70
86
|
conn_subscribe make_destination, :receipt => "abc"
|
71
87
|
msg = @conn.receive
|
72
|
-
|
88
|
+
p [ "05", msg.headers['receipt-id'].class, msg.headers['receipt-id'].is_a?(Array) ] if @tcndbg
|
89
|
+
#
|
90
|
+
tval = msg.headers['receipt-id']
|
91
|
+
tval = msg.headers['receipt-id'][0] if msg.headers['receipt-id'].is_a?(Array)
|
92
|
+
assert_equal "abc", tval
|
73
93
|
checkEmsg(@conn)
|
94
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
74
95
|
end
|
75
96
|
|
76
97
|
# Test asking for a receipt on disconnect.
|
77
98
|
def test_disconnect_receipt
|
99
|
+
mn = "test_disconnect_receipt" if @tcndbg
|
100
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
78
101
|
@conn.disconnect :receipt => "abc123"
|
79
102
|
assert_not_nil(@conn.disconnect_receipt, "should have a receipt")
|
80
103
|
assert_equal(@conn.disconnect_receipt.headers['receipt-id'],
|
81
104
|
"abc123", "receipt sent and received should match")
|
105
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
82
106
|
end
|
83
107
|
|
84
108
|
# Test ACKs for Stomp 1.0
|
85
109
|
def test_client_ack_with_symbol_10
|
110
|
+
mn = "test_client_ack_with_symbol_10" if @tcndbg
|
111
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
86
112
|
if @conn.protocol != Stomp::SPL_10
|
87
113
|
assert true
|
88
114
|
return
|
@@ -95,10 +121,13 @@ class TestConnection < Test::Unit::TestCase
|
|
95
121
|
# matching the message-id for the MESSAGE being acknowledged.
|
96
122
|
@conn.ack msg.headers['message-id']
|
97
123
|
checkEmsg(@conn)
|
124
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
98
125
|
end
|
99
126
|
|
100
127
|
# Test ACKs for Stomp 1.1
|
101
128
|
def test_client_ack_with_symbol_11
|
129
|
+
mn = "test_client_ack_with_symbol_11" if @tcndbg
|
130
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
102
131
|
if @conn.protocol != Stomp::SPL_11
|
103
132
|
assert true
|
104
133
|
return
|
@@ -114,10 +143,13 @@ class TestConnection < Test::Unit::TestCase
|
|
114
143
|
# id header.
|
115
144
|
@conn.ack msg.headers['message-id'], :subscription => msg.headers['subscription']
|
116
145
|
checkEmsg(@conn)
|
146
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
117
147
|
end
|
118
148
|
|
119
149
|
# Test ACKs for Stomp 1.2
|
120
150
|
def test_client_ack_with_symbol_12
|
151
|
+
mn = "test_client_ack_with_symbol_12" if @tcndbg
|
152
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
121
153
|
if @conn.protocol != Stomp::SPL_12
|
122
154
|
assert true
|
123
155
|
return
|
@@ -131,33 +163,45 @@ class TestConnection < Test::Unit::TestCase
|
|
131
163
|
# of the MESSAGE being acknowledged.
|
132
164
|
@conn.ack msg.headers['ack']
|
133
165
|
checkEmsg(@conn)
|
166
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
134
167
|
end
|
135
168
|
|
136
169
|
# Test a message with 0x00 embedded in the body.
|
137
170
|
def test_embedded_null
|
171
|
+
mn = "test_embedded_null" if @tcndbg
|
172
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
138
173
|
conn_subscribe make_destination
|
139
174
|
@conn.publish make_destination, "a\0"
|
140
175
|
msg = @conn.receive
|
141
176
|
assert_equal "a\0" , msg.body
|
142
177
|
checkEmsg(@conn)
|
178
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
143
179
|
end
|
144
180
|
|
145
181
|
# Test connection open checking.
|
146
182
|
def test_connection_open?
|
183
|
+
mn = "test_connection_open?" if @tcndbg
|
184
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
147
185
|
assert_equal true , @conn.open?
|
148
186
|
@conn.disconnect
|
149
187
|
assert_equal false, @conn.open?
|
188
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
150
189
|
end
|
151
190
|
|
152
191
|
# Test connection closed checking.
|
153
192
|
def test_connection_closed?
|
193
|
+
mn = "test_connection_closed?" if @tcndbg
|
194
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
154
195
|
assert_equal false, @conn.closed?
|
155
196
|
@conn.disconnect
|
156
197
|
assert_equal true, @conn.closed?
|
198
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
157
199
|
end
|
158
200
|
|
159
201
|
# Test that methods detect a closed connection.
|
160
202
|
def test_closed_checks_conn
|
203
|
+
mn = "test_closed_checks_conn" if @tcndbg
|
204
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
161
205
|
@conn.disconnect
|
162
206
|
#
|
163
207
|
assert_raise Stomp::Error::NoCurrentConnection do
|
@@ -203,33 +247,45 @@ class TestConnection < Test::Unit::TestCase
|
|
203
247
|
assert_raise Stomp::Error::NoCurrentConnection do
|
204
248
|
_ = @conn.poll
|
205
249
|
end
|
250
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
206
251
|
end
|
207
252
|
|
208
253
|
# Test that we receive a Stomp::Message.
|
209
254
|
def test_response_is_instance_of_message_class
|
255
|
+
mn = "test_response_is_instance_of_message_class" if @tcndbg
|
256
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
210
257
|
conn_subscribe make_destination
|
211
258
|
@conn.publish make_destination, "a\0"
|
212
259
|
msg = @conn.receive
|
213
260
|
assert_instance_of Stomp::Message , msg
|
214
261
|
checkEmsg(@conn)
|
262
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
215
263
|
end
|
216
264
|
|
217
265
|
# Test converting a Message to a string.
|
218
266
|
def test_message_to_s
|
267
|
+
mn = "test_message_to_s" if @tcndbg
|
268
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
219
269
|
conn_subscribe make_destination
|
220
270
|
@conn.publish make_destination, "a\0"
|
221
271
|
msg = @conn.receive
|
222
272
|
assert_match(/^<Stomp::Message headers=/ , msg.to_s)
|
223
273
|
checkEmsg(@conn)
|
274
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
224
275
|
end
|
225
276
|
|
226
277
|
# Test that a connection frame is present.
|
227
278
|
def test_connection_frame
|
279
|
+
mn = "test_connection_frame" if @tcndbg
|
280
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
228
281
|
assert_not_nil @conn.connection_frame
|
282
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
229
283
|
end
|
230
284
|
|
231
285
|
# Test messages with multiple line ends.
|
232
286
|
def test_messages_with_multipleLine_ends
|
287
|
+
mn = "test_messages_with_multipleLine_ends" if @tcndbg
|
288
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
233
289
|
conn_subscribe make_destination
|
234
290
|
@conn.publish make_destination, "a\n\n"
|
235
291
|
@conn.publish make_destination, "b\n\na\n\n"
|
@@ -240,10 +296,13 @@ class TestConnection < Test::Unit::TestCase
|
|
240
296
|
assert_equal "a\n\n", msg_a.body
|
241
297
|
assert_equal "b\n\na\n\n", msg_b.body
|
242
298
|
checkEmsg(@conn)
|
299
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
243
300
|
end
|
244
301
|
|
245
302
|
# Test publishing multiple messages.
|
246
303
|
def test_publish_two_messages
|
304
|
+
mn = "test_publish_two_messages" if @tcndbg
|
305
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
247
306
|
conn_subscribe make_destination
|
248
307
|
@conn.publish make_destination, "a\0"
|
249
308
|
@conn.publish make_destination, "b\0"
|
@@ -253,14 +312,18 @@ class TestConnection < Test::Unit::TestCase
|
|
253
312
|
assert_equal "a\0", msg_a.body
|
254
313
|
assert_equal "b\0", msg_b.body
|
255
314
|
checkEmsg(@conn)
|
315
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
256
316
|
end
|
257
317
|
|
258
318
|
def test_thread_hang_one
|
319
|
+
mn = "test_thread_hang_one" if @tcndbg
|
320
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
259
321
|
received = nil
|
260
322
|
Thread.new(@conn) do |amq|
|
261
323
|
no_rep_error()
|
262
324
|
while true
|
263
325
|
received = amq.receive
|
326
|
+
Thread::exit if received
|
264
327
|
end
|
265
328
|
end
|
266
329
|
#
|
@@ -271,10 +334,13 @@ class TestConnection < Test::Unit::TestCase
|
|
271
334
|
assert_not_nil received
|
272
335
|
assert_equal message, received.body
|
273
336
|
checkEmsg(@conn)
|
337
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
274
338
|
end
|
275
339
|
|
276
340
|
# Test polling with a single thread.
|
277
341
|
def test_thread_poll_one
|
342
|
+
mn = "test_thread_poll_one" if @tcndbg
|
343
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
278
344
|
received = nil
|
279
345
|
max_sleep = (RUBY_VERSION =~ /1\.8/) ? 10 : 1
|
280
346
|
Thread.new(@conn) do |amq|
|
@@ -294,10 +360,13 @@ class TestConnection < Test::Unit::TestCase
|
|
294
360
|
assert_not_nil received
|
295
361
|
assert_equal message, received.body
|
296
362
|
checkEmsg(@conn)
|
363
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
297
364
|
end
|
298
365
|
|
299
366
|
# Test receiving with multiple threads.
|
300
367
|
def test_multi_thread_receive
|
368
|
+
mn = "test_multi_thread_receive" if @tcndbg
|
369
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
301
370
|
lock = Mutex.new
|
302
371
|
msg_ctr = 0
|
303
372
|
dest = make_destination
|
@@ -334,10 +403,13 @@ class TestConnection < Test::Unit::TestCase
|
|
334
403
|
end
|
335
404
|
assert_equal @max_msgs, msg_ctr
|
336
405
|
checkEmsg(@conn)
|
406
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
337
407
|
end unless RUBY_ENGINE =~ /jruby/
|
338
408
|
|
339
409
|
# Test polling with multiple threads.
|
340
410
|
def test_multi_thread_poll
|
411
|
+
mn = "test_multi_thread_poll" if @tcndbg
|
412
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
341
413
|
#
|
342
414
|
lock = Mutex.new
|
343
415
|
msg_ctr = 0
|
@@ -380,20 +452,26 @@ class TestConnection < Test::Unit::TestCase
|
|
380
452
|
end
|
381
453
|
assert_equal @max_msgs, msg_ctr
|
382
454
|
checkEmsg(@conn)
|
455
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
383
456
|
end unless RUBY_ENGINE =~ /jruby/
|
384
457
|
|
385
458
|
# Test using a nil body.
|
386
459
|
def test_nil_body
|
460
|
+
mn = "test_nil_body" if @tcndbg
|
461
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
387
462
|
dest = make_destination
|
388
463
|
@conn.publish dest, nil
|
389
464
|
conn_subscribe dest
|
390
465
|
msg = @conn.receive
|
391
466
|
assert_equal "", msg.body
|
392
467
|
checkEmsg(@conn)
|
468
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
393
469
|
end
|
394
470
|
|
395
471
|
# Test transaction message sequencing.
|
396
472
|
def test_transaction
|
473
|
+
mn = "test_transaction" if @tcndbg
|
474
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
397
475
|
conn_subscribe make_destination
|
398
476
|
|
399
477
|
@conn.begin "txA"
|
@@ -408,10 +486,13 @@ class TestConnection < Test::Unit::TestCase
|
|
408
486
|
msg = @conn.receive
|
409
487
|
assert_equal "txn message", msg.body
|
410
488
|
checkEmsg(@conn)
|
489
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
411
490
|
end unless ENV['STOMP_ARTEMIS'] # See Artemis docs for 1.3, page 222
|
412
491
|
|
413
492
|
# Test duplicate subscriptions.
|
414
493
|
def test_duplicate_subscription
|
494
|
+
mn = "test_duplicate_subscription" if @tcndbg
|
495
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
415
496
|
@conn.disconnect # not reliable
|
416
497
|
@conn = Stomp::Connection.open(user, passcode, host, port, true) # reliable
|
417
498
|
dest = make_destination
|
@@ -421,18 +502,24 @@ class TestConnection < Test::Unit::TestCase
|
|
421
502
|
conn_subscribe dest
|
422
503
|
end
|
423
504
|
checkEmsg(@conn)
|
505
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
424
506
|
end
|
425
507
|
|
426
508
|
# Test nil 1.1 connection parameters.
|
427
509
|
def test_nil_connparms
|
510
|
+
mn = "test_nil_connparms" if @tcndbg
|
511
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
428
512
|
@conn.disconnect
|
429
513
|
#
|
430
514
|
@conn = Stomp::Connection.open(user, passcode, host, port, false, 5, nil)
|
431
515
|
checkEmsg(@conn)
|
516
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
432
517
|
end
|
433
518
|
|
434
519
|
# Basic NAK test.
|
435
520
|
def test_nack11p_0010
|
521
|
+
mn = "test_nack11p_0010" if @tcndbg
|
522
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
436
523
|
if @conn.protocol == Stomp::SPL_10
|
437
524
|
assert_raise Stomp::Error::UnsupportedProtocolError do
|
438
525
|
@conn.nack "dummy msg-id"
|
@@ -465,6 +552,7 @@ class TestConnection < Test::Unit::TestCase
|
|
465
552
|
msg2 = @conn.receive
|
466
553
|
assert_equal smsg, msg2.body
|
467
554
|
checkEmsg(@conn)
|
555
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
468
556
|
end
|
469
557
|
end unless (ENV['STOMP_AMQ11'] || ENV['STOMP_ARTEMIS'])
|
470
558
|
|
@@ -472,6 +560,8 @@ class TestConnection < Test::Unit::TestCase
|
|
472
560
|
# fail only when connecting to a pure STOMP 1.0 server that does not
|
473
561
|
# return a 'version' header at all.
|
474
562
|
def test_conn10_simple
|
563
|
+
mn = "test_conn10_simple" if @tcndbg
|
564
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
475
565
|
@conn.disconnect
|
476
566
|
#
|
477
567
|
vhost = ENV['STOMP_RABBIT'] ? "/" : host
|
@@ -494,19 +584,25 @@ class TestConnection < Test::Unit::TestCase
|
|
494
584
|
c = nil
|
495
585
|
c = Stomp::Connection.new(hash)
|
496
586
|
c.disconnect if c
|
587
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
497
588
|
end
|
498
589
|
|
499
590
|
# test JRuby detection
|
500
591
|
def test_jruby_presence
|
592
|
+
mn = "test_jruby_presence" if @tcndbg
|
593
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
501
594
|
if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
|
502
595
|
assert @conn.jruby
|
503
596
|
else
|
504
597
|
assert !@conn.jruby
|
505
598
|
end
|
599
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
506
600
|
end
|
507
601
|
|
508
602
|
# Test that methods detect an empty header key.
|
509
603
|
def test_empty_header_key
|
604
|
+
mn = "test_empty_header_key" if @tcndbg
|
605
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
510
606
|
#
|
511
607
|
bad_headers = {"a" => "11", "" => "emptykey", :c => "ccc"}
|
512
608
|
#
|
@@ -545,11 +641,14 @@ class TestConnection < Test::Unit::TestCase
|
|
545
641
|
assert_raise Stomp::Error::ProtocolErrorEmptyHeaderKey do
|
546
642
|
@conn.disconnect(bad_headers)
|
547
643
|
end
|
644
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
548
645
|
end
|
549
646
|
|
550
647
|
# Test that methods detect an empty header value.
|
551
648
|
# STOMP 1.0 only.
|
552
649
|
def test_empty_header_value
|
650
|
+
mn = "test_empty_header_value" if @tcndbg
|
651
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
553
652
|
if @conn.protocol != Stomp::SPL_10
|
554
653
|
assert true
|
555
654
|
return
|
@@ -592,10 +691,13 @@ class TestConnection < Test::Unit::TestCase
|
|
592
691
|
assert_raise Stomp::Error::ProtocolErrorEmptyHeaderValue do
|
593
692
|
@conn.disconnect(bad_headers)
|
594
693
|
end
|
694
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
595
695
|
end
|
596
696
|
|
597
697
|
# test issue99, OK values
|
598
698
|
def test_con_iss99_ok
|
699
|
+
mn = "test_con_iss99_ok" if @tcndbg
|
700
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
599
701
|
return unless host() == "localhost" && port() == 61613
|
600
702
|
#
|
601
703
|
ok_vals = dflt_data_ok()
|
@@ -603,24 +705,34 @@ class TestConnection < Test::Unit::TestCase
|
|
603
705
|
conn = Stomp::Connection.new(hsv)
|
604
706
|
conn.disconnect
|
605
707
|
end
|
708
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
606
709
|
end
|
607
710
|
|
608
711
|
def test_conn_nodest_sub
|
712
|
+
mn = "test_conn_nodest_sub" if @tcndbg
|
713
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
609
714
|
assert_raise Stomp::Error::DestinationRequired do
|
610
715
|
@conn.subscribe(nil)
|
611
716
|
end
|
717
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
612
718
|
end
|
613
719
|
|
614
720
|
def test_conn_nodest_unsub
|
721
|
+
mn = "test_conn_nodest_unsub" if @tcndbg
|
722
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
615
723
|
assert_raise Stomp::Error::DestinationRequired do
|
616
724
|
@conn.unsubscribe(nil)
|
617
725
|
end
|
726
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
618
727
|
end
|
619
728
|
|
620
729
|
def test_conn_nodest_pub
|
730
|
+
mn = "test_conn_nodest_pub" if @tcndbg
|
731
|
+
p [ "01", mn, "starts" ] if @tcndbg
|
621
732
|
assert_raise Stomp::Error::DestinationRequired do
|
622
733
|
@conn.publish(nil, "msg")
|
623
734
|
end
|
735
|
+
p [ "99", mn, "ends" ] if @tcndbg
|
624
736
|
end
|
625
737
|
|
626
738
|
end
|