amqp 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,10 +2,13 @@ language: ruby
2
2
  bundler_args: --without development
3
3
  before_script: ./bin/ci/before_build.sh
4
4
  script: "bundle exec rake spec:ci"
5
+ env:
6
+ - CI=true
5
7
  rvm:
6
8
  - 1.8.7
7
- - rbx-18mode
8
- - jruby-18mode
9
+ - rbx-19mode
10
+ - jruby-19mode
11
+ - jruby-head
9
12
  - 1.9.2
10
13
  - 1.9.3
11
14
  gemfile:
@@ -19,4 +22,24 @@ branches:
19
22
  - master
20
23
  - 0.9.x-stable
21
24
  - 0.8.x-stable
22
- - 0.7.x-stable
25
+ - 0.7.x-stable
26
+ matrix:
27
+ allow_failures:
28
+ - rvm: 1.8.7
29
+ gemfile: gemfiles/eventmachine-pre
30
+ - rvm: 1.9.3
31
+ gemfile: gemfiles/eventmachine-pre
32
+ - rvm: jruby-19mode
33
+ gemfile: gemfiles/eventmachine-pre
34
+ - rvm: jruby-head
35
+ gemfile: gemfiles/eventmachine-pre
36
+ - rvm: jruby-head
37
+ gemfile: Gemfile
38
+ - rvm: rbx-19mode
39
+ gemfile: gemfiles/eventmachine-pre
40
+ - rvm: rbx-19mode
41
+ gemfile: Gemfile
42
+ - rvm: 1.9.2
43
+ gemfile: gemfiles/eventmachine-pre
44
+ - rvm: 1.9.2
45
+ gemfile: Gemfile
@@ -227,6 +227,8 @@ module AMQP
227
227
  # Read more about EM::Deferrable#callback behavior in EventMachine documentation. MK.
228
228
  @channel_is_open_deferrable = AMQ::Client::EventMachineClient::Deferrable.new
229
229
 
230
+ @parameter_checks = {:queue => [:durable, :exclusive, :auto_delete, :arguments], :exchange => [:type, :durable, :arguments]}
231
+
230
232
  # only send channel.open when connection is actually open. Makes it possible to
231
233
  # do c = AMQP.connect; AMQP::Channel.new(c) that is what some people do. MK.
232
234
  @connection.on_connection do
@@ -379,7 +381,7 @@ module AMQP
379
381
  if exchange = find_exchange(name)
380
382
  extended_opts = Exchange.add_default_options(:direct, name, opts, block)
381
383
 
382
- validate_parameters_match!(exchange, extended_opts)
384
+ validate_parameters_match!(exchange, extended_opts, :exchange)
383
385
 
384
386
  block.call(exchange) if block
385
387
  exchange
@@ -487,7 +489,7 @@ module AMQP
487
489
  if exchange = find_exchange(name)
488
490
  extended_opts = Exchange.add_default_options(:fanout, name, opts, block)
489
491
 
490
- validate_parameters_match!(exchange, extended_opts)
492
+ validate_parameters_match!(exchange, extended_opts, :exchange)
491
493
 
492
494
  block.call(exchange) if block
493
495
  exchange
@@ -603,7 +605,7 @@ module AMQP
603
605
  if exchange = find_exchange(name)
604
606
  extended_opts = Exchange.add_default_options(:topic, name, opts, block)
605
607
 
606
- validate_parameters_match!(exchange, extended_opts)
608
+ validate_parameters_match!(exchange, extended_opts, :exchange)
607
609
 
608
610
  block.call(exchange) if block
609
611
  exchange
@@ -709,7 +711,7 @@ module AMQP
709
711
  if exchange = find_exchange(name)
710
712
  extended_opts = Exchange.add_default_options(:headers, name, opts, block)
711
713
 
712
- validate_parameters_match!(exchange, extended_opts)
714
+ validate_parameters_match!(exchange, extended_opts, :exchange)
713
715
 
714
716
  block.call(exchange) if block
715
717
  exchange
@@ -812,7 +814,7 @@ module AMQP
812
814
  if name && !name.empty? && (queue = find_queue(name))
813
815
  extended_opts = Queue.add_default_options(name, opts, block)
814
816
 
815
- validate_parameters_match!(queue, extended_opts)
817
+ validate_parameters_match!(queue, extended_opts, :queue)
816
818
 
817
819
  block.call(queue) if block
818
820
  queue
@@ -1266,15 +1268,13 @@ module AMQP
1266
1268
  end
1267
1269
 
1268
1270
 
1269
-
1270
1271
  protected
1271
1272
 
1272
- # @private
1273
- def validate_parameters_match!(entity, parameters)
1274
- parameters.delete(:no_declare)
1275
- unless entity.opts == parameters || parameters[:passive]
1273
+ @private
1274
+ def validate_parameters_match!(entity, parameters, type)
1275
+ unless entity.opts.values_at(*@parameter_checks[type]) == parameters.values_at(*@parameter_checks[type]) || parameters[:passive]
1276
1276
  raise AMQP::IncompatibleOptionsError.new(entity.name, entity.opts, parameters)
1277
1277
  end
1278
- end # validate_parameters_match!(entity, parameters)
1278
+ end # validate_parameters_match!(entity, parameters, type)
1279
1279
  end # Channel
1280
1280
  end # AMQP
@@ -39,12 +39,12 @@ module AMQP
39
39
  def initialize(*args, &block)
40
40
  super(*args, &block)
41
41
 
42
- @client_properties = {
42
+ @client_properties.merge!({
43
43
  :platform => ::RUBY_DESCRIPTION,
44
44
  :product => "AMQP gem",
45
45
  :information => "http://github.com/ruby-amqp/amqp",
46
46
  :version => AMQP::VERSION
47
- }
47
+ })
48
48
  end # initialize(*args, &block)
49
49
 
50
50
  # @return [Boolean] true if this AMQP connection is currently open
@@ -6,5 +6,5 @@ module AMQP
6
6
  #
7
7
  # @see AMQ::Protocol::VERSION
8
8
  # @return [String] AMQP gem version
9
- VERSION = '0.9.5'
9
+ VERSION = '0.9.6'
10
10
  end
@@ -232,6 +232,18 @@ describe AMQP::Channel do
232
232
  done
233
233
  end # it
234
234
  end # context
235
+
236
+ context "when exchange is re-declared with irrelevent parameters different from original declaration" do
237
+ it "doesn't raise an exception" do
238
+ @channel.direct("previously.declared.durable.direct.exchange", :durable => true)
239
+
240
+ expect {
241
+ @channel.direct("previously.declared.durable.direct.exchange", :durable => true, :header => {:random => 'stuff' })
242
+ }.to_not raise_error(AMQP::IncompatibleOptionsError)
243
+
244
+ done
245
+ end # it
246
+ end # context
235
247
  end # describe
236
248
 
237
249
 
@@ -20,14 +20,17 @@ describe AMQP do
20
20
  context "when queue is redeclared with different attributes" do
21
21
  let(:name) { "amqp-gem.nondurable.queue" }
22
22
  let(:options) {
23
- { :durable => false, :passive => false }
23
+ { :durable => false, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false }
24
24
  }
25
25
  let(:different_options) {
26
- { :durable => true, :passive => false}
26
+ { :durable => true, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false}
27
+ }
28
+ let(:irrelevant_different_options) {
29
+ { :durable => false, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false, :header => {:random => 'stuff' } }
27
30
  }
28
31
 
29
32
 
30
- it "should raise AMQP::IncompatibleOptionsError" do
33
+ it "should raise AMQP::IncompatibleOptionsError for incompatable options" do
31
34
  channel = AMQP::Channel.new
32
35
  channel.on_error do |ch, close|
33
36
  @callback_fired = true
@@ -39,5 +42,18 @@ describe AMQP do
39
42
  }.to raise_error(AMQP::IncompatibleOptionsError)
40
43
  done
41
44
  end
45
+
46
+ it "should not raise AMQP::IncompatibleOptionsError for irrelevant options" do
47
+ channel = AMQP::Channel.new
48
+ channel.on_error do |ch, close|
49
+ @callback_fired = true
50
+ end
51
+
52
+ channel.queue(name, options)
53
+ expect {
54
+ channel.queue(name, irrelevant_different_options)
55
+ }.to_not raise_error(AMQP::IncompatibleOptionsError)
56
+ done
57
+ end
42
58
  end
43
59
  end # describe AMQP
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amqp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 5
10
- version: 0.9.5
9
+ - 6
10
+ version: 0.9.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aman Gupta
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-06-22 00:00:00 Z
20
+ date: 2012-06-23 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: eventmachine