stomper 2.0.1 → 2.0.2
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.
- data/CHANGELOG.md +28 -0
- data/README.md +1 -17
- data/features/protocol_version_negotiation.feature +6 -6
- data/features/steps/{acking_messages_steps.rb → ack_and_nack_steps.rb} +9 -1
- data/features/steps/broker_steps.rb +52 -0
- data/features/steps/client_steps.rb +137 -0
- data/features/steps/{receipts_steps.rb → receipt_steps.rb} +0 -0
- data/features/steps/{scopes_steps.rb → scope_steps.rb} +0 -16
- data/features/steps/subscription_steps.rb +80 -0
- data/lib/stomper/connection.rb +29 -29
- data/lib/stomper/receipt_manager.rb +5 -0
- data/lib/stomper/subscription_manager.rb +8 -3
- data/lib/stomper/version.rb +1 -1
- data/spec/stomper/connection_spec.rb +16 -1
- data/spec/stomper/frame_serializer_spec.rb +299 -280
- data/spec/stomper/subscription_manager_spec.rb +2 -3
- data/spec/stomper_spec.rb +0 -1
- data/spec/support/frame_header_matchers.rb +25 -0
- metadata +17 -60
- data/features/steps/disconnecting_steps.rb +0 -8
- data/features/steps/establish_connection_steps.rb +0 -77
- data/features/steps/frame_transmission_steps.rb +0 -40
- data/features/steps/protocol_version_negotiation_steps.rb +0 -15
- data/features/steps/secure_connections_steps.rb +0 -43
- data/features/steps/send_and_message_steps.rb +0 -35
- data/features/steps/subscribing_steps.rb +0 -36
- data/features/steps/threaded_receiver_steps.rb +0 -8
- data/features/steps/transactions_steps.rb +0 -0
- data/spec/stomper/frame_serializer_1.8_spec.rb +0 -318
data/spec/stomper_spec.rb
CHANGED
@@ -8,3 +8,28 @@ end
|
|
8
8
|
RSpec::Matchers.define :have_transaction_header do |expected|
|
9
9
|
have_frame_header :transaction, expected
|
10
10
|
end
|
11
|
+
|
12
|
+
RSpec::Matchers.define :have_command do |expected|
|
13
|
+
match do |actual|
|
14
|
+
actual.command.should == expected
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
RSpec::Matchers.define :have_body_encoding do |expected|
|
19
|
+
if RUBY_VERSION >= "1.9"
|
20
|
+
match do |actual|
|
21
|
+
actual.body.encoding.name.should == expected
|
22
|
+
end
|
23
|
+
else
|
24
|
+
match do |actual|
|
25
|
+
true.should be_true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
RSpec::Matchers.define :have_body do |expected, expected_no_encoding, encoding|
|
31
|
+
e_expected = (RUBY_VERSION >= '1.9') ? expected.encode(encoding) : expected_no_encoding
|
32
|
+
match do |actual|
|
33
|
+
actual.body.should == e_expected
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stomper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 2
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
version: 2.0.1
|
4
|
+
prerelease:
|
5
|
+
version: 2.0.2
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Ian D. Eccles
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-03-01 00:00:00 -05:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,10 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ~>
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 2
|
30
|
-
- 4
|
31
|
-
- 0
|
32
24
|
version: 2.4.0
|
33
25
|
type: :development
|
34
26
|
version_requirements: *id001
|
@@ -40,10 +32,6 @@ dependencies:
|
|
40
32
|
requirements:
|
41
33
|
- - ">="
|
42
34
|
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
- 3
|
46
|
-
- 0
|
47
35
|
version: 0.3.0
|
48
36
|
type: :development
|
49
37
|
version_requirements: *id002
|
@@ -55,10 +43,6 @@ dependencies:
|
|
55
43
|
requirements:
|
56
44
|
- - ">="
|
57
45
|
- !ruby/object:Gem::Version
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
- 6
|
61
|
-
- 0
|
62
46
|
version: 0.6.0
|
63
47
|
type: :development
|
64
48
|
version_requirements: *id003
|
@@ -70,8 +54,6 @@ dependencies:
|
|
70
54
|
requirements:
|
71
55
|
- - ">="
|
72
56
|
- !ruby/object:Gem::Version
|
73
|
-
segments:
|
74
|
-
- 0
|
75
57
|
version: "0"
|
76
58
|
type: :development
|
77
59
|
version_requirements: *id004
|
@@ -83,8 +65,6 @@ dependencies:
|
|
83
65
|
requirements:
|
84
66
|
- - ">="
|
85
67
|
- !ruby/object:Gem::Version
|
86
|
-
segments:
|
87
|
-
- 0
|
88
68
|
version: "0"
|
89
69
|
type: :development
|
90
70
|
version_requirements: *id005
|
@@ -96,10 +76,6 @@ dependencies:
|
|
96
76
|
requirements:
|
97
77
|
- - ">="
|
98
78
|
- !ruby/object:Gem::Version
|
99
|
-
segments:
|
100
|
-
- 0
|
101
|
-
- 10
|
102
|
-
- 0
|
103
79
|
version: 0.10.0
|
104
80
|
type: :development
|
105
81
|
version_requirements: *id006
|
@@ -115,6 +91,7 @@ extra_rdoc_files: []
|
|
115
91
|
files:
|
116
92
|
- .gitignore
|
117
93
|
- .rspec
|
94
|
+
- CHANGELOG.md
|
118
95
|
- Gemfile
|
119
96
|
- LICENSE
|
120
97
|
- README.md
|
@@ -129,18 +106,12 @@ files:
|
|
129
106
|
- features/scopes.feature
|
130
107
|
- features/secure_connections.feature
|
131
108
|
- features/send_and_message.feature
|
132
|
-
- features/steps/
|
133
|
-
- features/steps/
|
134
|
-
- features/steps/
|
135
|
-
- features/steps/
|
136
|
-
- features/steps/
|
137
|
-
- features/steps/
|
138
|
-
- features/steps/scopes_steps.rb
|
139
|
-
- features/steps/secure_connections_steps.rb
|
140
|
-
- features/steps/send_and_message_steps.rb
|
141
|
-
- features/steps/subscribing_steps.rb
|
142
|
-
- features/steps/threaded_receiver_steps.rb
|
143
|
-
- features/steps/transactions_steps.rb
|
109
|
+
- features/steps/ack_and_nack_steps.rb
|
110
|
+
- features/steps/broker_steps.rb
|
111
|
+
- features/steps/client_steps.rb
|
112
|
+
- features/steps/receipt_steps.rb
|
113
|
+
- features/steps/scope_steps.rb
|
114
|
+
- features/steps/subscription_steps.rb
|
144
115
|
- features/subscribing.feature
|
145
116
|
- features/support/env.rb
|
146
117
|
- features/support/header_helpers.rb
|
@@ -198,7 +169,6 @@ files:
|
|
198
169
|
- spec/stomper/extensions/events_spec.rb
|
199
170
|
- spec/stomper/extensions/heartbeat_spec.rb
|
200
171
|
- spec/stomper/extensions/scoping_spec.rb
|
201
|
-
- spec/stomper/frame_serializer_1.8_spec.rb
|
202
172
|
- spec/stomper/frame_serializer_spec.rb
|
203
173
|
- spec/stomper/frame_spec.rb
|
204
174
|
- spec/stomper/headers_spec.rb
|
@@ -230,23 +200,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
200
|
requirements:
|
231
201
|
- - ">="
|
232
202
|
- !ruby/object:Gem::Version
|
233
|
-
segments:
|
234
|
-
- 1
|
235
|
-
- 8
|
236
|
-
- 7
|
237
203
|
version: 1.8.7
|
238
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
205
|
none: false
|
240
206
|
requirements:
|
241
207
|
- - ">="
|
242
208
|
- !ruby/object:Gem::Version
|
243
|
-
segments:
|
244
|
-
- 0
|
245
209
|
version: "0"
|
246
210
|
requirements: []
|
247
211
|
|
248
212
|
rubyforge_project: stomper
|
249
|
-
rubygems_version: 1.
|
213
|
+
rubygems_version: 1.5.2
|
250
214
|
signing_key:
|
251
215
|
specification_version: 3
|
252
216
|
summary: Client for message queues implementing the Stomp protocol interface.
|
@@ -259,18 +223,12 @@ test_files:
|
|
259
223
|
- features/scopes.feature
|
260
224
|
- features/secure_connections.feature
|
261
225
|
- features/send_and_message.feature
|
262
|
-
- features/steps/
|
263
|
-
- features/steps/
|
264
|
-
- features/steps/
|
265
|
-
- features/steps/
|
266
|
-
- features/steps/
|
267
|
-
- features/steps/
|
268
|
-
- features/steps/scopes_steps.rb
|
269
|
-
- features/steps/secure_connections_steps.rb
|
270
|
-
- features/steps/send_and_message_steps.rb
|
271
|
-
- features/steps/subscribing_steps.rb
|
272
|
-
- features/steps/threaded_receiver_steps.rb
|
273
|
-
- features/steps/transactions_steps.rb
|
226
|
+
- features/steps/ack_and_nack_steps.rb
|
227
|
+
- features/steps/broker_steps.rb
|
228
|
+
- features/steps/client_steps.rb
|
229
|
+
- features/steps/receipt_steps.rb
|
230
|
+
- features/steps/scope_steps.rb
|
231
|
+
- features/steps/subscription_steps.rb
|
274
232
|
- features/subscribing.feature
|
275
233
|
- features/support/env.rb
|
276
234
|
- features/support/header_helpers.rb
|
@@ -300,7 +258,6 @@ test_files:
|
|
300
258
|
- spec/stomper/extensions/events_spec.rb
|
301
259
|
- spec/stomper/extensions/heartbeat_spec.rb
|
302
260
|
- spec/stomper/extensions/scoping_spec.rb
|
303
|
-
- spec/stomper/frame_serializer_1.8_spec.rb
|
304
261
|
- spec/stomper/frame_serializer_spec.rb
|
305
262
|
- spec/stomper/frame_spec.rb
|
306
263
|
- spec/stomper/headers_spec.rb
|
@@ -1,77 +0,0 @@
|
|
1
|
-
After do |s|
|
2
|
-
begin
|
3
|
-
@connection && @connection.stop
|
4
|
-
@broker && @broker.force_stop
|
5
|
-
rescue Exception => ex
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
Given /^a (\d+\.\d+)?\s*connection between client and broker$/ do |version|
|
10
|
-
version ||= '1.0'
|
11
|
-
@broker_uri_string = "stomp:///"
|
12
|
-
@broker_uri = URI.parse(@broker_uri_string)
|
13
|
-
@broker = TestStompServer.new(version)
|
14
|
-
@broker.start
|
15
|
-
@connection = Stomper::Connection.new(@broker_uri)
|
16
|
-
@received_frames = []
|
17
|
-
@sent_frames = []
|
18
|
-
@connection.before_transmitting do |f, c|
|
19
|
-
@sent_frames << f
|
20
|
-
end
|
21
|
-
@connection.after_receiving do |f, c|
|
22
|
-
@received_frames << f
|
23
|
-
end
|
24
|
-
@connection.start
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
Given /^a Stomp (\d+\.\d+)?\s*broker$/ do |version|
|
29
|
-
version ||= '1.0'
|
30
|
-
@broker_uri_string = "stomp:///"
|
31
|
-
@broker_uri = URI.parse(@broker_uri_string)
|
32
|
-
@broker = TestStompServer.new(version)
|
33
|
-
@broker.start
|
34
|
-
@connection = Stomper::Connection.new(@broker_uri)
|
35
|
-
end
|
36
|
-
|
37
|
-
Given /^an erroring Stomp broker$/ do
|
38
|
-
@broker_uri_string = "stomp:///"
|
39
|
-
@broker_uri = URI.parse(@broker_uri_string)
|
40
|
-
@broker = TestStompServer.new('1.0')
|
41
|
-
@broker.session_class = TestStompServer::StompErrorOnConnectSession
|
42
|
-
@broker.start
|
43
|
-
@connection = Stomper::Connection.new(@broker_uri)
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
When /^a connection is created from the broker's URI$/ do
|
48
|
-
#@connection = Stomper::Connection.new(@broker_uri)
|
49
|
-
end
|
50
|
-
|
51
|
-
When /^a connection is created from the broker's URI string$/ do
|
52
|
-
@connection = Stomper::Connection.new(@broker_uri_string)
|
53
|
-
end
|
54
|
-
|
55
|
-
When /^the connection is told to connect$/ do
|
56
|
-
@connection.connect
|
57
|
-
end
|
58
|
-
|
59
|
-
Then /^the connection should be connected$/ do
|
60
|
-
@connection.connected?.should be_true
|
61
|
-
end
|
62
|
-
|
63
|
-
Then /^the connection should be using the (\d+\.\d+) protocol$/ do |version|
|
64
|
-
@connection.version.should == version
|
65
|
-
end
|
66
|
-
|
67
|
-
Then /^connecting should raise an unsupported protocol version error$/ do
|
68
|
-
lambda { @connection.connect }.should raise_error(Stomper::Errors::UnsupportedProtocolVersionError)
|
69
|
-
end
|
70
|
-
|
71
|
-
Then /^the (connection|client) should not be connected$/ do |arbitrary_name|
|
72
|
-
@connection.connected?.should be_false
|
73
|
-
end
|
74
|
-
|
75
|
-
Then /^connecting should raise an connect failed error$/ do
|
76
|
-
lambda { @connection.connect }.should raise_error(Stomper::Errors::ConnectFailedError)
|
77
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
Then /^the broker should have received an? "([^"]*)" frame$/ do |command|
|
2
|
-
Then "the broker should have received a \"#{command}\" frame with headers", table(%{
|
3
|
-
| header-name | header-value |
|
4
|
-
})
|
5
|
-
end
|
6
|
-
|
7
|
-
Then /^the broker should have received an? "([^"]*)" frame with headers$/ do |command, table|
|
8
|
-
headers = table_to_headers table
|
9
|
-
@broker.session.received_frames.any? do |f|
|
10
|
-
f.command == command && headers.all? { |(k,v)| headers[k] == f[k] }
|
11
|
-
end.should be_true
|
12
|
-
end
|
13
|
-
|
14
|
-
Then /^the client should have received an? "([^"]*)" frame with headers$/ do |command, table|
|
15
|
-
headers = table_to_headers table
|
16
|
-
@received_frames.any? do |f|
|
17
|
-
f.command == command && headers.all? { |(k,v)| headers[k] == f[k] }
|
18
|
-
end.should be_true
|
19
|
-
end
|
20
|
-
|
21
|
-
When /^the broker sends a "([^"]*)" frame with headers$/ do |command, table|
|
22
|
-
headers = table_to_headers table
|
23
|
-
@broker.session.send_frame command, headers
|
24
|
-
end
|
25
|
-
|
26
|
-
When /^the frame exchange is completed$/ do
|
27
|
-
@connection.disconnect(:receipt => 'TERMINATE_POLITELY_12345')
|
28
|
-
@connection.stop
|
29
|
-
@broker.stop
|
30
|
-
end
|
31
|
-
|
32
|
-
When /^the frame exchange is completed without client disconnect$/ do
|
33
|
-
@connection.stop
|
34
|
-
@broker.stop
|
35
|
-
end
|
36
|
-
|
37
|
-
When /^the client waits for (\d+) "([^"]*)" frames?$/ do |count, command|
|
38
|
-
count = count.to_i
|
39
|
-
Thread.pass while @received_frames.select { |f| f.command == command }.size < count
|
40
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
When /^a connection is established$/ do
|
2
|
-
@connection.connect
|
3
|
-
end
|
4
|
-
|
5
|
-
Given /^an unversioned Stomp broker$/ do
|
6
|
-
@broker_uri_string = "stomp:///"
|
7
|
-
@broker_uri = URI.parse(@broker_uri_string)
|
8
|
-
@broker = TestStompServer.new(nil)
|
9
|
-
@broker.start
|
10
|
-
@connection = Stomper::Connection.new(@broker_uri)
|
11
|
-
end
|
12
|
-
|
13
|
-
When /^the client protocol version is "([^"]*)"$/ do |arg1|
|
14
|
-
@connection.versions = arg1.split(",")
|
15
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
Given /^a Stomp (\d+\.\d+)?\s*SSL broker$/ do |version|
|
2
|
-
@broker = TestSSLStompServer.new(version)
|
3
|
-
@broker.start
|
4
|
-
end
|
5
|
-
|
6
|
-
When /^a connection is created for the SSL broker$/ do
|
7
|
-
@connection = Stomper::Connection.new("stomp+ssl:///")
|
8
|
-
end
|
9
|
-
|
10
|
-
When /^the broker's host is "([^"]*)"$/ do |hostname|
|
11
|
-
@connection.host = hostname
|
12
|
-
end
|
13
|
-
|
14
|
-
When /^no SSL verification is performed$/ do
|
15
|
-
@connection.ssl[:verify_mode] = OpenSSL::SSL::VERIFY_NONE
|
16
|
-
end
|
17
|
-
|
18
|
-
When /^SSL verification is performed$/ do
|
19
|
-
@connection.ssl[:verify_mode] = ::OpenSSL::SSL::VERIFY_PEER | ::OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
20
|
-
end
|
21
|
-
|
22
|
-
When /^an SSL post connection check is performed on "([^"]*)"$/ do |host|
|
23
|
-
@connection.ssl[:post_connection_check] = host
|
24
|
-
end
|
25
|
-
|
26
|
-
Then /^connecting should raise an openssl error$/ do
|
27
|
-
lambda { @connection.connect }.should raise_error(OpenSSL::SSL::SSLError)
|
28
|
-
# It is problematic that this is needed...
|
29
|
-
@broker.stop
|
30
|
-
end
|
31
|
-
|
32
|
-
When /^an SSL post connection check is not performed$/ do
|
33
|
-
@connection.ssl[:post_connection_check] = false
|
34
|
-
end
|
35
|
-
|
36
|
-
When /^the broker's certificate is verified by CA$/ do
|
37
|
-
@connection.ssl[:ca_file] = File.expand_path('../../support/ssl/demoCA/cacert.pem', __FILE__)
|
38
|
-
end
|
39
|
-
|
40
|
-
When /^the client's certificate and key are specified$/ do
|
41
|
-
@connection.ssl[:cert] = OpenSSL::X509::Certificate.new(File.read(File.expand_path('../../support/ssl/client_cert.pem', __FILE__)))
|
42
|
-
@connection.ssl[:key] = OpenSSL::PKey::RSA.new(File.read(File.expand_path('../../support/ssl/client_key.pem', __FILE__)))
|
43
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
Given /^the client subscribes to (\/.*)$/ do |dest|
|
2
|
-
@messages_for_subscription ||= []
|
3
|
-
@connection.subscribe(dest) do |m|
|
4
|
-
sub = m[:subscription]
|
5
|
-
@messages_for_subscription << m
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^the client sends a "([^"]*)" "([^"]*)" to (\/.*)$/ do |ct, body, dest|
|
10
|
-
@connection.send(dest, body, :'content-type' => ct)
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^the client should have received a "([^"]*)" message of "([^"]*)"$/ do |ct, body|
|
14
|
-
@messages_for_subscription.any? do |m|
|
15
|
-
m.content_type == ct && m.body == body
|
16
|
-
end.should be_true
|
17
|
-
end
|
18
|
-
|
19
|
-
When /^the client sends a "([^"]*)" encoded as "([^"]*)" to (\/.*)$/ do |body, enc, dest|
|
20
|
-
body.force_encoding(enc) if body.respond_to?(:force_encoding)
|
21
|
-
@connection.send(dest, body)
|
22
|
-
end
|
23
|
-
|
24
|
-
Then /^the client should have received a "([^"]*)" message of "([^"]*)" encoded as "([^"]*)"$/ do |ct, body, enc|
|
25
|
-
@messages_for_subscription.any? do |m|
|
26
|
-
ct_check = (m.content_type == ct || m.content_type.nil? && ct.empty?)
|
27
|
-
b_check = body == m.body
|
28
|
-
if body.respond_to?(:encoding)
|
29
|
-
ct_check && b_check && m.body.encoding.name == enc
|
30
|
-
else
|
31
|
-
ct_check && b_check
|
32
|
-
end
|
33
|
-
end.should be_true
|
34
|
-
end
|
35
|
-
|
@@ -1,36 +0,0 @@
|
|
1
|
-
When /^the client subscribes to "([^"]*)" with headers$/ do |dest, table|
|
2
|
-
@subscribe_frames ||= []
|
3
|
-
headers = table_to_headers table
|
4
|
-
@default_subscription_triggered = 0
|
5
|
-
@subscribe_frames << @connection.subscribe(dest, headers) do |m|
|
6
|
-
@default_subscription_triggered += 1
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
Then /^the default subscription callback should have been triggered( (\d+) times?)?$/ do |full, times|
|
11
|
-
if times.nil? || times.empty?
|
12
|
-
@default_subscription_triggered.should >= 1
|
13
|
-
else
|
14
|
-
@default_subscription_triggered.should == times.to_i
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Then /^the default subscription callback should not have been triggered$/ do
|
19
|
-
@default_subscription_triggered.should == 0
|
20
|
-
end
|
21
|
-
|
22
|
-
When /^the client unsubscribes by ID$/ do
|
23
|
-
@connection.unsubscribe(@subscribe_frames.last[:id])
|
24
|
-
end
|
25
|
-
|
26
|
-
When /^the client unsubscribes by destination$/ do
|
27
|
-
@connection.unsubscribe(@subscribe_frames.last[:destination])
|
28
|
-
end
|
29
|
-
|
30
|
-
When /^the client unsubscribes by frame$/ do
|
31
|
-
@connection.unsubscribe(@subscribe_frames.last)
|
32
|
-
end
|
33
|
-
|
34
|
-
When /^the client unsubscribes from destination "([^"]*)"$/ do |destination|
|
35
|
-
@connection.unsubscribe(destination)
|
36
|
-
end
|
File without changes
|