stomp 1.4.3 → 1.4.4
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 +10 -0
- data/README.md +46 -3
- data/examples/artemis/artlogger.rb +41 -0
- data/examples/artemis/cliwaiter_not_reliable.rb +66 -0
- data/examples/artemis/cliwaiter_reliable.rb +61 -0
- data/examples/contrib.sh +2 -2
- data/examples/examplogger.rb +5 -3
- data/examples/ssl_uc1.rb +4 -2
- data/lib/client/utils.rb +10 -7
- data/lib/connection/heartbeats.rb +13 -11
- data/lib/connection/netio.rb +47 -14
- data/lib/connection/utils.rb +15 -5
- data/lib/stomp/client.rb +13 -6
- data/lib/stomp/connection.rb +10 -6
- data/lib/stomp/constants.rb +6 -4
- data/lib/stomp/errors.rb +25 -2
- data/lib/stomp/version.rb +4 -4
- data/spec/client_spec.rb +33 -18
- data/spec/spec_helper.rb +1 -0
- data/stomp.gemspec +21 -17
- data/test/MultiBrokerUnitTestExample.sh +65 -0
- data/test/test_anonymous.rb +29 -47
- data/test/test_client.rb +131 -131
- data/test/test_connection.rb +49 -51
- data/test/test_connection1p.rb +45 -76
- data/test/test_helper.rb +15 -2
- data/test/test_message.rb +18 -35
- data/test/test_ssl.rb +4 -10
- data/test/unitst.sh +3 -2
- metadata +7 -3
data/test/test_connection.rb
CHANGED
@@ -33,7 +33,9 @@ class TestConnection < Test::Unit::TestCase
|
|
33
33
|
|
34
34
|
# Test asynchronous polling.
|
35
35
|
def test_poll_async
|
36
|
-
|
36
|
+
sq = ENV['STOMP_ARTEMIS'] ? "jms.queue.queue.do.not.put.messages.on.this.queue" :
|
37
|
+
"/queue/do.not.put.messages.on.this.queue"
|
38
|
+
@conn.subscribe(sq, :id => "a.no.messages.queue")
|
37
39
|
# If the test 'hangs' here, Connection#poll is broken.
|
38
40
|
m = @conn.poll
|
39
41
|
assert m.nil?
|
@@ -74,11 +76,9 @@ class TestConnection < Test::Unit::TestCase
|
|
74
76
|
# Test asking for a receipt on disconnect.
|
75
77
|
def test_disconnect_receipt
|
76
78
|
@conn.disconnect :receipt => "abc123"
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
"abc123", "receipt sent and received should match")
|
81
|
-
}
|
79
|
+
assert_not_nil(@conn.disconnect_receipt, "should have a receipt")
|
80
|
+
assert_equal(@conn.disconnect_receipt.headers['receipt-id'],
|
81
|
+
"abc123", "receipt sent and received should match")
|
82
82
|
end
|
83
83
|
|
84
84
|
# Test ACKs for Stomp 1.0
|
@@ -91,11 +91,9 @@ class TestConnection < Test::Unit::TestCase
|
|
91
91
|
@conn.subscribe queue, :ack => :client
|
92
92
|
@conn.publish queue, "test_stomp#test_client_ack_with_symbol_10"
|
93
93
|
msg = @conn.receive
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
@conn.ack msg.headers['message-id']
|
98
|
-
}
|
94
|
+
# ACK has one required header, message-id, which must contain a value
|
95
|
+
# matching the message-id for the MESSAGE being acknowledged.
|
96
|
+
@conn.ack msg.headers['message-id']
|
99
97
|
checkEmsg(@conn)
|
100
98
|
end
|
101
99
|
|
@@ -110,13 +108,11 @@ class TestConnection < Test::Unit::TestCase
|
|
110
108
|
@conn.subscribe queue, :ack => :client, :id => sid
|
111
109
|
@conn.publish queue, "test_stomp#test_client_ack_with_symbol_11"
|
112
110
|
msg = @conn.receive
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
@conn.ack msg.headers['message-id'], :subscription => msg.headers['subscription']
|
119
|
-
}
|
111
|
+
# ACK has two REQUIRED headers: message-id, which MUST contain a value
|
112
|
+
# matching the message-id for the MESSAGE being acknowledged and
|
113
|
+
# subscription, which MUST be set to match the value of the subscription's
|
114
|
+
# id header.
|
115
|
+
@conn.ack msg.headers['message-id'], :subscription => msg.headers['subscription']
|
120
116
|
checkEmsg(@conn)
|
121
117
|
end
|
122
118
|
|
@@ -131,11 +127,9 @@ class TestConnection < Test::Unit::TestCase
|
|
131
127
|
@conn.subscribe queue, :ack => :client, :id => sid
|
132
128
|
@conn.publish queue, "test_stomp#test_client_ack_with_symbol_11"
|
133
129
|
msg = @conn.receive
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
@conn.ack msg.headers['ack']
|
138
|
-
}
|
130
|
+
# The ACK frame MUST include an id header matching the ack header
|
131
|
+
# of the MESSAGE being acknowledged.
|
132
|
+
@conn.ack msg.headers['ack']
|
139
133
|
checkEmsg(@conn)
|
140
134
|
end
|
141
135
|
|
@@ -387,9 +381,7 @@ class TestConnection < Test::Unit::TestCase
|
|
387
381
|
# Test using a nil body.
|
388
382
|
def test_nil_body
|
389
383
|
dest = make_destination
|
390
|
-
|
391
|
-
@conn.publish dest, nil
|
392
|
-
}
|
384
|
+
@conn.publish dest, nil
|
393
385
|
conn_subscribe dest
|
394
386
|
msg = @conn.receive
|
395
387
|
assert_equal "", msg.body
|
@@ -412,7 +404,7 @@ class TestConnection < Test::Unit::TestCase
|
|
412
404
|
msg = @conn.receive
|
413
405
|
assert_equal "txn message", msg.body
|
414
406
|
checkEmsg(@conn)
|
415
|
-
end
|
407
|
+
end unless ENV['STOMP_ARTEMIS'] # See Artemis docs for 1.3, page 222
|
416
408
|
|
417
409
|
# Test duplicate subscriptions.
|
418
410
|
def test_duplicate_subscription
|
@@ -431,9 +423,7 @@ class TestConnection < Test::Unit::TestCase
|
|
431
423
|
def test_nil_connparms
|
432
424
|
@conn.disconnect
|
433
425
|
#
|
434
|
-
|
435
|
-
@conn = Stomp::Connection.open(user, passcode, host, port, false, 5, nil)
|
436
|
-
end
|
426
|
+
@conn = Stomp::Connection.open(user, passcode, host, port, false, 5, nil)
|
437
427
|
checkEmsg(@conn)
|
438
428
|
end
|
439
429
|
|
@@ -454,17 +444,13 @@ class TestConnection < Test::Unit::TestCase
|
|
454
444
|
assert_equal smsg, msg.body
|
455
445
|
case @conn.protocol
|
456
446
|
when Stomp::SPL_12
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
@conn.unsubscribe dest, :id => sid
|
461
|
-
}
|
447
|
+
@conn.nack msg.headers["ack"]
|
448
|
+
sleep 0.05 # Give racy brokers a chance to handle the last nack before unsubscribe
|
449
|
+
@conn.unsubscribe dest, :id => sid
|
462
450
|
else # Stomp::SPL_11
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
@conn.unsubscribe dest, :id => sid
|
467
|
-
}
|
451
|
+
@conn.nack msg.headers["message-id"], :subscription => sid
|
452
|
+
sleep 0.05 # Give racy brokers a chance to handle the last nack before unsubscribe
|
453
|
+
@conn.unsubscribe dest, :id => sid
|
468
454
|
end
|
469
455
|
|
470
456
|
# phase 2
|
@@ -476,7 +462,7 @@ class TestConnection < Test::Unit::TestCase
|
|
476
462
|
assert_equal smsg, msg2.body
|
477
463
|
checkEmsg(@conn)
|
478
464
|
end
|
479
|
-
end unless ENV['STOMP_AMQ11']
|
465
|
+
end unless (ENV['STOMP_AMQ11'] || ENV['STOMP_ARTEMIS'])
|
480
466
|
|
481
467
|
# Test to illustrate Issue #44. Prior to a fix for #44, these tests would
|
482
468
|
# fail only when connecting to a pure STOMP 1.0 server that does not
|
@@ -492,9 +478,7 @@ class TestConnection < Test::Unit::TestCase
|
|
492
478
|
:reliable => false,
|
493
479
|
}
|
494
480
|
c = nil
|
495
|
-
|
496
|
-
c = Stomp::Connection.new(hash)
|
497
|
-
}
|
481
|
+
c = Stomp::Connection.new(hash)
|
498
482
|
c.disconnect if c
|
499
483
|
#
|
500
484
|
hash = { :hosts => [
|
@@ -504,9 +488,7 @@ class TestConnection < Test::Unit::TestCase
|
|
504
488
|
:reliable => false,
|
505
489
|
}
|
506
490
|
c = nil
|
507
|
-
|
508
|
-
c = Stomp::Connection.new(hash)
|
509
|
-
}
|
491
|
+
c = Stomp::Connection.new(hash)
|
510
492
|
c.disconnect if c
|
511
493
|
end
|
512
494
|
|
@@ -614,10 +596,26 @@ class TestConnection < Test::Unit::TestCase
|
|
614
596
|
#
|
615
597
|
ok_vals = dflt_data_ok()
|
616
598
|
ok_vals.each do |hsv|
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
599
|
+
conn = Stomp::Connection.new(hsv)
|
600
|
+
conn.disconnect
|
601
|
+
end
|
602
|
+
end
|
603
|
+
|
604
|
+
def test_conn_nodest_sub
|
605
|
+
assert_raise Stomp::Error::DestinationRequired do
|
606
|
+
@conn.subscribe(nil)
|
607
|
+
end
|
608
|
+
end
|
609
|
+
|
610
|
+
def test_conn_nodest_unsub
|
611
|
+
assert_raise Stomp::Error::DestinationRequired do
|
612
|
+
@conn.unsubscribe(nil)
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
def test_conn_nodest_pub
|
617
|
+
assert_raise Stomp::Error::DestinationRequired do
|
618
|
+
@conn.publish(nil, "msg")
|
621
619
|
end
|
622
620
|
end
|
623
621
|
|
data/test/test_connection1p.rb
CHANGED
@@ -77,10 +77,8 @@ class TestConnection1P < Test::Unit::TestCase
|
|
77
77
|
cha = {:host => "localhost", "accept-version" => "1.0"}
|
78
78
|
cha[:host] = "/" if ENV['STOMP_RABBIT']
|
79
79
|
conn = nil
|
80
|
-
|
81
|
-
|
82
|
-
conn.disconnect
|
83
|
-
end
|
80
|
+
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
81
|
+
conn.disconnect
|
84
82
|
assert_equal conn.protocol, Stomp::SPL_10
|
85
83
|
end
|
86
84
|
|
@@ -90,10 +88,8 @@ class TestConnection1P < Test::Unit::TestCase
|
|
90
88
|
#
|
91
89
|
cha = get_conn_headers()
|
92
90
|
conn = nil
|
93
|
-
|
94
|
-
|
95
|
-
conn.disconnect
|
96
|
-
end
|
91
|
+
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
92
|
+
conn.disconnect
|
97
93
|
assert conn.protocol >= Stomp::SPL_11
|
98
94
|
end
|
99
95
|
|
@@ -104,10 +100,8 @@ class TestConnection1P < Test::Unit::TestCase
|
|
104
100
|
cha = get_conn_headers()
|
105
101
|
cha["heart-beat"] = "0,0" # No heartbeats
|
106
102
|
conn = nil
|
107
|
-
|
108
|
-
|
109
|
-
conn.disconnect
|
110
|
-
end
|
103
|
+
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
104
|
+
conn.disconnect
|
111
105
|
assert conn.protocol >= Stomp::SPL_11
|
112
106
|
end
|
113
107
|
|
@@ -142,10 +136,8 @@ class TestConnection1P < Test::Unit::TestCase
|
|
142
136
|
cha = get_conn_headers()
|
143
137
|
cha["heart-beat"] = "500,1000" # Valid heart beat headers
|
144
138
|
conn = nil
|
145
|
-
|
146
|
-
|
147
|
-
conn.disconnect
|
148
|
-
end
|
139
|
+
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
140
|
+
conn.disconnect
|
149
141
|
assert conn.hbsend_interval > 0
|
150
142
|
assert conn.hbrecv_interval > 0
|
151
143
|
end
|
@@ -158,13 +150,11 @@ class TestConnection1P < Test::Unit::TestCase
|
|
158
150
|
cha["heart-beat"] = "10000,0" # Valid heart beat headers, send only
|
159
151
|
conn = nil
|
160
152
|
logger = Tlogger.new
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
conn.disconnect
|
167
|
-
end
|
153
|
+
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
154
|
+
conn.set_logger(logger)
|
155
|
+
sleep 65
|
156
|
+
conn.set_logger(nil)
|
157
|
+
conn.disconnect
|
168
158
|
hb_asserts_send(conn)
|
169
159
|
end if ENV['STOMP_HB11LONG']
|
170
160
|
|
@@ -176,14 +166,12 @@ class TestConnection1P < Test::Unit::TestCase
|
|
176
166
|
cha["heart-beat"] = "0,6000" # Valid heart beat headers, receive only
|
177
167
|
conn = nil
|
178
168
|
logger = Tlogger.new
|
179
|
-
|
180
|
-
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
169
|
+
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
181
170
|
# m = conn.receive # This will hang forever .....
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
end
|
171
|
+
conn.set_logger(logger)
|
172
|
+
sleep 65
|
173
|
+
conn.set_logger(nil)
|
174
|
+
conn.disconnect
|
187
175
|
hb_asserts_recv(conn)
|
188
176
|
end if ENV['STOMP_HB11LONG']
|
189
177
|
|
@@ -195,14 +183,12 @@ class TestConnection1P < Test::Unit::TestCase
|
|
195
183
|
cha["heart-beat"] = "5000,10000" # Valid heart beat headers, send and receive
|
196
184
|
conn = nil
|
197
185
|
logger = Tlogger.new
|
198
|
-
|
199
|
-
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
186
|
+
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
200
187
|
# m = conn.receive # This will hang forever .....
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
end
|
188
|
+
conn.set_logger(logger)
|
189
|
+
sleep 65
|
190
|
+
conn.set_logger(nil)
|
191
|
+
conn.disconnect
|
206
192
|
hb_asserts_both(conn)
|
207
193
|
end if ENV['STOMP_HB11LONG']
|
208
194
|
|
@@ -271,19 +257,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
271
257
|
conn.disconnect
|
272
258
|
end
|
273
259
|
|
274
|
-
# Repeated headers test.
|
275
|
-
#
|
276
|
-
# - RabbitMQ does not emit repeated headers under any circumstances
|
277
|
-
# - AMQ 5.6 does not emit repeated headers under any circumstances
|
278
|
-
# Pure luck that this runs against AMQ at present.
|
260
|
+
# Repeated headers test. Brokers have a lot of freedom given the verbiage
|
261
|
+
# in the specs.
|
279
262
|
def test_conn_1p_0124
|
280
263
|
dest = make_destination
|
281
264
|
msg = "payload: #{Time.now.to_f}"
|
282
265
|
shdrs = { "key1" => "val1", "key2" => "val2",
|
283
266
|
"key3" => ["kv3", "kv2", "kv1"] }
|
284
|
-
|
285
|
-
@conn.publish dest, msg, shdrs
|
286
|
-
}
|
267
|
+
@conn.publish dest, msg, shdrs
|
287
268
|
#
|
288
269
|
sid = @conn.uuid()
|
289
270
|
@conn.subscribe dest, :id => sid
|
@@ -291,7 +272,7 @@ class TestConnection1P < Test::Unit::TestCase
|
|
291
272
|
received = @conn.receive
|
292
273
|
assert_equal msg, received.body
|
293
274
|
if @conn.protocol != Stomp::SPL_10
|
294
|
-
assert_equal shdrs["key3"], received.headers["key3"] unless ENV['STOMP_RABBIT'] || ENV['STOMP_AMQ11']
|
275
|
+
assert_equal shdrs["key3"], received.headers["key3"] unless ENV['STOMP_RABBIT'] || ENV['STOMP_AMQ11'] || ENV['STOMP_ARTEMIS']
|
295
276
|
else
|
296
277
|
assert_equal "kv3", received.headers["key3"]
|
297
278
|
end
|
@@ -304,9 +285,7 @@ class TestConnection1P < Test::Unit::TestCase
|
|
304
285
|
dest = make_destination
|
305
286
|
sid = @conn.uuid()
|
306
287
|
sid.freeze
|
307
|
-
|
308
|
-
@conn.subscribe dest, :id => sid
|
309
|
-
}
|
288
|
+
@conn.subscribe dest, :id => sid
|
310
289
|
end
|
311
290
|
|
312
291
|
# Test heartbeats with send and receive.
|
@@ -317,14 +296,12 @@ class TestConnection1P < Test::Unit::TestCase
|
|
317
296
|
cha["heart-beat"] = "10000,6000" # Valid heart beat headers, send and receive
|
318
297
|
conn = nil
|
319
298
|
logger = Tlogger.new
|
320
|
-
|
321
|
-
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
299
|
+
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
322
300
|
# m = conn.receive # This will hang forever .....
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
end
|
301
|
+
conn.set_logger(logger)
|
302
|
+
sleep 65
|
303
|
+
conn.set_logger(nil)
|
304
|
+
conn.disconnect
|
328
305
|
hb_asserts_both(conn)
|
329
306
|
end if ENV['STOMP_HB11LONG']
|
330
307
|
|
@@ -336,14 +313,12 @@ class TestConnection1P < Test::Unit::TestCase
|
|
336
313
|
cha["heart-beat"] = "10000,1000" # Valid heart beat headers, send and receive
|
337
314
|
conn = nil
|
338
315
|
logger = Tlogger.new
|
339
|
-
|
340
|
-
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
316
|
+
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
341
317
|
# m = conn.receive # This will hang forever .....
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
end
|
318
|
+
conn.set_logger(logger)
|
319
|
+
sleep 65
|
320
|
+
conn.set_logger(nil)
|
321
|
+
conn.disconnect
|
347
322
|
hb_asserts_both(conn)
|
348
323
|
end if ENV['STOMP_HB11LONG']
|
349
324
|
|
@@ -355,14 +330,12 @@ class TestConnection1P < Test::Unit::TestCase
|
|
355
330
|
cha["heart-beat"] = "1000,10000" # Valid heart beat headers, send and receive
|
356
331
|
conn = nil
|
357
332
|
logger = Tlogger.new
|
358
|
-
|
359
|
-
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
333
|
+
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
360
334
|
# m = conn.receive # This will hang forever .....
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
end
|
335
|
+
conn.set_logger(logger)
|
336
|
+
sleep 65
|
337
|
+
conn.set_logger(nil)
|
338
|
+
conn.disconnect
|
366
339
|
hb_asserts_both(conn)
|
367
340
|
end if ENV['STOMP_HB11LONG']
|
368
341
|
|
@@ -378,9 +351,7 @@ class TestConnection1P < Test::Unit::TestCase
|
|
378
351
|
if conn.protocol >= Stomp::SPL_12
|
379
352
|
shdrs["bb\rcc"] = "dd\ree"
|
380
353
|
end
|
381
|
-
|
382
|
-
conn.publish dest, msg, shdrs
|
383
|
-
}
|
354
|
+
conn.publish dest, msg, shdrs
|
384
355
|
#
|
385
356
|
sid = conn.uuid()
|
386
357
|
conn.subscribe dest, :id => sid
|
@@ -402,9 +373,7 @@ class TestConnection1P < Test::Unit::TestCase
|
|
402
373
|
msg = "payload: #{Time.now.to_f}"
|
403
374
|
dest = make_destination
|
404
375
|
shdrs = { :suppress_content_length => true }
|
405
|
-
|
406
|
-
@conn.publish dest, msg, shdrs
|
407
|
-
}
|
376
|
+
@conn.publish dest, msg, shdrs
|
408
377
|
#
|
409
378
|
sid = @conn.uuid()
|
410
379
|
@conn.subscribe dest, :id => sid
|
data/test/test_helper.rb
CHANGED
@@ -168,15 +168,28 @@ module TestBase
|
|
168
168
|
# Get a dynamic destination name.
|
169
169
|
def make_destination
|
170
170
|
name = caller_method_name unless name
|
171
|
-
|
171
|
+
case
|
172
|
+
when ENV['STOMP_DOTQUEUE']
|
173
|
+
qname = "/queue/test.ruby.stomp." + name
|
174
|
+
when ENV['STOMP_ARTEMIS']
|
175
|
+
qname = "jms.queue.queue.test.ruby.stomp." + name
|
176
|
+
else
|
177
|
+
qname = "/queue/test/ruby/stomp/" + name
|
178
|
+
end
|
172
179
|
return qname
|
173
180
|
end
|
174
181
|
|
182
|
+
# get DLQ name
|
183
|
+
def make_dlq
|
184
|
+
return "jms.queue.DLQ" if ENV['STOMP_ARTEMIS']
|
185
|
+
"/queue/DLQ"
|
186
|
+
end
|
187
|
+
|
175
188
|
#
|
176
189
|
def checkEmsg(cc)
|
177
190
|
m = cc.poll
|
178
191
|
if m
|
179
|
-
assert m.command != Stomp::CMD_ERROR
|
192
|
+
assert m.command != Stomp::CMD_ERROR, "checkEmsg"
|
180
193
|
end
|
181
194
|
end
|
182
195
|
|
data/test/test_message.rb
CHANGED
@@ -123,44 +123,29 @@ class TestMessage < Test::Unit::TestCase
|
|
123
123
|
_ = Stomp::Message.new("ERROR\nbadheaders\n\njunk\0\n\n", false)
|
124
124
|
}
|
125
125
|
#
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
}
|
133
|
-
#
|
134
|
-
assert_nothing_raised {
|
135
|
-
_ = Stomp::Message.new("MESSAGE\nh2:val2\n\n\0", false)
|
136
|
-
}
|
137
|
-
#
|
138
|
-
assert_nothing_raised {
|
139
|
-
_ = Stomp::Message.new("RECEIPT\nh1:val1\n\njunk\0\n", false)
|
140
|
-
}
|
141
|
-
#
|
142
|
-
assert_nothing_raised {
|
143
|
-
_ = Stomp::Message.new("ERROR\nh1:val1\n\njunk\0\n", false)
|
144
|
-
}
|
126
|
+
|
127
|
+
_ = Stomp::Message.new("CONNECTED\nh1:val1\n\njunk\0\n", false)
|
128
|
+
_ = Stomp::Message.new("MESSAGE\nh1:val1\n\njunk\0\n", false)
|
129
|
+
_ = Stomp::Message.new("MESSAGE\nh2:val2\n\n\0", false)
|
130
|
+
_ = Stomp::Message.new("RECEIPT\nh1:val1\n\njunk\0\n", false)
|
131
|
+
_ = Stomp::Message.new("ERROR\nh1:val1\n\njunk\0\n", false)
|
145
132
|
|
146
133
|
end
|
147
134
|
|
148
135
|
# Test multiple headers with the same key
|
149
136
|
def test_0050_mh_msg_create
|
150
137
|
aframe = bframe = nil
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
bframe = Stomp::Message.new(amsg, true)
|
163
|
-
}
|
138
|
+
amsg = "MESSAGE\n" +
|
139
|
+
"h1:val1\n" +
|
140
|
+
"h2:val3\n" +
|
141
|
+
"h2:val2\n" +
|
142
|
+
"h2:val1\n" +
|
143
|
+
"h3:val1\n" +
|
144
|
+
"\n" +
|
145
|
+
"payload" +
|
146
|
+
"\0\n"
|
147
|
+
aframe = Stomp::Message.new(amsg, false)
|
148
|
+
bframe = Stomp::Message.new(amsg, true)
|
164
149
|
#
|
165
150
|
assert aframe.headers["h2"].is_a?(String), "Expected a String"
|
166
151
|
assert_equal "val3", aframe.headers["h2"], "Expected 1st value"
|
@@ -199,9 +184,7 @@ class TestMessage < Test::Unit::TestCase
|
|
199
184
|
assert_raise Stomp::Error::ProtocolErrorEmptyHeaderValue do
|
200
185
|
_ = Stomp::Message.new(amsg, false)
|
201
186
|
end
|
202
|
-
|
203
|
-
_ = Stomp::Message.new(amsg, true)
|
204
|
-
}
|
187
|
+
_ = Stomp::Message.new(amsg, true)
|
205
188
|
end
|
206
189
|
|
207
190
|
end
|