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 +3 -0
- data/{CHANGELOG → CHANGELOG.rdoc} +7 -0
- data/README.rdoc +16 -0
- data/Rakefile +43 -27
- data/examples/consumer.rb +19 -0
- data/examples/publisher.rb +17 -0
- data/lib/stomp.rb +5 -5
- data/lib/stomp/client.rb +17 -7
- data/lib/stomp/connection.rb +20 -9
- data/lib/stomp/version.rb +8 -0
- data/spec/client_shared_examples.rb +55 -0
- data/spec/client_spec.rb +275 -0
- data/spec/connection_spec.rb +345 -0
- data/spec/message_spec.rb +56 -0
- data/spec/spec_helper.rb +14 -0
- data/stomp.gemspec +78 -0
- data/test/test_client.rb +17 -15
- data/test/test_connection.rb +15 -13
- metadata +37 -18
data/test/test_client.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
|
3
5
|
class TestClient < Test::Unit::TestCase
|
4
6
|
include TestBase
|
@@ -12,7 +14,7 @@ class TestClient < Test::Unit::TestCase
|
|
12
14
|
end
|
13
15
|
|
14
16
|
def test_ack_api_works
|
15
|
-
@client.
|
17
|
+
@client.publish destination, message_text, {:suppress_content_length => true}
|
16
18
|
|
17
19
|
received = nil
|
18
20
|
@client.subscribe(destination, {:ack => 'client'}) {|msg| received = msg}
|
@@ -28,7 +30,7 @@ class TestClient < Test::Unit::TestCase
|
|
28
30
|
def test_asynch_subscribe
|
29
31
|
received = false
|
30
32
|
@client.subscribe(destination) {|msg| received = msg}
|
31
|
-
@client.
|
33
|
+
@client.publish destination, message_text
|
32
34
|
sleep 0.01 until received
|
33
35
|
|
34
36
|
assert_equal message_text, received.body
|
@@ -36,7 +38,7 @@ class TestClient < Test::Unit::TestCase
|
|
36
38
|
|
37
39
|
# BROKEN
|
38
40
|
def test_noack
|
39
|
-
@client.
|
41
|
+
@client.publish destination, message_text
|
40
42
|
|
41
43
|
received = nil
|
42
44
|
@client.subscribe(destination, :ack => :client) {|msg| received = msg}
|
@@ -56,7 +58,7 @@ class TestClient < Test::Unit::TestCase
|
|
56
58
|
|
57
59
|
def test_receipts
|
58
60
|
receipt = false
|
59
|
-
@client.
|
61
|
+
@client.publish(destination, message_text) {|r| receipt = r}
|
60
62
|
sleep 0.1 until receipt
|
61
63
|
|
62
64
|
message = nil
|
@@ -75,8 +77,8 @@ class TestClient < Test::Unit::TestCase
|
|
75
77
|
@client = nil
|
76
78
|
end
|
77
79
|
|
78
|
-
def
|
79
|
-
@client.
|
80
|
+
def test_publish_then_sub
|
81
|
+
@client.publish destination, message_text
|
80
82
|
message = nil
|
81
83
|
@client.subscribe(destination) {|m| message = m}
|
82
84
|
sleep 0.01 until message
|
@@ -90,9 +92,9 @@ class TestClient < Test::Unit::TestCase
|
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
93
|
-
def
|
95
|
+
def test_transactional_publish
|
94
96
|
@client.begin 'tx1'
|
95
|
-
@client.
|
97
|
+
@client.publish destination, message_text, :transaction => 'tx1'
|
96
98
|
@client.commit 'tx1'
|
97
99
|
|
98
100
|
message = nil
|
@@ -102,13 +104,13 @@ class TestClient < Test::Unit::TestCase
|
|
102
104
|
assert_equal message_text, message.body
|
103
105
|
end
|
104
106
|
|
105
|
-
def
|
107
|
+
def test_transaction_publish_then_rollback
|
106
108
|
@client.begin 'tx1'
|
107
|
-
@client.
|
109
|
+
@client.publish destination, "first_message", :transaction => 'tx1'
|
108
110
|
@client.abort 'tx1'
|
109
111
|
|
110
112
|
@client.begin 'tx1'
|
111
|
-
@client.
|
113
|
+
@client.publish destination, "second_message", :transaction => 'tx1'
|
112
114
|
@client.commit 'tx1'
|
113
115
|
|
114
116
|
message = nil
|
@@ -118,7 +120,7 @@ class TestClient < Test::Unit::TestCase
|
|
118
120
|
end
|
119
121
|
|
120
122
|
def test_transaction_ack_rollback_with_new_client
|
121
|
-
@client.
|
123
|
+
@client.publish destination, message_text
|
122
124
|
|
123
125
|
@client.begin 'tx1'
|
124
126
|
message = nil
|
@@ -146,7 +148,7 @@ class TestClient < Test::Unit::TestCase
|
|
146
148
|
end
|
147
149
|
|
148
150
|
def test_transaction_with_client_side_redelivery
|
149
|
-
@client.
|
151
|
+
@client.publish destination, message_text
|
150
152
|
|
151
153
|
@client.begin 'tx1'
|
152
154
|
message = nil
|
@@ -177,7 +179,7 @@ class TestClient < Test::Unit::TestCase
|
|
177
179
|
message = nil
|
178
180
|
client = Stomp::Client.new(user, passcode, host, port, true)
|
179
181
|
client.subscribe(destination, :ack => 'client') { |m| message = m }
|
180
|
-
@client.
|
182
|
+
@client.publish destination, message_text
|
181
183
|
Timeout::timeout(4) do
|
182
184
|
sleep 0.01 until message
|
183
185
|
end
|
data/test/test_connection.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'test_helper'
|
2
4
|
|
3
5
|
class TestStomp < Test::Unit::TestCase
|
4
6
|
include TestBase
|
@@ -17,7 +19,7 @@ class TestStomp < Test::Unit::TestCase
|
|
17
19
|
|
18
20
|
def test_explicit_receive
|
19
21
|
@conn.subscribe make_destination
|
20
|
-
@conn.
|
22
|
+
@conn.publish make_destination, "test_stomp#test_explicit_receive"
|
21
23
|
msg = @conn.receive
|
22
24
|
assert_equal "test_stomp#test_explicit_receive", msg.body
|
23
25
|
end
|
@@ -40,14 +42,14 @@ class TestStomp < Test::Unit::TestCase
|
|
40
42
|
|
41
43
|
def test_client_ack_with_symbol
|
42
44
|
@conn.subscribe make_destination, :ack => :client
|
43
|
-
@conn.
|
45
|
+
@conn.publish make_destination, "test_stomp#test_client_ack_with_symbol"
|
44
46
|
msg = @conn.receive
|
45
47
|
@conn.ack msg.headers['message-id']
|
46
48
|
end
|
47
49
|
|
48
50
|
def test_embedded_null
|
49
51
|
@conn.subscribe make_destination
|
50
|
-
@conn.
|
52
|
+
@conn.publish make_destination, "a\0"
|
51
53
|
msg = @conn.receive
|
52
54
|
assert_equal "a\0" , msg.body
|
53
55
|
end
|
@@ -66,14 +68,14 @@ class TestStomp < Test::Unit::TestCase
|
|
66
68
|
|
67
69
|
def test_response_is_instance_of_message_class
|
68
70
|
@conn.subscribe make_destination
|
69
|
-
@conn.
|
71
|
+
@conn.publish make_destination, "a\0"
|
70
72
|
msg = @conn.receive
|
71
73
|
assert_instance_of Stomp::Message , msg
|
72
74
|
end
|
73
75
|
|
74
76
|
def test_message_to_s
|
75
77
|
@conn.subscribe make_destination
|
76
|
-
@conn.
|
78
|
+
@conn.publish make_destination, "a\0"
|
77
79
|
msg = @conn.receive
|
78
80
|
assert_match /^<Stomp::Message headers=/ , msg.to_s
|
79
81
|
end
|
@@ -84,8 +86,8 @@ class TestStomp < Test::Unit::TestCase
|
|
84
86
|
|
85
87
|
def test_messages_with_multipleLine_ends
|
86
88
|
@conn.subscribe make_destination
|
87
|
-
@conn.
|
88
|
-
@conn.
|
89
|
+
@conn.publish make_destination, "a\n\n"
|
90
|
+
@conn.publish make_destination, "b\n\na\n\n"
|
89
91
|
|
90
92
|
msg_a = @conn.receive
|
91
93
|
msg_b = @conn.receive
|
@@ -94,10 +96,10 @@ class TestStomp < Test::Unit::TestCase
|
|
94
96
|
assert_equal "b\n\na\n\n", msg_b.body
|
95
97
|
end
|
96
98
|
|
97
|
-
def
|
99
|
+
def test_publish_two_messages
|
98
100
|
@conn.subscribe make_destination
|
99
|
-
@conn.
|
100
|
-
@conn.
|
101
|
+
@conn.publish make_destination, "a\0"
|
102
|
+
@conn.publish make_destination, "b\0"
|
101
103
|
msg_a = @conn.receive
|
102
104
|
msg_b = @conn.receive
|
103
105
|
|
@@ -118,9 +120,9 @@ class TestStomp < Test::Unit::TestCase
|
|
118
120
|
sleep 0.01 while @conn.poll!=nil
|
119
121
|
|
120
122
|
@conn.begin "tx1"
|
121
|
-
@conn.
|
123
|
+
@conn.publish make_destination, "txn message", 'transaction' => "tx1"
|
122
124
|
|
123
|
-
@conn.
|
125
|
+
@conn.publish make_destination, "first message"
|
124
126
|
|
125
127
|
sleep 0.01
|
126
128
|
msg = @conn.receive
|
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.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian McCallister
|
@@ -11,10 +11,19 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2010-
|
14
|
+
date: 2010-03-17 00:00:00 -03:00
|
15
15
|
default_executable:
|
16
|
-
dependencies:
|
17
|
-
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: rspec
|
19
|
+
type: :development
|
20
|
+
version_requirement:
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: "0"
|
26
|
+
version:
|
18
27
|
description: Ruby client for the Stomp messaging protocol
|
19
28
|
email:
|
20
29
|
- brianm@apache.org
|
@@ -26,20 +35,31 @@ executables:
|
|
26
35
|
extensions: []
|
27
36
|
|
28
37
|
extra_rdoc_files:
|
29
|
-
- README.rdoc
|
30
|
-
- CHANGELOG
|
31
38
|
- LICENSE
|
32
|
-
files:
|
33
39
|
- README.rdoc
|
40
|
+
files:
|
41
|
+
- .gitignore
|
42
|
+
- CHANGELOG.rdoc
|
34
43
|
- LICENSE
|
35
|
-
-
|
44
|
+
- README.rdoc
|
36
45
|
- Rakefile
|
46
|
+
- bin/catstomp
|
47
|
+
- bin/stompcat
|
48
|
+
- examples/consumer.rb
|
49
|
+
- examples/publisher.rb
|
37
50
|
- lib/stomp.rb
|
38
51
|
- lib/stomp/client.rb
|
39
52
|
- lib/stomp/connection.rb
|
40
|
-
- lib/stomp/message.rb
|
41
53
|
- lib/stomp/errors.rb
|
42
54
|
- lib/stomp/ext/hash.rb
|
55
|
+
- lib/stomp/message.rb
|
56
|
+
- lib/stomp/version.rb
|
57
|
+
- spec/client_shared_examples.rb
|
58
|
+
- spec/client_spec.rb
|
59
|
+
- spec/connection_spec.rb
|
60
|
+
- spec/message_spec.rb
|
61
|
+
- spec/spec_helper.rb
|
62
|
+
- stomp.gemspec
|
43
63
|
- test/test_client.rb
|
44
64
|
- test/test_connection.rb
|
45
65
|
- test/test_helper.rb
|
@@ -49,15 +69,7 @@ licenses: []
|
|
49
69
|
|
50
70
|
post_install_message:
|
51
71
|
rdoc_options:
|
52
|
-
- --
|
53
|
-
- --title
|
54
|
-
- stomp documentation
|
55
|
-
- --opname
|
56
|
-
- index.html
|
57
|
-
- --line-numbers
|
58
|
-
- --main
|
59
|
-
- README.rdoc
|
60
|
-
- --inline-source
|
72
|
+
- --charset=UTF-8
|
61
73
|
require_paths:
|
62
74
|
- lib
|
63
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -80,6 +92,13 @@ signing_key:
|
|
80
92
|
specification_version: 3
|
81
93
|
summary: Ruby client for the Stomp messaging protocol
|
82
94
|
test_files:
|
95
|
+
- spec/client_shared_examples.rb
|
96
|
+
- spec/client_spec.rb
|
97
|
+
- spec/connection_spec.rb
|
98
|
+
- spec/message_spec.rb
|
99
|
+
- spec/spec_helper.rb
|
83
100
|
- test/test_client.rb
|
84
101
|
- test/test_connection.rb
|
85
102
|
- test/test_helper.rb
|
103
|
+
- examples/consumer.rb
|
104
|
+
- examples/publisher.rb
|