summaryrefslogtreecommitdiff
path: root/qpid/tests
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2014-11-18 17:07:23 +0000
committerKeith Wall <kwall@apache.org>2014-11-18 17:07:23 +0000
commita4ba3fe79a79aa063154da0676fe1336c271c256 (patch)
tree92b2a58d435745e2c32874e00a2edf94caf35743 /qpid/tests
parenta33a578d175767cf0129dcdb5c78d017dc93ee63 (diff)
downloadqpid-python-a4ba3fe79a79aa063154da0676fe1336c271c256.tar.gz
QPID-6226: [Java Broker] Change queue.declare so that on the passive path, exclusivity is verified if command has set the exclusive flag.
Also strengthen the python tests. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1640390 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/tests')
-rw-r--r--qpid/tests/src/py/qpid_tests/broker_0_10/queue.py52
1 files changed, 43 insertions, 9 deletions
diff --git a/qpid/tests/src/py/qpid_tests/broker_0_10/queue.py b/qpid/tests/src/py/qpid_tests/broker_0_10/queue.py
index 545bc8cc23..132bd7b987 100644
--- a/qpid/tests/src/py/qpid_tests/broker_0_10/queue.py
+++ b/qpid/tests/src/py/qpid_tests/broker_0_10/queue.py
@@ -152,20 +152,54 @@ class QueueTests(TestBase010):
self.assertEquals(405, e.args[0].error_code)
def test_declare_passive(self):
+ """
+ Test that the passive field is honoured in queue.declare
+ """
+ s1 = self.session
+ s2 = self.conn.session("other")
+
+ s1.queue_declare(queue="passive-queue-1")
+
+ #ensure that same/separate sessions can passively declare same queue
+ s1.queue_declare(queue="passive-queue-1", passive=True)
+ s2.queue_declare(queue="passive-queue-1", passive=True)
+
+ s1.queue_delete(queue="passive-queue-1")
+
+ def test_declare_passive_queue_not_found(self):
+ """
+ Test that the passive field is honoured in queue.declare
+ """
+ s1 = self.session
+
+ try:
+ s1.queue_declare(queue="passive-queue-not-found", passive=True)
+ self.fail("Expected passive declaration of non-existent queue to raise a channel exception")
+ except SessionException, e:
+ self.assertEquals(404, e.args[0].error_code) #not-found
+
+
+ def test_declare_passive_with_exclusive(self):
"""
Test that the passive field is honoured in queue.declare
"""
- session = self.session
- #declare an exclusive queue:
- session.queue_declare(queue="passive-queue-1", exclusive=True, auto_delete=True)
- session.queue_declare(queue="passive-queue-1", passive=True)
+ s1 = self.session
+ s2 = self.conn.session("other")
+
+ #declare exclusive/non-exclusive queues:
+ s1.queue_declare(queue="passive-queue-exc", exclusive=True, auto_delete=True)
+ s1.queue_declare(queue="passive-queue-nonexc", exclusive=False, auto_delete=True)
+
+ #ensure that same/separate sessions can passively declare same queue *without* the exclusive flag
+ #this is important for the request/reply pattern
+ s1.queue_declare(queue="passive-queue-exc", passive=True)
+ s2.queue_declare(queue="passive-queue-exc", passive=True)
+
try:
- #other connection should not be allowed to declare this:
- session.queue_declare(queue="passive-queue-2", passive=True)
- self.fail("Expected passive declaration of non-existant queue to raise a channel exception")
+ s2.queue_declare(queue="passive-queue-nonexc", exclusive=True, passive=True)
+ self.fail("Expected exclusive passive declaration of existing queue to raise a channel exception")
except SessionException, e:
- self.assertEquals(404, e.args[0].error_code) #not-found
-
+ self.assertEquals(405, e.args[0].error_code) # resource locked
def test_bind(self):
"""