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_connection1p.rb
CHANGED
@@ -17,6 +17,7 @@ class TestConnection1P < Test::Unit::TestCase
|
|
17
17
|
|
18
18
|
def setup
|
19
19
|
@conn = get_connection()
|
20
|
+
@tc1dbg = ENV['TC1DBG'] ? true : false
|
20
21
|
end
|
21
22
|
|
22
23
|
def teardown
|
@@ -25,11 +26,17 @@ class TestConnection1P < Test::Unit::TestCase
|
|
25
26
|
|
26
27
|
# Test basic connection open.
|
27
28
|
def test_conn_1p_0000
|
29
|
+
mn = "test_conn_1p_0000" if @tc1dbg
|
30
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
28
31
|
assert @conn.open?
|
32
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
29
33
|
end
|
30
34
|
|
31
35
|
# Test missing connect headers - part 1.
|
32
36
|
def test_conn_1p_0010
|
37
|
+
mn = "test_conn_1p_0010" if @tc1dbg
|
38
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
39
|
+
|
33
40
|
@conn.disconnect
|
34
41
|
#
|
35
42
|
cha = {:host => "localhost"}
|
@@ -40,11 +47,15 @@ class TestConnection1P < Test::Unit::TestCase
|
|
40
47
|
chb = {"accept-version" => "1.0"}
|
41
48
|
assert_raise Stomp::Error::ProtocolErrorConnect do
|
42
49
|
_ = Stomp::Connection.open(user, passcode, host, port, false, 5, chb)
|
43
|
-
end
|
50
|
+
end
|
51
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
44
52
|
end
|
45
53
|
|
46
54
|
# Test missing connect headers - part 2.
|
47
55
|
def test_conn_1p_0015
|
56
|
+
mn = "test_conn_1p_0015" if @tc1dbg
|
57
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
58
|
+
|
48
59
|
@conn.disconnect
|
49
60
|
#
|
50
61
|
cha = {:host => "localhost"}
|
@@ -68,10 +79,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
68
79
|
assert_raise Stomp::Error::ProtocolErrorConnect do
|
69
80
|
_ = Stomp::Connection.open(hash)
|
70
81
|
end
|
82
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
71
83
|
end
|
72
84
|
|
73
85
|
# Test requesting only a 1.0 connection.
|
74
86
|
def test_conn_1p_0020
|
87
|
+
mn = "test_conn_1p_0020" if @tc1dbg
|
88
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
89
|
+
|
75
90
|
@conn.disconnect
|
76
91
|
#
|
77
92
|
cha = {:host => "localhost", "accept-version" => "1.0"}
|
@@ -80,10 +95,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
80
95
|
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
81
96
|
conn.disconnect
|
82
97
|
assert_equal conn.protocol, Stomp::SPL_10
|
98
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
83
99
|
end
|
84
100
|
|
85
101
|
# Test requesting only a 1.1+ connection.
|
86
102
|
def test_conn_1p_0030
|
103
|
+
mn = "test_conn_1p_0030" if @tc1dbg
|
104
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
105
|
+
|
87
106
|
@conn.disconnect
|
88
107
|
#
|
89
108
|
cha = get_conn_headers()
|
@@ -91,10 +110,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
91
110
|
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
92
111
|
conn.disconnect
|
93
112
|
assert conn.protocol >= Stomp::SPL_11
|
113
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
94
114
|
end
|
95
115
|
|
96
116
|
# Test basic request for no heartbeats.
|
97
117
|
def test_conn_1p_0040
|
118
|
+
mn = "test_conn_1p_0040" if @tc1dbg
|
119
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
120
|
+
|
98
121
|
@conn.disconnect
|
99
122
|
#
|
100
123
|
cha = get_conn_headers()
|
@@ -103,10 +126,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
103
126
|
conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
104
127
|
conn.disconnect
|
105
128
|
assert conn.protocol >= Stomp::SPL_11
|
129
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
106
130
|
end
|
107
131
|
|
108
132
|
# Test malformed heartbeat header.
|
109
133
|
def test_conn_1p_0050
|
134
|
+
mn = "test_conn_1p_0050" if @tc1dbg
|
135
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
136
|
+
|
110
137
|
@conn.disconnect
|
111
138
|
#
|
112
139
|
cha = get_conn_headers()
|
@@ -114,10 +141,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
114
141
|
assert_raise Stomp::Error::InvalidHeartBeatHeaderError do
|
115
142
|
_ = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
116
143
|
end
|
144
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
117
145
|
end
|
118
146
|
|
119
147
|
# Test malformed heartbeat header.
|
120
148
|
def test_conn_11h_0060
|
149
|
+
mn = "test_conn_1p_0060" if @tc1dbg
|
150
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
151
|
+
|
121
152
|
@conn.disconnect
|
122
153
|
#
|
123
154
|
cha = get_conn_headers()
|
@@ -125,10 +156,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
125
156
|
assert_raise Stomp::Error::InvalidHeartBeatHeaderError do
|
126
157
|
_ = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
|
127
158
|
end
|
159
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
128
160
|
end
|
129
161
|
|
130
162
|
# Test a valid heartbeat header.
|
131
163
|
def test_conn_1p_0070
|
164
|
+
mn = "test_conn_1p_0070" if @tc1dbg
|
165
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
166
|
+
|
132
167
|
@conn.disconnect
|
133
168
|
#
|
134
169
|
cha = get_conn_headers()
|
@@ -138,10 +173,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
138
173
|
conn.disconnect
|
139
174
|
assert conn.hbsend_interval > 0
|
140
175
|
assert conn.hbrecv_interval > 0
|
176
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
141
177
|
end
|
142
178
|
|
143
179
|
# Test only sending heartbeats.
|
144
180
|
def test_conn_1p_0080
|
181
|
+
mn = "test_conn_1p_0080" if @tc1dbg
|
182
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
183
|
+
|
145
184
|
@conn.disconnect
|
146
185
|
#
|
147
186
|
cha = get_conn_headers()
|
@@ -154,10 +193,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
154
193
|
conn.set_logger(nil)
|
155
194
|
conn.disconnect
|
156
195
|
hb_asserts_send(conn)
|
196
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
157
197
|
end if ENV['STOMP_HB11LONG']
|
158
198
|
|
159
199
|
# Test only receiving heartbeats.
|
160
200
|
def test_conn_1p_0090
|
201
|
+
mn = "test_conn_1p_0090" if @tc1dbg
|
202
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
203
|
+
|
161
204
|
@conn.disconnect
|
162
205
|
#
|
163
206
|
cha = get_conn_headers()
|
@@ -171,10 +214,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
171
214
|
conn.set_logger(nil)
|
172
215
|
conn.disconnect
|
173
216
|
hb_asserts_recv(conn)
|
217
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
174
218
|
end if ENV['STOMP_HB11LONG']
|
175
219
|
|
176
220
|
# Test sending and receiving heartbeats.
|
177
221
|
def test_conn_1p_0100
|
222
|
+
mn = "test_conn_1p_0100" if @tc1dbg
|
223
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
224
|
+
|
178
225
|
@conn.disconnect
|
179
226
|
#
|
180
227
|
cha = get_conn_headers()
|
@@ -188,10 +235,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
188
235
|
conn.set_logger(nil)
|
189
236
|
conn.disconnect
|
190
237
|
hb_asserts_both(conn)
|
238
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
191
239
|
end if ENV['STOMP_HB11LONG']
|
192
240
|
|
193
241
|
# Test valid UTF8 data.
|
194
242
|
def test_conn_1p_0110
|
243
|
+
mn = "test_conn_1p_0110" if @tc1dbg
|
244
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
245
|
+
|
195
246
|
@conn.disconnect
|
196
247
|
#
|
197
248
|
cha = get_conn_headers()
|
@@ -219,10 +270,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
219
270
|
assert conn.valid_utf8?(string), "good unicode specs 01: #{string}"
|
220
271
|
end
|
221
272
|
conn.disconnect
|
273
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
222
274
|
end
|
223
275
|
|
224
276
|
# Test invalid UTF8 data.
|
225
277
|
def test_conn_1p_0120
|
278
|
+
mn = "test_conn_1p_0120" if @tc1dbg
|
279
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
280
|
+
|
226
281
|
@conn.disconnect
|
227
282
|
#
|
228
283
|
cha = get_conn_headers()
|
@@ -253,11 +308,15 @@ class TestConnection1P < Test::Unit::TestCase
|
|
253
308
|
assert !conn.valid_utf8?(string), "bad unicode specs 01: #{string}"
|
254
309
|
end
|
255
310
|
conn.disconnect
|
311
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
256
312
|
end
|
257
313
|
|
258
314
|
# Repeated headers test. Brokers have a lot of freedom given the verbiage
|
259
315
|
# in the specs.
|
260
316
|
def test_conn_1p_0124
|
317
|
+
mn = "test_conn_1p_0124" if @tc1dbg
|
318
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
319
|
+
|
261
320
|
dest = make_destination
|
262
321
|
msg = "payload: #{Time.now.to_f}"
|
263
322
|
shdrs = { "key1" => "val1", "key2" => "val2",
|
@@ -276,18 +335,26 @@ class TestConnection1P < Test::Unit::TestCase
|
|
276
335
|
end
|
277
336
|
#
|
278
337
|
@conn.unsubscribe dest, :id => sid
|
338
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
279
339
|
end
|
280
340
|
|
281
341
|
# Test frozen headers.
|
282
342
|
def test_conn_1p_0127
|
343
|
+
mn = "test_conn_1p_0127" if @tc1dbg
|
344
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
345
|
+
|
283
346
|
dest = make_destination
|
284
347
|
sid = @conn.uuid()
|
285
348
|
sid.freeze
|
286
349
|
@conn.subscribe dest, :id => sid
|
350
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
287
351
|
end
|
288
352
|
|
289
353
|
# Test heartbeats with send and receive.
|
290
354
|
def test_conn_1p_0130
|
355
|
+
mn = "test_conn_1p_0130" if @tc1dbg
|
356
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
357
|
+
|
291
358
|
@conn.disconnect
|
292
359
|
#
|
293
360
|
cha = get_conn_headers()
|
@@ -301,10 +368,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
301
368
|
conn.set_logger(nil)
|
302
369
|
conn.disconnect
|
303
370
|
hb_asserts_both(conn)
|
371
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
304
372
|
end if ENV['STOMP_HB11LONG']
|
305
373
|
|
306
374
|
# Test heartbeats with send and receive.
|
307
375
|
def test_conn_1p_0135
|
376
|
+
mn = "test_conn_1p_0135" if @tc1dbg
|
377
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
378
|
+
|
308
379
|
@conn.disconnect
|
309
380
|
#
|
310
381
|
cha = get_conn_headers()
|
@@ -318,10 +389,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
318
389
|
conn.set_logger(nil)
|
319
390
|
conn.disconnect
|
320
391
|
hb_asserts_both(conn)
|
392
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
321
393
|
end if ENV['STOMP_HB11LONG']
|
322
394
|
|
323
395
|
# Test heartbeats with send and receive.
|
324
396
|
def test_conn_1p_0140
|
397
|
+
mn = "test_conn_1p_0140" if @tc1dbg
|
398
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
399
|
+
|
325
400
|
@conn.disconnect
|
326
401
|
#
|
327
402
|
cha = get_conn_headers()
|
@@ -335,10 +410,14 @@ class TestConnection1P < Test::Unit::TestCase
|
|
335
410
|
conn.set_logger(nil)
|
336
411
|
conn.disconnect
|
337
412
|
hb_asserts_both(conn)
|
413
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
338
414
|
end if ENV['STOMP_HB11LONG']
|
339
415
|
|
340
416
|
# Test very basic encoding / decoding of headers
|
341
417
|
def test_conn_1p_0200
|
418
|
+
mn = "test_conn_1p_0200" if @tc1dbg
|
419
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
420
|
+
|
342
421
|
@conn.disconnect
|
343
422
|
#
|
344
423
|
cha = get_conn_headers()
|
@@ -363,11 +442,15 @@ class TestConnection1P < Test::Unit::TestCase
|
|
363
442
|
assert received.headers[k] == v, "Mismatch: #{k},#{v}"
|
364
443
|
}
|
365
444
|
conn.disconnect
|
445
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
366
446
|
end unless ENV['STOMP_RABBIT']
|
367
447
|
|
368
448
|
# Test that 1.1+ connections do not break suppress_content_length
|
369
449
|
# (Issue #52)
|
370
450
|
def test_conn_1p_0210
|
451
|
+
mn = "test_conn_1p_0210" if @tc1dbg
|
452
|
+
p [ "01", mn, "starts" ] if @tc1dbg
|
453
|
+
|
371
454
|
msg = "payload: #{Time.now.to_f}"
|
372
455
|
dest = make_destination
|
373
456
|
shdrs = { :suppress_content_length => true }
|
@@ -379,6 +462,7 @@ class TestConnection1P < Test::Unit::TestCase
|
|
379
462
|
received = @conn.receive
|
380
463
|
assert_equal msg, received.body
|
381
464
|
assert_nil received.headers["content-length"], "No content length expected."
|
465
|
+
p [ "99", mn, "ends" ] if @tc1dbg
|
382
466
|
end if ENV['STOMP_AMQ11']
|
383
467
|
|
384
468
|
private
|
data/test/test_helper.rb
CHANGED
data/test/test_message.rb
CHANGED
@@ -37,7 +37,8 @@ class TestMessage < Test::Unit::TestCase
|
|
37
37
|
"bad byte: \372",
|
38
38
|
"\004\b{\f:\tbody\"\001\207\004\b{\b:\016statusmsg\"\aOK:\017statuscodei\000:\tdata{\t:\voutput\"3Enabled, not running, last run 693 seconds ago:\frunningi\000:\fenabledi\006:\flastrunl+\aE\021\022M:\rsenderid\"\032xx.xx.xx.xx:\016requestid\"%849d647bbe3e421ea19ac9f947bbdde4:\020senderagent\"\fpuppetd:\016msgtarget\"%/topic/mcollective.puppetd.reply:\thash\"\001\257ZdQqtaDmmdD0jZinnEcpN+YbkxQDn8uuCnwsQdvGHau6d+gxnnfPLUddWRSb\nZNMs+sQUXgJNfcV1eVBn1H+Z8QQmzYXVDMqz7J43jmgloz5PsLVbN9K3PmX/\ngszqV/WpvIyAqm98ennWqSzpwMuiCC4q2Jr3s3Gm6bUJ6UkKXnY=\n:\fmsgtimel+\a\372\023\022M"
|
39
39
|
]
|
40
|
-
|
40
|
+
#
|
41
|
+
@tmsdbg = ENV['TMSDBG'] ? true : false
|
41
42
|
end
|
42
43
|
|
43
44
|
def teardown
|
@@ -46,6 +47,8 @@ class TestMessage < Test::Unit::TestCase
|
|
46
47
|
|
47
48
|
# Various message bodies, including the failing test case reported
|
48
49
|
def test_0010_kcode
|
50
|
+
mn = "test_0010_kcode" if @tmsdbg
|
51
|
+
p [ "01", mn, "starts" ] if @tmsdbg
|
49
52
|
#
|
50
53
|
dest = make_destination
|
51
54
|
if @conn.protocol == Stomp::SPL_10
|
@@ -60,10 +63,14 @@ class TestMessage < Test::Unit::TestCase
|
|
60
63
|
assert_instance_of Stomp::Message , msg, "type check for #{abody}"
|
61
64
|
assert_equal abody, msg.body, "equal check for #{abody}"
|
62
65
|
end
|
66
|
+
p [ "99", mn, "ends" ] if @tmsdbg
|
63
67
|
end
|
64
68
|
|
65
69
|
# All possible byte values
|
66
70
|
def test_0020_kcode
|
71
|
+
mn = "test_0020_kcode" if @tmsdbg
|
72
|
+
p [ "01", mn, "starts" ] if @tmsdbg
|
73
|
+
|
67
74
|
#
|
68
75
|
abody = ""
|
69
76
|
"\000".upto("\377") {|abyte| abody << abyte }
|
@@ -78,11 +85,15 @@ class TestMessage < Test::Unit::TestCase
|
|
78
85
|
@conn.publish dest, abody
|
79
86
|
msg = @conn.receive
|
80
87
|
assert_instance_of Stomp::Message , msg, "type check for #{abody}"
|
81
|
-
|
88
|
+
assert_equal abody, msg.body, "equal check for #{abody}"
|
89
|
+
p [ "99", mn, "ends" ] if @tmsdbg
|
82
90
|
end
|
83
91
|
|
84
92
|
# A single byte at a time
|
85
93
|
def test_0030_kcode
|
94
|
+
mn = "test_0030_kcode" if @tmsdbg
|
95
|
+
p [ "01", mn, "starts" ] if @tmsdbg
|
96
|
+
|
86
97
|
#
|
87
98
|
dest = make_destination
|
88
99
|
if @conn.protocol == Stomp::SPL_10
|
@@ -97,11 +108,15 @@ class TestMessage < Test::Unit::TestCase
|
|
97
108
|
msg = @conn.receive
|
98
109
|
assert_instance_of Stomp::Message , msg, "type check for #{abody}"
|
99
110
|
assert_equal abody, msg.body, "equal check for #{abody}"
|
100
|
-
|
111
|
+
end
|
112
|
+
p [ "99", mn, "ends" ] if @tmsdbg
|
101
113
|
end
|
102
114
|
|
103
115
|
# Test various valid and invalid frames.
|
104
|
-
|
116
|
+
def test_0040_msg_create
|
117
|
+
mn = "test_0040_msg_create" if @tmsdbg
|
118
|
+
p [ "01", mn, "starts" ] if @tmsdbg
|
119
|
+
|
105
120
|
#
|
106
121
|
assert_raise(Stomp::Error::InvalidFormat) {
|
107
122
|
_ = Stomp::Message.new("junk", false)
|
@@ -130,10 +145,14 @@ class TestMessage < Test::Unit::TestCase
|
|
130
145
|
_ = Stomp::Message.new("RECEIPT\nh1:val1\n\njunk\0\n", false)
|
131
146
|
_ = Stomp::Message.new("ERROR\nh1:val1\n\njunk\0\n", false)
|
132
147
|
|
148
|
+
p [ "99", mn, "ends" ] if @tmsdbg
|
133
149
|
end
|
134
150
|
|
135
151
|
# Test multiple headers with the same key
|
136
152
|
def test_0050_mh_msg_create
|
153
|
+
mn = "test_0050_mh_msg_create" if @tmsdbg
|
154
|
+
p [ "01", mn, "starts" ] if @tmsdbg
|
155
|
+
|
137
156
|
aframe = bframe = nil
|
138
157
|
amsg = "MESSAGE\n" +
|
139
158
|
"h1:val1\n" +
|
@@ -155,10 +174,14 @@ class TestMessage < Test::Unit::TestCase
|
|
155
174
|
assert_equal "val3", bframe.headers["h2"][0], "Expected val3"
|
156
175
|
assert_equal "val2", bframe.headers["h2"][1], "Expected val2"
|
157
176
|
assert_equal "val1", bframe.headers["h2"][2], "Expected val1"
|
177
|
+
p [ "99", mn, "ends" ] if @tmsdbg
|
158
178
|
end
|
159
179
|
|
160
180
|
# Test headers with empty key / value
|
161
181
|
def test_0060_hdr_ekv
|
182
|
+
mn = "test_0060_hdr_ekv" if @tmsdbg
|
183
|
+
p [ "01", mn, "starts" ] if @tmsdbg
|
184
|
+
|
162
185
|
#
|
163
186
|
amsg = "MESSAGE\n" +
|
164
187
|
"h1:val1\n" +
|
@@ -185,6 +208,7 @@ class TestMessage < Test::Unit::TestCase
|
|
185
208
|
_ = Stomp::Message.new(amsg, false)
|
186
209
|
end
|
187
210
|
_ = Stomp::Message.new(amsg, true)
|
211
|
+
p [ "99", mn, "ends" ] if @tmsdbg
|
188
212
|
end
|
189
213
|
|
190
214
|
end
|
data/test/test_ssl.rb
CHANGED
@@ -17,6 +17,7 @@ class TestSSL < Test::Unit::TestCase
|
|
17
17
|
|
18
18
|
def setup
|
19
19
|
@conn = get_ssl_connection()
|
20
|
+
@tssdbg = ENV['TSSDBG'] ? true : false
|
20
21
|
end
|
21
22
|
|
22
23
|
def teardown
|
@@ -24,38 +25,56 @@ class TestSSL < Test::Unit::TestCase
|
|
24
25
|
end
|
25
26
|
#
|
26
27
|
def test_ssl_0000
|
28
|
+
mn = "test_ssl_0000" if @tssdbg
|
29
|
+
p [ "01", mn, "starts" ] if @tssdbg
|
27
30
|
assert @conn.open?
|
31
|
+
p [ "99", mn, "ends" ] if @tssdbg
|
28
32
|
end
|
29
33
|
|
30
34
|
# Test SSLParams basic.
|
31
35
|
def test_ssl_0010_parms
|
36
|
+
mn = "test_ssl_0010_parms" if @tssdbg
|
37
|
+
p [ "01", mn, "starts" ] if @tssdbg
|
38
|
+
|
32
39
|
ssl_params = Stomp::SSLParams.new
|
33
40
|
assert ssl_params.ts_files.nil?
|
34
41
|
assert ssl_params.cert_file.nil?
|
35
42
|
assert ssl_params.key_file.nil?
|
36
43
|
assert ssl_params.fsck.nil?
|
44
|
+
p [ "99", mn, "ends" ] if @tssdbg
|
37
45
|
end
|
38
46
|
|
39
47
|
# Test using correct parameters.
|
40
48
|
def test_ssl_0020_noraise
|
49
|
+
mn = "test_ssl_0020_noraise" if @tssdbg
|
50
|
+
p [ "01", mn, "starts" ] if @tssdbg
|
51
|
+
|
41
52
|
_ = Stomp::SSLParams.new(:cert_file => "dummy1", :key_file => "dummy2")
|
42
53
|
_ = Stomp::SSLParams.new(:ts_files => "dummyts1")
|
43
54
|
_ = Stomp::SSLParams.new(:ts_files => "dummyts1",
|
44
55
|
:cert_file => "dummy1", :key_file => "dummy2")
|
56
|
+
p [ "99", mn, "ends" ] if @tssdbg
|
45
57
|
end
|
46
58
|
|
47
59
|
# Test using incorrect / incomplete parameters.
|
48
60
|
def test_ssl_0030_raise
|
61
|
+
mn = "test_ssl_0030_raise" if @tssdbg
|
62
|
+
p [ "01", mn, "starts" ] if @tssdbg
|
63
|
+
|
49
64
|
assert_raise(Stomp::Error::SSLClientParamsError) {
|
50
65
|
_ = Stomp::SSLParams.new(:cert_file => "dummy1")
|
51
66
|
}
|
52
67
|
assert_raise(Stomp::Error::SSLClientParamsError) {
|
53
68
|
_ = Stomp::SSLParams.new(:key_file => "dummy2")
|
54
69
|
}
|
70
|
+
p [ "99", mn, "ends" ] if @tssdbg
|
55
71
|
end
|
56
72
|
|
57
73
|
# Test that :fsck works.
|
58
74
|
def test_ssl_0040_fsck
|
75
|
+
mn = "test_ssl_0040_fsck" if @tssdbg
|
76
|
+
p [ "01", mn, "starts" ] if @tssdbg
|
77
|
+
|
59
78
|
assert_raise(Stomp::Error::SSLNoCertFileError) {
|
60
79
|
_ = Stomp::SSLParams.new(:cert_file => "dummy1",
|
61
80
|
:key_file => "dummy2", :fsck => true)
|
@@ -68,6 +87,7 @@ class TestSSL < Test::Unit::TestCase
|
|
68
87
|
_ = Stomp::SSLParams.new(:ts_files => "/tmp/not-likely-here.txt",
|
69
88
|
:fsck => true)
|
70
89
|
}
|
90
|
+
p [ "99", mn, "ends" ] if @tssdbg
|
71
91
|
end
|
72
92
|
|
73
93
|
#
|