stomper 0.4 → 1.0.0
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 +7 -0
- data/README.rdoc +63 -11
- data/lib/stomper.rb +13 -1
- data/lib/stomper/client.rb +3 -284
- data/lib/stomper/connection.rb +67 -114
- data/lib/stomper/frame_reader.rb +73 -0
- data/lib/stomper/frame_writer.rb +21 -0
- data/lib/stomper/frames.rb +24 -9
- data/lib/stomper/frames/abort.rb +2 -6
- data/lib/stomper/frames/ack.rb +2 -6
- data/lib/stomper/frames/begin.rb +2 -5
- data/lib/stomper/frames/client_frame.rb +30 -27
- data/lib/stomper/frames/commit.rb +1 -5
- data/lib/stomper/frames/connect.rb +2 -7
- data/lib/stomper/frames/connected.rb +11 -8
- data/lib/stomper/frames/disconnect.rb +1 -4
- data/lib/stomper/frames/error.rb +3 -8
- data/lib/stomper/frames/message.rb +15 -11
- data/lib/stomper/frames/receipt.rb +1 -6
- data/lib/stomper/frames/send.rb +1 -5
- data/lib/stomper/frames/server_frame.rb +13 -23
- data/lib/stomper/frames/subscribe.rb +9 -14
- data/lib/stomper/frames/unsubscribe.rb +3 -7
- data/lib/stomper/open_uri_interface.rb +41 -0
- data/lib/stomper/receipt_handlers.rb +23 -0
- data/lib/stomper/receiptor.rb +38 -0
- data/lib/stomper/sockets.rb +37 -0
- data/lib/stomper/subscriber.rb +76 -0
- data/lib/stomper/subscription.rb +14 -14
- data/lib/stomper/threaded_receiver.rb +59 -0
- data/lib/stomper/transaction.rb +13 -8
- data/lib/stomper/transactor.rb +50 -0
- data/lib/stomper/uri.rb +55 -0
- data/spec/client_spec.rb +7 -158
- data/spec/connection_spec.rb +13 -3
- data/spec/frame_reader_spec.rb +37 -0
- data/spec/frame_writer_spec.rb +27 -0
- data/spec/frames/client_frame_spec.rb +22 -98
- data/spec/frames/indirect_frame_spec.rb +45 -0
- data/spec/frames/server_frame_spec.rb +15 -16
- data/spec/open_uri_interface_spec.rb +132 -0
- data/spec/receiptor_spec.rb +35 -0
- data/spec/shared_connection_examples.rb +12 -17
- data/spec/spec_helper.rb +6 -0
- data/spec/subscriber_spec.rb +77 -0
- data/spec/subscription_spec.rb +11 -11
- data/spec/subscriptions_spec.rb +3 -6
- data/spec/threaded_receiver_spec.rb +33 -0
- data/spec/transaction_spec.rb +5 -5
- data/spec/transactor_spec.rb +46 -0
- metadata +30 -6
- data/lib/stomper/frames/headers.rb +0 -68
- data/spec/frames/headers_spec.rb +0 -54
@@ -2,27 +2,27 @@ shared_examples_for "All Client Connections" do
|
|
2
2
|
describe "connection initializers" do
|
3
3
|
describe "from uri" do
|
4
4
|
it "should accept the stomp:/// uri (no host specified)" do
|
5
|
-
lambda { @connection.class.new("stomp:///"
|
5
|
+
lambda { @connection.class.new("stomp:///") }.should_not raise_error
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should accept a uri specifying just the host" do
|
9
|
-
lambda { @connection.class.new("stomp://localhost/"
|
9
|
+
lambda { @connection.class.new("stomp://localhost/") }.should_not raise_error
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should accept a uri specifying host and port" do
|
13
|
-
lambda { @connection.class.new("stomp://localhost:61613/"
|
13
|
+
lambda { @connection.class.new("stomp://localhost:61613/") }.should_not raise_error
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should accept a uri specifying host, port and credentials" do
|
17
|
-
lambda { @connection.class.new("stomp://test_user:s3cr3tz@localhost:61613/"
|
17
|
+
lambda { @connection.class.new("stomp://test_user:s3cr3tz@localhost:61613/") }.should_not raise_error
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should accept a uri specifying a secure connection" do
|
21
|
-
lambda { @connection.class.new("stomp+ssl://localhost"
|
21
|
+
lambda { @connection.class.new("stomp+ssl://localhost") }.should_not raise_error
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should not accept a bogus URI" do
|
25
|
-
lambda { @connection.class.new("stomp://localhost:garbage"
|
25
|
+
lambda { @connection.class.new("stomp://localhost:garbage") }.should raise_error
|
26
26
|
end
|
27
27
|
|
28
28
|
end
|
@@ -67,18 +67,13 @@ shared_examples_for "All Client Connections" do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
describe "
|
71
|
-
|
72
|
-
|
70
|
+
describe "exception handling" do
|
71
|
+
it "should close and propagate when an exception is raised on transmit" do
|
72
|
+
pending
|
73
73
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
@connection.transmit(Stomper::Frames::Subscribe.new("/topic/test_topic"))
|
78
|
-
@connection.transmit(Stomper::Frames::Send.new("/topic/test_topic", "hello"))
|
79
|
-
@frame = @connection.receive while @frame.nil?
|
80
|
-
@frame.should be_an_instance_of(Stomper::Frames::Message)
|
81
|
-
@frame.body.should == "hello"
|
74
|
+
|
75
|
+
it "should close and propagate when an exception is raised on receive" do
|
76
|
+
pending
|
82
77
|
end
|
83
78
|
end
|
84
79
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,77 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
2
|
+
|
3
|
+
module Stomper
|
4
|
+
describe Subscriber do
|
5
|
+
class MockConcreteSubscriber
|
6
|
+
include Stomper::Subscriber
|
7
|
+
end
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@client = MockConcreteSubscriber.new
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "expected interface" do
|
14
|
+
it "should provide a subscribe method" do
|
15
|
+
@client.should respond_to(:subscribe)
|
16
|
+
@client.should_receive(:transmit).with(an_instance_of(Stomper::Frames::Subscribe)).twice.and_return(nil)
|
17
|
+
@client.subscribe("/queue/to", {:additional => 'header'})
|
18
|
+
@client.subscribe("/queue/to")
|
19
|
+
end
|
20
|
+
it "should provide an unsubscribe method" do
|
21
|
+
@client.should respond_to(:unsubscribe)
|
22
|
+
@client.should_receive(:transmit).with(an_instance_of(Stomper::Frames::Subscribe)).twice.and_return(nil)
|
23
|
+
@client.subscribe("/queue/to", {:id => 'subscription-id'})
|
24
|
+
@client.subscribe("/queue/to")
|
25
|
+
@client.should_receive(:transmit).with(an_instance_of(Stomper::Frames::Unsubscribe)).twice.and_return(nil)
|
26
|
+
@client.unsubscribe("/queue/to", 'subscription-id')
|
27
|
+
@client.unsubscribe("/queue/to")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "subscribing to queue" do
|
32
|
+
before(:each) do
|
33
|
+
@message_sent = Stomper::Frames::Message.new({:destination => "/queue/test"}, "test message")
|
34
|
+
@client.should_receive(:connected?).any_number_of_times.and_return(true)
|
35
|
+
@client.should_receive(:transmit).with(a_kind_of(Stomper::Frames::ClientFrame)).at_least(:once).and_return(nil)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should subscribe to a destination with a block" do
|
39
|
+
@client.should_receive(:receive_without_message_dispatch).once.and_return(@message_sent)
|
40
|
+
@message_received = nil
|
41
|
+
@client.subscribe("/queue/test") do |msg|
|
42
|
+
@message_received = msg
|
43
|
+
end
|
44
|
+
@client.receive_with_message_dispatch
|
45
|
+
@message_received.should == @message_sent
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should not unsubscribe from all destinations when a subscription id is provided" do
|
49
|
+
@client.subscribe("/queue/test", { :id => 'subscription-1' }) do |msg|
|
50
|
+
@message_received = msg
|
51
|
+
end
|
52
|
+
@client.subscribe("/queue/test") do |msg|
|
53
|
+
@message_received = msg
|
54
|
+
end
|
55
|
+
@client.subscribe("/queue/test", :id => 'subscription-2') do |msg|
|
56
|
+
@message_received = msg
|
57
|
+
end
|
58
|
+
@client.unsubscribe("/queue/test", 'subscription-1')
|
59
|
+
@client.subscriptions.size.should == 2
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should not unsubscribe from non-naive subscriptions when only a destination is supplied" do
|
63
|
+
@client.subscribe("/queue/test", { :id => 'subscription-1' }) do |msg|
|
64
|
+
@message_received = msg
|
65
|
+
end
|
66
|
+
@client.subscribe("/queue/test") do |msg|
|
67
|
+
@message_received = msg
|
68
|
+
end
|
69
|
+
@client.subscribe("/queue/test") do |msg|
|
70
|
+
@message_received = msg
|
71
|
+
end
|
72
|
+
@client.unsubscribe("/queue/test")
|
73
|
+
@client.subscriptions.size.should == 1
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/spec/subscription_spec.rb
CHANGED
@@ -60,7 +60,7 @@ module Stomper
|
|
60
60
|
it "should accept a message without a subscription header only when the subscription is 'naive'" do
|
61
61
|
@matching_subscription_1 = Subscription.new("/queue/test/1")
|
62
62
|
@matching_subscription_2 = Subscription.new("/queue/test/1", nil, :auto)
|
63
|
-
@message = Stomper::Frames::Message.new({
|
63
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1'},"test message")
|
64
64
|
@subscription.accepts?(@message).should be_false
|
65
65
|
@matching_subscription_1.accepts?(@message).should be_true
|
66
66
|
@matching_subscription_2.accepts?(@message).should be_true
|
@@ -68,34 +68,34 @@ module Stomper
|
|
68
68
|
|
69
69
|
it "should be able to accept messages by destination" do
|
70
70
|
@non_matching_subscription = Subscription.new("/queue/test/another")
|
71
|
-
@message = Stomper::Frames::Message.new({
|
71
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1', :subscription => @subscription.id},"test message")
|
72
72
|
@subscription.accepts?(@message).should be_true
|
73
73
|
@non_matching_subscription.accepts?(@message).should be_false
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should accept messages only if the same destination and subscription" do
|
77
77
|
@alternate_subscription = Subscription.new("/queue/test/1", 'subscription-2')
|
78
|
-
@message = Stomper::Frames::Message.new({
|
78
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1', :subscription => @subscription.id},"test message")
|
79
79
|
@subscription.accepts?(@message).should be_true
|
80
80
|
@alternate_subscription.accepts?(@message).should be_false
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should accept messages by the subscription id if the message has a subscription" do
|
84
84
|
@non_matching_subscription = Subscription.new("/queue/test/1")
|
85
|
-
@message = Stomper::Frames::Message.new({
|
85
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1', :subscription => @subscription.id},"test message")
|
86
86
|
@subscription.accepts?(@message).should be_true
|
87
87
|
@non_matching_subscription.accepts?(@message).should be_false
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should not accept messages with the same destination when its ack mode is not 'auto' and no subscription header was specified" do
|
91
91
|
@non_matching_subscription = Subscription.new("/queue/test/1", nil, 'client')
|
92
|
-
@message = Stomper::Frames::Message.new({
|
92
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1'},"test message")
|
93
93
|
@non_matching_subscription.accepts?(@message).should be_false
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should not accept messages with the same destination when it has a selector and no subscription header was specified" do
|
97
97
|
@non_matching_subscription = Subscription.new("/queue/test/1", nil, 'auto', 'rating > 3.0')
|
98
|
-
@message = Stomper::Frames::Message.new({
|
98
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1'},"test message")
|
99
99
|
@non_matching_subscription.accepts?(@message).should be_false
|
100
100
|
end
|
101
101
|
|
@@ -107,7 +107,7 @@ module Stomper
|
|
107
107
|
# To test this without insisting that the #id field be equivalent to the subscribe frame's header
|
108
108
|
# go this way:
|
109
109
|
|
110
|
-
@message = Stomper::Frames::Message.new({
|
110
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1', :subscription => @non_matching_subscription.id},"test message")
|
111
111
|
@non_matching_subscription.accepts?(@message).should be_true
|
112
112
|
end
|
113
113
|
end
|
@@ -118,14 +118,14 @@ module Stomper
|
|
118
118
|
@subscription_with_block = Subscription.new("/queue/test/1", 'subscription-test') do |msg|
|
119
119
|
called_back = (msg == @message)
|
120
120
|
end
|
121
|
-
@message = Stomper::Frames::Message.new({
|
121
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1', :subscription => @subscription_with_block.id},"test message")
|
122
122
|
@subscription_with_block.perform(@message)
|
123
123
|
called_back.should be_true
|
124
124
|
end
|
125
125
|
|
126
126
|
it "should not call its callback when given a message for a different destination" do
|
127
127
|
called_back = false
|
128
|
-
@message = Stomper::Frames::Message.new({
|
128
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1'},"test message")
|
129
129
|
@subscription_with_block = Subscription.new("/queue/test/another", 'subscription-test') do |msg|
|
130
130
|
called_back = (msg == @message)
|
131
131
|
end
|
@@ -138,14 +138,14 @@ module Stomper
|
|
138
138
|
@subscription_with_block = Subscription.new("/queue/test/another", 'subscription-test') do |msg|
|
139
139
|
called_back = (msg == @message)
|
140
140
|
end
|
141
|
-
@message = Stomper::Frames::Message.new({
|
141
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1', :subscription => @subscription_with_block.id},"test message")
|
142
142
|
@subscription_with_block.perform(@message)
|
143
143
|
called_back.should be_true
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should not call its callback when a message arrives for its subscription id, even on the same " do
|
147
147
|
called_back = false
|
148
|
-
@message = Stomper::Frames::Message.new({
|
148
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1', :subscription => 'subscription-not-test'},"test message")
|
149
149
|
@subscription_with_block = Subscription.new("/queue/test/another", 'subscription-test') do |msg|
|
150
150
|
called_back = (msg == @message)
|
151
151
|
end
|
data/spec/subscriptions_spec.rb
CHANGED
@@ -48,14 +48,11 @@ module Stomper
|
|
48
48
|
@subscriptions << Subscription.new("/queue/test/1")
|
49
49
|
@subscriptions << Subscription.new("/queue/test/2")
|
50
50
|
@subscriptions << Subscription.new("/queue/test/3")
|
51
|
-
Thread.new { sleep(0.1); @subscriptions.remove("/queue/test/1") }
|
52
|
-
# In general, this next step should execute before the thread has a chance to
|
53
|
-
# but the sleep in the map should mean that our thread gets woken up before
|
54
|
-
# map finishes. However, destinations should NEVER contain "/queue/test/4"
|
55
|
-
# because map should be synchronized.
|
51
|
+
sync_thread = Thread.new { sleep(0.1); @subscriptions.remove("/queue/test/1") }
|
56
52
|
destinations = @subscriptions.map { |sub| sleep(0.1); sub.destination }
|
57
53
|
destinations.size.should == 3
|
58
54
|
destinations.should == ['/queue/test/1', '/queue/test/2', '/queue/test/3']
|
55
|
+
sync_thread.join
|
59
56
|
@subscriptions.size.should == 2
|
60
57
|
@subscriptions.first.destination.should == "/queue/test/2"
|
61
58
|
end
|
@@ -70,7 +67,7 @@ module Stomper
|
|
70
67
|
@subscriptions << Subscription.new("/queue/test/1") { |msg| received_1 = true }
|
71
68
|
@subscriptions << Subscription.new("/queue/test/1", 'subscription-2') { |msg| received_2 = true }
|
72
69
|
@subscriptions << Subscription.new("/queue/test/2") { |msg| received_3 = true }
|
73
|
-
@message = Stomper::Frames::Message.new({
|
70
|
+
@message = Stomper::Frames::Message.new({:destination => '/queue/test/1'},"test message")
|
74
71
|
@subscriptions.perform(@message)
|
75
72
|
received_1.should be_true
|
76
73
|
received_2.should be_false
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
module Stomper
|
4
|
+
describe ThreadedReceiver do
|
5
|
+
before(:each) do
|
6
|
+
@connection = mock("connection")
|
7
|
+
@connection.extend Stomper::ThreadedReceiver
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "expected interface" do
|
11
|
+
it "should provide a start method" do
|
12
|
+
@connection.should respond_to(:start)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should provide a stop method" do
|
16
|
+
@connection.should respond_to(:stop)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "reading on a thread" do
|
21
|
+
it "should start receiving when started, and stop when stopped." do
|
22
|
+
@connection.should_receive(:connected?).once.and_return(false)
|
23
|
+
@connection.should_receive(:connect).once.and_return(true)
|
24
|
+
@connection.should_receive(:connected?).any_number_of_times.and_return(true)
|
25
|
+
@connection.should_receive(:receive).at_least(:once).and_return(nil)
|
26
|
+
@connection.start
|
27
|
+
sleep(0.5)
|
28
|
+
@connection.stop
|
29
|
+
@connection.should_not_receive(:receive)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/transaction_spec.rb
CHANGED
@@ -35,7 +35,7 @@ module Stomper
|
|
35
35
|
before(:each) do
|
36
36
|
@transaction_name = "tx-test"
|
37
37
|
@mock_client.should_receive(:begin).once.with(@transaction_name).and_return(nil)
|
38
|
-
@mock_client.should_receive(:send).once.with("/queue/test/1","test message", hash_including(
|
38
|
+
@mock_client.should_receive(:send).once.with("/queue/test/1","test message", hash_including(:transaction => @transaction_name)).and_return(nil)
|
39
39
|
@mock_client.should_receive(:commit).once.with(@transaction_name).and_return(nil)
|
40
40
|
end
|
41
41
|
|
@@ -50,7 +50,7 @@ module Stomper
|
|
50
50
|
before(:each) do
|
51
51
|
@transaction_name = "tx-test-2"
|
52
52
|
@mock_client.should_receive(:begin).once.with(@transaction_name).and_return(nil)
|
53
|
-
@mock_client.should_receive(:send).once.with("/queue/test/1","test message", hash_including(
|
53
|
+
@mock_client.should_receive(:send).once.with("/queue/test/1","test message", hash_including(:transaction => @transaction_name)).and_return(nil)
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should abort when an exception is raised" do
|
@@ -97,8 +97,8 @@ module Stomper
|
|
97
97
|
@inner_inner_transaction_name = "#{@transaction_name}-inner-inner"
|
98
98
|
@mock_client.should_receive(:begin).with(@transaction_name).once.and_return(nil)
|
99
99
|
@mock_client.should_receive(:begin).with(@inner_transaction_name).once.and_return(nil)
|
100
|
-
@mock_client.should_receive(:send).with("/queue/test/1","test message", hash_including(
|
101
|
-
@mock_client.should_receive(:send).with("/queue/test/2","inner message", hash_including(
|
100
|
+
@mock_client.should_receive(:send).with("/queue/test/1","test message", hash_including(:transaction => @transaction_name)).once.and_return(nil)
|
101
|
+
@mock_client.should_receive(:send).with("/queue/test/2","inner message", hash_including(:transaction => @inner_transaction_name)).once.and_return(nil)
|
102
102
|
end
|
103
103
|
it "no transaction should succeed when an inner one fails" do
|
104
104
|
@mock_client.should_receive(:abort).once.with(@transaction_name).and_return(nil)
|
@@ -116,7 +116,7 @@ module Stomper
|
|
116
116
|
end
|
117
117
|
it "no transaction should succeed when an inner one is explicitly aborted" do
|
118
118
|
@mock_client.should_receive(:begin).with(@inner_inner_transaction_name).once.and_return(nil)
|
119
|
-
@mock_client.should_receive(:send).with("/queue/test/3","inner-inner message", hash_including(
|
119
|
+
@mock_client.should_receive(:send).with("/queue/test/3","inner-inner message", hash_including(:transaction => @inner_inner_transaction_name)).once.and_return(nil)
|
120
120
|
@mock_client.should_receive(:abort).once.with(@transaction_name).and_return(nil)
|
121
121
|
@mock_client.should_receive(:abort).once.with(@inner_transaction_name).and_return(nil)
|
122
122
|
@mock_client.should_receive(:abort).once.with(@inner_inner_transaction_name).and_return(nil)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
2
|
+
|
3
|
+
module Stomper
|
4
|
+
describe Transactor do
|
5
|
+
class MockConcreteTransactor
|
6
|
+
include Stomper::Transactor
|
7
|
+
end
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@client = MockConcreteTransactor.new
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "expected interface" do
|
14
|
+
it "should provide a transaction method" do
|
15
|
+
@client.should respond_to(:transaction)
|
16
|
+
end
|
17
|
+
it "should provide a begin method" do
|
18
|
+
@client.should respond_to(:begin)
|
19
|
+
@client.should_receive(:transmit).with(an_instance_of(Stomper::Frames::Begin)).once.and_return(nil)
|
20
|
+
@client.begin("tx-001")
|
21
|
+
end
|
22
|
+
it "should proivde an abort method" do
|
23
|
+
@client.should respond_to(:abort)
|
24
|
+
@client.should_receive(:transmit).with(an_instance_of(Stomper::Frames::Abort)).once.and_return(nil)
|
25
|
+
@client.abort("tx-001")
|
26
|
+
end
|
27
|
+
it "should provide a commit method" do
|
28
|
+
@client.should respond_to(:commit)
|
29
|
+
@client.should_receive(:transmit).with(an_instance_of(Stomper::Frames::Commit)).once.and_return(nil)
|
30
|
+
@client.commit("tx-001")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "transactions" do
|
35
|
+
it "should provide a transaction method that generates a new Transaction" do
|
36
|
+
@client.should_receive(:begin)
|
37
|
+
@client.should_receive(:commit)
|
38
|
+
@evaluated = false
|
39
|
+
@client.transaction do |t|
|
40
|
+
@evaluated = true
|
41
|
+
end
|
42
|
+
@evaluated.should be_true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
metadata
CHANGED
@@ -3,9 +3,10 @@ name: stomper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
+
- 1
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
version:
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
9
10
|
platform: ruby
|
10
11
|
authors:
|
11
12
|
- Ian D. Eccles
|
@@ -13,7 +14,7 @@ autorequire:
|
|
13
14
|
bindir: bin
|
14
15
|
cert_chain: []
|
15
16
|
|
16
|
-
date: 2010-
|
17
|
+
date: 2010-09-27 00:00:00 -04:00
|
17
18
|
default_executable:
|
18
19
|
dependencies: []
|
19
20
|
|
@@ -30,10 +31,18 @@ extra_rdoc_files:
|
|
30
31
|
- LICENSE
|
31
32
|
- AUTHORS
|
32
33
|
files:
|
34
|
+
- lib/stomper/receiptor.rb
|
33
35
|
- lib/stomper/subscription.rb
|
36
|
+
- lib/stomper/transactor.rb
|
37
|
+
- lib/stomper/receipt_handlers.rb
|
38
|
+
- lib/stomper/frame_reader.rb
|
34
39
|
- lib/stomper/frames.rb
|
40
|
+
- lib/stomper/subscriber.rb
|
35
41
|
- lib/stomper/transaction.rb
|
42
|
+
- lib/stomper/threaded_receiver.rb
|
43
|
+
- lib/stomper/sockets.rb
|
36
44
|
- lib/stomper/subscriptions.rb
|
45
|
+
- lib/stomper/uri.rb
|
37
46
|
- lib/stomper/frames/send.rb
|
38
47
|
- lib/stomper/frames/receipt.rb
|
39
48
|
- lib/stomper/frames/ack.rb
|
@@ -46,23 +55,31 @@ files:
|
|
46
55
|
- lib/stomper/frames/begin.rb
|
47
56
|
- lib/stomper/frames/unsubscribe.rb
|
48
57
|
- lib/stomper/frames/connect.rb
|
49
|
-
- lib/stomper/frames/headers.rb
|
50
58
|
- lib/stomper/frames/abort.rb
|
51
59
|
- lib/stomper/frames/commit.rb
|
52
60
|
- lib/stomper/frames/subscribe.rb
|
61
|
+
- lib/stomper/frame_writer.rb
|
53
62
|
- lib/stomper/client.rb
|
54
63
|
- lib/stomper/connection.rb
|
64
|
+
- lib/stomper/open_uri_interface.rb
|
55
65
|
- lib/stomper.rb
|
66
|
+
- spec/threaded_receiver_spec.rb
|
67
|
+
- spec/open_uri_interface_spec.rb
|
68
|
+
- spec/frame_writer_spec.rb
|
56
69
|
- spec/subscriptions_spec.rb
|
70
|
+
- spec/frame_reader_spec.rb
|
57
71
|
- spec/spec_helper.rb
|
72
|
+
- spec/transactor_spec.rb
|
58
73
|
- spec/shared_connection_examples.rb
|
59
74
|
- spec/spec.opts
|
75
|
+
- spec/receiptor_spec.rb
|
60
76
|
- spec/frames/server_frame_spec.rb
|
61
77
|
- spec/frames/client_frame_spec.rb
|
62
|
-
- spec/frames/
|
78
|
+
- spec/frames/indirect_frame_spec.rb
|
63
79
|
- spec/connection_spec.rb
|
64
80
|
- spec/subscription_spec.rb
|
65
81
|
- spec/client_spec.rb
|
82
|
+
- spec/subscriber_spec.rb
|
66
83
|
- spec/transaction_spec.rb
|
67
84
|
- README.rdoc
|
68
85
|
- CHANGELOG
|
@@ -107,14 +124,21 @@ signing_key:
|
|
107
124
|
specification_version: 3
|
108
125
|
summary: Ruby client for the stomp messaging protocol derived from the original stomp gem
|
109
126
|
test_files:
|
127
|
+
- spec/threaded_receiver_spec.rb
|
128
|
+
- spec/open_uri_interface_spec.rb
|
129
|
+
- spec/frame_writer_spec.rb
|
110
130
|
- spec/subscriptions_spec.rb
|
131
|
+
- spec/frame_reader_spec.rb
|
111
132
|
- spec/spec_helper.rb
|
133
|
+
- spec/transactor_spec.rb
|
112
134
|
- spec/shared_connection_examples.rb
|
113
135
|
- spec/spec.opts
|
136
|
+
- spec/receiptor_spec.rb
|
114
137
|
- spec/frames/server_frame_spec.rb
|
115
138
|
- spec/frames/client_frame_spec.rb
|
116
|
-
- spec/frames/
|
139
|
+
- spec/frames/indirect_frame_spec.rb
|
117
140
|
- spec/connection_spec.rb
|
118
141
|
- spec/subscription_spec.rb
|
119
142
|
- spec/client_spec.rb
|
143
|
+
- spec/subscriber_spec.rb
|
120
144
|
- spec/transaction_spec.rb
|