qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1537579 - in /qpid/trunk/qpid: cpp/src/qpid/broker/Queue.cpp cpp/src/tests/acl.py tests/src/py/qpid_tests/broker_0_10/dtx.py tests/src/py/qpid_tests/broker_0_10/queue.py
Date Thu, 31 Oct 2013 18:37:49 GMT
Author: gsim
Date: Thu Oct 31 18:37:49 2013
New Revision: 1537579

URL: http://svn.apache.org/r1537579
Log:
QPID-5283: ensure queue has no consumers before granting exclusive ownership

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
    qpid/trunk/qpid/cpp/src/tests/acl.py
    qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/dtx.py
    qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/queue.py

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp?rev=1537579&r1=1537578&r2=1537579&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp Thu Oct 31 18:37:49 2013
@@ -1323,7 +1323,7 @@ bool Queue::setExclusiveOwner(const Owne
         autoDeleteTask->cancel();
     }
     Mutex::ScopedLock locker(messageLock);
-    if (owner) {
+    if (owner  || users.hasConsumers()) {
         return false;
     } else {
         owner = o;

Modified: qpid/trunk/qpid/cpp/src/tests/acl.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/acl.py?rev=1537579&r1=1537578&r2=1537579&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/acl.py (original)
+++ qpid/trunk/qpid/cpp/src/tests/acl.py Thu Oct 31 18:37:49 2013
@@ -1570,7 +1570,8 @@ class ACLTests(TestBase010):
             session = self.get_session('bob','bob')
 
         try:
-            session.message_subscribe(queue='q3', destination='myq1')
+            session.message_subscribe(queue='q3', destination='myq3')
+            session.message_cancel(destination='myq3')
         except qpid.session.SessionException, e:
             if (403 == e.args[0].error_code):
                 self.fail("ACL should allow subscription for q3");

Modified: qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/dtx.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/dtx.py?rev=1537579&r1=1537578&r2=1537579&view=diff
==============================================================================
--- qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/dtx.py (original)
+++ qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/dtx.py Thu Oct 31 18:37:49 2013
@@ -386,7 +386,6 @@ class DtxTests(TestBase010):
         """
         guard = self.keepQueuesAlive(["tx-queue"])
         session = self.conn.session("alternate", 1)
-        session.queue_declare(queue="tx-queue", exclusive=True, auto_delete=True)
 
         #publish a message under a transaction
         session.dtx_select()

Modified: qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/queue.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/queue.py?rev=1537579&r1=1537578&r2=1537579&view=diff
==============================================================================
--- qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/queue.py (original)
+++ qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/queue.py Thu Oct 31 18:37:49 2013
@@ -99,7 +99,7 @@ class QueueTests(TestBase010):
             self.fail("Expected second exclusive queue_declare to raise a channel exception")
         except SessionException, e:
             self.assertEquals(405, e.args[0].error_code)
-            
+
         s3 = self.conn.session("subscriber")
         try:
             #other connection should not be allowed to declare this:
@@ -132,6 +132,25 @@ class QueueTests(TestBase010):
         except SessionException, e:
             self.assertEquals(405, e.args[0].error_code)
 
+    def test_declare_exclusive_alreadyinuse(self):
+        """
+        Test that exclusivity is real if granted
+        """
+        # TestBase.setUp has already opened session(1)
+        s1 = self.session
+        # Here we open a second separate connection:
+        s2 = self.conn.session("other")
+
+        #declare an exclusive queue:
+        s1.queue_declare(queue="a-queue", auto_delete=True)
+        s1.message_subscribe(queue="a-queue")
+        try:
+            #other connection should not be allowed to declare this:
+            s2.queue_declare(queue="a-queue", exclusive=True, auto_delete=True)
+            self.fail("Expected request for exclusivity to fail")
+        except SessionException, e:
+            self.assertEquals(405, e.args[0].error_code)
+
     def test_declare_passive(self):
         """
         Test that the passive field is honoured in queue.declare



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message