stomp 1.4.7 → 1.4.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c522e1ef42b07f7c2e8b6249db610f171dde8f8c7a593e1f9bd146c41085c122
4
- data.tar.gz: ba93ed4e01d681093fa36794b1703478ea54275fecf7472fecbf40651a2ac69f
3
+ metadata.gz: c59a4e733516943028a09517af79ef6f83b364b25e6829235a867512580d8983
4
+ data.tar.gz: 2822a29ebea5e99588b98a20689f0ae784e2e52cf43548fc88d5e7c6a35c1256
5
5
  SHA512:
6
- metadata.gz: 1f29dad885daf7b54f1e16182e0ad8c13f16a5c13bb32955a98068b94c5796e88217d35280079f46acb3fbb26b6873043ff76c7e2259a4037840c0b668426f53
7
- data.tar.gz: b6df90be887426860f8f2d66d0ab36347b375f04a6a1822c848bb072a9c44ef838556d08e02f890ecdd2c533bf183f7dc759f1399a1168fa32a47bbdb726b618
6
+ metadata.gz: 72e141edc786894c8992f103a4fadfe00f34a45430960cb526a4c1867f12a0a25923579cd247cadf4e8b74c432cdc92f718d38a09cb5f0a1a11324324ead3587
7
+ data.tar.gz: cedb2740f8b266c0893ad42b85e5799f5770269ff0a9eb7a5950f1950dd69fe7e2f0e8352a032e4adaf5ec30ae395f3093587ef51c9c5ca2f374239831899067
@@ -1,5 +1,10 @@
1
1
  # Stomp Gem Change Log
2
2
 
3
+ ## 1.4.8 20181219
4
+
5
+ * Fix missed merge from 1.4.7 release.
6
+ * Add global debug output flag to all unit tests.
7
+
3
8
  ## 1.4.7 20181210
4
9
 
5
10
  * Support SSL cert/key in text format.
@@ -38,7 +43,7 @@
38
43
 
39
44
  ## 1.4.3 20160821
40
45
 
41
- * Quick fix of install failures. Do not try to use install 1.4.2.
46
+ * Quick fix of install failures. Do not try to install 1.4.2.
42
47
 
43
48
  ## 1.4.2 20160820
44
49
 
data/README.md CHANGED
@@ -94,6 +94,8 @@ A Stomp URL must begin with 'stomp://' and can be in one of the following forms:
94
94
 
95
95
  See _CHANGELOG.rdoc_ for details.
96
96
 
97
+ * Gem version 1.4.8. Fix missed merge in 1.4.7 release.
98
+ * Gem version 1.4.7. Add support for text SSL certs. Do not use, use 1.4.8 instead.
97
99
  * Gem version 1.4.6. Fix version 1.4.5 which breaks JRuby support.
98
100
  * Gem version 1.4.5. JRuby broken here. Use is not recommended.
99
101
  * Gem version 1.4.4. Miscellaneous fixes, see CHANGELOG.md for details.
@@ -51,6 +51,30 @@ module SSLCommon
51
51
  ENV['CLI_KEY'] || pck() # The client private key File
52
52
  end
53
53
 
54
+ # Client cert file name. Change or specify.
55
+ # This is the author's default.
56
+ def cli_cert_text()
57
+ fake_cert = '------BEGIN CERTIFICATE-----
58
+ fake_cert
59
+ ------END CERTIFICATE-----'
60
+
61
+ # The client cert text is stored in environmental variable
62
+ ENV['CLI_CERT_TEXT'] || fake_cert
63
+
64
+ end
65
+
66
+ # Client private key . Change or specify.
67
+ # This is the author's default.
68
+ # This file should not be exposed to the outside world.
69
+ def cli_key_text()
70
+ fake_key = '-----BEGIN PRIVATE KEY-----
71
+ fake_key
72
+ -----END PRIVATE KEY-----'
73
+
74
+ # The client private key text is stored in environment variable
75
+ ENV['CLI_KEY_TEXT'] || fake_key
76
+ end
77
+
54
78
  # Server Data.
55
79
 
56
80
  # Server file location/directory. Change or specify.
@@ -0,0 +1,69 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ #
4
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
5
+ #
6
+ if Kernel.respond_to?(:require_relative)
7
+ require_relative("../ssl_common")
8
+ require_relative("../../stomp_common")
9
+ else
10
+ $LOAD_PATH << File.dirname(__FILE__)
11
+ require "../ssl_common"
12
+ require("../../stomp_common")
13
+ end
14
+ include SSLCommon
15
+ include Stomp1xCommon
16
+ #
17
+ # == SSL Use Case 3 - server *does* authenticate client, client does *not* authenticate server
18
+ #
19
+ # Subcase 3.A - Message broker configuration does *not* require client authentication
20
+ #
21
+ # - Expect connection success
22
+ # - Expect a verify result of 20 becuase the client did not authenticate the
23
+ # server's certificate.
24
+ #
25
+ # Subcase 3.B - Message broker configuration *does* require client authentication
26
+ #
27
+ # - Expect connection success if the server can authenticate the client certificate
28
+ # - Expect a verify result of 20 because the client did not authenticate the
29
+ # server's certificate.
30
+ #
31
+ class ExampleSSL3woFiles
32
+ # Initialize.
33
+ def initialize
34
+ # Change the following as needed.
35
+ @host = host()
36
+ # It is very likely that you will have to specify your specific port number.
37
+ # 61612 is currently my AMQ local port number for ssl client auth is required.
38
+ @port = ENV['STOMP_PORT'] ? ENV['STOMP_PORT'].to_i : 61612
39
+ end
40
+ # Run example.
41
+ def run
42
+ puts "SSLUC3 Connect host: #{@host}, port: #{@port}"
43
+
44
+ # Possibly change the cert file(s) name(s) here.
45
+ ssl_opts = Stomp::SSLParams.new(
46
+ :key_text => cli_key_text().to_s, # the client's private key, private data
47
+ :cert_text => cli_cert_text().to_s # the client's signed certificate
48
+ )
49
+ puts "SSLOPTS: #{ssl_opts.inspect}"
50
+ #
51
+ hash = { :hosts => [
52
+ {:login => login(), :passcode => passcode(), :host => @host, :port => @port, :ssl => ssl_opts},
53
+ ],
54
+ :reliable => false, # YMMV, to test this in a sane manner
55
+ }
56
+ #
57
+ puts "Connect starts, SSL Use Case 3"
58
+ c = Stomp::Connection.new(hash)
59
+ puts "Connect completed"
60
+ puts "SSL Verify Result: #{ssl_opts.verify_result}"
61
+ puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}" if showPeerCert()
62
+ c.disconnect()
63
+ end
64
+
65
+ end
66
+ #
67
+ e = ExampleSSL3woFiles.new()
68
+ e.run
69
+
@@ -0,0 +1,65 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ #
4
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
5
+ #
6
+ if Kernel.respond_to?(:require_relative)
7
+ require_relative("../ssl_common")
8
+ require_relative("../../stomp_common")
9
+ else
10
+ $LOAD_PATH << File.dirname(__FILE__)
11
+ require "../ssl_common"
12
+ require("../../stomp_common")
13
+ end
14
+ include SSLCommon
15
+ include Stomp1xCommon
16
+ #
17
+ # == SSL Use Case 3 - User Supplied Ciphers not from files
18
+ #
19
+ # If you need your own ciphers list, this is how.
20
+ # Stomp's default list will work in many cases. If you need to use this, you
21
+ # will know it because SSL connect will fail. In that case, determining
22
+ # _what_ should be in the list is your responsibility.
23
+ #
24
+ class ExampleSSLwoFiles3C
25
+ # Initialize.
26
+ def initialize # Change the following as needed.
27
+ @host = host()
28
+ # It is very likely that you will have to specify your specific port number.
29
+ # 61612 is currently my AMQ local port number for ssl client auth is required.
30
+ @port = ENV['STOMP_PORT'] ? ENV['STOMP_PORT'].to_i : 61612
31
+ end
32
+ # Run example.
33
+ def run
34
+ puts "SSLUC3C Connect host: #{@host}, port: #{@port}"
35
+ #
36
+ # SSL Use Case 3 without files
37
+ # certificate information will typically be stored in environmental variables
38
+ #
39
+ # Possibly change the cert file(s) name(s) here.
40
+ ssl_opts = Stomp::SSLParams.new(
41
+ :key_text => cli_key_text().to_s, # the client's private key, private data
42
+ :cert_text => cli_cert_text().to_s, # the client's signed certificate
43
+ :ciphers => ciphers_list() # The cipher list
44
+ )
45
+ #
46
+ puts "SSLOPTS: #{ssl_opts.inspect}"
47
+ hash = { :hosts => [
48
+ {:login => login(), :passcode => passcode(), :host => @host, :port => @port, :ssl => ssl_opts},
49
+ ],
50
+ :reliable => false, # YMMV, to test this in a sane manner
51
+ }
52
+ #
53
+ puts "Connect starts, SSL Use Case 3 without files"
54
+ c = Stomp::Connection.new(hash)
55
+ puts "Connect completed"
56
+ puts "SSL Verify Result: #{ssl_opts.verify_result}"
57
+ puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}" if showPeerCert()
58
+ c.disconnect()
59
+ end
60
+
61
+ end
62
+ #
63
+ e = ExampleSSLwoFiles3C.new()
64
+ e.run
65
+
@@ -164,7 +164,7 @@ module Stomp
164
164
  begin
165
165
  delta = curt - @lr
166
166
  if delta > sleeptime
167
- slog(:on_hbfire, log_params, "receive_heartbeat", {})
167
+ slog(:on_hbfire, log_params, "receive_heartbeat", {:delta => delta})
168
168
  # Client code could be off doing something else (that is, no reading of
169
169
  # the socket has been requested by the caller). Try to handle that case.
170
170
  lock = @read_semaphore.try_lock
@@ -367,19 +367,36 @@ module Stomp
367
367
  ctx.cert_store = truststores
368
368
  end
369
369
 
370
- # Client authentication parameters.
371
- # Both cert file and key file must be present or not, it can not be a mix.
372
- raise Stomp::Error::SSLClientParamsError if @ssl.cert_file.nil? && !@ssl.key_file.nil?
373
- raise Stomp::Error::SSLClientParamsError if !@ssl.cert_file.nil? && @ssl.key_file.nil?
374
- if @ssl.cert_file # Any check will do here
370
+ # Client authentication
371
+ # If cert exists as a file, then it should not be input as text
372
+ raise Stomp::Error::SSLClientParamsError if !@ssl.cert_file.nil? && !@ssl.cert_text.nil?
373
+ # If cert exists as file, then key must exist, either as text or file
374
+ raise Stomp::Error::SSLClientParamsError if !@ssl.cert_file.nil? && @ssl.key_file.nil? && @ssl.key_text.nil?
375
+ if @ssl.cert_file
375
376
  raise Stomp::Error::SSLNoCertFileError if !File::exists?(@ssl.cert_file)
376
377
  raise Stomp::Error::SSLUnreadableCertFileError if !File::readable?(@ssl.cert_file)
377
378
  ctx.cert = OpenSSL::X509::Certificate.new(File.read(@ssl.cert_file))
379
+ end
380
+
381
+ # If cert exists as file, then key must exist, either as text or file
382
+ raise Stomp::Error::SSLClientParamsError if !@ssl.cert_text.nil? && @ssl.key_file.nil? && @ssl.key_text.nil?
383
+ if @ssl.cert_text
384
+ ctx.cert = OpenSSL::X509::Certificate.new(@ssl.cert_text)
385
+ end
386
+
387
+ # If key exists as a text, then it should not be input as file
388
+ raise Stomp::Error::SSLClientParamsError if !@ssl.key_text.nil? && !@ssl.key_file.nil?
389
+ if @ssl.key_file
378
390
  raise Stomp::Error::SSLNoKeyFileError if !File::exists?(@ssl.key_file)
379
391
  raise Stomp::Error::SSLUnreadableKeyFileError if !File::readable?(@ssl.key_file)
380
392
  ctx.key = OpenSSL::PKey::RSA.new(File.read(@ssl.key_file), @ssl.key_password)
381
393
  end
382
394
 
395
+ if @ssl.key_text
396
+ nt = @ssl.key_text.gsub(/\t/, "")
397
+ ctx.key = OpenSSL::PKey::RSA.new(nt, @ssl.key_password)
398
+ end
399
+
383
400
  # Cipher list
384
401
  # As of this writing, there are numerous problems with supplying
385
402
  # cipher lists to jruby. So we do not attempt to do that here.
@@ -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
- @key_password = opts[:key_password] # Client key password
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 @cert_file.nil? && !@key_file.nil?
60
- raise Stomp::Error::SSLClientParamsError if !@cert_file.nil? && @key_file.nil?
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
@@ -6,8 +6,8 @@ module Stomp
6
6
  module Version #:nodoc: all
7
7
  MAJOR = 1
8
8
  MINOR = 4
9
- PATCH = 7
10
- # PATCH = "7.plvl.001"
9
+ PATCH = 8
10
+ # PATCH = "8.plvl.001"
11
11
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
12
12
  end
13
13
  end
@@ -2,16 +2,16 @@
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.7 ruby lib
5
+ # stub: stomp 1.4.8 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "stomp".freeze
9
- s.version = "1.4.7"
9
+ s.version = "1.4.8"
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 = "2018-12-10"
14
+ s.date = "2018-12-19"
15
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]
@@ -63,8 +63,10 @@ Gem::Specification.new do |s|
63
63
  "examples/ssl/uc1/ssl_uc1_ciphers.rb",
64
64
  "examples/ssl/uc2/ssl_uc2.rb",
65
65
  "examples/ssl/uc2/ssl_uc2_ciphers.rb",
66
- "examples/ssl/uc3/ssl_uc3.rb",
67
- "examples/ssl/uc3/ssl_uc3_ciphers.rb",
66
+ "examples/ssl/uc3/ssl_uc3_from_files.rb",
67
+ "examples/ssl/uc3/ssl_uc3_from_files_ciphers.rb",
68
+ "examples/ssl/uc3/ssl_uc3_without_files.rb",
69
+ "examples/ssl/uc3/ssl_uc3_without_files_ciphers.rb",
68
70
  "examples/ssl/uc4/ssl_uc4.rb",
69
71
  "examples/ssl/uc4/ssl_uc4_ciphers.rb",
70
72
  "examples/stomp_common.rb",
@@ -20,7 +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'] ? true : false
23
+ @tandbg = ENV['TANDBG'] || ENV['TDBGALL'] ? true : false
24
24
  end
25
25
 
26
26
  def teardown
@@ -20,7 +20,7 @@ class TestClient < Test::Unit::TestCase
20
20
  # Multi_thread test data
21
21
  @max_threads = 20
22
22
  @max_msgs = 50
23
- @tcldbg = ENV['TCLDBG'] ? true : false
23
+ @tcldbg = ENV['TCLDBG'] || ENV['TDBGALL'] ? true : false
24
24
  end
25
25
 
26
26
  def teardown
@@ -169,9 +169,10 @@ class TestClient < Test::Unit::TestCase
169
169
  mn = "test_transactional_publish" if @tcldbg
170
170
  p [ "01", mn, "starts" ] if @tcldbg
171
171
 
172
- @client.begin 'tx1'
173
- @client.publish make_destination, message_text, :transaction => 'tx1'
174
- @client.commit 'tx1'
172
+ tid = "tx1A"
173
+ @client.begin tid
174
+ @client.publish make_destination, message_text, :transaction => tid
175
+ @client.commit tid
175
176
 
176
177
  message = nil
177
178
  @client.subscribe(make_destination) {|m| message = m}
@@ -180,20 +181,21 @@ class TestClient < Test::Unit::TestCase
180
181
  assert_equal message_text, message.body
181
182
  checkEmsg(@client) unless jruby?()
182
183
  p [ "99", mn, "ends" ] if @tcldbg
183
- end
184
+ end unless ENV['STOMP_ARTEMIS']
184
185
 
185
186
  # Test transaction publish and abort.
186
187
  def test_transaction_publish_then_rollback
187
188
  mn = "test_transaction_publish_then_rollback" if @tcldbg
188
189
  p [ "01", mn, "starts" ] if @tcldbg
189
190
 
190
- @client.begin 'tx1'
191
- @client.publish make_destination, "first_message", :transaction => 'tx1'
192
- @client.abort 'tx1'
191
+ tid = "txrb1"
192
+ @client.begin tid
193
+ @client.publish make_destination, "first_message", :transaction => tid
194
+ @client.abort tid
193
195
 
194
- @client.begin 'tx1'
195
- @client.publish make_destination, "second_message", :transaction => 'tx1'
196
- @client.commit 'tx1'
196
+ @client.begin tid
197
+ @client.publish make_destination, "second_message", :transaction => tid
198
+ @client.commit tid
197
199
 
198
200
  message = nil
199
201
  @client.subscribe(make_destination) {|m| message = m}
@@ -201,7 +203,7 @@ class TestClient < Test::Unit::TestCase
201
203
  assert_equal "second_message", message.body
202
204
  checkEmsg(@client) unless jruby?()
203
205
  p [ "99", mn, "ends" ] if @tcldbg
204
- end
206
+ end unless ENV['STOMP_ARTEMIS']
205
207
 
206
208
  # Test transaction publish and abort, receive with new client.
207
209
  # New client uses ack => client.
@@ -209,13 +211,14 @@ class TestClient < Test::Unit::TestCase
209
211
  mn = "test_tran_ack_abrt_newcli_cli" if @tcldbg
210
212
  p [ "01", mn, "starts" ] if @tcldbg
211
213
 
214
+ tid = "tx1B"
212
215
  @client.close if @client && @client.open? # allow tests to close
213
216
  @client = get_client()
214
217
  q = make_destination
215
218
  data = message_text
216
219
  @client.publish q, data
217
220
 
218
- @client.begin 'tx1'
221
+ @client.begin tid
219
222
  message = nil
220
223
  sid = nil
221
224
  if @client.protocol() == Stomp::SPL_10
@@ -228,24 +231,25 @@ class TestClient < Test::Unit::TestCase
228
231
  assert_equal data, message.body
229
232
  case @client.protocol()
230
233
  when Stomp::SPL_10
231
- @client.acknowledge message, :transaction => 'tx1'
234
+ @client.acknowledge message, :transaction => tid
232
235
  checkEmsg(@client) unless jruby?()
233
236
  when Stomp::SPL_11
234
- @client.acknowledge message, :transaction => 'tx1', :subscription => message.headers['subscription']
237
+ @client.acknowledge message, :transaction => tid, :subscription => message.headers['subscription']
235
238
  checkEmsg(@client) unless jruby?()
236
239
  else # 1.2+
237
- @client.acknowledge message, :transaction => 'tx1', :id => message.headers['ack']
240
+ @client.acknowledge message, :transaction => tid, :id => message.headers['ack']
238
241
  checkEmsg(@client) unless jruby?()
239
242
  end
240
243
  message = nil # reset
241
- @client.abort 'tx1' # now abort
244
+ @client.abort tid # now abort
242
245
  checkEmsg(@client) unless jruby?()
243
246
  # lets recreate the connection
244
247
  @client.close
245
248
  @client = get_client()
246
249
  sid = nil
247
250
  message2 = nil
248
- @client.begin 'tx2'
251
+ tid2 = "tx2A"
252
+ @client.begin tid2
249
253
  if @client.protocol() == Stomp::SPL_10
250
254
  @client.subscribe(q, :ack => 'client') {|m| message2 = m}
251
255
  else # 1.1 and 1.2 are the same for this
@@ -257,16 +261,16 @@ class TestClient < Test::Unit::TestCase
257
261
  assert_equal data, message2.body
258
262
  case @client.protocol()
259
263
  when Stomp::SPL_10
260
- @client.acknowledge message2, :transaction => 'tx2'
264
+ @client.acknowledge message2, :transaction => tid2
261
265
  checkEmsg(@client) unless jruby?()
262
266
  when Stomp::SPL_11
263
- @client.acknowledge message2, :transaction => 'tx2', :subscription => message2.headers['subscription']
267
+ @client.acknowledge message2, :transaction => tid2, :subscription => message2.headers['subscription']
264
268
  checkEmsg(@client) unless jruby?()
265
269
  else # 1.2+
266
- @client.acknowledge message2, :transaction => 'tx2', :id => message2.headers['ack']
270
+ @client.acknowledge message2, :transaction => tid2, :id => message2.headers['ack']
267
271
  checkEmsg(@client) unless jruby?()
268
272
  end
269
- @client.commit 'tx2'
273
+ @client.commit tid2
270
274
  checkEmsg(@client) unless jruby?()
271
275
  @client.close
272
276
  p [ "99", mn, "ends" ] if @tcldbg
@@ -278,13 +282,14 @@ class TestClient < Test::Unit::TestCase
278
282
  mn = "test_tran_ack_abrt_newcli_auto" if @tcldbg
279
283
  p [ "01", mn, "starts" ] if @tcldbg
280
284
 
285
+ tid = "tx1C"
281
286
  @client.close if @client && @client.open? # allow tests to close
282
287
  @client = get_client()
283
288
  q = make_destination
284
289
  data = message_text
285
290
  @client.publish q, data
286
291
 
287
- @client.begin 'tx1'
292
+ @client.begin tid
288
293
  message = nil
289
294
  sid = nil
290
295
  if @client.protocol() == Stomp::SPL_10
@@ -297,17 +302,17 @@ class TestClient < Test::Unit::TestCase
297
302
  assert_equal data, message.body
298
303
  case @client.protocol()
299
304
  when Stomp::SPL_10
300
- @client.acknowledge message, :transaction => 'tx1'
305
+ @client.acknowledge message, :transaction => tid
301
306
  checkEmsg(@client) unless jruby?()
302
307
  when Stomp::SPL_11
303
- @client.acknowledge message, :transaction => 'tx1', :subscription => message.headers['subscription']
308
+ @client.acknowledge message, :transaction => tid, :subscription => message.headers['subscription']
304
309
  checkEmsg(@client) unless jruby?()
305
310
  else # 1.2+
306
- @client.acknowledge message, :transaction => 'tx1', :id => message.headers['ack']
311
+ @client.acknowledge message, :transaction => tid, :id => message.headers['ack']
307
312
  checkEmsg(@client) unless jruby?()
308
313
  end
309
314
  message = nil # reset
310
- @client.abort 'tx1' # now abort
315
+ @client.abort tid # now abort
311
316
  checkEmsg(@client) unless jruby?()
312
317
  # lets recreate the connection
313
318
  @client.close
@@ -315,7 +320,8 @@ class TestClient < Test::Unit::TestCase
315
320
  @client = get_client()
316
321
  sid = nil
317
322
  message2 = nil
318
- @client.begin 'tx2'
323
+ tid2 = "tx2C"
324
+ @client.begin tid2
319
325
  if @client.protocol() == Stomp::SPL_10
320
326
  @client.subscribe(q, :ack => 'auto') {|m| message2 = m}
321
327
  else # 1.1 and 1.2 are the same for this
@@ -325,7 +331,7 @@ class TestClient < Test::Unit::TestCase
325
331
  sleep 0.01 until message2
326
332
  assert_not_nil message2
327
333
  assert_equal data, message2.body
328
- @client.commit 'tx2'
334
+ @client.commit tid2
329
335
  checkEmsg(@client) unless jruby?()
330
336
  @client.close
331
337
  p [ "99", mn, "ends" ] if @tcldbg
@@ -457,8 +463,8 @@ class TestClient < Test::Unit::TestCase
457
463
  q = make_destination
458
464
  data = message_text
459
465
  @client.publish q, data
460
-
461
- @client.begin 'tx1'
466
+ tid = "tx1D"
467
+ @client.begin tid
462
468
  message = nil
463
469
  sid = nil
464
470
  if @client.protocol() == Stomp::SPL_10
@@ -471,39 +477,40 @@ class TestClient < Test::Unit::TestCase
471
477
  assert_equal data, message.body
472
478
  case @client.protocol()
473
479
  when Stomp::SPL_10
474
- @client.acknowledge message, :transaction => 'tx1'
480
+ @client.acknowledge message, :transaction => tid
475
481
  checkEmsg(@client) unless jruby?()
476
482
  when Stomp::SPL_11
477
- @client.acknowledge message, :transaction => 'tx1', :subscription => message.headers['subscription']
483
+ @client.acknowledge message, :transaction => tid, :subscription => message.headers['subscription']
478
484
  checkEmsg(@client) unless jruby?()
479
485
  else # 1.2+
480
- @client.acknowledge message, :transaction => 'tx1', :id => message.headers['ack']
486
+ @client.acknowledge message, :transaction => tid, :id => message.headers['ack']
481
487
  checkEmsg(@client) unless jruby?()
482
488
  end
483
489
  message = nil
484
- @client.abort 'tx1'
490
+ @client.abort tid
485
491
  # Wait for redlivery (Client logic)
486
492
  sleep 0.1 while message.nil?
487
493
  assert_not_nil message
488
494
  assert_equal data, message.body
489
- @client.begin 'tx2'
495
+ tid2 = "tx2D"
496
+ @client.begin tid2
490
497
  case @client.protocol()
491
498
  when Stomp::SPL_10
492
- @client.acknowledge message, :transaction => 'tx2'
499
+ @client.acknowledge message, :transaction => tid2
493
500
  checkEmsg(@client) unless jruby?()
494
501
  when Stomp::SPL_11
495
- @client.acknowledge message, :transaction => 'tx2', :subscription => message.headers['subscription']
502
+ @client.acknowledge message, :transaction => tid2, :subscription => message.headers['subscription']
496
503
  checkEmsg(@client) unless jruby?()
497
504
  else # 1.2+
498
- @client.acknowledge message, :transaction => 'tx2', :id => message.headers['ack']
505
+ @client.acknowledge message, :transaction => tid2, :id => message.headers['ack']
499
506
  checkEmsg(@client) unless jruby?()
500
507
  end
501
- @client.commit 'tx2'
508
+ @client.commit tid2
502
509
  checkEmsg(@client) unless jruby?()
503
510
  @client.close
504
511
  @client = nil
505
512
  p [ "99", mn, "ends" ] if @tcldbg
506
- end
513
+ end unless ENV['STOMP_ARTEMIS']
507
514
 
508
515
  # Test that a connection frame is received.
509
516
  def test_connection_frame
@@ -20,7 +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
+ @tcodbg = ENV['TCODBG'] || ENV['TDBGALL'] ? true : false
24
24
  end
25
25
 
26
26
  def teardown
@@ -20,7 +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
+ @tcndbg = ENV['TCNDBG'] || ENV['TDBGALL'] ? true : false
24
24
  end
25
25
 
26
26
  def teardown
@@ -17,7 +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
+ @tc1dbg = ENV['TC1DBG'] || ENV['TDBGALL'] ? true : false
21
21
  end
22
22
 
23
23
  def teardown
@@ -197,6 +197,7 @@ class TestConnection1P < Test::Unit::TestCase
197
197
  end if ENV['STOMP_HB11LONG']
198
198
 
199
199
  # Test only receiving heartbeats.
200
+ # This is a no-no with Artemis, you must send, see docs
200
201
  def test_conn_1p_0090
201
202
  mn = "test_conn_1p_0090" if @tc1dbg
202
203
  p [ "01", mn, "starts" ] if @tc1dbg
@@ -215,7 +216,7 @@ class TestConnection1P < Test::Unit::TestCase
215
216
  conn.disconnect
216
217
  hb_asserts_recv(conn)
217
218
  p [ "99", mn, "ends" ] if @tc1dbg
218
- end if ENV['STOMP_HB11LONG']
219
+ end if ENV['STOMP_HB11LONG'] && !ENV['STOMP_ARTEMIS']
219
220
 
220
221
  # Test sending and receiving heartbeats.
221
222
  def test_conn_1p_0100
@@ -38,7 +38,7 @@ class TestMessage < Test::Unit::TestCase
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
+ @tmsdbg = ENV['TMSDBG'] || ENV['TDBGALL'] ? true : false
42
42
  end
43
43
 
44
44
  def teardown
@@ -146,7 +146,7 @@ class TestMessage < Test::Unit::TestCase
146
146
  _ = Stomp::Message.new("ERROR\nh1:val1\n\njunk\0\n", false)
147
147
 
148
148
  p [ "99", mn, "ends" ] if @tmsdbg
149
- end
149
+ end
150
150
 
151
151
  # Test multiple headers with the same key
152
152
  def test_0050_mh_msg_create
@@ -17,7 +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
+ @tssdbg = ENV['TSSDBG'] || ENV['TDBGALL'] ? true : false
21
21
  end
22
22
 
23
23
  def teardown
@@ -50,6 +50,9 @@ class TestSSL < Test::Unit::TestCase
50
50
  p [ "01", mn, "starts" ] if @tssdbg
51
51
 
52
52
  _ = Stomp::SSLParams.new(:cert_file => "dummy1", :key_file => "dummy2")
53
+ _ = Stomp::SSLParams.new(:cert_file => "dummy1", :key_text => "dummy3")
54
+ _ = Stomp::SSLParams.new(:cert_text => "dummy1", :key_file => "dummy2")
55
+ _ = Stomp::SSLParams.new(:cert_text => "dummy4", :key_text => "dummy3")
53
56
  _ = Stomp::SSLParams.new(:ts_files => "dummyts1")
54
57
  _ = Stomp::SSLParams.new(:ts_files => "dummyts1",
55
58
  :cert_file => "dummy1", :key_file => "dummy2")
@@ -61,12 +64,43 @@ class TestSSL < Test::Unit::TestCase
61
64
  mn = "test_ssl_0030_raise" if @tssdbg
62
65
  p [ "01", mn, "starts" ] if @tssdbg
63
66
 
67
+ key_text = '-----BEGIN PRIVATE KEY-----
68
+ fake_key
69
+ -----END PRIVATE KEY-----'
70
+ cert_text = '------BEGIN CERTIFICATE-----
71
+ fake_cert
72
+ ------END CERTIFICATE-----'
73
+
64
74
  assert_raise(Stomp::Error::SSLClientParamsError) {
65
75
  _ = Stomp::SSLParams.new(:cert_file => "dummy1")
66
76
  }
77
+ assert_raise(Stomp::Error::SSLClientParamsError) {
78
+ _ = Stomp::SSLParams.new(:cert_text => cert_text)
79
+ }
67
80
  assert_raise(Stomp::Error::SSLClientParamsError) {
68
81
  _ = Stomp::SSLParams.new(:key_file => "dummy2")
69
82
  }
83
+ assert_raise(Stomp::Error::SSLClientParamsError) {
84
+ _ = Stomp::SSLParams.new(:key_text => key_text)
85
+ }
86
+ assert_raise(Stomp::Error::SSLClientParamsError) {
87
+ _ = Stomp::SSLParams.new(:cert_text => cert_text, :cert_file => "dummy1")
88
+ }
89
+ assert_raise(Stomp::Error::SSLClientParamsError) {
90
+ _ = Stomp::SSLParams.new(:key_text => key_text, :cert_text => cert_text, :cert_file => "dummy1")
91
+ }
92
+ assert_raise(Stomp::Error::SSLClientParamsError) {
93
+ _ = Stomp::SSLParams.new(:key_file => "dummy2", :cert_text => cert_text, :cert_file => "dummy1")
94
+ }
95
+ assert_raise(Stomp::Error::SSLClientParamsError) {
96
+ _ = Stomp::SSLParams.new(:key_text => key_text, :key_file => "dummy2")
97
+ }
98
+ assert_raise(Stomp::Error::SSLClientParamsError) {
99
+ _ = Stomp::SSLParams.new(:cert_file => "dummy1", :key_text => key_text, :key_file => "dummy2")
100
+ }
101
+ assert_raise(Stomp::Error::SSLClientParamsError) {
102
+ _ = Stomp::SSLParams.new(:cert_text => cert_text, :key_text => key_text, :key_file => "dummy2")
103
+ }
70
104
  p [ "99", mn, "ends" ] if @tssdbg
71
105
  end
72
106
 
@@ -54,7 +54,7 @@ class TestURLLogins < Test::Unit::TestCase
54
54
  @badparms = "failover://(stomp://#{hostname}:#{portnum})?a=b&noequal"
55
55
 
56
56
  @client = nil
57
- @turdbg = ENV['TURDBG'] ? true : false
57
+ @turdbg = ENV['TURDBG'] || ENV['TDBGALL'] ? true : false
58
58
  end
59
59
 
60
60
  def teardown
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stomp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian McCallister
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-12-10 00:00:00.000000000 Z
14
+ date: 2018-12-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
@@ -90,8 +90,10 @@ files:
90
90
  - examples/ssl/uc1/ssl_uc1_ciphers.rb
91
91
  - examples/ssl/uc2/ssl_uc2.rb
92
92
  - examples/ssl/uc2/ssl_uc2_ciphers.rb
93
- - examples/ssl/uc3/ssl_uc3.rb
94
- - examples/ssl/uc3/ssl_uc3_ciphers.rb
93
+ - examples/ssl/uc3/ssl_uc3_from_files.rb
94
+ - examples/ssl/uc3/ssl_uc3_from_files_ciphers.rb
95
+ - examples/ssl/uc3/ssl_uc3_without_files.rb
96
+ - examples/ssl/uc3/ssl_uc3_without_files_ciphers.rb
95
97
  - examples/ssl/uc4/ssl_uc4.rb
96
98
  - examples/ssl/uc4/ssl_uc4_ciphers.rb
97
99
  - examples/stomp_common.rb