amqp 0.7.5 → 0.8.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/.gitignore +3 -4
  2. data/.travis.yml +3 -5
  3. data/.yardopts +6 -0
  4. data/CHANGELOG +26 -7
  5. data/Gemfile +15 -7
  6. data/README.textile +216 -0
  7. data/Rakefile +0 -6
  8. data/amqp.gemspec +14 -4
  9. data/bin/jenkins.sh +27 -0
  10. data/bin/set_test_suite_realms_up.sh +16 -2
  11. data/docs/VendorSpecificExtensions.textile +32 -0
  12. data/examples/extensions/rabbitmq/publisher_confirmations_with_transient_messages.rb +53 -0
  13. data/examples/hello_world.rb +29 -0
  14. data/examples/real-world/task-queue/README.textile +3 -0
  15. data/examples/real-world/task-queue/consumer.rb +27 -0
  16. data/examples/real-world/task-queue/producer.rb +22 -0
  17. data/examples/various/ack.rb +70 -0
  18. data/examples/various/automatic_binding_for_default_direct_exchange.rb +53 -0
  19. data/examples/various/basic_get.rb +65 -0
  20. data/examples/various/callbacks.rb +45 -0
  21. data/examples/various/clock.rb +74 -0
  22. data/examples/various/declare_a_queue_without_assignment.rb +46 -0
  23. data/examples/various/declare_an_exchange_without_assignment.rb +46 -0
  24. data/examples/various/hashtable.rb +60 -0
  25. data/examples/{logger.rb → various/logger.rb} +9 -7
  26. data/examples/{multiclock.rb → various/multiclock.rb} +15 -17
  27. data/examples/various/open_channel_without_assignment.rb +34 -0
  28. data/examples/various/pingpong.rb +53 -0
  29. data/examples/various/primes-simple.rb +29 -0
  30. data/examples/various/primes.rb +76 -0
  31. data/examples/various/pubsub.rb +43 -0
  32. data/examples/various/queue_status.rb +58 -0
  33. data/examples/various/stocks.rb +59 -0
  34. data/examples/various/weather_updates.rb +63 -0
  35. data/lib/amqp.rb +11 -2
  36. data/lib/amqp/basic_client.rb +23 -54
  37. data/lib/amqp/channel.rb +577 -805
  38. data/lib/amqp/client.rb +37 -275
  39. data/lib/amqp/connection.rb +165 -93
  40. data/lib/amqp/deprecated/fork.rb +15 -0
  41. data/lib/amqp/deprecated/logger.rb +99 -0
  42. data/lib/amqp/deprecated/mq.rb +20 -0
  43. data/lib/amqp/deprecated/rpc.rb +168 -0
  44. data/lib/amqp/exchange.rb +409 -281
  45. data/lib/amqp/extensions/rabbitmq.rb +1 -0
  46. data/lib/amqp/header.rb +41 -17
  47. data/lib/amqp/logger.rb +10 -84
  48. data/lib/amqp/queue.rb +457 -320
  49. data/lib/amqp/rpc.rb +11 -107
  50. data/lib/amqp/version.rb +1 -1
  51. data/lib/mq.rb +2 -1
  52. data/lib/mq/logger.rb +2 -0
  53. data/lib/mq/rpc.rb +2 -0
  54. data/spec/integration/authentication_spec.rb +36 -40
  55. data/spec/integration/automatic_binding_for_default_direct_exchange_spec.rb +3 -5
  56. data/spec/integration/basic_get_spec.rb +91 -0
  57. data/spec/integration/channel_close_spec.rb +5 -5
  58. data/spec/integration/exchange_declaration_spec.rb +6 -53
  59. data/spec/integration/extensions/basic_return_spec.rb +47 -0
  60. data/spec/integration/queue_declaration_spec.rb +14 -17
  61. data/spec/integration/queue_exclusivity_spec.rb +49 -48
  62. data/spec/integration/reply_queue_communication_spec.rb +6 -4
  63. data/spec/integration/store_and_forward_spec.rb +9 -36
  64. data/spec/integration/topic_subscription_spec.rb +1 -1
  65. data/spec/integration/workload_distribution_spec.rb +1 -0
  66. data/spec/spec_helper.rb +69 -43
  67. data/spec/unit/amqp/connection_spec.rb +27 -23
  68. data/tasks.rb +11 -0
  69. metadata +124 -95
  70. data/README.md +0 -156
  71. data/TODO +0 -30
  72. data/amqp.pre.gemspec +0 -6
  73. data/examples/ack.rb +0 -47
  74. data/examples/automatic_binding_for_default_direct_exchange.rb +0 -65
  75. data/examples/callbacks.rb +0 -40
  76. data/examples/clock.rb +0 -65
  77. data/examples/default_channel.rb +0 -19
  78. data/examples/hashtable.rb +0 -61
  79. data/examples/immediately_bind_a_server_named_queue.rb +0 -38
  80. data/examples/internal.rb +0 -51
  81. data/examples/issues/issue_75.rb +0 -21
  82. data/examples/issues/issue_94.rb +0 -23
  83. data/examples/pingpong.rb +0 -54
  84. data/examples/pop.rb +0 -45
  85. data/examples/primes-simple.rb +0 -21
  86. data/examples/primes.rb +0 -101
  87. data/examples/simple.rb +0 -81
  88. data/examples/stocks.rb +0 -67
  89. data/gemfiles/eventmachine-pre +0 -24
  90. data/lib/amqp/buffer.rb +0 -272
  91. data/lib/amqp/collection.rb +0 -60
  92. data/lib/amqp/frame.rb +0 -68
  93. data/lib/amqp/protocol.rb +0 -163
  94. data/lib/amqp/server.rb +0 -101
  95. data/lib/amqp/spec.rb +0 -832
  96. data/protocol/amqp-0.8.json +0 -617
  97. data/protocol/amqp-0.8.xml +0 -3908
  98. data/protocol/codegen.rb +0 -175
  99. data/protocol/doc.txt +0 -281
  100. data/research/api.rb +0 -52
  101. data/research/primes-forked.rb +0 -65
  102. data/research/primes-processes.rb +0 -137
  103. data/research/primes-threaded.rb +0 -51
  104. data/spec/integration/queue_status_spec.rb +0 -44
  105. data/spec/unit/amqp/buffer_spec.rb +0 -178
  106. data/spec/unit/amqp/client_spec.rb +0 -102
  107. data/spec/unit/amqp/collection_spec.rb +0 -144
  108. data/spec/unit/amqp/frame_spec.rb +0 -60
  109. data/spec/unit/amqp/protocol_spec.rb +0 -51
@@ -1,114 +1,18 @@
1
- # encoding: utf-8
1
+ $stdout.puts <<-MESSAGE
2
+ -------------------------------------------------------------------------------------
3
+ DEPRECATION WARNING!
2
4
 
3
- module AMQP
5
+ Use of amqp/rpc.rb is deprecated. Instead of
4
6
 
5
- # encoding: utf-8
7
+ require "amqp/rpc"
6
8
 
7
- if defined?(BasicObject)
8
- BlankSlate = BasicObject
9
- else
10
- class BlankSlate #:nodoc:
11
- instance_methods.each { |m| undef_method m unless m =~ /^__/ }
12
- end
13
- end
9
+ please use
14
10
 
11
+ require "amqp/deprecated/rpc"
15
12
 
16
- # Basic RPC (remote procedure call) facility.
17
- #
18
- # Needs more detail and explanation.
19
- #
20
- # EM.run do
21
- # server = AMQP::Channel.new.rpc('hash table node', Hash)
22
- #
23
- # client = AMQP::Channel.new.rpc('hash table node')
24
- # client[:now] = Time.now
25
- # client[:one] = 1
26
- #
27
- # client.values do |res|
28
- # p 'client', :values => res
29
- # end
30
- #
31
- # client.keys do |res|
32
- # p 'client', :keys => res
33
- # EM.stop_event_loop
34
- # end
35
- # end
36
- #
37
- class RPC < ::AMQP::BlankSlate
38
- # Takes a channel, queue and optional object.
39
- #
40
- # The optional object may be a class name, module name or object
41
- # instance. When given a class or module name, the object is instantiated
42
- # during this setup. The passed queue is automatically subscribed to so
43
- # it passes all messages (and their arguments) to the object.
44
- #
45
- # Marshalling and unmarshalling the objects is handled internally. This
46
- # marshalling is subject to the same restrictions as defined in the
47
- # Marshal[http://ruby-doc.org/core/classes/Marshal.html] standard
48
- # library. See that documentation for further reference.
49
- #
50
- # When the optional object is not passed, the returned rpc reference is
51
- # used to send messages and arguments to the queue. See #method_missing
52
- # which does all of the heavy lifting with the proxy. Some client
53
- # elsewhere must call this method *with* the optional block so that
54
- # there is a valid destination. Failure to do so will just enqueue
55
- # marshalled messages that are never consumed.
56
- #
57
- def initialize(mq, queue, obj = nil)
58
- @mq = mq
59
- @mq.rpcs[queue] ||= self
60
13
 
61
- if obj
62
- @obj = case obj
63
- when ::Class
64
- obj.new
65
- when ::Module
66
- (::Class.new do include(obj) end).new
67
- else
68
- obj
69
- end
14
+ Both amqp/rpc.rb and AMQP::RPC implementation will be REMOVED before 1.0 release.
15
+ If you need RPC, we recommend the rpc gem (see https://github.com/ruby-amqp/rpc).
16
+ MESSAGE
70
17
 
71
- @mq.queue(queue).subscribe(:ack => true) { |info, request|
72
- method, *args = ::Marshal.load(request)
73
- ret = @obj.__send__(method, *args)
74
-
75
- info.ack
76
-
77
- if info.reply_to
78
- @mq.queue(info.reply_to, :auto_delete => true).publish(::Marshal.dump(ret), :key => info.reply_to, :message_id => info.message_id)
79
- end
80
- }
81
- else
82
- @callbacks ||= {}
83
- # XXX implement and use queue(nil)
84
- @queue = @mq.queue(@name = "random identifier #{::Kernel.rand(999_999_999_999)}", :auto_delete => true).subscribe { |info, msg|
85
- if blk = @callbacks.delete(info.message_id)
86
- blk.call ::Marshal.load(msg)
87
- end
88
- }
89
- @remote = @mq.queue(queue)
90
- end
91
- end
92
-
93
- # Calling AMQP::Channel.rpc(*args) returns a proxy object without any methods beyond
94
- # those in Object. All calls to the proxy are handled by #method_missing which
95
- # works to marshal and unmarshal all method calls and their arguments.
96
- #
97
- # EM.run do
98
- # server = AMQP::Channel.new.rpc('hash table node', Hash)
99
- # client = AMQP::Channel.new.rpc('hash table node')
100
- #
101
- # # calls #method_missing on #[] which marshals the method name and
102
- # # arguments to publish them to the remote
103
- # client[:now] = Time.now
104
- # ....
105
- # end
106
- #
107
- def method_missing(meth, *args, &blk)
108
- # XXX use uuids instead
109
- message_id = "random message id #{::Kernel.rand(999_999_999_999)}"
110
- @callbacks[message_id] = blk if blk
111
- @remote.publish(::Marshal.dump([meth, *args]), :reply_to => blk ? @name : nil, :message_id => message_id)
112
- end
113
- end
114
- end
18
+ require "amqp/deprecated/rpc"
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module AMQP
4
- VERSION = '0.7.5'
4
+ VERSION = '0.8.0.beta1'
5
5
  end
data/lib/mq.rb CHANGED
@@ -20,7 +20,8 @@ MQ should have been called Channel all along). No other AMQP client library we k
20
20
  of invents it's own terminology when it comes to AMQP entities, and amqp gem shouldn't,
21
21
  too.
22
22
 
23
- Learn more at http://bit.ly/amqp-gem-080-migration.
23
+ If you disagree with this really strongly, let us know by opening an issue at
24
+ https://github.com/ruby-amqp/amqp/issues
24
25
 
25
26
  Thank you for understanding. AMQP gem maintainers team.
26
27
 
@@ -0,0 +1,2 @@
1
+ require "mq"
2
+ require "amqp/logger"
@@ -0,0 +1,2 @@
1
+ require "mq"
2
+ require "amqp/rpc"
@@ -7,34 +7,31 @@ describe "Authentication attempt" do
7
7
  # Environment
8
8
  #
9
9
 
10
- include EventedSpec::EMSpec
11
- default_timeout 1
12
- em_before { AMQP.cleanup_state }
13
- em_after { AMQP.cleanup_state }
10
+ include EventedSpec::AMQPSpec
11
+ include EventedSpec::SpecHelper
14
12
 
15
13
 
16
- # Tests below use AMQP_OPTS for settings, if you really need to modify them,
17
- # create amqp.yml file with new settings. (see spec/spec_helper)
18
-
19
- # Also it assumes that guest/guest has access to /
20
14
  describe "with default connection parameters" do
15
+
21
16
  #
22
17
  # Examples
23
18
  #
24
19
 
25
-
20
+ # assuming there is an account guest with password of "guest" that has
21
+ # access to / (default vhost)
26
22
  context "when guest/guest has access to /" do
27
23
  after :all do
28
24
  done
29
25
  end
30
26
 
31
27
  it "succeeds" do
32
- connection = AMQP.connect
28
+ AMQP.connect do |connection|
29
+ connection.should be_open
33
30
 
34
- done(0.3) {
35
- connection.should be_connected
36
- connection.close
37
- }
31
+ connection.close { done }
32
+ end
33
+
34
+ done(0.5)
38
35
  end # it
39
36
  end # context
40
37
  end # describe
@@ -46,18 +43,14 @@ describe "Authentication attempt" do
46
43
  # Examples
47
44
  #
48
45
 
49
- # assuming AMQP_OPTS are correct
50
- # and SchadenFreude with random password doesn't have any access
51
- context "when #{AMQP_OPTS[:username]} has access to #{AMQP_OPTS[:vhost]}" do
52
- after :all do
53
- done
54
- end
55
-
46
+ # assuming there is an account amqp_gem with password of "amqp_gem_password" that has
47
+ # access to /amqp_gem_testbed
48
+ context "when amqp_gem/amqp_gem_testbed has access to /amqp_gem_testbed" do
56
49
  context "and provided credentials are correct" do
57
50
  it "succeeds" do
58
- connection = AMQP.connect :username => AMQP_OPTS[:username], :password => AMQP_OPTS[:password], :vhost => AMQP_OPTS[:vhost]
51
+ connection = AMQP.connect :username => "amqp_gem", :password => "amqp_gem_password", :vhost => "/amqp_gem_testbed"
59
52
 
60
- done(0.3) {
53
+ done(0.5) {
61
54
  connection.should be_connected
62
55
  connection.close
63
56
  }
@@ -65,12 +58,17 @@ describe "Authentication attempt" do
65
58
  end # context
66
59
 
67
60
  context "and provided credentials ARE INCORRECT" do
68
- it "fails" do
69
- connection = AMQP.connect :user => "SchadenFreude", :pass => Time.now.to_i.to_s, :vhost => AMQP_OPTS[:vhost]
61
+ default_timeout 10
70
62
 
71
- done(0.5) {
72
- connection.should_not be_connected
63
+ after(:all) { done }
64
+
65
+ it "fails" do
66
+ handler = Proc.new { |settings|
67
+ puts "Callback has fired"
68
+ callback_has_fired = true
69
+ done
73
70
  }
71
+ connection = AMQP.connect(:username => "amqp_gem", :password => Time.now.to_i.to_s, :vhost => "/amqp_gem_testbed", :on_possible_authentication_failure => handler)
74
72
  end # it
75
73
  end
76
74
  end # context
@@ -83,16 +81,12 @@ describe "Authentication attempt" do
83
81
  # Examples
84
82
  #
85
83
 
86
- # assuming AMQP_OPTS are correct
87
- # and SchadenFreude with random password doesn't have any access
88
- context "when #{AMQP_OPTS[:username]} has access to #{AMQP_OPTS[:vhost]}" do
89
- after :all do
90
- done
91
- end
92
-
84
+ # assuming there is an account amqp_gem with password of "amqp_gem_password" that has
85
+ # access to /amqp_gem_testbed
86
+ context "when amqp_gem/amqp_gem_testbed has access to /amqp_gem_testbed" do
93
87
  context "and provided credentials are correct" do
94
88
  it "succeeds" do
95
- connection = AMQP.connect "amqp://#{AMQP_OPTS[:username]}:#{AMQP_OPTS[:password]}@localhost/#{URI::escape AMQP_OPTS[:vhost], /[^-_.!~*'()a-zA-Z\d]/n}"
89
+ connection = AMQP.connect "amqp://amqp_gem:amqp_gem_password@localhost/amqp_gem_testbed"
96
90
 
97
91
  done(0.3) {
98
92
  connection.should be_connected
@@ -102,12 +96,14 @@ describe "Authentication attempt" do
102
96
  end # context
103
97
 
104
98
  context "and provided credentials ARE INCORRECT" do
105
- it "succeeds" do
106
- connection = AMQP.connect "amqp://schadenfreude:#{Time.now.to_i}@localhost"
99
+ default_timeout 10
107
100
 
108
- done(0.5) {
109
- connection.should_not be_connected
110
- connection.close
101
+ after(:all) { done }
102
+
103
+ it "fails" do
104
+ connection = AMQP.connect "amqp://amqp_gem:#{Time.now.to_i}@localhost/amqp_gem_testbed", :on_possible_authentication_failure => Proc.new { |settings|
105
+ puts "Callback has fired"
106
+ done
111
107
  }
112
108
  end # it
113
109
  end # context
@@ -16,8 +16,8 @@ describe "Queue that was bound to default direct exchange thanks to Automatic Mo
16
16
  @channel = AMQP::Channel.new
17
17
  @channel.should be_open
18
18
 
19
- @queue1 = @channel.queue("amqp-gem.automatic-binding.q1", :auto_delete => true)
20
- @queue2 = @channel.queue("amqp-gem.automatic-binding.q2", :auto_delete => true)
19
+ @queue1 = @channel.queue("queue1")
20
+ @queue2 = @channel.queue("queue2")
21
21
 
22
22
  # Rely on default direct exchange binding, see section 2.1.2.4 Automatic Mode in AMQP 0.9.1 spec.
23
23
  @exchange = AMQP::Exchange.default(@channel)
@@ -55,9 +55,7 @@ describe "Queue that was bound to default direct exchange thanks to Automatic Mo
55
55
  @exchange.publish("some white noise", :routing_key => "killa key")
56
56
  end
57
57
 
58
- delayed(0.2) { @queue2.delete }
59
-
60
- done(0.35) {
58
+ done(0.2) {
61
59
  number_of_received_messages.should == expected_number_of_messages
62
60
  }
63
61
  end # it
@@ -0,0 +1,91 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "spec_helper"
3
+
4
+ describe AMQP::Queue, "#pop" do
5
+
6
+ #
7
+ # Environment
8
+ #
9
+
10
+ include EventedSpec::AMQPSpec
11
+ include EventedSpec::SpecHelper
12
+
13
+
14
+ default_options AMQP_OPTS
15
+ default_timeout 10
16
+
17
+ amqp_before do
18
+ @channel = AMQP::Channel.new
19
+ @channel.should be_open
20
+
21
+ @queue_name = "amqpgem.integration.basic.get.queue"
22
+
23
+ @exchange = @channel.fanout("amqpgem.integration.basic.get.queue", :auto_delete => true)
24
+ @queue = @channel.queue(@queue_name, :auto_delete => true)
25
+
26
+ @queue.bind(@exchange) do
27
+ puts "Bound #{@exchange.name} => #{@queue.name}"
28
+ end
29
+
30
+ @dispatched_data = "fetch me synchronously"
31
+ end
32
+
33
+
34
+
35
+ #
36
+ # Examples
37
+ #
38
+
39
+ context "when THERE ARE NO messages in the queue" do
40
+ it "yields nil (instead of message payload) to the callback" do
41
+ @queue.purge do
42
+ callback_has_fired = false
43
+
44
+ @queue.status do |number_of_messages, number_of_consumers|
45
+ number_of_messages.should == 0
46
+ end
47
+
48
+ @queue.pop do |payload|
49
+ callback_has_fired = true
50
+
51
+ payload.should be_nil
52
+ end
53
+
54
+ done(0.2) {
55
+ callback_has_fired.should be_true
56
+ }
57
+ end
58
+ end
59
+ end
60
+
61
+ context "when THERE ARE messages in the queue" do
62
+ it "yields message payload to the callback" do
63
+ number_of_received_messages = 0
64
+ expected_number_of_messages = 300
65
+
66
+ expected_number_of_messages.times do |i|
67
+ @exchange.publish(@dispatched_data + "_#{i}", :key => @queue_name)
68
+ end
69
+
70
+ @queue.status do |number_of_messages, number_of_consumers|
71
+ expected_number_of_messages.times do
72
+ @queue.pop do |headers, payload|
73
+ payload.should_not be_nil
74
+ number_of_received_messages += 1
75
+ headers.message_count.should == (expected_number_of_messages - number_of_received_messages)
76
+
77
+ if RUBY_VERSION =~ /^1.9/
78
+ payload.force_encoding("UTF-8").should =~ /#{@dispatched_data}/
79
+ else
80
+ payload.should =~ /#{@dispatched_data}/
81
+ end
82
+ end # pop
83
+ end # do
84
+ end
85
+
86
+ done(1.5) {
87
+ number_of_received_messages.should == expected_number_of_messages
88
+ }
89
+ end # it
90
+ end # context
91
+ end # describe
@@ -2,14 +2,14 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- describe AMQP, "#close(&callback)" do
5
+ describe AMQP::Channel, "#close(&callback)" do
6
6
  include EventedSpec::AMQPSpec
7
7
 
8
- default_timeout 5
9
-
10
8
  it "takes a callback which will run when we get back Channel.Close-Ok" do
11
- AMQP::Channel.new.close do |amq|
12
- done
9
+ channel = AMQP::Channel.new do |*args|
10
+ channel.close do |channel, method|
11
+ done
12
+ end
13
13
  end
14
14
  end
15
15
  end
@@ -26,8 +26,6 @@ describe AMQP do
26
26
  it 'declares a new direct exchange with that name' do
27
27
  @channel.direct('name').name.should == 'name'
28
28
 
29
- @channel.direct('name').delete
30
-
31
29
  done
32
30
  end
33
31
 
@@ -37,8 +35,6 @@ describe AMQP do
37
35
  exchange.should_not be_durable
38
36
  exchange.should be_transient
39
37
 
40
- exchange.delete
41
-
42
38
  done
43
39
  end
44
40
 
@@ -46,7 +42,6 @@ describe AMQP do
46
42
  exchange = @channel.direct('name')
47
43
 
48
44
  exchange.should_not be_auto_deleted
49
- exchange.delete
50
45
 
51
46
  done
52
47
  end
@@ -64,9 +59,9 @@ describe AMQP do
64
59
  context "when exchange name was specified as a blank string" do
65
60
  it 'returns direct exchange with server-generated name' do
66
61
  pending <<-EOF
67
- This has to be fixed in RabbitMQ first
68
- https://bugzilla.rabbitmq.com/show_bug.cgi?id=23509
69
- EOF
62
+ This has to be fixed in RabbitMQ first
63
+ https://bugzilla.rabbitmq.com/show_bug.cgi?id=23509
64
+ EOF
70
65
  @channel.direct("") do |exchange|
71
66
  exchange.name.should_not be_empty
72
67
  done
@@ -85,9 +80,6 @@ describe AMQP do
85
80
 
86
81
  exchange.should == original_exchange
87
82
 
88
- original_exchange.delete
89
- exchange.delete
90
-
91
83
  done
92
84
  end # it
93
85
  end
@@ -112,8 +104,6 @@ describe AMQP do
112
104
  exchange.should be_durable
113
105
  exchange.should_not be_transient
114
106
 
115
- exchange.delete
116
-
117
107
  done
118
108
  end # it
119
109
  end # context
@@ -125,8 +115,6 @@ describe AMQP do
125
115
  exchange.should_not be_durable
126
116
  exchange.should be_transient
127
117
 
128
- exchange.delete
129
-
130
118
  done
131
119
  end # it
132
120
  end # context
@@ -137,7 +125,6 @@ describe AMQP do
137
125
  exchange = @channel.direct("a new auto-deleted direct exchange", :auto_delete => true)
138
126
 
139
127
  exchange.should be_auto_deleted
140
- exchange.delete
141
128
  done
142
129
  end # it
143
130
  end # context
@@ -148,7 +135,6 @@ describe AMQP do
148
135
  exchange = @channel.direct("a new non-auto-deleted direct exchange", :auto_delete => false)
149
136
 
150
137
  exchange.should_not be_auto_deleted
151
- exchange.delete
152
138
  done
153
139
  end # it
154
140
  end # context
@@ -159,7 +145,6 @@ describe AMQP do
159
145
  exchange = @channel.direct("a new non-auto-deleted direct exchange", :auto_delete => false)
160
146
 
161
147
  exchange.should_not be_auto_deleted
162
- exchange.delete
163
148
  done
164
149
  end # it
165
150
  end # context
@@ -167,14 +152,12 @@ describe AMQP do
167
152
 
168
153
  context "when exchange is re-declared with parameters different from original declaration" do
169
154
  it "raises an exception" do
170
- exchange = @channel.direct("previously.declared.durable.direct.exchange", :durable => true)
155
+ @channel.direct("previously.declared.durable.direct.exchange", :durable => true)
171
156
 
172
157
  expect {
173
158
  @channel.direct("previously.declared.durable.direct.exchange", :durable => false)
174
159
  }.to raise_error(AMQP::IncompatibleOptionsError)
175
160
 
176
- exchange.delete
177
-
178
161
  done
179
162
  end # it
180
163
  end # context
@@ -191,7 +174,6 @@ describe AMQP do
191
174
  exchange = @channel.fanout(name)
192
175
 
193
176
  exchange.name.should == name
194
- exchange.delete
195
177
 
196
178
  done
197
179
  end
@@ -217,9 +199,6 @@ describe AMQP do
217
199
 
218
200
  exchange.should == original_exchange
219
201
 
220
- original_exchange.delete
221
- exchange.delete
222
-
223
202
  done
224
203
  end # it
225
204
  end
@@ -314,8 +293,6 @@ describe AMQP do
314
293
  exchange = @channel.topic(name)
315
294
  exchange.name.should == name
316
295
 
317
- exchange.delete
318
-
319
296
  done
320
297
  end
321
298
  end # context
@@ -339,8 +316,6 @@ describe AMQP do
339
316
  exchange = @channel.topic(name, :passive => true)
340
317
 
341
318
  exchange.should == original_exchange
342
- original_exchange.delete
343
- exchange.delete
344
319
 
345
320
  done
346
321
  end # it
@@ -366,8 +341,6 @@ describe AMQP do
366
341
  exchange.should be_durable
367
342
  exchange.should_not be_transient
368
343
 
369
- exchange.delete
370
-
371
344
  done
372
345
  end # it
373
346
  end # context
@@ -379,8 +352,6 @@ describe AMQP do
379
352
  exchange.should_not be_durable
380
353
  exchange.should be_transient
381
354
 
382
- exchange.delete
383
-
384
355
  done
385
356
  end # it
386
357
  end # context
@@ -401,7 +372,6 @@ describe AMQP do
401
372
  exchange = @channel.topic("a new non-auto-deleted topic exchange", :auto_delete => false)
402
373
 
403
374
  exchange.should_not be_auto_deleted
404
- exchange.delete
405
375
  done
406
376
  end # it
407
377
  end # context
@@ -412,7 +382,6 @@ describe AMQP do
412
382
  exchange = @channel.topic("a new non-auto-deleted topic exchange", :auto_delete => false)
413
383
 
414
384
  exchange.should_not be_auto_deleted
415
- exchange.delete
416
385
  done
417
386
  end # it
418
387
  end # context
@@ -426,15 +395,13 @@ describe AMQP do
426
395
  it "raises an exception" do
427
396
  channel = AMQP::Channel.new
428
397
 
429
- exchange = channel.topic("previously.declared.durable.topic.exchange", :durable => true)
398
+ channel.topic("previously.declared.durable.topic.exchange", :durable => true)
430
399
  channel.should be_open
431
400
 
432
401
  expect {
433
402
  channel.topic("previously.declared.durable.topic.exchange", :durable => false)
434
403
  }.to raise_error(AMQP::IncompatibleOptionsError)
435
404
 
436
- exchange.delete
437
-
438
405
  done
439
406
  end # it
440
407
  end # context
@@ -451,7 +418,6 @@ describe AMQP do
451
418
  exchange = @channel.headers(name)
452
419
 
453
420
  exchange.name.should == name
454
- exchange.delete
455
421
 
456
422
  done
457
423
  end
@@ -480,8 +446,6 @@ describe AMQP do
480
446
  exchange = @channel.headers(name, :passive => true)
481
447
 
482
448
  exchange.should == original_exchange
483
- original_exchange.delete
484
- exchange.delete
485
449
 
486
450
  done
487
451
  end # it
@@ -507,8 +471,6 @@ describe AMQP do
507
471
  exchange.should be_durable
508
472
  exchange.should_not be_transient
509
473
 
510
- exchange.delete
511
-
512
474
  done
513
475
  end # it
514
476
  end # context
@@ -520,8 +482,6 @@ describe AMQP do
520
482
  exchange.should_not be_durable
521
483
  exchange.should be_transient
522
484
 
523
- exchange.delete
524
-
525
485
  done
526
486
  end # it
527
487
  end # context
@@ -532,7 +492,6 @@ describe AMQP do
532
492
  exchange = @channel.headers("a new auto-deleted headers exchange", :auto_delete => true)
533
493
 
534
494
  exchange.should be_auto_deleted
535
-
536
495
  done
537
496
  end # it
538
497
  end # context
@@ -543,8 +502,6 @@ describe AMQP do
543
502
  exchange = @channel.headers("a new non-auto-deleted headers exchange", :auto_delete => false)
544
503
 
545
504
  exchange.should_not be_auto_deleted
546
- exchange.delete
547
-
548
505
  done
549
506
  end # it
550
507
  end # context
@@ -555,8 +512,6 @@ describe AMQP do
555
512
  exchange = @channel.headers("a new non-auto-deleted headers exchange", :auto_delete => false)
556
513
 
557
514
  exchange.should_not be_auto_deleted
558
- exchange.delete
559
-
560
515
  done
561
516
  end # it
562
517
  end # context
@@ -568,14 +523,12 @@ describe AMQP do
568
523
  end
569
524
 
570
525
  it "raises an exception" do
571
- exchange = @channel.headers("previously.declared.durable.topic.exchange", :durable => true)
526
+ @channel.headers("previously.declared.durable.topic.exchange", :durable => true)
572
527
 
573
528
  expect {
574
529
  @channel.headers("previously.declared.durable.topic.exchange", :durable => false)
575
530
  }.to raise_error(AMQP::IncompatibleOptionsError)
576
531
 
577
- exchange.delete
578
-
579
532
  done
580
533
  end # it
581
534
  end # context