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.
- 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/lib/connection/utils.rb
CHANGED
@@ -252,6 +252,7 @@ module Stomp
|
|
252
252
|
noiosel = (@ssl || @jruby) ? true : false
|
253
253
|
return _receive(used_socket, connread, noiosel)
|
254
254
|
rescue Stomp::Error::MaxReconnectAttempts
|
255
|
+
@failure = $!
|
255
256
|
unless slog(:on_miscerr, log_params, "Reached MaxReconnectAttempts")
|
256
257
|
$stderr.print "Reached MaxReconnectAttempts\n"
|
257
258
|
end
|
data/lib/stomp/connection.rb
CHANGED
@@ -492,6 +492,7 @@ module Stomp
|
|
492
492
|
super_result = __old_receive()
|
493
493
|
if super_result.nil? && @reliable && !closed?
|
494
494
|
errstr = "connection.receive returning EOF as nil - resetting connection.\n"
|
495
|
+
@failure = nil
|
495
496
|
unless slog(:on_miscerr, log_params, "es_recv: " + errstr)
|
496
497
|
$stderr.print errstr
|
497
498
|
end
|
data/lib/stomp/sslparams.rb
CHANGED
@@ -18,6 +18,12 @@ module Stomp
|
|
18
18
|
# The client private key file.
|
19
19
|
attr_accessor :key_file
|
20
20
|
|
21
|
+
# The client certificate text.
|
22
|
+
attr_accessor :cert_text
|
23
|
+
|
24
|
+
# The client private key text.
|
25
|
+
attr_accessor :key_text
|
26
|
+
|
21
27
|
# The client private key password.
|
22
28
|
attr_accessor :key_password
|
23
29
|
|
@@ -52,12 +58,20 @@ module Stomp
|
|
52
58
|
# or a CSV list of cert file names
|
53
59
|
|
54
60
|
# Client authentication parameters
|
55
|
-
@cert_file = opts[:cert_file] # Client cert
|
56
|
-
@key_file = opts[:key_file] # Client key
|
57
|
-
@
|
61
|
+
@cert_file = opts[:cert_file] # Client cert file
|
62
|
+
@key_file = opts[:key_file] # Client key file
|
63
|
+
@cert_text = opts[:cert_text] # Client cert text
|
64
|
+
@key_text = opts[:key_text] # Client key text
|
65
|
+
@key_password = opts[:key_password] # Client key password
|
58
66
|
#
|
59
|
-
raise Stomp::Error::SSLClientParamsError if
|
60
|
-
raise Stomp::Error::SSLClientParamsError if !@
|
67
|
+
raise Stomp::Error::SSLClientParamsError if !@cert_file.nil? && @key_file.nil? && @key_text.nil?
|
68
|
+
raise Stomp::Error::SSLClientParamsError if !@cert_text.nil? && @key_file.nil? && @key_text.nil?
|
69
|
+
raise Stomp::Error::SSLClientParamsError if !@cert_text.nil? && !@cert_file.nil?
|
70
|
+
|
71
|
+
raise Stomp::Error::SSLClientParamsError if !@key_file.nil? && @cert_file.nil? && @cert_text.nil?
|
72
|
+
raise Stomp::Error::SSLClientParamsError if !@key_text.nil? && @cert_file.nil? && @cert_text.nil?
|
73
|
+
raise Stomp::Error::SSLClientParamsError if !@key_text.nil? && !@key_file.nil?
|
74
|
+
|
61
75
|
#
|
62
76
|
@ciphers = opts[:ciphers]
|
63
77
|
@use_ruby_ciphers = opts[:use_ruby_ciphers] ? opts[:use_ruby_ciphers] : false
|
data/lib/stomp/version.rb
CHANGED
@@ -6,8 +6,10 @@ module Stomp
|
|
6
6
|
module Version #:nodoc: all
|
7
7
|
MAJOR = 1
|
8
8
|
MINOR = 4
|
9
|
-
PATCH =
|
10
|
-
|
11
|
-
STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
|
9
|
+
PATCH = "10"
|
10
|
+
MODLEVEL = ""
|
11
|
+
STRING = "#{MAJOR}.#{MINOR}.#{PATCH}#{MODLEVEL}"
|
12
|
+
# Alternate version string
|
13
|
+
Version = STRING
|
12
14
|
end
|
13
15
|
end
|
data/spec/connection_spec.rb
CHANGED
data/stomp.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: stomp 1.4.
|
5
|
+
# stub: stomp 1.4.10 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "stomp".freeze
|
9
|
-
s.version = "1.4.
|
9
|
+
s.version = "1.4.10"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Brian McCallister".freeze, "Marius Mathiesen".freeze, "Thiago Morello".freeze, "Guy M. Allard".freeze]
|
14
|
-
s.date = "
|
15
|
-
s.description = "Ruby client for the Stomp messaging protocol.
|
14
|
+
s.date = "2020-08-19"
|
15
|
+
s.description = "Ruby client for the Stomp messaging protocol.".freeze
|
16
16
|
s.email = ["brianm@apache.org".freeze, "marius@stones.com".freeze, "morellon@gmail.com".freeze, "allard.guy.m@gmail.com".freeze]
|
17
17
|
s.executables = ["catstomp".freeze, "stompcat".freeze]
|
18
18
|
s.extra_rdoc_files = [
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
]
|
22
22
|
s.files = [
|
23
23
|
"CHANGELOG.md",
|
24
|
+
"CONTRIBUTORS.md",
|
24
25
|
"LICENSE",
|
25
26
|
"README.md",
|
26
27
|
"Rakefile",
|
@@ -42,6 +43,9 @@ Gem::Specification.new do |s|
|
|
42
43
|
"examples/client_conndisc.rb",
|
43
44
|
"examples/client_putget.rb",
|
44
45
|
"examples/conn_conndisc.rb",
|
46
|
+
"examples/conn_get.rb",
|
47
|
+
"examples/conn_put.rb",
|
48
|
+
"examples/conn_put_pace.rb",
|
45
49
|
"examples/conn_putget.rb",
|
46
50
|
"examples/contrib.sh",
|
47
51
|
"examples/contributors.rb",
|
@@ -53,6 +57,7 @@ Gem::Specification.new do |s|
|
|
53
57
|
"examples/logexamp.rb",
|
54
58
|
"examples/putget_file.rb",
|
55
59
|
"examples/putget_rephdrs.rb",
|
60
|
+
"examples/showver.rb",
|
56
61
|
"examples/ssl/SSL.md",
|
57
62
|
"examples/ssl/misc/ssl_ctxoptions.rb",
|
58
63
|
"examples/ssl/misc/ssl_newparm.rb",
|
@@ -63,8 +68,10 @@ Gem::Specification.new do |s|
|
|
63
68
|
"examples/ssl/uc1/ssl_uc1_ciphers.rb",
|
64
69
|
"examples/ssl/uc2/ssl_uc2.rb",
|
65
70
|
"examples/ssl/uc2/ssl_uc2_ciphers.rb",
|
66
|
-
"examples/ssl/uc3/
|
67
|
-
"examples/ssl/uc3/
|
71
|
+
"examples/ssl/uc3/ssl_uc3_from_files.rb",
|
72
|
+
"examples/ssl/uc3/ssl_uc3_from_files_ciphers.rb",
|
73
|
+
"examples/ssl/uc3/ssl_uc3_without_files.rb",
|
74
|
+
"examples/ssl/uc3/ssl_uc3_without_files_ciphers.rb",
|
68
75
|
"examples/ssl/uc4/ssl_uc4.rb",
|
69
76
|
"examples/ssl/uc4/ssl_uc4_ciphers.rb",
|
70
77
|
"examples/stomp_common.rb",
|
data/test/test_anonymous.rb
CHANGED
@@ -20,6 +20,7 @@ class TestAnonymous < Test::Unit::TestCase
|
|
20
20
|
# Data for multi_thread tests
|
21
21
|
@max_threads = 20
|
22
22
|
@max_msgs = 100
|
23
|
+
@tandbg = ENV['TANDBG'] || ENV['TDBGALL'] ? true : false
|
23
24
|
end
|
24
25
|
|
25
26
|
def teardown
|
@@ -28,21 +29,29 @@ class TestAnonymous < Test::Unit::TestCase
|
|
28
29
|
|
29
30
|
# Test basic connection creation.
|
30
31
|
def test_connection_exists
|
32
|
+
mn = "test_connection_exists" if @tandbg
|
33
|
+
p [ "01", mn, "starts" ] if @tandbg
|
31
34
|
assert_not_nil @conn
|
35
|
+
p [ "99", mn, "ends" ] if @tandbg
|
32
36
|
end
|
33
37
|
|
34
38
|
# Test asynchronous polling.
|
35
39
|
def test_poll_async
|
36
|
-
|
37
|
-
|
40
|
+
mn = "test_poll_async" if @tandbg
|
41
|
+
p [ "01", mn, "starts" ] if @tandbg
|
42
|
+
sq = ENV['STOMP_ARTEMIS'] ? "jms.queue.queue.do.not.put.messages.on.this.queue" :
|
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 @tandbg
|
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 @tandbg
|
54
|
+
p [ "01", mn, "starts" ] if @tandbg
|
46
55
|
conn_subscribe make_destination
|
47
56
|
#
|
48
57
|
@conn.publish make_destination, "test_stomp#test_no_length",
|
@@ -55,34 +64,48 @@ class TestAnonymous < 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 @tandbg
|
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 @tandbg
|
73
|
+
p [ "01", mn, "starts" ] if @tandbg
|
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 @tandbg
|
66
79
|
end
|
67
80
|
|
68
81
|
# Test asking for a receipt.
|
69
82
|
def test_receipt
|
83
|
+
mn = "test_receipt" if @tandbg
|
84
|
+
p [ "01", mn, "starts" ] if @tandbg
|
70
85
|
conn_subscribe make_destination, :receipt => "abc"
|
71
86
|
msg = @conn.receive
|
72
|
-
|
87
|
+
tval = msg.headers['receipt-id']
|
88
|
+
tval = msg.headers['receipt-id'][0] if msg.headers['receipt-id'].is_a?(Array)
|
89
|
+
assert_equal "abc", tval
|
73
90
|
checkEmsg(@conn)
|
91
|
+
p [ "99", mn, "ends" ] if @tandbg
|
74
92
|
end
|
75
93
|
|
76
94
|
# Test asking for a receipt on disconnect.
|
77
95
|
def test_disconnect_receipt
|
96
|
+
mn = "test_disconnect_receipt" if @tandbg
|
97
|
+
p [ "01", mn, "starts" ] if @tandbg
|
78
98
|
@conn.disconnect :receipt => "abc123"
|
79
99
|
assert_not_nil(@conn.disconnect_receipt, "should have a receipt")
|
80
100
|
assert_equal(@conn.disconnect_receipt.headers['receipt-id'],
|
81
101
|
"abc123", "receipt sent and received should match")
|
102
|
+
p [ "99", mn, "ends" ] if @tandbg
|
82
103
|
end
|
83
104
|
|
84
105
|
# Test ACKs for Stomp 1.0
|
85
106
|
def test_client_ack_with_symbol_10
|
107
|
+
mn = "test_client_ack_with_symbol_10" if @tandbg
|
108
|
+
p [ "01", mn, "starts" ] if @tandbg
|
86
109
|
if @conn.protocol != Stomp::SPL_10
|
87
110
|
assert true
|
88
111
|
return
|
@@ -95,10 +118,13 @@ class TestAnonymous < Test::Unit::TestCase
|
|
95
118
|
# matching the message-id for the MESSAGE being acknowledged.
|
96
119
|
@conn.ack msg.headers['message-id']
|
97
120
|
checkEmsg(@conn)
|
121
|
+
p [ "99", mn, "ends" ] if @tandbg
|
98
122
|
end
|
99
123
|
|
100
124
|
# Test ACKs for Stomp 1.1
|
101
125
|
def test_client_ack_with_symbol_11
|
126
|
+
mn = "test_client_ack_with_symbol_11" if @tandbg
|
127
|
+
p [ "01", mn, "starts" ] if @tandbg
|
102
128
|
if @conn.protocol != Stomp::SPL_11
|
103
129
|
assert true
|
104
130
|
return
|
@@ -114,10 +140,13 @@ class TestAnonymous < Test::Unit::TestCase
|
|
114
140
|
# id header.
|
115
141
|
@conn.ack msg.headers['message-id'], :subscription => msg.headers['subscription']
|
116
142
|
checkEmsg(@conn)
|
143
|
+
p [ "99", mn, "ends" ] if @tandbg
|
117
144
|
end
|
118
145
|
|
119
146
|
# Test ACKs for Stomp 1.2
|
120
147
|
def test_client_ack_with_symbol_12
|
148
|
+
mn = "test_client_ack_with_symbol_12" if @tandbg
|
149
|
+
p [ "01", mn, "starts" ] if @tandbg
|
121
150
|
if @conn.protocol != Stomp::SPL_12
|
122
151
|
assert true
|
123
152
|
return
|
@@ -131,33 +160,45 @@ class TestAnonymous < Test::Unit::TestCase
|
|
131
160
|
# of the MESSAGE being acknowledged.
|
132
161
|
@conn.ack msg.headers['ack']
|
133
162
|
checkEmsg(@conn)
|
163
|
+
p [ "99", mn, "ends" ] if @tandbg
|
134
164
|
end
|
135
165
|
|
136
166
|
# Test a message with 0x00 embedded in the body.
|
137
167
|
def test_embedded_null
|
168
|
+
mn = "test_embedded_null" if @tandbg
|
169
|
+
p [ "01", mn, "starts" ] if @tandbg
|
138
170
|
conn_subscribe make_destination
|
139
171
|
@conn.publish make_destination, "a\0"
|
140
172
|
msg = @conn.receive
|
141
173
|
assert_equal "a\0" , msg.body
|
142
174
|
checkEmsg(@conn)
|
175
|
+
p [ "99", mn, "ends" ] if @tandbg
|
143
176
|
end
|
144
177
|
|
145
178
|
# Test connection open checking.
|
146
179
|
def test_connection_open?
|
180
|
+
mn = "test_connection_open?" if @tandbg
|
181
|
+
p [ "01", mn, "starts" ] if @tandbg
|
147
182
|
assert_equal true , @conn.open?
|
148
183
|
@conn.disconnect
|
149
184
|
assert_equal false, @conn.open?
|
185
|
+
p [ "99", mn, "ends" ] if @tandbg
|
150
186
|
end
|
151
187
|
|
152
188
|
# Test connection closed checking.
|
153
189
|
def test_connection_closed?
|
190
|
+
mn = "test_connection_closed?" if @tandbg
|
191
|
+
p [ "01", mn, "starts" ] if @tandbg
|
154
192
|
assert_equal false, @conn.closed?
|
155
193
|
@conn.disconnect
|
156
194
|
assert_equal true, @conn.closed?
|
195
|
+
p [ "99", mn, "ends" ] if @tandbg
|
157
196
|
end
|
158
197
|
|
159
198
|
# Test that methods detect a closed connection.
|
160
199
|
def test_closed_checks_conn
|
200
|
+
mn = "test_closed_checks_conn" if @tandbg
|
201
|
+
p [ "01", mn, "starts" ] if @tandbg
|
161
202
|
@conn.disconnect
|
162
203
|
#
|
163
204
|
assert_raise Stomp::Error::NoCurrentConnection do
|
@@ -203,33 +244,45 @@ class TestAnonymous < Test::Unit::TestCase
|
|
203
244
|
assert_raise Stomp::Error::NoCurrentConnection do
|
204
245
|
_ = @conn.poll
|
205
246
|
end
|
247
|
+
p [ "99", mn, "ends" ] if @tandbg
|
206
248
|
end
|
207
249
|
|
208
250
|
# Test that we receive a Stomp::Message.
|
209
251
|
def test_response_is_instance_of_message_class
|
252
|
+
mn = "test_response_is_instance_of_message_class" if @tandbg
|
253
|
+
p [ "01", mn, "starts" ] if @tandbg
|
210
254
|
conn_subscribe make_destination
|
211
255
|
@conn.publish make_destination, "a\0"
|
212
256
|
msg = @conn.receive
|
213
257
|
assert_instance_of Stomp::Message , msg
|
214
258
|
checkEmsg(@conn)
|
259
|
+
p [ "99", mn, "ends" ] if @tandbg
|
215
260
|
end
|
216
261
|
|
217
262
|
# Test converting a Message to a string.
|
218
263
|
def test_message_to_s
|
264
|
+
mn = "test_message_to_s" if @tandbg
|
265
|
+
p [ "01", mn, "starts" ] if @tandbg
|
219
266
|
conn_subscribe make_destination
|
220
267
|
@conn.publish make_destination, "a\0"
|
221
268
|
msg = @conn.receive
|
222
269
|
assert_match(/^<Stomp::Message headers=/ , msg.to_s)
|
223
270
|
checkEmsg(@conn)
|
271
|
+
p [ "99", mn, "ends" ] if @tandbg
|
224
272
|
end
|
225
273
|
|
226
274
|
# Test that a connection frame is present.
|
227
275
|
def test_connection_frame
|
276
|
+
mn = "test_connection_frame" if @tandbg
|
277
|
+
p [ "01", mn, "starts" ] if @tandbg
|
228
278
|
assert_not_nil @conn.connection_frame
|
279
|
+
p [ "99", mn, "ends" ] if @tandbg
|
229
280
|
end
|
230
281
|
|
231
282
|
# Test messages with multiple line ends.
|
232
283
|
def test_messages_with_multipleLine_ends
|
284
|
+
mn = "test_messages_with_multipleLine_ends" if @tandbg
|
285
|
+
p [ "01", mn, "starts" ] if @tandbg
|
233
286
|
conn_subscribe make_destination
|
234
287
|
@conn.publish make_destination, "a\n\n"
|
235
288
|
@conn.publish make_destination, "b\n\na\n\n"
|
@@ -240,10 +293,13 @@ class TestAnonymous < Test::Unit::TestCase
|
|
240
293
|
assert_equal "a\n\n", msg_a.body
|
241
294
|
assert_equal "b\n\na\n\n", msg_b.body
|
242
295
|
checkEmsg(@conn)
|
296
|
+
p [ "99", mn, "ends" ] if @tandbg
|
243
297
|
end
|
244
298
|
|
245
299
|
# Test publishing multiple messages.
|
246
300
|
def test_publish_two_messages
|
301
|
+
mn = "test_publish_two_messages" if @tandbg
|
302
|
+
p [ "01", mn, "starts" ] if @tandbg
|
247
303
|
conn_subscribe make_destination
|
248
304
|
@conn.publish make_destination, "a\0"
|
249
305
|
@conn.publish make_destination, "b\0"
|
@@ -253,14 +309,18 @@ class TestAnonymous < Test::Unit::TestCase
|
|
253
309
|
assert_equal "a\0", msg_a.body
|
254
310
|
assert_equal "b\0", msg_b.body
|
255
311
|
checkEmsg(@conn)
|
312
|
+
p [ "99", mn, "ends" ] if @tandbg
|
256
313
|
end
|
257
314
|
|
258
315
|
def test_thread_hang_one
|
316
|
+
mn = "test_thread_hang_one" if @tandbg
|
317
|
+
p [ "01", mn, "starts" ] if @tandbg
|
259
318
|
received = nil
|
260
319
|
Thread.new(@conn) do |amq|
|
261
320
|
no_rep_error()
|
262
321
|
while true
|
263
322
|
received = amq.receive
|
323
|
+
Thread::exit if received
|
264
324
|
end
|
265
325
|
end
|
266
326
|
#
|
@@ -271,10 +331,13 @@ class TestAnonymous < Test::Unit::TestCase
|
|
271
331
|
assert_not_nil received
|
272
332
|
assert_equal message, received.body
|
273
333
|
checkEmsg(@conn)
|
334
|
+
p [ "99", mn, "ends" ] if @tandbg
|
274
335
|
end
|
275
336
|
|
276
337
|
# Test polling with a single thread.
|
277
338
|
def test_thread_poll_one
|
339
|
+
mn = "test_thread_poll_one" if @tandbg
|
340
|
+
p [ "01", mn, "starts" ] if @tandbg
|
278
341
|
received = nil
|
279
342
|
max_sleep = (RUBY_VERSION =~ /1\.8/) ? 10 : 1
|
280
343
|
Thread.new(@conn) do |amq|
|
@@ -294,10 +357,13 @@ class TestAnonymous < Test::Unit::TestCase
|
|
294
357
|
assert_not_nil received
|
295
358
|
assert_equal message, received.body
|
296
359
|
checkEmsg(@conn)
|
360
|
+
p [ "99", mn, "ends" ] if @tandbg
|
297
361
|
end
|
298
362
|
|
299
363
|
# Test receiving with multiple threads.
|
300
364
|
def test_multi_thread_receive
|
365
|
+
mn = "test_multi_thread_receive" if @tandbg
|
366
|
+
p [ "01", mn, "starts" ] if @tandbg
|
301
367
|
lock = Mutex.new
|
302
368
|
msg_ctr = 0
|
303
369
|
dest = make_destination
|
@@ -334,10 +400,13 @@ class TestAnonymous < Test::Unit::TestCase
|
|
334
400
|
end
|
335
401
|
assert_equal @max_msgs, msg_ctr
|
336
402
|
checkEmsg(@conn)
|
403
|
+
p [ "99", mn, "ends" ] if @tandbg
|
337
404
|
end unless RUBY_ENGINE =~ /jruby/
|
338
405
|
|
339
406
|
# Test polling with multiple threads.
|
340
407
|
def test_multi_thread_poll
|
408
|
+
mn = "test_multi_thread_poll" if @tandbg
|
409
|
+
p [ "01", mn, "starts" ] if @tandbg
|
341
410
|
#
|
342
411
|
lock = Mutex.new
|
343
412
|
msg_ctr = 0
|
@@ -380,20 +449,26 @@ class TestAnonymous < Test::Unit::TestCase
|
|
380
449
|
end
|
381
450
|
assert_equal @max_msgs, msg_ctr
|
382
451
|
checkEmsg(@conn)
|
452
|
+
p [ "99", mn, "ends" ] if @tandbg
|
383
453
|
end unless RUBY_ENGINE =~ /jruby/
|
384
454
|
|
385
455
|
# Test using a nil body.
|
386
456
|
def test_nil_body
|
457
|
+
mn = "test_nil_body" if @tandbg
|
458
|
+
p [ "01", mn, "starts" ] if @tandbg
|
387
459
|
dest = make_destination
|
388
460
|
@conn.publish dest, nil
|
389
461
|
conn_subscribe dest
|
390
462
|
msg = @conn.receive
|
391
463
|
assert_equal "", msg.body
|
392
464
|
checkEmsg(@conn)
|
465
|
+
p [ "99", mn, "ends" ] if @tandbg
|
393
466
|
end
|
394
467
|
|
395
468
|
# Test transaction message sequencing.
|
396
469
|
def test_transaction
|
470
|
+
mn = "test_transaction" if @tandbg
|
471
|
+
p [ "01", mn, "starts" ] if @tandbg
|
397
472
|
conn_subscribe make_destination
|
398
473
|
|
399
474
|
@conn.begin "txA"
|
@@ -408,10 +483,13 @@ class TestAnonymous < Test::Unit::TestCase
|
|
408
483
|
msg = @conn.receive
|
409
484
|
assert_equal "txn message", msg.body
|
410
485
|
checkEmsg(@conn)
|
486
|
+
p [ "99", mn, "ends" ] if @tandbg
|
411
487
|
end unless ENV['STOMP_ARTEMIS'] # See Artemis docs for 1.3, page 222
|
412
488
|
|
413
489
|
# Test duplicate subscriptions.
|
414
490
|
def test_duplicate_subscription
|
491
|
+
mn = "test_duplicate_subscription" if @tandbg
|
492
|
+
p [ "01", mn, "starts" ] if @tandbg
|
415
493
|
@conn.disconnect # not reliable
|
416
494
|
@conn = Stomp::Connection.open(nil, nil, host, port, true, nil, nil) # reliable
|
417
495
|
dest = make_destination
|
@@ -421,18 +499,24 @@ class TestAnonymous < Test::Unit::TestCase
|
|
421
499
|
conn_subscribe dest
|
422
500
|
end
|
423
501
|
checkEmsg(@conn)
|
502
|
+
p [ "99", mn, "ends" ] if @tandbg
|
424
503
|
end
|
425
504
|
|
426
505
|
# Test nil 1.1 connection parameters.
|
427
506
|
def test_nil_connparms
|
507
|
+
mn = "test_nil_connparms" if @tandbg
|
508
|
+
p [ "01", mn, "starts" ] if @tandbg
|
428
509
|
@conn.disconnect
|
429
510
|
#
|
430
511
|
@conn = Stomp::Connection.open(nil, nil, host, port, false, 5, nil)
|
431
512
|
checkEmsg(@conn)
|
513
|
+
p [ "99", mn, "ends" ] if @tandbg
|
432
514
|
end
|
433
515
|
|
434
516
|
# Basic NAK test.
|
435
517
|
def test_nack11p_0010
|
518
|
+
mn = "test_nack11p_0010" if @tandbg
|
519
|
+
p [ "01", mn, "starts" ] if @tandbg
|
436
520
|
if @conn.protocol == Stomp::SPL_10
|
437
521
|
assert_raise Stomp::Error::UnsupportedProtocolError do
|
438
522
|
@conn.nack "dummy msg-id"
|
@@ -465,6 +549,7 @@ class TestAnonymous < Test::Unit::TestCase
|
|
465
549
|
msg2 = @conn.receive
|
466
550
|
assert_equal smsg, msg2.body
|
467
551
|
checkEmsg(@conn)
|
552
|
+
p [ "99", mn, "ends" ] if @tandbg
|
468
553
|
end
|
469
554
|
end unless (ENV['STOMP_AMQ11'] || ENV['STOMP_ARTEMIS'])
|
470
555
|
|
@@ -472,6 +557,8 @@ class TestAnonymous < Test::Unit::TestCase
|
|
472
557
|
# fail only when connecting to a pure STOMP 1.0 server that does not
|
473
558
|
# return a 'version' header at all.
|
474
559
|
def test_conn10_simple
|
560
|
+
mn = "test_conn10_simple" if @tandbg
|
561
|
+
p [ "01", mn, "starts" ] if @tandbg
|
475
562
|
@conn.disconnect
|
476
563
|
#
|
477
564
|
vhost = ENV['STOMP_RABBIT'] ? "/" : host
|
@@ -494,15 +581,19 @@ class TestAnonymous < Test::Unit::TestCase
|
|
494
581
|
c = nil
|
495
582
|
c = Stomp::Connection.new(hash)
|
496
583
|
c.disconnect if c
|
584
|
+
p [ "99", mn, "ends" ] if @tandbg
|
497
585
|
end
|
498
586
|
|
499
587
|
# test JRuby detection
|
500
588
|
def test_jruby_presence
|
589
|
+
mn = "test_jruby_presence" if @tandbg
|
590
|
+
p [ "01", mn, "starts" ] if @tandbg
|
501
591
|
if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
|
502
592
|
assert @conn.jruby
|
503
593
|
else
|
504
594
|
assert !@conn.jruby
|
505
595
|
end
|
596
|
+
p [ "99", mn, "ends" ] if @tandbg
|
506
597
|
end
|
507
598
|
|
508
599
|
end
|