torquebox-messaging 3.2.0-java → 4.0.0.alpha1-java
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.
- checksums.yaml +4 -4
- data/lib/torquebox-messaging.rb +19 -20
- data/lib/torquebox/messaging.rb +80 -20
- data/lib/torquebox/messaging/context.rb +174 -0
- data/lib/torquebox/messaging/destination.rb +164 -215
- data/lib/torquebox/messaging/helpers.rb +34 -0
- data/lib/torquebox/messaging/hornetq.rb +70 -0
- data/lib/torquebox/messaging/hornetq/address_settings.rb +228 -0
- data/lib/torquebox/messaging/queue.rb +139 -301
- data/lib/torquebox/messaging/topic.rb +84 -46
- data/lib/wunderboss-jars/hornetq-commons-2.4.5.Final.jar +0 -0
- data/lib/wunderboss-jars/hornetq-core-client-2.4.5.Final.jar +0 -0
- data/lib/wunderboss-jars/hornetq-jms-client-2.4.5.Final.jar +0 -0
- data/lib/wunderboss-jars/hornetq-jms-server-2.4.5.Final.jar +0 -0
- data/lib/wunderboss-jars/hornetq-journal-2.4.5.Final.jar +0 -0
- data/lib/wunderboss-jars/hornetq-native-2.4.5.Final.jar +0 -0
- data/lib/wunderboss-jars/hornetq-server-2.4.5.Final.jar +0 -0
- data/lib/wunderboss-jars/javax.inject-1.jar +0 -0
- data/lib/wunderboss-jars/jboss-common-core-2.2.10.GA.jar +0 -0
- data/lib/wunderboss-jars/jboss-connector-api_1.5_spec-1.0.0.Final.jar +0 -0
- data/lib/wunderboss-jars/jboss-jms-api_2.0_spec-1.0.0.Final.jar +0 -0
- data/lib/wunderboss-jars/jboss-transaction-api_1.1_spec-1.0.0.Final.jar +0 -0
- data/lib/wunderboss-jars/jboss-transaction-spi-7.0.0.Final.jar +0 -0
- data/lib/wunderboss-jars/jnpserver-5.0.3.GA.jar +0 -0
- data/lib/wunderboss-jars/netty-all-4.0.13.Final.jar +0 -0
- data/lib/wunderboss-jars/wunderboss-messaging-1.x.incremental.174.jar +0 -0
- metadata +88 -98
- data/lib/gem_hook.rb +0 -51
- data/lib/hornetq-commons-2.3.1.Final.jar +0 -0
- data/lib/hornetq-core-client-2.3.1.Final.jar +0 -0
- data/lib/hornetq-jms-client-2.3.1.Final.jar +0 -0
- data/lib/hornetq-journal-2.3.1.Final.jar +0 -0
- data/lib/jboss-jms-api_1.1_spec-1.0.1.Final.jar +0 -0
- data/lib/jboss-logging-3.1.2.GA.jar +0 -0
- data/lib/jboss-logmanager-1.4.0.Final.jar +0 -0
- data/lib/jboss-transaction-api_1.1_spec-1.0.1.Final.jar +0 -0
- data/lib/netty-3.6.2.Final.jar +0 -0
- data/lib/org.torquebox.messaging-client.rb +0 -20
- data/lib/torquebox-messaging.jar +0 -0
- data/lib/torquebox/messaging/backgroundable.rb +0 -250
- data/lib/torquebox/messaging/backgroundable_processor.rb +0 -52
- data/lib/torquebox/messaging/connection.rb +0 -74
- data/lib/torquebox/messaging/connection_factory.rb +0 -115
- data/lib/torquebox/messaging/const_missing.rb +0 -28
- data/lib/torquebox/messaging/core.rb +0 -27
- data/lib/torquebox/messaging/datamapper_marshaling.rb +0 -43
- data/lib/torquebox/messaging/echo_processor.rb +0 -35
- data/lib/torquebox/messaging/edn_message.rb +0 -26
- data/lib/torquebox/messaging/ext/javax_jms_queue_browser.rb +0 -25
- data/lib/torquebox/messaging/future.rb +0 -131
- data/lib/torquebox/messaging/future_responder.rb +0 -109
- data/lib/torquebox/messaging/future_status.rb +0 -37
- data/lib/torquebox/messaging/json_message.rb +0 -26
- data/lib/torquebox/messaging/marshal_base64_message.rb +0 -26
- data/lib/torquebox/messaging/marshal_message.rb +0 -43
- data/lib/torquebox/messaging/message.rb +0 -137
- data/lib/torquebox/messaging/message_processor.rb +0 -209
- data/lib/torquebox/messaging/processor_middleware/chain.rb +0 -89
- data/lib/torquebox/messaging/processor_middleware/default_middleware.rb +0 -39
- data/lib/torquebox/messaging/processor_middleware/with_transaction.rb +0 -35
- data/lib/torquebox/messaging/session.rb +0 -173
- data/lib/torquebox/messaging/task.rb +0 -66
- data/lib/torquebox/messaging/text_message.rb +0 -36
- data/lib/torquebox/messaging/xa_connection.rb +0 -55
- data/lib/torquebox/messaging/xa_connection_factory.rb +0 -45
- data/lib/torquebox/messaging/xa_session.rb +0 -51
- data/licenses/cc0-1.0.txt +0 -121
- data/spec/backgroundable_spec.rb +0 -319
- data/spec/chain_spec.rb +0 -160
- data/spec/datamapper_marshaling_spec.rb +0 -25
- data/spec/default_middleware_spec.rb +0 -21
- data/spec/destination_spec.rb +0 -248
- data/spec/future_responder_spec.rb +0 -81
- data/spec/future_spec.rb +0 -163
- data/spec/message_processor_spec.rb +0 -211
- data/spec/message_spec.rb +0 -135
- data/spec/task_spec.rb +0 -111
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'torquebox/messaging/future_responder'
|
2
|
-
|
3
|
-
include TorqueBox::Messaging
|
4
|
-
|
5
|
-
describe TorqueBox::Messaging::FutureResponder do
|
6
|
-
def self.it_should_publish(message, priority=nil, &block)
|
7
|
-
it "should publish with #{message.inspect}#{priority ? ' and priority :' + priority.to_s : ''}" do
|
8
|
-
opts = { :correlation_id => 'ham-biscuit', :ttl => 1234, :encoding => :marshal }
|
9
|
-
opts[:priority] = priority if priority
|
10
|
-
queue = mock('queue')
|
11
|
-
responder = FutureResponder.new(queue, 'ham-biscuit', 1234)
|
12
|
-
queue.should_receive( :publish ).with( hash_including(message), hash_including( opts ) )
|
13
|
-
block.call( responder )
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
before(:each) do
|
18
|
-
@queue = mock('queue')
|
19
|
-
@queue.stub(:publish)
|
20
|
-
@responder = FutureResponder.new(@queue, 'correlation-id')
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '#started' do
|
24
|
-
it_should_publish({}, :low) do |responder|
|
25
|
-
responder.started
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe '#status=' do
|
30
|
-
it "should set the status" do
|
31
|
-
@responder.status = 'biscuit'
|
32
|
-
@responder.instance_variable_get('@status').should == 'biscuit'
|
33
|
-
end
|
34
|
-
|
35
|
-
it_should_publish({:status => 'biscuit'}, :normal) do |responder|
|
36
|
-
responder.status = 'biscuit'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#result=' do
|
41
|
-
it "should set the result" do
|
42
|
-
@responder.result = 'biscuit'
|
43
|
-
@responder.instance_variable_get('@result').should == 'biscuit'
|
44
|
-
end
|
45
|
-
|
46
|
-
it_should_publish({:result => 'biscuit'}, :high) do |responder|
|
47
|
-
responder.result = 'biscuit'
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should include the last status with the result" do
|
51
|
-
queue = mock('queue')
|
52
|
-
responder = FutureResponder.new(queue, 'ham-biscuit')
|
53
|
-
queue.should_receive( :publish )
|
54
|
-
responder.status = 'crepe'
|
55
|
-
queue.should_receive( :publish ).with( hash_including({:result => 'biscuit', :status => 'crepe'}), anything )
|
56
|
-
responder.result = 'biscuit'
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe '#error=' do
|
61
|
-
it "should set the error" do
|
62
|
-
@responder.error = 'biscuit'
|
63
|
-
@responder.instance_variable_get('@error').should == 'biscuit'
|
64
|
-
end
|
65
|
-
|
66
|
-
it_should_publish({:error => 'biscuit'}, :high) do |responder|
|
67
|
-
responder.error = 'biscuit'
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should include the last status with the error" do
|
71
|
-
queue = mock('queue')
|
72
|
-
responder = FutureResponder.new(queue, 'ham-biscuit')
|
73
|
-
queue.should_receive( :publish )
|
74
|
-
responder.status = 'crepe'
|
75
|
-
queue.should_receive( :publish ).with( hash_including({:error => 'biscuit', :status => 'crepe'}), anything )
|
76
|
-
responder.error = 'biscuit'
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
data/spec/future_spec.rb
DELETED
@@ -1,163 +0,0 @@
|
|
1
|
-
require 'torquebox/messaging/future'
|
2
|
-
|
3
|
-
include TorqueBox::Messaging
|
4
|
-
|
5
|
-
describe TorqueBox::Messaging::Future do
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
@queue = mock( Queue )
|
9
|
-
@response = nil
|
10
|
-
@queue.stub( :receive ).and_return { @response }
|
11
|
-
@future = Future.new( @queue )
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "#started?" do
|
15
|
-
it "should be false if the remote side hasn't started" do
|
16
|
-
@future.should_not be_started
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should be true if the remote side has started" do
|
20
|
-
@response = { }
|
21
|
-
@future.should be_started
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should be true if an error occurs" do
|
25
|
-
@response = { :error => 'foo' }
|
26
|
-
@future.should be_started
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should be true if an processing is complete" do
|
30
|
-
@response = { :result => 'foo' }
|
31
|
-
@future.should be_started
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "#complete?" do
|
36
|
-
it "should be false if the remote side hasn't started" do
|
37
|
-
@future.should_not be_complete
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should be false if the remote side hasn't completed" do
|
41
|
-
@response = { }
|
42
|
-
@future.should_not be_complete
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should be false if an error occurs" do
|
46
|
-
@response = { :error => 'foo' }
|
47
|
-
@future.should_not be_complete
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should be true if an processing is complete" do
|
51
|
-
@response = { :result => 'foo' }
|
52
|
-
@future.should be_complete
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "#error?" do
|
57
|
-
it "should be false if the remote side hasn't started" do
|
58
|
-
@future.should_not be_error
|
59
|
-
end
|
60
|
-
|
61
|
-
it "should be false if the remote side hasn't completed" do
|
62
|
-
@response = { }
|
63
|
-
@future.should_not be_error
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should be true if an error occurs" do
|
67
|
-
@response = { :error => 'foo' }
|
68
|
-
@future.should be_error
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should be false if an processing is complete" do
|
72
|
-
@response = { :result => 'foo' }
|
73
|
-
@future.should_not be_error
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe '#status' do
|
78
|
-
it "should return nil if no status set" do
|
79
|
-
@future.status.should be_nil
|
80
|
-
end
|
81
|
-
|
82
|
-
it "should return the remote status" do
|
83
|
-
@response = { :status => 'biscuit' }
|
84
|
-
@future.status.should == 'biscuit'
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should remember the last status" do
|
88
|
-
@response = { :status => 'biscuit' }
|
89
|
-
@future.status.should == 'biscuit'
|
90
|
-
@response = { }
|
91
|
-
@future.status.should == 'biscuit'
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "#all_statuses" do
|
96
|
-
it "should be an emtpy array if no status has been received" do
|
97
|
-
@future.all_statuses.should == []
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should be an have all the seen statuses" do
|
101
|
-
@response = { :status => :ham }
|
102
|
-
@future.status
|
103
|
-
@response = { :status => :biscuit }
|
104
|
-
@future.status
|
105
|
-
@future.all_statuses.should == [:ham, :biscuit]
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe "#status_changed?" do
|
110
|
-
it "should return false if no status has been sent" do
|
111
|
-
@future.should_not be_status_changed
|
112
|
-
end
|
113
|
-
|
114
|
-
it "should be true for the first status" do
|
115
|
-
@response = { :status => :ham }
|
116
|
-
@future.should be_status_changed
|
117
|
-
end
|
118
|
-
|
119
|
-
it "should return true if the status doesn't match the last" do
|
120
|
-
@response = { :status => :ham }
|
121
|
-
@future.status
|
122
|
-
@future.should_not be_status_changed
|
123
|
-
@response = { :status => :biscuit }
|
124
|
-
@future.should be_status_changed
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe "#result" do
|
129
|
-
|
130
|
-
it "should raise if it fails to start before timeout" do
|
131
|
-
lambda { @future.result( 1 ) }.should raise_error( TimeoutException )
|
132
|
-
end
|
133
|
-
|
134
|
-
it "should raise if it fails to complete before timeout" do
|
135
|
-
@response = { }
|
136
|
-
lambda { @future.result( 1 ) }.should raise_error( TimeoutException )
|
137
|
-
end
|
138
|
-
|
139
|
-
it "should raise if a remote error occurs" do
|
140
|
-
@response = { :error => ArgumentError.new }
|
141
|
-
lambda { @future.result( 1 ) }.should raise_error( ArgumentError )
|
142
|
-
end
|
143
|
-
|
144
|
-
it "should return the result if complete" do
|
145
|
-
@response = { :result => :success! }
|
146
|
-
@future.result.should == :success!
|
147
|
-
end
|
148
|
-
|
149
|
-
end
|
150
|
-
|
151
|
-
describe "#method_missing" do
|
152
|
-
|
153
|
-
it "should delegate to #result" do
|
154
|
-
@result = mock(:result)
|
155
|
-
@result.should_receive(:blah)
|
156
|
-
@response = { :result => @result }
|
157
|
-
@future.blah
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
|
163
|
-
end
|
@@ -1,211 +0,0 @@
|
|
1
|
-
require 'torquebox/messaging/message_processor'
|
2
|
-
require 'torquebox/messaging/message'
|
3
|
-
require 'torquebox/messaging/marshal_base64_message'
|
4
|
-
|
5
|
-
class MyTestMessage
|
6
|
-
include javax.jms::TextMessage
|
7
|
-
attr_accessor :text
|
8
|
-
def initialize
|
9
|
-
@properties = {}
|
10
|
-
end
|
11
|
-
def set_string_property k, v
|
12
|
-
@properties[k] = v
|
13
|
-
end
|
14
|
-
def get_string_property k
|
15
|
-
@properties[k]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class MyTestSession
|
20
|
-
include javax.jms::Session
|
21
|
-
|
22
|
-
def create_text_message
|
23
|
-
MyTestMessage.new
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class MyTestProcessor < TorqueBox::Messaging::MessageProcessor
|
28
|
-
attr_accessor :body
|
29
|
-
def on_message(body)
|
30
|
-
self.body = body
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe TorqueBox::Messaging::MessageProcessor do
|
35
|
-
|
36
|
-
before :each do
|
37
|
-
@processor = MyTestProcessor.new
|
38
|
-
@jms_session = MyTestSession.new
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should process text messages" do
|
42
|
-
@processor.should_receive(:synchronous?).and_return(false)
|
43
|
-
@message = TorqueBox::Messaging::Message.new(@jms_session, "foo", :marshal_base64)
|
44
|
-
@processor.process! @message
|
45
|
-
@processor.body.should eql("foo")
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should process non-text messages" do
|
49
|
-
@processor.should_receive(:synchronous?).and_return(false)
|
50
|
-
payload = {:foo => "foo", :sym => :sym, "bar" => :bar}
|
51
|
-
@message = TorqueBox::Messaging::Message.new(@jms_session, payload, :marshal_base64)
|
52
|
-
@processor.process! @message
|
53
|
-
@processor.body.should eql(payload)
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "#middleware" do
|
57
|
-
it "should return the default middleware" do
|
58
|
-
@processor.middleware.inspect.should == "[TorqueBox::Messaging::ProcessorMiddleware::WithTransaction]"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context "lookups" do
|
63
|
-
class ServiceNameMock
|
64
|
-
def initialize(name)
|
65
|
-
@name = name
|
66
|
-
end
|
67
|
-
|
68
|
-
def append(name)
|
69
|
-
@name << ".#{name}"
|
70
|
-
self
|
71
|
-
end
|
72
|
-
|
73
|
-
def canonical_name
|
74
|
-
@name
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
before(:each) do
|
79
|
-
@service_name = ServiceNameMock.new("jboss.deployment.unit.\"test-message_processor_concurrency-knob.yml\"")
|
80
|
-
|
81
|
-
TorqueBox::MSC.stub_chain(:deployment_unit, :service_name).and_return(@service_name)
|
82
|
-
end
|
83
|
-
|
84
|
-
describe ".list" do
|
85
|
-
class ServiceMock
|
86
|
-
def initialize(name)
|
87
|
-
@name = name
|
88
|
-
end
|
89
|
-
|
90
|
-
attr_reader :name
|
91
|
-
|
92
|
-
def value
|
93
|
-
self
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
it "should return list of avaialble message processors" do
|
98
|
-
TorqueBox::MSC.should_receive(:get_services).
|
99
|
-
with(/^jboss.deployment.unit."test-message_processor_concurrency-knob.yml".torquebox.messaging\.\".*\"$/).
|
100
|
-
and_yield(ServiceMock.new("jboss.deployment.unit.\"test-message_processor_concurrency-knob.yml\".torquebox.messaging"))
|
101
|
-
|
102
|
-
processors = TorqueBox::Messaging::MessageProcessor.list
|
103
|
-
|
104
|
-
processors.should_not == nil
|
105
|
-
processors.size.should == 1
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should return empty list when no message processors are available" do
|
109
|
-
TorqueBox::MSC.should_receive(:get_services).with(/^jboss.deployment.unit."test-message_processor_concurrency-knob.yml".torquebox.messaging\.\".*\"$/)
|
110
|
-
|
111
|
-
processors = TorqueBox::Messaging::MessageProcessor.list
|
112
|
-
|
113
|
-
processors.should_not == nil
|
114
|
-
processors.size.should == 0
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe ".lookup" do
|
119
|
-
it "should return a message processor" do
|
120
|
-
TorqueBox::ServiceRegistry.should_receive(:lookup).with(@service_name).and_return(mock('Group'))
|
121
|
-
|
122
|
-
processor = TorqueBox::Messaging::MessageProcessor.lookup('/queues/sample', 'SimpleProcessor')
|
123
|
-
processor.should_not == nil
|
124
|
-
|
125
|
-
@service_name.canonical_name.should match(/torquebox\.messaging\.\/queues\/sample\.SimpleProcessor$/)
|
126
|
-
end
|
127
|
-
|
128
|
-
it "should return nil when a message processor is not found" do
|
129
|
-
TorqueBox::ServiceRegistry.should_receive(:lookup).with(@service_name)
|
130
|
-
|
131
|
-
processor = TorqueBox::Messaging::MessageProcessor.lookup('/queues/sample', 'SimpleProcessor')
|
132
|
-
processor.should == nil
|
133
|
-
|
134
|
-
@service_name.canonical_name.should match(/torquebox\.messaging\.\/queues\/sample\.SimpleProcessor$/)
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
describe TorqueBox::Messaging::MessageProcessorProxy do
|
141
|
-
describe ".new" do
|
142
|
-
it "should not raise when creating the object" do
|
143
|
-
lambda {
|
144
|
-
MessageProcessorProxy.new("group")
|
145
|
-
}.should_not raise_error
|
146
|
-
end
|
147
|
-
|
148
|
-
it "should raise when the group is nil" do
|
149
|
-
lambda {
|
150
|
-
MessageProcessorProxy.new(nil)
|
151
|
-
}.should raise_error(Exception, "Cannot create MessageProcessorProxy for non-existing MessageProcessorGroup")
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
context "management" do
|
156
|
-
before :each do
|
157
|
-
@group = mock('BaseMessageProcessorGroup')
|
158
|
-
@proxy = MessageProcessorProxy.new(@group)
|
159
|
-
end
|
160
|
-
|
161
|
-
it "should return group properties" do
|
162
|
-
@group.should_receive(:concurrency).and_return(3)
|
163
|
-
@group.should_receive(:message_selector).and_return("something is null")
|
164
|
-
@group.should_receive(:message_processor_class).and_return(mock("Class", :name => 'SimpleProcessor'))
|
165
|
-
@group.should_receive(:destination_name).and_return("/queues/simple")
|
166
|
-
@group.should_receive(:name).and_return("/queues/simple.SimpleProcessor")
|
167
|
-
@group.should_receive(:durable).and_return(false)
|
168
|
-
|
169
|
-
@proxy.concurrency.should == 3
|
170
|
-
@proxy.message_selector.should == "something is null"
|
171
|
-
@proxy.class_name.should == "SimpleProcessor"
|
172
|
-
@proxy.destination_name.should == "/queues/simple"
|
173
|
-
@proxy.name.should == "/queues/simple.SimpleProcessor"
|
174
|
-
@proxy.durable?.should == false
|
175
|
-
end
|
176
|
-
|
177
|
-
describe ".concurrency=" do
|
178
|
-
it "should change the concurrency" do
|
179
|
-
@group.should_receive(:concurrency).and_return(1)
|
180
|
-
@group.should_receive(:concurrency).and_return(3)
|
181
|
-
@group.should_receive(:update_concurrency).with(3).and_return(3)
|
182
|
-
|
183
|
-
(@proxy.concurrency = 3).should == 3
|
184
|
-
end
|
185
|
-
|
186
|
-
it "should allow to set the concurrency to 0" do
|
187
|
-
@group.should_receive(:concurrency).and_return(1)
|
188
|
-
@group.should_receive(:concurrency).and_return(0)
|
189
|
-
@group.should_receive(:update_concurrency).with(0).and_return(0)
|
190
|
-
|
191
|
-
(@proxy.concurrency = 0).should == 0
|
192
|
-
end
|
193
|
-
|
194
|
-
it "should do nothing if the concurrency size is the same" do
|
195
|
-
@group.should_receive(:concurrency).and_return(3)
|
196
|
-
@group.should_not_receive(:update_concurrency)
|
197
|
-
|
198
|
-
(@proxy.concurrency = 3).should == 3
|
199
|
-
end
|
200
|
-
|
201
|
-
it "should raise if the value is lower than 0" do
|
202
|
-
@group.should_receive(:name).and_return("/queues/simple.SimpleProcessor")
|
203
|
-
@group.should_not_receive(:update_concurrency)
|
204
|
-
|
205
|
-
lambda {
|
206
|
-
@proxy.concurrency = -2
|
207
|
-
}.should raise_error(Exception, "Setting concurrency for '/queues/simple.SimpleProcessor' to value < 0 is not allowed. You tried '-2'.")
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|