stomp 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ doc/*
3
+ coverage/*
@@ -1,3 +1,10 @@
1
+ == 1.1.5 2010-17-03
2
+
3
+ * Added publish method (send is now deprecated)
4
+ * Changes on Rake File
5
+ * Added original_destination header to unreceive
6
+ * suppress content length header is send on the message for future handling (like unreceive)
7
+
1
8
  == 1.1.4 2010-21-01
2
9
 
3
10
  * Added unreceive message method that sends the message back to its queue or to the
data/README.rdoc CHANGED
@@ -73,3 +73,19 @@ Project Home :
73
73
 
74
74
  Stomp Protocol Info :
75
75
  http://stomp.codehaus.org/Protocol
76
+
77
+ = Contributors
78
+
79
+ The following people have contributed to Stomp (ordered by commits):
80
+
81
+ * Brian McCaliister
82
+ * Glenn Rempe <glenn@rempe.us>
83
+ * jstrachan
84
+ * Marius Mathiesen <marius.mathiesen@gmail.com>
85
+ * Johan S√∏rensen <johan@johansorensen.com>
86
+ * Thiago Morello <morellon@gmail.com>
87
+ * Guy M. Allard
88
+ * kookster
89
+ * Tony Garnock-Jones <tonyg@lshift.net>
90
+ * chirino
91
+ * Stefan Saasen
data/Rakefile CHANGED
@@ -11,37 +11,40 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
-
14
+ $:.unshift(File.dirname(__FILE__) + "/lib")
15
15
  require 'rubygems'
16
- require 'rake/gempackagetask'
16
+ require 'rake'
17
17
  require 'rake/testtask'
18
- require 'rake/rdoctask'
19
18
  require 'spec/rake/spectask'
19
+ require "stomp/version"
20
20
 
21
- # read the contents of the gemspec, eval it, and assign it to 'spec'
22
- # this lets us maintain all gemspec info in one place. Nice and DRY.
23
- spec = eval(IO.read("stomp.gemspec"))
24
-
25
- Rake::GemPackageTask.new(spec) do |pkg|
26
- pkg.gem_spec = spec
27
- pkg.need_tar = true
21
+ begin
22
+ require "hanna/rdoctask"
23
+ rescue LoadError => e
24
+ require "rake/rdoctask"
28
25
  end
29
26
 
30
- task :install => [:package] do
31
- sh %{sudo gem install pkg/#{GEM}-#{VERSION}}
27
+ begin
28
+ require 'jeweler'
29
+ Jeweler::Tasks.new do |gem|
30
+ gem.name = "stomp"
31
+ gem.version = Stomp::Version::STRING
32
+ gem.summary = %Q{Ruby client for the Stomp messaging protocol}
33
+ gem.description = %Q{Ruby client for the Stomp messaging protocol}
34
+ gem.email = ["brianm@apache.org", 'marius@stones.com', 'morellon@gmail.com']
35
+ gem.homepage = "http://stomp.codehaus.org/"
36
+ gem.authors = ["Brian McCallister", 'Marius Mathiesen', 'Thiago Morello']
37
+ gem.add_development_dependency "rspec"
38
+ end
39
+ Jeweler::GemcutterTasks.new
40
+ rescue LoadError
41
+ puts "Jeweler not available. Install it with: gem install jeweler"
32
42
  end
33
43
 
34
- Rake::TestTask.new do |t|
35
- t.libs << "test"
36
- t.test_files = FileList['test/test*.rb']
37
- t.verbose = true
38
- end
39
-
40
- Rake::RDocTask.new do |rd|
41
- rd.main = "README.rdoc"
42
- rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
43
- rd.rdoc_dir = 'doc'
44
- rd.options = spec.rdoc_options
44
+ desc 'Run the specs'
45
+ Spec::Rake::SpecTask.new(:spec) do |t|
46
+ t.spec_opts = ['--colour --format specdoc --loadby mtime --reverse']
47
+ t.spec_files = FileList['spec/**/*_spec.rb']
45
48
  end
46
49
 
47
50
  desc "Rspec : run all with RCov"
@@ -51,9 +54,22 @@ Spec::Rake::SpecTask.new('spec:rcov') do |t|
51
54
  t.rcov_opts = ['--exclude', 'gems', '--exclude', 'spec']
52
55
  end
53
56
 
54
- desc "RSpec : run all"
55
- Spec::Rake::SpecTask.new('spec') do |t|
56
- t.spec_files = FileList['spec/**/*.rb']
57
- t.spec_opts = ["--color", "--format", "specdoc"]
57
+ Rake::RDocTask.new do |rdoc|
58
+ rdoc.main = "README.rdoc"
59
+ rdoc.rdoc_dir = "doc"
60
+ rdoc.title = "Stomp"
61
+ rdoc.options += %w[ --line-numbers --inline-source --charset utf-8 ]
62
+ rdoc.rdoc_files.include("README.rdoc", "CHANGELOG.rdoc")
63
+ rdoc.rdoc_files.include("lib/**/*.rb")
58
64
  end
59
65
 
66
+ Rake::TestTask.new do |t|
67
+ t.libs << "test"
68
+ t.test_files = FileList['test/test*.rb']
69
+ t.verbose = true
70
+ end
71
+
72
+ task :default => :spec
73
+
74
+
75
+
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'stomp'
3
+
4
+
5
+ client = Stomp::Client.new("failover://(stomp://:@localhost:61613,stomp://:@remotehost:61613)?initialReconnectDelay=5000&randomize=false&useExponentialBackOff=false")
6
+ puts "Subscribing ronaldo"
7
+ client.subscribe("/queue/ronaldo", {:ack => "client", "activemq.prefetchSize" => 1, "activemq.exclusive" => true }) do |msg|
8
+ File.open("file", "a") do |f|
9
+ f.write(msg.body)
10
+ f.write("\n----------------\n")
11
+ end
12
+
13
+ client.acknowledge(msg)
14
+ end
15
+
16
+ loop do
17
+ sleep(1)
18
+ puts "."
19
+ end
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'stomp'
3
+
4
+ #client = Stomp::Client.new("", "", "localhost", 61613)
5
+
6
+ client = Stomp::Client.new("failover://(stomp://:@localhost:61613,stomp://:@remotehost:61613)?initialReconnectDelay=5000&randomize=false&useExponentialBackOff=false")
7
+ message = "ronaldo #{ARGV[0]}"
8
+
9
+ for i in (1..300)
10
+ puts "Sending message"
11
+ client.send("/queue/ronaldo", "#{i}: #{message}", {:persistent => true})
12
+ puts "(#{Time.now})Message sent: #{i}"
13
+ sleep 1
14
+ end
15
+
16
+
17
+
data/lib/stomp.rb CHANGED
@@ -13,11 +13,11 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- require File.join(File.dirname(__FILE__), 'stomp', 'ext', 'hash')
17
- require File.join(File.dirname(__FILE__), 'stomp', 'connection')
18
- require File.join(File.dirname(__FILE__), 'stomp', 'client')
19
- require File.join(File.dirname(__FILE__), 'stomp', 'message')
20
- require File.join(File.dirname(__FILE__), 'stomp', 'errors')
16
+ require 'stomp/ext/hash'
17
+ require 'stomp/connection'
18
+ require 'stomp/client'
19
+ require 'stomp/message'
20
+ require 'stomp/errors'
21
21
 
22
22
  module Stomp
23
23
  end
data/lib/stomp/client.rb CHANGED
@@ -10,7 +10,8 @@ module Stomp
10
10
  class Client
11
11
 
12
12
  attr_reader :login, :passcode, :host, :port, :reliable, :parameters
13
- alias :obj_send :send
13
+
14
+ #alias :obj_send :send
14
15
 
15
16
  # A new Client object can be initialized using two forms:
16
17
  #
@@ -172,22 +173,31 @@ module Stomp
172
173
  end
173
174
 
174
175
  # Unreceive a message, sending it back to its queue or to the DLQ
175
- # client acknowledgement ( connection.subscribe "/queue/a", :ack => 'client'g
176
176
  #
177
- def unreceive(message)
178
- @connection.unreceive message
177
+ def unreceive(message, options = {})
178
+ @connection.unreceive(message, options)
179
179
  end
180
- # Send message to destination
180
+
181
+ # Publishes message to destination
181
182
  #
182
183
  # If a block is given a receipt will be requested and passed to the
183
184
  # block on receipt
184
185
  #
185
186
  # Accepts a transaction header ( :transaction => 'some_transaction_id' )
186
- def send(destination, message, headers = {})
187
+ def publish(destination, message, headers = {})
187
188
  if block_given?
188
189
  headers['receipt'] = register_receipt_listener lambda {|r| yield r}
189
190
  end
190
- @connection.send(destination, message, headers)
191
+ @connection.publish(destination, message, headers)
192
+ end
193
+
194
+ def obj_send(*args)
195
+ __send__(*args)
196
+ end
197
+
198
+ def send(*args)
199
+ warn("This method is deprecated and will be removed on the next release. Use 'publish' instead")
200
+ publish(*args)
191
201
  end
192
202
 
193
203
  def connection_frame
@@ -9,7 +9,7 @@ module Stomp
9
9
  class Connection
10
10
  attr_reader :connection_frame
11
11
  attr_reader :disconnect_receipt
12
- alias :obj_send :send
12
+ #alias :obj_send :send
13
13
 
14
14
  def self.default_port(ssl)
15
15
  ssl ? 61612 : 61613
@@ -239,19 +239,29 @@ module Stomp
239
239
  end
240
240
  end
241
241
 
242
- # Send message to destination
242
+ # Publish message to destination
243
243
  #
244
244
  # To disable content length header ( :suppress_content_length => true )
245
245
  # Accepts a transaction header ( :transaction => 'some_transaction_id' )
246
- def send(destination, message, headers = {})
246
+ def publish(destination, message, headers = {})
247
247
  headers[:destination] = destination
248
248
  transmit("SEND", headers, message)
249
249
  end
250
250
 
251
+ def obj_send(*args)
252
+ __send__(*args)
253
+ end
254
+
255
+ def send(*args)
256
+ warn("This method is deprecated and will be removed on the next release. Use 'publish' instead")
257
+ publish(*args)
258
+ end
259
+
251
260
  # Send a message back to the source or to the dead letter queue
252
261
  #
253
262
  # Accepts a dead letter queue option ( :dead_letter_queue => "/queue/DLQ" )
254
263
  # Accepts a limit number of redeliveries option ( :max_redeliveries => 6 )
264
+ # Accepts a force client acknowledgement option (:force_client_ack => true)
255
265
  def unreceive(message, options = {})
256
266
  options = { :dead_letter_queue => "/queue/DLQ", :max_redeliveries => 6 }.merge options
257
267
  # Lets make sure all keys are symbols
@@ -260,19 +270,20 @@ module Stomp
260
270
  retry_count = message.headers[:retry_count].to_i || 0
261
271
  message.headers[:retry_count] = retry_count + 1
262
272
  transaction_id = "transaction-#{message.headers[:'message-id']}-#{retry_count}"
273
+ message_id = message.headers.delete(:'message-id')
263
274
 
264
275
  begin
265
276
  self.begin transaction_id
266
277
 
267
- if client_ack?(message)
268
- self.ack(message.headers[:'message-id'], :transaction => transaction_id)
278
+ if client_ack?(message) || options[:force_client_ack]
279
+ self.ack(message_id, :transaction => transaction_id)
269
280
  end
270
281
 
271
282
  if retry_count <= options[:max_redeliveries]
272
- self.send(message.headers[:destination], message.body, message.headers.merge(:transaction => transaction_id))
283
+ self.publish(message.headers[:destination], message.body, message.headers.merge(:transaction => transaction_id))
273
284
  else
274
285
  # Poison ack, sending the message to the DLQ
275
- self.send(options[:dead_letter_queue], message.body, message.headers.merge(:transaction => transaction_id, :persistent => true))
286
+ self.publish(options[:dead_letter_queue], message.body, message.headers.merge(:transaction => transaction_id, :original_destination => message.headers[:destination], :persistent => true))
276
287
  end
277
288
  self.commit transaction_id
278
289
  rescue Exception => exception
@@ -397,8 +408,8 @@ module Stomp
397
408
  # Using :suppress_content_length => true will suppress this behaviour
398
409
  # and ActiveMQ will interpret the message as a TextMessage.
399
410
  # For more information refer to http://juretta.com/log/2009/05/24/activemq-jms-stomp/
400
- suppress_content_length = headers.delete :suppress_content_length
401
- headers['content-length'] = "#{body.length}" unless suppress_content_length
411
+ # Lets send this header in the message, so it can maintain state when using unreceive
412
+ headers['content-length'] = "#{body.length}" unless headers[:suppress_content_length]
402
413
 
403
414
  used_socket.puts command
404
415
  headers.each {|k,v| used_socket.puts "#{k}:#{v}" }
@@ -0,0 +1,8 @@
1
+ module Stomp
2
+ module Version #:nodoc: all
3
+ MAJOR = 1
4
+ MINOR = 1
5
+ PATCH = 5
6
+ STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
+ end
8
+ end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ shared_examples_for "standard Client" do
4
+
5
+ before(:each) do
6
+ @destination = "/queue/test/ruby/client"
7
+ @message_text = "test_client-#{Time.now.to_i}"
8
+ end
9
+
10
+ describe "the closed? method" do
11
+ it "should be false when the connection is open" do
12
+ @mock_connection.stub!(:closed?).and_return(false)
13
+ @client.closed?.should == false
14
+ end
15
+
16
+ it "should be true when the connection is closed" do
17
+ @mock_connection.stub!(:closed?).and_return(true)
18
+ @client.closed?.should == true
19
+ end
20
+ end
21
+
22
+ describe "the open? method" do
23
+ it "should be true when the connection is open" do
24
+ @mock_connection.stub!(:open?).and_return(true)
25
+ @client.open?.should == true
26
+ end
27
+
28
+ it "should be false when the connection is closed" do
29
+ @mock_connection.stub!(:open?).and_return(false)
30
+ @client.open?.should == false
31
+ end
32
+ end
33
+
34
+ describe "the subscribe method" do
35
+
36
+ before(:each) do
37
+ @mock_connection.stub!(:subscribe).and_return(true)
38
+ end
39
+
40
+ it "should raise RuntimeError if not passed a block" do
41
+ lambda {
42
+ @client.subscribe(@destination)
43
+ }.should raise_error
44
+ end
45
+
46
+ it "should not raise an error when passed a block" do
47
+ lambda {
48
+ @client.subscribe(@destination) {|msg| received = msg}
49
+ }.should_not raise_error
50
+ end
51
+
52
+ end
53
+
54
+ end
55
+
@@ -0,0 +1,275 @@
1
+ require 'spec_helper'
2
+ require 'client_shared_examples'
3
+
4
+ describe Stomp::Client do
5
+
6
+ before(:each) do
7
+ @mock_connection = mock('connection')
8
+ Stomp::Connection.stub!(:new).and_return(@mock_connection)
9
+ end
10
+
11
+ describe "(created with no params)" do
12
+
13
+ before(:each) do
14
+ @client = Stomp::Client.new
15
+ end
16
+
17
+ it "should not return any errors" do
18
+ lambda {
19
+ @client = Stomp::Client.new
20
+ }.should_not raise_error
21
+ end
22
+
23
+ it "should not return any errors when created with the open constructor" do
24
+ lambda {
25
+ @client = Stomp::Client.open
26
+ }.should_not raise_error
27
+ end
28
+
29
+ it_should_behave_like "standard Client"
30
+
31
+ end
32
+
33
+ describe "(created with invalid params)" do
34
+
35
+ it "should return ArgumentError if host is nil" do
36
+ lambda {
37
+ @client = Stomp::Client.new('login', 'passcode', nil)
38
+ }.should raise_error
39
+ end
40
+
41
+ it "should return ArgumentError if host is empty" do
42
+ lambda {
43
+ @client = Stomp::Client.new('login', 'passcode', '')
44
+ }.should raise_error
45
+ end
46
+
47
+ it "should return ArgumentError if port is nil" do
48
+ lambda {
49
+ @client = Stomp::Client.new('login', 'passcode', 'localhost', nil)
50
+ }.should raise_error
51
+ end
52
+
53
+ it "should return ArgumentError if port is < 1" do
54
+ lambda {
55
+ @client = Stomp::Client.new('login', 'passcode', 'localhost', 0)
56
+ }.should raise_error
57
+ end
58
+
59
+ it "should return ArgumentError if port is > 65535" do
60
+ lambda {
61
+ @client = Stomp::Client.new('login', 'passcode', 'localhost', 65536)
62
+ }.should raise_error
63
+ end
64
+
65
+ it "should return ArgumentError if port is empty" do
66
+ lambda {
67
+ @client = Stomp::Client.new('login', 'passcode', 'localhost', '')
68
+ }.should raise_error
69
+ end
70
+
71
+ it "should return ArgumentError if reliable is something other than true or false" do
72
+ lambda {
73
+ @client = Stomp::Client.new('login', 'passcode', 'localhost', '12345', 'foo')
74
+ }.should raise_error
75
+ end
76
+
77
+ end
78
+
79
+
80
+ describe "(created with positional params)" do
81
+
82
+ before(:each) do
83
+ @client = Stomp::Client.new('testlogin', 'testpassword', 'localhost', '12345', false)
84
+ end
85
+
86
+ it "should properly parse the URL provided" do
87
+ @client.login.should eql('testlogin')
88
+ @client.passcode.should eql('testpassword')
89
+ @client.host.should eql('localhost')
90
+ @client.port.should eql(12345)
91
+ @client.reliable.should be_false
92
+ end
93
+
94
+ it_should_behave_like "standard Client"
95
+
96
+ end
97
+
98
+ describe "(created with non-authenticating stomp:// URL and non-TLD host)" do
99
+
100
+ before(:each) do
101
+ @client = Stomp::Client.new('stomp://foobar:12345')
102
+ end
103
+
104
+ it "should properly parse the URL provided" do
105
+ @client.login.should eql('')
106
+ @client.passcode.should eql('')
107
+ @client.host.should eql('foobar')
108
+ @client.port.should eql(12345)
109
+ @client.reliable.should be_false
110
+ end
111
+
112
+ it_should_behave_like "standard Client"
113
+
114
+ end
115
+
116
+ describe "(created with authenticating stomp:// URL and non-TLD host)" do
117
+
118
+ before(:each) do
119
+ @client = Stomp::Client.new('stomp://testlogin:testpasscode@foobar:12345')
120
+ end
121
+
122
+ it "should properly parse the URL provided" do
123
+ @client.login.should eql('testlogin')
124
+ @client.passcode.should eql('testpasscode')
125
+ @client.host.should eql('foobar')
126
+ @client.port.should eql(12345)
127
+ @client.reliable.should be_false
128
+ end
129
+
130
+ it_should_behave_like "standard Client"
131
+
132
+ end
133
+
134
+ describe "(created with non-authenticating stomp:// URL and TLD host)" do
135
+
136
+ before(:each) do
137
+ @client = Stomp::Client.new('stomp://host.foobar.com:12345')
138
+ end
139
+
140
+ after(:each) do
141
+ end
142
+
143
+ it "should properly parse the URL provided" do
144
+ @client.login.should eql('')
145
+ @client.passcode.should eql('')
146
+ @client.host.should eql('host.foobar.com')
147
+ @client.port.should eql(12345)
148
+ @client.reliable.should be_false
149
+ end
150
+
151
+ it_should_behave_like "standard Client"
152
+
153
+ end
154
+
155
+ describe "(created with authenticating stomp:// URL and non-TLD host)" do
156
+
157
+ before(:each) do
158
+ @client = Stomp::Client.new('stomp://testlogin:testpasscode@host.foobar.com:12345')
159
+ end
160
+
161
+ it "should properly parse the URL provided" do
162
+ @client.login.should eql('testlogin')
163
+ @client.passcode.should eql('testpasscode')
164
+ @client.host.should eql('host.foobar.com')
165
+ @client.port.should eql(12345)
166
+ @client.reliable.should be_false
167
+ end
168
+
169
+ it_should_behave_like "standard Client"
170
+
171
+ end
172
+
173
+ describe "(created with failover URL)" do
174
+ before(:each) do
175
+ #default options
176
+ @parameters = {
177
+ :initial_reconnect_delay => 0.01,
178
+ :max_reconnect_delay => 30.0,
179
+ :use_exponential_back_off => true,
180
+ :back_off_multiplier => 2,
181
+ :max_reconnect_attempts => 0,
182
+ :randomize => false,
183
+ :backup => false,
184
+ :timeout => -1
185
+ }
186
+ end
187
+ it "should properly parse a URL with failover://" do
188
+ url = "failover://(stomp://login1:passcode1@localhost:61616,stomp://login2:passcode2@remotehost:61617)"
189
+
190
+ @parameters[:hosts] = [
191
+ {:login => "login1", :passcode => "passcode1", :host => "localhost", :port => 61616, :ssl => false},
192
+ {:login => "login2", :passcode => "passcode2", :host => "remotehost", :port => 61617, :ssl => false}
193
+ ]
194
+
195
+ Stomp::Connection.should_receive(:new).with(@parameters)
196
+
197
+ client = Stomp::Client.new(url)
198
+ client.parameters.should == @parameters
199
+ end
200
+
201
+ it "should properly parse a URL with failover:" do
202
+ url = "failover:(stomp://login1:passcode1@localhost:61616,stomp://login2:passcode2@remotehost1:61617),stomp://login3:passcode3@remotehost2:61618)"
203
+
204
+ @parameters[:hosts] = [
205
+ {:login => "login1", :passcode => "passcode1", :host => "localhost", :port => 61616, :ssl => false},
206
+ {:login => "login2", :passcode => "passcode2", :host => "remotehost1", :port => 61617, :ssl => false},
207
+ {:login => "login3", :passcode => "passcode3", :host => "remotehost2", :port => 61618, :ssl => false}
208
+ ]
209
+
210
+ Stomp::Connection.should_receive(:new).with(@parameters)
211
+
212
+ client = Stomp::Client.new(url)
213
+ client.parameters.should == @parameters
214
+ end
215
+
216
+ it "should properly parse a URL without user and password" do
217
+ url = "failover:(stomp://localhost:61616,stomp://remotehost:61617)"
218
+
219
+ @parameters[:hosts] = [
220
+ {:login => "", :passcode => "", :host => "localhost", :port => 61616, :ssl => false},
221
+ {:login => "", :passcode => "", :host => "remotehost", :port => 61617, :ssl => false}
222
+ ]
223
+
224
+ Stomp::Connection.should_receive(:new).with(@parameters)
225
+
226
+ client = Stomp::Client.new(url)
227
+ client.parameters.should == @parameters
228
+ end
229
+
230
+ it "should properly parse a URL with user and/or password blank" do
231
+ url = "failover:(stomp://:@localhost:61616,stomp://:@remotehost:61617)"
232
+
233
+ @parameters[:hosts] = [
234
+ {:login => "", :passcode => "", :host => "localhost", :port => 61616, :ssl => false},
235
+ {:login => "", :passcode => "", :host => "remotehost", :port => 61617, :ssl => false}
236
+ ]
237
+
238
+ Stomp::Connection.should_receive(:new).with(@parameters)
239
+
240
+ client = Stomp::Client.new(url)
241
+ client.parameters.should == @parameters
242
+ end
243
+
244
+ it "should properly parse a URL with the options query" do
245
+ query = "initialReconnectDelay=5000&maxReconnectDelay=60000&useExponentialBackOff=false&backOffMultiplier=3"
246
+ query += "&maxReconnectAttempts=4&randomize=true&backup=true&timeout=10000"
247
+
248
+ url = "failover:(stomp://login1:passcode1@localhost:61616,stomp://login2:passcode2@remotehost:61617)?#{query}"
249
+
250
+ #backup and timeout are not implemented yet
251
+ @parameters = {
252
+ :initial_reconnect_delay => 5.0,
253
+ :max_reconnect_delay => 60.0,
254
+ :use_exponential_back_off => false,
255
+ :back_off_multiplier => 3,
256
+ :max_reconnect_attempts => 4,
257
+ :randomize => true,
258
+ :backup => false,
259
+ :timeout => -1
260
+ }
261
+
262
+ @parameters[:hosts] = [
263
+ {:login => "login1", :passcode => "passcode1", :host => "localhost", :port => 61616, :ssl => false},
264
+ {:login => "login2", :passcode => "passcode2", :host => "remotehost", :port => 61617, :ssl => false}
265
+ ]
266
+
267
+ Stomp::Connection.should_receive(:new).with(@parameters)
268
+
269
+ client = Stomp::Client.new(url)
270
+ client.parameters.should == @parameters
271
+ end
272
+
273
+ end
274
+
275
+ end