stomp 1.3.5 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -251,7 +251,7 @@ module Stomp
251
251
  $stderr.print "\n"
252
252
  $stderr.print "es2_oldrecv: " + errstr
253
253
  $stderr.print "\n"
254
- end
254
+ end
255
255
 
256
256
  # !!! This initiates a re-connect !!!
257
257
  _reconn_prep()
data/lib/stomp/client.rb CHANGED
@@ -30,29 +30,32 @@ module Stomp
30
30
  # {:login => "login1", :passcode => "passcode1", :host => "localhost", :port => 61616, :ssl => false},
31
31
  # {:login => "login2", :passcode => "passcode2", :host => "remotehost", :port => 61617, :ssl => false}
32
32
  # ],
33
- # :reliable => true,
34
- # :initial_reconnect_delay => 0.01,
35
- # :max_reconnect_delay => 30.0,
36
- # :use_exponential_back_off => true,
37
- # :back_off_multiplier => 2,
38
- # :max_reconnect_attempts => 0,
39
- # :randomize => false,
40
- # :connect_timeout => 0,
41
- # :connect_headers => {},
42
- # :parse_timeout => 5,
43
- # :logger => nil,
44
- # :dmh => false,
45
- # :closed_check => true,
46
- # :hbser => false,
47
- # :stompconn => false,
48
- # :usecrlf => false,
49
- # :max_hbread_fails => 0,
50
- # :max_hbrlck_fails => 0,
51
- # :fast_hbs_adjust => 0.0,
52
- # :connread_timeout => 0,
53
- # :tcp_nodelay => true,
54
- # :start_timeout => 0,
55
- # :sslctx_newparm => nil,
33
+ # # These are the default parameters and do not need to be set
34
+ # :reliable => true, # reliable (use failover)
35
+ # :initial_reconnect_delay => 0.01, # initial delay before reconnect (secs)
36
+ # :max_reconnect_delay => 30.0, # max delay before reconnect
37
+ # :use_exponential_back_off => true, # increase delay between reconnect attpempts
38
+ # :back_off_multiplier => 2, # next delay multiplier
39
+ # :max_reconnect_attempts => 0, # retry forever, use # for maximum attempts
40
+ # :randomize => false, # do not radomize hosts hash before reconnect
41
+ # :connect_timeout => 0, # Timeout for TCP/TLS connects, use # for max seconds
42
+ # :connect_headers => {}, # user supplied CONNECT headers (req'd for Stomp 1.1+)
43
+ # :parse_timeout => 5, # IO::select wait time on socket reads
44
+ # :logger => nil, # user suplied callback logger instance
45
+ # :dmh => false, # do not support multihomed IPV4 / IPV6 hosts during failover
46
+ # :closed_check => true, # check first if closed in each protocol method
47
+ # :hbser => false, # raise on heartbeat send exception
48
+ # :stompconn => false, # Use STOMP instead of CONNECT
49
+ # :usecrlf => false, # Use CRLF command and header line ends (1.2+)
50
+ # :max_hbread_fails => 0, # Max HB read fails before retry. 0 => never retry
51
+ # :max_hbrlck_fails => 0, # Max HB read lock obtain fails before retry. 0 => never retry
52
+ # :fast_hbs_adjust => 0.0, # Fast heartbeat senders sleep adjustment, seconds, needed ...
53
+ # # For fast heartbeat senders. 'fast' == YMMV. If not
54
+ # # correct for your environment, expect unnecessary fail overs
55
+ # :connread_timeout => 0, # Timeout during CONNECT for read of CONNECTED/ERROR, secs
56
+ # :tcp_nodelay => true, # Turns on the TCP_NODELAY socket option; disables Nagle's algorithm
57
+ # :start_timeout => 0, # Timeout around Stomp::Client initialization
58
+ # :sslctx_newparm => nil, # Param for SSLContext.new
56
59
  # }
57
60
  #
58
61
  # e.g. c = Stomp::Client.new(hash)
@@ -86,6 +89,8 @@ module Stomp
86
89
  @start_timeout = @parameters[:start_timeout] || 0
87
90
  check_arguments!()
88
91
 
92
+ # p [ "cldbg01", @parameters ]
93
+
89
94
  begin
90
95
  Timeout::timeout(@start_timeout) {
91
96
  create_error_handler
@@ -93,6 +98,7 @@ module Stomp
93
98
  start_listeners()
94
99
  }
95
100
  rescue TimeoutError
101
+ # p [ "cldbg02" ]
96
102
  ex = Stomp::Error::StartTimeoutException.new(@start_timeout)
97
103
  raise ex
98
104
  end
@@ -116,6 +122,7 @@ module Stomp
116
122
  end
117
123
 
118
124
  def create_connection(autoflush)
125
+ # p [ "ccon01", @parameters ]
119
126
  @connection = Connection.new(@parameters)
120
127
  @connection.autoflush = autoflush
121
128
  end
@@ -67,29 +67,32 @@ module Stomp
67
67
  # {:login => "login1", :passcode => "passcode1", :host => "localhost", :port => 61616, :ssl => false},
68
68
  # {:login => "login2", :passcode => "passcode2", :host => "remotehost", :port => 61617, :ssl => false}
69
69
  # ],
70
- # :reliable => true,
71
- # :initial_reconnect_delay => 0.01,
72
- # :max_reconnect_delay => 30.0,
73
- # :use_exponential_back_off => true,
74
- # :back_off_multiplier => 2,
75
- # :max_reconnect_attempts => 0,
76
- # :randomize => false,
77
- # :connect_timeout => 0,
78
- # :connect_headers => {},
79
- # :parse_timeout => 5,
80
- # :logger => nil,
81
- # :dmh => false,
82
- # :closed_check => true,
83
- # :hbser => false,
84
- # :stompconn => false,
85
- # :usecrlf => false,
86
- # :max_hbread_fails => 0,
87
- # :max_hbrlck_fails => 0,
88
- # :fast_hbs_adjust => 0.0,
89
- # :connread_timeout => 0,
90
- # :tcp_nodelay => true,
91
- # :start_timeout => 0,
92
- # :sslctx_newparm => nil,
70
+ # # These are the default parameters and do not need to be set
71
+ # :reliable => true, # reliable (use failover)
72
+ # :initial_reconnect_delay => 0.01, # initial delay before reconnect (secs)
73
+ # :max_reconnect_delay => 30.0, # max delay before reconnect
74
+ # :use_exponential_back_off => true, # increase delay between reconnect attpempts
75
+ # :back_off_multiplier => 2, # next delay multiplier
76
+ # :max_reconnect_attempts => 0, # retry forever, use # for maximum attempts
77
+ # :randomize => false, # do not radomize hosts hash before reconnect
78
+ # :connect_timeout => 0, # Timeout for TCP/TLS connects, use # for max seconds
79
+ # :connect_headers => {}, # user supplied CONNECT headers (req'd for Stomp 1.1+)
80
+ # :parse_timeout => 5, # IO::select wait time on socket reads
81
+ # :logger => nil, # user suplied callback logger instance
82
+ # :dmh => false, # do not support multihomed IPV4 / IPV6 hosts during failover
83
+ # :closed_check => true, # check first if closed in each protocol method
84
+ # :hbser => false, # raise on heartbeat send exception
85
+ # :stompconn => false, # Use STOMP instead of CONNECT
86
+ # :usecrlf => false, # Use CRLF command and header line ends (1.2+)
87
+ # :max_hbread_fails => 0, # Max HB read fails before retry. 0 => never retry
88
+ # :max_hbrlck_fails => 0, # Max HB read lock obtain fails before retry. 0 => never retry
89
+ # :fast_hbs_adjust => 0.0, # Fast heartbeat senders sleep adjustment, seconds, needed ...
90
+ # # For fast heartbeat senders. 'fast' == YMMV. If not
91
+ # # correct for your environment, expect unnecessary fail overs
92
+ # :connread_timeout => 0, # Timeout during CONNECT for read of CONNECTED/ERROR, secs
93
+ # :tcp_nodelay => true, # Turns on the TCP_NODELAY socket option; disables Nagle's algorithm
94
+ # :start_timeout => 0, # Timeout around Stomp::Client initialization
95
+ # :sslctx_newparm => nil, # Param for SSLContext.new
93
96
  # }
94
97
  #
95
98
  # e.g. c = Stomp::Connection.new(hash)
@@ -111,6 +114,8 @@ module Stomp
111
114
  @hb_sent = true # Assumed at first
112
115
  @hbs = @hbr = false # Sending/Receiving heartbeats. Assume no for now.
113
116
  @jruby = false # Assumed at first
117
+ # Initialize some variables
118
+ @closed, @socket, @hhas10, @rt, @st = true, nil, false, nil, nil
114
119
  if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
115
120
  @jruby = true
116
121
  end
@@ -175,6 +175,8 @@ module Stomp
175
175
  ["SRP-RSA-AES-256-CBC-SHA","TLSv1/SSLv3",256,256],
176
176
  ]
177
177
 
178
+ original_verbose, $VERBOSE = $VERBOSE, nil # try to shut off warnings
179
+
178
180
  # stomp URL regex pattern, for e.g. login:passcode@host:port or host:port
179
181
  URL_REPAT = '((([\w~!@#$%^&*()\-+=.?:<>,.]*\w):([\w~!@#$%^&*()\-+=.?:<>,.]*))?@)?([\w\.\-]+):(\d+)'
180
182
 
@@ -182,4 +184,6 @@ module Stomp
182
184
  #failover:(stomp+ssl://login1:passcode1@remotehost1:61612,stomp://login2:passcode2@remotehost2:61613)
183
185
  FAILOVER_REGEX = /^failover:(\/\/)?\(stomp(\+ssl)?:\/\/#{URL_REPAT}(,stomp(\+ssl)?:\/\/#{URL_REPAT})*\)(\?(.*))?$/
184
186
 
187
+ $VERBOSE = original_verbose
188
+
185
189
  end # Module Stomp
data/lib/stomp/errors.rb CHANGED
@@ -38,6 +38,15 @@ module Stomp
38
38
  end
39
39
  end
40
40
 
41
+ # ReceiveTimeout is raised if:
42
+ # * The read socket shows "not ready" at any time after the timeout
43
+ # specified by :parse_timeout in the connection hash.
44
+ class ReceiveTimeout < RuntimeError
45
+ def message
46
+ "Receive status timeout"
47
+ end
48
+ end
49
+
41
50
  # SocketOpenTimeout is raised if:
42
51
  # * A timeout occurs during a socket open.
43
52
  class SocketOpenTimeout < RuntimeError
data/lib/stomp/version.rb CHANGED
@@ -5,8 +5,8 @@ module Stomp
5
5
  # Define the gem version.
6
6
  module Version #:nodoc: all
7
7
  MAJOR = 1
8
- MINOR = 3
9
- PATCH = 5
8
+ MINOR = 4
9
+ PATCH = 0
10
10
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
11
11
  end
12
12
  end
data/stomp.gemspec CHANGED
@@ -5,80 +5,32 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{stomp}
8
- s.version = "1.3.5"
8
+ s.version = "1.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian McCallister", "Marius Mathiesen", "Thiago Morello", "Guy M. Allard"]
12
- s.date = %q{2016-03-02}
12
+ s.date = %q{2016-06-08}
13
13
  s.description = %q{Ruby client for the Stomp messaging protocol. Note that this gem is no longer supported on rubyforge.}
14
14
  s.email = ["brianm@apache.org", "marius@stones.com", "morellon@gmail.com", "allard.guy.m@gmail.com"]
15
- s.executables = ["catstomp", "stompcat"]
15
+ s.executables = ["stompcat", "catstomp"]
16
16
  s.extra_rdoc_files = [
17
- "CHANGELOG.rdoc",
18
17
  "LICENSE",
19
- "README.rdoc",
20
- "examples/amqdurasub.rb",
21
- "examples/client11_ex1.rb",
22
- "examples/client11_putget1.rb",
23
- "examples/conn11_ex1.rb",
24
- "examples/conn11_ex2.rb",
25
- "examples/conn11_hb1.rb",
26
- "examples/consumer.rb",
27
- "examples/examplogger.rb",
28
- "examples/get11conn_ex1.rb",
29
- "examples/get11conn_ex2.rb",
30
- "examples/logexamp.rb",
31
- "examples/logexamp_ssl.rb",
32
- "examples/publisher.rb",
33
- "examples/put11conn_ex1.rb",
34
- "examples/putget11_rh1.rb",
35
- "examples/ssl_ctxoptions.rb",
36
- "examples/ssl_newparm.rb",
37
- "examples/ssl_uc1.rb",
38
- "examples/ssl_uc1_ciphers.rb",
39
- "examples/ssl_uc2.rb",
40
- "examples/ssl_uc2_ciphers.rb",
41
- "examples/ssl_uc3.rb",
42
- "examples/ssl_uc3_ciphers.rb",
43
- "examples/ssl_uc4.rb",
44
- "examples/ssl_uc4_ciphers.rb",
45
- "examples/ssl_ucx_default_ciphers.rb",
46
- "examples/stomp11_common.rb",
47
- "examples/topic_consumer.rb",
48
- "examples/topic_publisher.rb",
49
- "lib/client/utils.rb",
50
- "lib/connection/heartbeats.rb",
51
- "lib/connection/netio.rb",
52
- "lib/connection/utf8.rb",
53
- "lib/connection/utils.rb",
54
- "lib/stomp.rb",
55
- "lib/stomp/client.rb",
56
- "lib/stomp/codec.rb",
57
- "lib/stomp/connection.rb",
58
- "lib/stomp/constants.rb",
59
- "lib/stomp/errors.rb",
60
- "lib/stomp/ext/hash.rb",
61
- "lib/stomp/message.rb",
62
- "lib/stomp/null_logger.rb",
63
- "lib/stomp/slogger.rb",
64
- "lib/stomp/sslparams.rb",
65
- "lib/stomp/version.rb",
66
- "test/test_anonymous.rb",
67
- "test/test_client.rb",
68
- "test/test_codec.rb",
69
- "test/test_connection.rb",
70
- "test/test_connection1p.rb",
71
- "test/test_helper.rb",
72
- "test/test_message.rb",
73
- "test/test_ssl.rb",
74
- "test/test_urlogin.rb",
75
- "test/tlogger.rb"
18
+ "README.md"
76
19
  ]
77
20
  s.files = [
78
- "CHANGELOG.rdoc",
21
+ "CHANGELOG.md",
79
22
  "LICENSE",
80
- "README.rdoc",
23
+ "README.md",
81
24
  "Rakefile",
25
+ "adhoc/.gitignore",
26
+ "adhoc/README.md",
27
+ "adhoc/issue121_01.rb",
28
+ "adhoc/issue121_01_conn.rb",
29
+ "adhoc/issue121_02.rb",
30
+ "adhoc/issue121_03.rb",
31
+ "adhoc/payload_generator.rb",
32
+ "adhoc/payload_generator_adhoctest.rb",
33
+ "adhoc/stomp_adhoc_common.rb",
82
34
  "bin/catstomp",
83
35
  "bin/stompcat",
84
36
  "examples/amqdurasub.rb",
@@ -87,12 +39,18 @@ Gem::Specification.new do |s|
87
39
  "examples/conn11_ex1.rb",
88
40
  "examples/conn11_ex2.rb",
89
41
  "examples/conn11_hb1.rb",
42
+ "examples/consume_file.rb",
90
43
  "examples/consumer.rb",
44
+ "examples/contrib.sh",
45
+ "examples/contributors.rb",
91
46
  "examples/examplogger.rb",
92
47
  "examples/get11conn_ex1.rb",
93
48
  "examples/get11conn_ex2.rb",
49
+ "examples/lflogger.rb",
94
50
  "examples/logexamp.rb",
95
51
  "examples/logexamp_ssl.rb",
52
+ "examples/publish_file.rb",
53
+ "examples/publish_file_conn.rb",
96
54
  "examples/publisher.rb",
97
55
  "examples/put11conn_ex1.rb",
98
56
  "examples/putget11_rh1.rb",
@@ -134,6 +92,7 @@ Gem::Specification.new do |s|
134
92
  "spec/message_spec.rb",
135
93
  "spec/spec_helper.rb",
136
94
  "stomp.gemspec",
95
+ "test/.gitignore",
137
96
  "test/test_anonymous.rb",
138
97
  "test/test_client.rb",
139
98
  "test/test_codec.rb",
@@ -146,7 +105,7 @@ Gem::Specification.new do |s|
146
105
  "test/tlogger.rb"
147
106
  ]
148
107
  s.homepage = %q{https://github.com/stompgem/stomp}
149
- s.licenses = ["Apache 2.0"]
108
+ s.licenses = ["Apache-2.0"]
150
109
  s.require_paths = ["lib"]
151
110
  s.rubygems_version = %q{1.3.7}
152
111
  s.summary = %q{Ruby client for the Stomp messaging protocol}
data/test/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ #
2
+ 1method.rb
3
+
@@ -203,11 +203,11 @@ class TestAnonymous < Test::Unit::TestCase
203
203
  end
204
204
  #
205
205
  assert_raise Stomp::Error::NoCurrentConnection do
206
- m = @conn.receive
206
+ _ = @conn.receive
207
207
  end
208
208
  #
209
209
  assert_raise Stomp::Error::NoCurrentConnection do
210
- m = @conn.poll
210
+ _ = @conn.poll
211
211
  end
212
212
  end
213
213
 
@@ -225,7 +225,7 @@ class TestAnonymous < Test::Unit::TestCase
225
225
  conn_subscribe make_destination
226
226
  @conn.publish make_destination, "a\0"
227
227
  msg = @conn.receive
228
- assert_match /^<Stomp::Message headers=/ , msg.to_s
228
+ assert_match(/^<Stomp::Message headers=/ , msg.to_s)
229
229
  checkEmsg(@conn)
230
230
  end
231
231
 
@@ -309,7 +309,7 @@ class TestAnonymous < Test::Unit::TestCase
309
309
  1.upto(@max_threads) do |tnum|
310
310
  Thread.new(@conn) do |amq|
311
311
  while true
312
- received = amq.receive
312
+ _ = amq.receive
313
313
  lock.synchronize do
314
314
  msg_ctr += 1
315
315
  end
data/test/test_client.rb CHANGED
@@ -449,23 +449,25 @@ class TestClient < Test::Unit::TestCase
449
449
 
450
450
  # Test basic unsubscribe.
451
451
  def test_unsubscribe
452
+ @client.close if @client && @client.open? # close setup work
453
+ @client = nil
452
454
  message = nil
453
455
  dest = make_destination
454
456
  to_send = message_text
455
457
  client = get_client()
456
458
  sid = nil
457
- if @client.protocol() == Stomp::SPL_10
459
+ if client.protocol() == Stomp::SPL_10
458
460
  client.subscribe(dest, :ack => 'client') { |m| message = m }
459
461
  else
460
462
  sid = client.uuid()
461
463
  client.subscribe(dest, :ack => 'client', :id => sid) { |m| message = m }
462
464
  end
463
- @client.publish dest, to_send
465
+ client.publish dest, to_send
464
466
  Timeout::timeout(4) do
465
467
  sleep 0.01 until message
466
468
  end
467
469
  assert_equal to_send, message.body, "first body check"
468
- if @client.protocol() == Stomp::SPL_10
470
+ if client.protocol() == Stomp::SPL_10
469
471
  client.unsubscribe dest
470
472
  else
471
473
  client.unsubscribe dest, :id => sid
@@ -474,7 +476,7 @@ class TestClient < Test::Unit::TestCase
474
476
  # Same message should remain on the queue. Receive it again with ack=>auto.
475
477
  message_copy = nil
476
478
  client = get_client()
477
- if @client.protocol() == Stomp::SPL_10
479
+ if client.protocol() == Stomp::SPL_10
478
480
  client.subscribe(dest, :ack => 'auto') { |m| message_copy = m }
479
481
  else
480
482
  sid = client.uuid()
@@ -485,7 +487,8 @@ class TestClient < Test::Unit::TestCase
485
487
  end
486
488
  assert_equal to_send, message_copy.body, "second body check"
487
489
  assert_equal message.headers['message-id'], message_copy.headers['message-id'], "header check" unless ENV['STOMP_RABBIT']
488
- checkEmsg(@client)
490
+ checkEmsg(client)
491
+ client.close
489
492
  end
490
493
 
491
494
  # Test subscribe from a worker thread.
@@ -524,7 +527,7 @@ class TestClient < Test::Unit::TestCase
524
527
  # this is ugly .....
525
528
  if acli.protocol() == Stomp::SPL_10
526
529
  acli.subscribe(dest) { |m|
527
- msg = m
530
+ _ = m
528
531
  lock.synchronize do
529
532
  msg_ctr += 1
530
533
  end
@@ -533,7 +536,7 @@ class TestClient < Test::Unit::TestCase
533
536
  }
534
537
  else
535
538
  acli.subscribe(dest, :id => acli.uuid()) { |m|
536
- msg = m
539
+ _ = m
537
540
  lock.synchronize do
538
541
  msg_ctr += 1
539
542
  end
@@ -547,7 +550,7 @@ class TestClient < Test::Unit::TestCase
547
550
  #
548
551
  1.upto(@max_msgs) do |mnum|
549
552
  msg = Time.now.to_s + " #{mnum}"
550
- @client.publish(dest, message_text)
553
+ @client.publish(dest, msg)
551
554
  end
552
555
  #
553
556
  max_sleep = (RUBY_VERSION =~ /1\.8\.6/) ? 30 : 5
@@ -569,7 +572,7 @@ class TestClient < Test::Unit::TestCase
569
572
  #
570
573
  assert_raise Stomp::Error::NoCurrentConnection do
571
574
  m = Stomp::Message.new("")
572
- @client.acknowledge(m) {|r| receipt = r}
575
+ @client.acknowledge(m) {|r| _ = r}
573
576
  end
574
577
  #
575
578
  assert_raise Stomp::Error::NoCurrentConnection do
@@ -585,7 +588,7 @@ class TestClient < Test::Unit::TestCase
585
588
  end
586
589
  #
587
590
  assert_raise Stomp::Error::NoCurrentConnection do
588
- @client.subscribe("dummy_data", {:ack => 'auto'}) {|msg| received = msg}
591
+ @client.subscribe("dummy_data", {:ack => 'auto'}) {|msg| _ = msg}
589
592
  end
590
593
  #
591
594
  assert_raise Stomp::Error::NoCurrentConnection do
@@ -662,7 +665,7 @@ class TestClient < Test::Unit::TestCase
662
665
  ex_vals = dflt_data_ex()
663
666
  ex_vals.each do |hsv|
664
667
  assert_raise ArgumentError do
665
- cli = Stomp::Client.open(hsv)
668
+ _ = Stomp::Client.open(hsv)
666
669
  end
667
670
  end
668
671
  end
@@ -203,11 +203,11 @@ class TestConnection < Test::Unit::TestCase
203
203
  end
204
204
  #
205
205
  assert_raise Stomp::Error::NoCurrentConnection do
206
- m = @conn.receive
206
+ _ = @conn.receive
207
207
  end
208
208
  #
209
209
  assert_raise Stomp::Error::NoCurrentConnection do
210
- m = @conn.poll
210
+ _ = @conn.poll
211
211
  end
212
212
  end
213
213
 
@@ -225,7 +225,7 @@ class TestConnection < Test::Unit::TestCase
225
225
  conn_subscribe make_destination
226
226
  @conn.publish make_destination, "a\0"
227
227
  msg = @conn.receive
228
- assert_match /^<Stomp::Message headers=/ , msg.to_s
228
+ assert_match(/^<Stomp::Message headers=/ , msg.to_s)
229
229
  checkEmsg(@conn)
230
230
  end
231
231
 
@@ -309,7 +309,7 @@ class TestConnection < Test::Unit::TestCase
309
309
  1.upto(@max_threads) do |tnum|
310
310
  Thread.new(@conn) do |amq|
311
311
  while true
312
- received = amq.receive
312
+ _ = amq.receive
313
313
  lock.synchronize do
314
314
  msg_ctr += 1
315
315
  end
@@ -34,12 +34,12 @@ class TestConnection1P < Test::Unit::TestCase
34
34
  #
35
35
  cha = {:host => "localhost"}
36
36
  assert_raise Stomp::Error::ProtocolErrorConnect do
37
- conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
37
+ _ = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)
38
38
  end
39
39
  #
40
40
  chb = {"accept-version" => "1.0"}
41
41
  assert_raise Stomp::Error::ProtocolErrorConnect do
42
- conn = Stomp::Connection.open(user, passcode, host, port, false, 5, chb)
42
+ _ = Stomp::Connection.open(user, passcode, host, port, false, 5, chb)
43
43
  end
44
44
  end
45
45
 
@@ -62,11 +62,11 @@ class TestConnection1P < Test::Unit::TestCase
62
62
  :max_reconnect_attempts => 10,
63
63
  }
64
64
  assert_raise Stomp::Error::ProtocolErrorConnect do
65
- conn = Stomp::Connection.open(hash)
65
+ _ = Stomp::Connection.open(hash)
66
66
  end
67
67
  hash[:connect_headers] = {"accept-version" => "1.1"}
68
68
  assert_raise Stomp::Error::ProtocolErrorConnect do
69
- conn = Stomp::Connection.open(hash)
69
+ _ = Stomp::Connection.open(hash)
70
70
  end
71
71
  end
72
72
 
data/test/test_helper.rb CHANGED
@@ -13,8 +13,8 @@ else
13
13
  end
14
14
 
15
15
  begin
16
- dummy = RUBY_ENGINE
17
- rescue NameError => ne
16
+ _ = RUBY_ENGINE
17
+ rescue NameError
18
18
  RUBY_ENGINE = "unknown"
19
19
  end
20
20
 
@@ -169,6 +169,7 @@ module TestBase
169
169
  def make_destination
170
170
  name = caller_method_name unless name
171
171
  qname = ENV['STOMP_DOTQUEUE'] ? "/queue/test.ruby.stomp." + name : "/queue/test/ruby/stomp/" + name
172
+ return qname
172
173
  end
173
174
 
174
175
  #
@@ -182,6 +183,7 @@ module TestBase
182
183
  # Check for JRuby before a connection exists
183
184
  def jruby?()
184
185
  jr = defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/ ? true : false
186
+ return jr
185
187
  end
186
188
 
187
189
  # OK Data For Default Tests
data/test/test_message.rb CHANGED
@@ -104,49 +104,49 @@ class TestMessage < Test::Unit::TestCase
104
104
  def test_0040_msg_create
105
105
  #
106
106
  assert_raise(Stomp::Error::InvalidFormat) {
107
- aframe = Stomp::Message.new("junk", false)
107
+ _ = Stomp::Message.new("junk", false)
108
108
  }
109
109
  #
110
110
  assert_raise(Stomp::Error::InvalidFormat) {
111
- aframe = Stomp::Message.new("command\njunk", false)
111
+ _ = Stomp::Message.new("command\njunk", false)
112
112
  }
113
113
  #
114
114
  assert_raise(Stomp::Error::InvalidFormat) {
115
- aframe = Stomp::Message.new("command\nheaders\n\njunk", false)
115
+ _ = Stomp::Message.new("command\nheaders\n\njunk", false)
116
116
  }
117
117
  #
118
118
  assert_raise(Stomp::Error::InvalidServerCommand) {
119
- aframe = Stomp::Message.new("junkcommand\nheaders\n\njunk\0\n\n", false)
119
+ _ = Stomp::Message.new("junkcommand\nheaders\n\njunk\0\n\n", false)
120
120
  }
121
121
  #
122
122
  assert_raise(Stomp::Error::InvalidFormat) {
123
- aframe = Stomp::Message.new("ERROR\nbadheaders\n\njunk\0\n\n", false)
123
+ _ = Stomp::Message.new("ERROR\nbadheaders\n\njunk\0\n\n", false)
124
124
  }
125
125
  #
126
126
  assert_nothing_raised {
127
- aframe = Stomp::Message.new("CONNECTED\nh1:val1\n\njunk\0\n", false)
127
+ _ = Stomp::Message.new("CONNECTED\nh1:val1\n\njunk\0\n", false)
128
128
  }
129
129
  #
130
130
  assert_nothing_raised {
131
- aframe = Stomp::Message.new("MESSAGE\nh1:val1\n\njunk\0\n", false)
131
+ _ = Stomp::Message.new("MESSAGE\nh1:val1\n\njunk\0\n", false)
132
132
  }
133
133
  #
134
134
  assert_nothing_raised {
135
- aframe = Stomp::Message.new("MESSAGE\nh2:val2\n\n\0", false)
135
+ _ = Stomp::Message.new("MESSAGE\nh2:val2\n\n\0", false)
136
136
  }
137
137
  #
138
138
  assert_nothing_raised {
139
- aframe = Stomp::Message.new("RECEIPT\nh1:val1\n\njunk\0\n", false)
139
+ _ = Stomp::Message.new("RECEIPT\nh1:val1\n\njunk\0\n", false)
140
140
  }
141
141
  #
142
142
  assert_nothing_raised {
143
- aframe = Stomp::Message.new("ERROR\nh1:val1\n\njunk\0\n", false)
143
+ _ = Stomp::Message.new("ERROR\nh1:val1\n\njunk\0\n", false)
144
144
  }
145
145
 
146
146
  end
147
147
 
148
148
  # Test multiple headers with the same key
149
- def test_0050_mh_msg_create
149
+ def test_0050_mh_msg_create
150
150
  aframe = bframe = nil
151
151
  assert_nothing_raised {
152
152
  amsg = "MESSAGE\n" +
@@ -173,7 +173,7 @@ class TestMessage < Test::Unit::TestCase
173
173
  end
174
174
 
175
175
  # Test headers with empty key / value
176
- def test_0060_hdr_ekv
176
+ def test_0060_hdr_ekv
177
177
  #
178
178
  amsg = "MESSAGE\n" +
179
179
  "h1:val1\n" +
@@ -183,10 +183,10 @@ class TestMessage < Test::Unit::TestCase
183
183
  "payload" +
184
184
  "\0\n"
185
185
  assert_raise Stomp::Error::ProtocolErrorEmptyHeaderKey do
186
- aframe = Stomp::Message.new(amsg, false)
186
+ _ = Stomp::Message.new(amsg, false)
187
187
  end
188
188
  assert_raise Stomp::Error::ProtocolErrorEmptyHeaderKey do
189
- aframe = Stomp::Message.new(amsg, true)
189
+ _ = Stomp::Message.new(amsg, true)
190
190
  end
191
191
  #
192
192
  amsg = "MESSAGE\n" +
@@ -197,10 +197,10 @@ class TestMessage < Test::Unit::TestCase
197
197
  "payload" +
198
198
  "\0\n"
199
199
  assert_raise Stomp::Error::ProtocolErrorEmptyHeaderValue do
200
- aframe = Stomp::Message.new(amsg, false)
200
+ _ = Stomp::Message.new(amsg, false)
201
201
  end
202
202
  assert_nothing_raised {
203
- aframe = Stomp::Message.new(amsg, true)
203
+ _ = Stomp::Message.new(amsg, true)
204
204
  }
205
205
  end
206
206