Author: gsim Date: Thu Oct 11 06:29:37 2007 New Revision: 583821 URL: http://svn.apache.org/viewvc?rev=583821&view=rev Log: Exclusive no longer implies auto-delete on queue.declare. Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.cpp incubator/qpid/trunk/qpid/python/tests_0-10/alternate-exchange.py incubator/qpid/trunk/qpid/python/tests_0-10/dtx.py incubator/qpid/trunk/qpid/python/tests_0-10/message.py incubator/qpid/trunk/qpid/python/tests_0-10/query.py incubator/qpid/trunk/qpid/python/tests_0-10/queue.py incubator/qpid/trunk/qpid/python/tests_0-10/tx.py Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp Thu Oct 11 06:29:37 2007 @@ -180,7 +180,7 @@ std::pair queue_created = getBroker().getQueues().declare( name, durable, - autoDelete && !exclusive, + autoDelete, exclusive ? &getConnection() : 0); queue = queue_created.first; assert(queue); @@ -202,7 +202,11 @@ if (exclusive) { getConnection().exclusiveQueues.push_back(queue); } - } + } else { + if (exclusive && !queue->hasExclusiveOwner()) { + queue->setExclusiveOwner(&getConnection()); + } + } } if (exclusive && !queue->isExclusiveOwner(&getConnection())) throw ResourceLockedException( Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp Thu Oct 11 06:29:37 2007 @@ -29,6 +29,7 @@ #include "SemanticHandler.h" #include +#include using namespace boost; using namespace qpid::sys; @@ -76,10 +77,14 @@ try { while (!exclusiveQueues.empty()) { Queue::shared_ptr q(exclusiveQueues.front()); - broker.getQueues().destroy(q->getName()); + q->releaseExclusiveOwnership(); + if (q->canAutoDelete() && + broker.getQueues().destroyIf(q->getName(), boost::bind(boost::mem_fn(&Queue::canAutoDelete), q))) { + + q->unbind(broker.getExchanges(), q); + q->destroy(); + } exclusiveQueues.erase(exclusiveQueues.begin()); - q->unbind(broker.getExchanges(), q); - q->destroy(); } } catch(std::exception& e) { QPID_LOG(error, " Unhandled exception while closing session: " << Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h Thu Oct 11 06:29:37 2007 @@ -67,7 +67,7 @@ const string name; const bool autodelete; MessageStore* const store; - const ConnectionToken* const owner; + const ConnectionToken* owner; Consumers acquirers; Consumers browsers; Messages messages; @@ -155,6 +155,8 @@ uint32_t getConsumerCount() const; inline const string& getName() const { return name; } inline const bool isExclusiveOwner(const ConnectionToken* const o) const { return o == owner; } + inline void releaseExclusiveOwnership() { owner = 0; } + inline void setExclusiveOwner(const ConnectionToken* const o) { owner = o; } inline bool hasExclusiveConsumer() const { return exclusive; } inline bool hasExclusiveOwner() const { return owner != 0; } inline bool isDurable() const { return store != 0; } Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h Thu Oct 11 06:29:37 2007 @@ -62,11 +62,14 @@ * */ void destroy(const string& name); - template void destroyIf(const string& name, Test test) + template bool destroyIf(const string& name, Test test) { qpid::sys::RWlock::ScopedWlock locker(lock); if (test()) { queues.erase(name); + return true; + } else { + return false; } } Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.cpp?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.cpp (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.cpp Thu Oct 11 06:29:37 2007 @@ -290,7 +290,7 @@ { if(queue) { queue->cancel(this); - if (queue->canAutoDelete()) { + if (queue->canAutoDelete() && !queue->hasExclusiveOwner()) { parent->getSession().getBroker().getQueues().destroyIf( queue->getName(), boost::bind(boost::mem_fn(&Queue::canAutoDelete), queue)); Modified: incubator/qpid/trunk/qpid/python/tests_0-10/alternate-exchange.py URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/tests_0-10/alternate-exchange.py?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/tests_0-10/alternate-exchange.py (original) +++ incubator/qpid/trunk/qpid/python/tests_0-10/alternate-exchange.py Thu Oct 11 06:29:37 2007 @@ -37,13 +37,13 @@ channel.exchange_declare(exchange="primary", type="direct", alternate_exchange="secondary") #declare, bind (to the alternate exchange) and consume from a queue for 'returned' messages - channel.queue_declare(queue="returns", exclusive=True) + channel.queue_declare(queue="returns", exclusive=True, auto_delete=True) channel.queue_bind(queue="returns", exchange="secondary") self.subscribe(destination="a", queue="returns") returned = self.client.queue("a") #declare, bind (to the primary exchange) and consume from a queue for 'processed' messages - channel.queue_declare(queue="processed", exclusive=True) + channel.queue_declare(queue="processed", exclusive=True, auto_delete=True) channel.queue_bind(queue="processed", exchange="primary", routing_key="my-key") self.subscribe(destination="b", queue="processed") processed = self.client.queue("b") @@ -71,7 +71,7 @@ channel = self.channel #set up a 'dead letter queue': channel.exchange_declare(exchange="dlq", type="fanout") - channel.queue_declare(queue="deleted", exclusive=True) + channel.queue_declare(queue="deleted", exclusive=True, auto_delete=True) channel.queue_bind(exchange="dlq", queue="deleted") self.subscribe(destination="dlq", queue="deleted") dlq = self.client.queue("dlq") @@ -101,13 +101,13 @@ channel = self.channel #set up a 'dead letter queue': channel.exchange_declare(exchange="dlq", type="fanout") - channel.queue_declare(queue="immediate", exclusive=True) + channel.queue_declare(queue="immediate", exclusive=True, auto_delete=True) channel.queue_bind(exchange="dlq", queue="immediate") self.subscribe(destination="dlq", queue="immediate") dlq = self.client.queue("dlq") #create a queue using the dlq as its alternate exchange: - channel.queue_declare(queue="no-consumers", alternate_exchange="dlq", exclusive=True) + channel.queue_declare(queue="no-consumers", alternate_exchange="dlq", exclusive=True, auto_delete=True) #send it some messages: #TODO: WE HAVE LOST THE IMMEDIATE FLAG; FIX THIS ONCE ITS BACK channel.message_transfer(content=Content("no one wants me", properties={'routing_key':"no-consumers"})) @@ -128,7 +128,7 @@ """ channel = self.channel channel.exchange_declare(exchange="alternate", type="fanout") - channel.queue_declare(queue="q", exclusive=True, alternate_exchange="alternate") + channel.queue_declare(queue="q", exclusive=True, auto_delete=True, alternate_exchange="alternate") try: channel.exchange_delete(exchange="alternate") self.fail("Expected deletion of in-use alternate-exchange to fail") Modified: incubator/qpid/trunk/qpid/python/tests_0-10/dtx.py URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/tests_0-10/dtx.py?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/tests_0-10/dtx.py (original) +++ incubator/qpid/trunk/qpid/python/tests_0-10/dtx.py Thu Oct 11 06:29:37 2007 @@ -246,8 +246,8 @@ channel2.dtx_demarcation_select() #setup - channel1.queue_declare(queue="one", exclusive=True) - channel1.queue_declare(queue="two", exclusive=True) + channel1.queue_declare(queue="one", exclusive=True, auto_delete=True) + channel1.queue_declare(queue="two", exclusive=True, auto_delete=True) channel1.message_transfer(content=Content(properties={'routing_key':"one", 'message_id':"a"}, body="DtxMessage")) channel1.message_transfer(content=Content(properties={'routing_key':"two", 'message_id':"b"}, body="DtxMessage")) @@ -282,8 +282,8 @@ channel.dtx_demarcation_select() #setup - channel.queue_declare(queue="one", exclusive=True) - channel.queue_declare(queue="two", exclusive=True) + channel.queue_declare(queue="one", exclusive=True, auto_delete=True) + channel.queue_declare(queue="two", exclusive=True, auto_delete=True) channel.message_transfer(content=Content(properties={'routing_key':"one", 'message_id':"a"}, body="DtxMessage")) channel.message_transfer(content=Content(properties={'routing_key':"two", 'message_id':"b"}, body="DtxMessage")) @@ -352,7 +352,7 @@ """ channel = self.client.channel(2) channel.session_open() - channel.queue_declare(queue="tx-queue", exclusive=True) + channel.queue_declare(queue="tx-queue", exclusive=True, auto_delete=True) #publish a message under a transaction channel.dtx_demarcation_select() @@ -389,7 +389,7 @@ other = self.connect() tester = other.channel(1) tester.session_open() - tester.queue_declare(queue="dummy", exclusive=True) + tester.queue_declare(queue="dummy", exclusive=True, auto_delete=True) tester.dtx_demarcation_select() tx = self.xid("dummy") tester.dtx_demarcation_start(xid=tx) @@ -423,7 +423,7 @@ other = self.connect() tester = other.channel(1) tester.session_open() - tester.queue_declare(queue="dummy", exclusive=True) + tester.queue_declare(queue="dummy", exclusive=True, auto_delete=True) tester.dtx_demarcation_select() tx = self.xid("dummy") tester.dtx_demarcation_start(xid=tx) @@ -455,7 +455,7 @@ channel2.session_open() #setup: - channel2.queue_declare(queue="dummy", exclusive=True) + channel2.queue_declare(queue="dummy", exclusive=True, auto_delete=True) channel2.message_transfer(content=Content(properties={'routing_key':"dummy"}, body="whatever")) tx = self.xid("dummy") @@ -498,8 +498,8 @@ channel.session_open() #setup: tx = self.xid("dummy") - channel.queue_declare(queue="queue-a", exclusive=True) - channel.queue_declare(queue="queue-b", exclusive=True) + channel.queue_declare(queue="queue-a", exclusive=True, auto_delete=True) + channel.queue_declare(queue="queue-b", exclusive=True, auto_delete=True) channel.message_transfer(content=Content(properties={'routing_key':"queue-a", 'message_id':"timeout"}, body="DtxMessage")) channel.dtx_demarcation_select() @@ -524,7 +524,7 @@ channel = self.channel channel.dtx_demarcation_select() - channel.queue_declare(queue="dummy", exclusive=True) + channel.queue_declare(queue="dummy", exclusive=True, auto_delete=True) prepared = [] for i in range(1, 10): @@ -575,8 +575,8 @@ def txswap(self, tx, id): channel = self.channel #declare two queues: - channel.queue_declare(queue="queue-a", exclusive=True) - channel.queue_declare(queue="queue-b", exclusive=True) + channel.queue_declare(queue="queue-a", exclusive=True, auto_delete=True) + channel.queue_declare(queue="queue-b", exclusive=True, auto_delete=True) #put message with specified id on one queue: channel.message_transfer(content=Content(properties={'routing_key':"queue-a", 'message_id':id}, body="DtxMessage")) Modified: incubator/qpid/trunk/qpid/python/tests_0-10/message.py URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/tests_0-10/message.py?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/tests_0-10/message.py (original) +++ incubator/qpid/trunk/qpid/python/tests_0-10/message.py Thu Oct 11 06:29:37 2007 @@ -31,8 +31,8 @@ """ channel = self.channel #setup, declare two queues: - channel.queue_declare(queue="test-queue-1a", exclusive=True) - channel.queue_declare(queue="test-queue-1b", exclusive=True) + channel.queue_declare(queue="test-queue-1a", exclusive=True, auto_delete=True) + channel.queue_declare(queue="test-queue-1b", exclusive=True, auto_delete=True) #establish two consumers one of which excludes delivery of locally sent messages self.subscribe(destination="local_included", queue="test-queue-1a") self.subscribe(destination="local_excluded", queue="test-queue-1b", no_local=True) @@ -58,7 +58,7 @@ """ channel = self.channel #setup, declare a queue: - channel.queue_declare(queue="test-queue-2", exclusive=True) + channel.queue_declare(queue="test-queue-2", exclusive=True, auto_delete=True) #check that an exclusive consumer prevents other consumer being created: self.subscribe(destination="first", queue="test-queue-2", exclusive=True) @@ -107,7 +107,7 @@ """ channel = self.channel #setup, declare a queue: - channel.queue_declare(queue="test-queue-3", exclusive=True) + channel.queue_declare(queue="test-queue-3", exclusive=True, auto_delete=True) #check that attempts to use duplicate tags are detected and prevented: self.subscribe(destination="first", queue="test-queue-3") @@ -123,7 +123,7 @@ """ channel = self.channel #setup, declare a queue: - channel.queue_declare(queue="test-queue-4", exclusive=True) + channel.queue_declare(queue="test-queue-4", exclusive=True, auto_delete=True) self.subscribe(destination="my-consumer", queue="test-queue-4") channel.message_transfer(content=Content(properties={'routing_key' : "test-queue-4"}, body="One")) @@ -148,7 +148,7 @@ Test basic ack/recover behaviour """ channel = self.channel - channel.queue_declare(queue="test-ack-queue", exclusive=True) + channel.queue_declare(queue="test-ack-queue", exclusive=True, auto_delete=True) self.subscribe(queue="test-ack-queue", destination="consumer_tag", confirm_mode=1) queue = self.client.queue("consumer_tag") @@ -193,9 +193,9 @@ Test recover behaviour """ channel = self.channel - channel.queue_declare(queue="queue-a", exclusive=True) + channel.queue_declare(queue="queue-a", exclusive=True, auto_delete=True) channel.queue_bind(exchange="amq.fanout", queue="queue-a") - channel.queue_declare(queue="queue-b", exclusive=True) + channel.queue_declare(queue="queue-b", exclusive=True, auto_delete=True) channel.queue_bind(exchange="amq.fanout", queue="queue-b") self.subscribe(queue="queue-a", destination="unconfirmed", confirm_mode=1) @@ -233,7 +233,7 @@ Test requeing on recovery """ channel = self.channel - channel.queue_declare(queue="test-requeue", exclusive=True) + channel.queue_declare(queue="test-requeue", exclusive=True, auto_delete=True) self.subscribe(queue="test-requeue", destination="consumer_tag", confirm_mode=1) queue = self.client.queue("consumer_tag") @@ -296,7 +296,7 @@ """ #setup: declare queue and subscribe channel = self.channel - channel.queue_declare(queue="test-prefetch-count", exclusive=True) + channel.queue_declare(queue="test-prefetch-count", exclusive=True, auto_delete=True) subscription = self.subscribe(queue="test-prefetch-count", destination="consumer_tag", confirm_mode=1) queue = self.client.queue("consumer_tag") @@ -338,7 +338,7 @@ """ #setup: declare queue and subscribe channel = self.channel - channel.queue_declare(queue="test-prefetch-size", exclusive=True) + channel.queue_declare(queue="test-prefetch-size", exclusive=True, auto_delete=True) subscription = self.subscribe(queue="test-prefetch-size", destination="consumer_tag", confirm_mode=1) queue = self.client.queue("consumer_tag") @@ -382,8 +382,8 @@ def test_reject(self): channel = self.channel - channel.queue_declare(queue = "q", exclusive=True, alternate_exchange="amq.fanout") - channel.queue_declare(queue = "r", exclusive=True) + channel.queue_declare(queue = "q", exclusive=True, auto_delete=True, alternate_exchange="amq.fanout") + channel.queue_declare(queue = "r", exclusive=True, auto_delete=True) channel.queue_bind(queue = "r", exchange = "amq.fanout") self.subscribe(queue = "q", destination = "consumer", confirm_mode = 1) @@ -402,7 +402,7 @@ """ #declare an exclusive queue channel = self.channel - channel.queue_declare(queue = "q", exclusive=True) + channel.queue_declare(queue = "q", exclusive=True, auto_delete=True) #create consumer (for now that defaults to infinite credit) channel.message_subscribe(queue = "q", destination = "c") channel.message_flow_mode(mode = 0, destination = "c") @@ -432,7 +432,7 @@ """ #declare an exclusive queue channel = self.channel - channel.queue_declare(queue = "q", exclusive=True) + channel.queue_declare(queue = "q", exclusive=True, auto_delete=True) #create consumer (for now that defaults to infinite credit) channel.message_subscribe(queue = "q", destination = "c") channel.message_flow_mode(mode = 0, destination = "c") @@ -464,7 +464,7 @@ """ #declare an exclusive queue channel = self.channel - channel.queue_declare(queue = "q", exclusive=True) + channel.queue_declare(queue = "q", exclusive=True, auto_delete=True) #create consumer (for now that defaults to infinite credit) channel.message_subscribe(queue = "q", destination = "c", confirm_mode = 1) channel.message_flow_mode(mode = 1, destination = "c") @@ -496,7 +496,7 @@ """ #declare an exclusive queue channel = self.channel - channel.queue_declare(queue = "q", exclusive=True) + channel.queue_declare(queue = "q", exclusive=True, auto_delete=True) #create consumer (for now that defaults to infinite credit) channel.message_subscribe(queue = "q", destination = "c", confirm_mode = 1) channel.message_flow_mode(mode = 1, destination = "c") @@ -535,7 +535,7 @@ #existing tests twice. channel = self.channel - channel.queue_declare(queue = "q", exclusive=True) + channel.queue_declare(queue = "q", exclusive=True, auto_delete=True) for i in range(1, 6): channel.message_transfer(content=Content(properties={'routing_key' : "q"}, body = "Message %s" % i)) @@ -562,7 +562,7 @@ Test explicit acquire function """ channel = self.channel - channel.queue_declare(queue = "q", exclusive=True) + channel.queue_declare(queue = "q", exclusive=True, auto_delete=True) channel.message_transfer(content=Content(properties={'routing_key' : "q"}, body = "acquire me")) self.subscribe(queue = "q", destination = "a", acquire_mode = 1, confirm_mode = 1) @@ -578,7 +578,7 @@ Test explicit release function """ channel = self.channel - channel.queue_declare(queue = "q", exclusive=True) + channel.queue_declare(queue = "q", exclusive=True, auto_delete=True) channel.message_transfer(content=Content(properties={'routing_key' : "q"}, body = "release me")) self.subscribe(queue = "q", destination = "a", acquire_mode = 0, confirm_mode = 1) @@ -595,7 +595,7 @@ Test order of released messages is as expected """ channel = self.channel - channel.queue_declare(queue = "q", exclusive=True) + channel.queue_declare(queue = "q", exclusive=True, auto_delete=True) for i in range (1, 11): channel.message_transfer(content=Content(properties={'routing_key' : "q"}, body = "released message %s" % (i))) @@ -618,7 +618,7 @@ Test acking of messages ranges """ channel = self.channel - channel.queue_declare(queue = "q", exclusive=True) + channel.queue_declare(queue = "q", exclusive=True, auto_delete=True) for i in range (1, 11): channel.message_transfer(content=Content(properties={'routing_key' : "q"}, body = "message %s" % (i))) Modified: incubator/qpid/trunk/qpid/python/tests_0-10/query.py URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/tests_0-10/query.py?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/tests_0-10/query.py (original) +++ incubator/qpid/trunk/qpid/python/tests_0-10/query.py Thu Oct 11 06:29:37 2007 @@ -65,8 +65,8 @@ def binding_query_with_key(self, exchange_name): channel = self.channel #setup: create two queues - channel.queue_declare(queue="used-queue", exclusive=True) - channel.queue_declare(queue="unused-queue", exclusive=True) + channel.queue_declare(queue="used-queue", exclusive=True, auto_delete=True) + channel.queue_declare(queue="unused-queue", exclusive=True, auto_delete=True) channel.queue_bind(exchange=exchange_name, queue="used-queue", routing_key="used-key") @@ -135,8 +135,8 @@ """ channel = self.channel #setup - channel.queue_declare(queue="used-queue", exclusive=True) - channel.queue_declare(queue="unused-queue", exclusive=True) + channel.queue_declare(queue="used-queue", exclusive=True, auto_delete=True) + channel.queue_declare(queue="unused-queue", exclusive=True, auto_delete=True) channel.queue_bind(exchange="amq.fanout", queue="used-queue") # test detection of any binding to specific queue @@ -163,8 +163,8 @@ """ channel = self.channel #setup - channel.queue_declare(queue="used-queue", exclusive=True) - channel.queue_declare(queue="unused-queue", exclusive=True) + channel.queue_declare(queue="used-queue", exclusive=True, auto_delete=True) + channel.queue_declare(queue="unused-queue", exclusive=True, auto_delete=True) channel.queue_bind(exchange="amq.match", queue="used-queue", arguments={"x-match":"all", "a":"A"} ) # test detection of any binding to specific queue Modified: incubator/qpid/trunk/qpid/python/tests_0-10/queue.py URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/tests_0-10/queue.py?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/tests_0-10/queue.py (original) +++ incubator/qpid/trunk/qpid/python/tests_0-10/queue.py Thu Oct 11 06:29:37 2007 @@ -31,7 +31,7 @@ channel = self.channel #setup, declare a queue and add some messages to it: channel.exchange_declare(exchange="test-exchange", type="direct") - channel.queue_declare(queue="test-queue", exclusive=True) + channel.queue_declare(queue="test-queue", exclusive=True, auto_delete=True) channel.queue_bind(queue="test-queue", exchange="test-exchange", routing_key="key") channel.message_transfer(destination="test-exchange", content=Content("one", properties={'routing_key':"key"})) channel.message_transfer(destination="test-exchange", content=Content("two", properties={'routing_key':"key"})) @@ -91,10 +91,10 @@ c2.session_open() #declare an exclusive queue: - c1.queue_declare(queue="exclusive-queue", exclusive="True") + c1.queue_declare(queue="exclusive-queue", exclusive=True, auto_delete=True) try: #other connection should not be allowed to declare this: - c2.queue_declare(queue="exclusive-queue", exclusive="True") + c2.queue_declare(queue="exclusive-queue", exclusive=True, auto_delete=True) self.fail("Expected second exclusive queue_declare to raise a channel exception") except Closed, e: self.assertChannelException(405, e.args[0]) @@ -106,11 +106,11 @@ """ channel = self.channel #declare an exclusive queue: - channel.queue_declare(queue="passive-queue-1", exclusive="True") - channel.queue_declare(queue="passive-queue-1", passive="True") + channel.queue_declare(queue="passive-queue-1", exclusive=True, auto_delete=True) + channel.queue_declare(queue="passive-queue-1", passive=True) try: #other connection should not be allowed to declare this: - channel.queue_declare(queue="passive-queue-2", passive="True") + channel.queue_declare(queue="passive-queue-2", passive=True) self.fail("Expected passive declaration of non-existant queue to raise a channel exception") except Closed, e: self.assertChannelException(404, e.args[0]) @@ -121,7 +121,7 @@ Test various permutations of the queue.bind method """ channel = self.channel - channel.queue_declare(queue="queue-1", exclusive="True") + channel.queue_declare(queue="queue-1", exclusive=True, auto_delete=True) #straightforward case, both exchange & queue exist so no errors expected: channel.queue_bind(queue="queue-1", exchange="amq.direct", routing_key="key1") @@ -166,8 +166,8 @@ #bind two queues and consume from them channel = self.channel - channel.queue_declare(queue="queue-1", exclusive="True") - channel.queue_declare(queue="queue-2", exclusive="True") + channel.queue_declare(queue="queue-1", exclusive=True, auto_delete=True) + channel.queue_declare(queue="queue-2", exclusive=True, auto_delete=True) self.subscribe(queue="queue-1", destination="queue-1") self.subscribe(queue="queue-2", destination="queue-2") @@ -218,7 +218,7 @@ channel.queue_delete(queue="delete-me") #check that it has gone be declaring passively try: - channel.queue_declare(queue="delete-me", passive="True") + channel.queue_declare(queue="delete-me", passive=True) self.fail("Queue has not been deleted") except Closed, e: self.assertChannelException(404, e.args[0]) @@ -227,7 +227,7 @@ channel = self.client.channel(2) channel.session_open() try: - channel.queue_delete(queue="i-dont-exist", if_empty="True") + channel.queue_delete(queue="i-dont-exist", if_empty=True) self.fail("Expected delete of non-existant queue to fail") except Closed, e: self.assertChannelException(404, e.args[0]) @@ -242,12 +242,12 @@ #create a queue and add a message to it (use default binding): channel.queue_declare(queue="delete-me-2") - channel.queue_declare(queue="delete-me-2", passive="True") + channel.queue_declare(queue="delete-me-2", passive=True) channel.message_transfer(content=Content("message", properties={'routing_key':"delete-me-2"})) #try to delete, but only if empty: try: - channel.queue_delete(queue="delete-me-2", if_empty="True") + channel.queue_delete(queue="delete-me-2", if_empty=True) self.fail("Expected delete if_empty to fail for non-empty queue") except Closed, e: self.assertChannelException(406, e.args[0]) @@ -264,11 +264,11 @@ channel.message_cancel(destination="consumer_tag") #retry deletion on empty queue: - channel.queue_delete(queue="delete-me-2", if_empty="True") + channel.queue_delete(queue="delete-me-2", if_empty=True) #check that it has gone by declaring passively: try: - channel.queue_declare(queue="delete-me-2", passive="True") + channel.queue_declare(queue="delete-me-2", passive=True) self.fail("Queue has not been deleted") except Closed, e: self.assertChannelException(404, e.args[0]) @@ -281,7 +281,7 @@ #create a queue and register a consumer: channel.queue_declare(queue="delete-me-3") - channel.queue_declare(queue="delete-me-3", passive="True") + channel.queue_declare(queue="delete-me-3", passive=True) self.subscribe(destination="consumer_tag", queue="delete-me-3") #need new channel now: @@ -289,17 +289,17 @@ channel2.session_open() #try to delete, but only if empty: try: - channel2.queue_delete(queue="delete-me-3", if_unused="True") + channel2.queue_delete(queue="delete-me-3", if_unused=True) self.fail("Expected delete if_unused to fail for queue with existing consumer") except Closed, e: self.assertChannelException(406, e.args[0]) channel.message_cancel(destination="consumer_tag") - channel.queue_delete(queue="delete-me-3", if_unused="True") + channel.queue_delete(queue="delete-me-3", if_unused=True) #check that it has gone by declaring passively: try: - channel.queue_declare(queue="delete-me-3", passive="True") + channel.queue_declare(queue="delete-me-3", passive=True) self.fail("Queue has not been deleted") except Closed, e: self.assertChannelException(404, e.args[0]) Modified: incubator/qpid/trunk/qpid/python/tests_0-10/tx.py URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/tests_0-10/tx.py?rev=583821&r1=583820&r2=583821&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/tests_0-10/tx.py (original) +++ incubator/qpid/trunk/qpid/python/tests_0-10/tx.py Thu Oct 11 06:29:37 2007 @@ -155,9 +155,9 @@ commit and rollback """ #setup: - channel.queue_declare(queue=name_a, exclusive=True) - channel.queue_declare(queue=name_b, exclusive=True) - channel.queue_declare(queue=name_c, exclusive=True) + channel.queue_declare(queue=name_a, exclusive=True, auto_delete=True) + channel.queue_declare(queue=name_b, exclusive=True, auto_delete=True) + channel.queue_declare(queue=name_c, exclusive=True, auto_delete=True) key = "my_key_" + name_b topic = "my_topic_" + name_c