You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2013/10/22 15:16:44 UTC

svn commit: r1534627 - in /qpid/branches/linearstore/qpid: ./ cpp/src/ cpp/src/qpid/acl/ cpp/src/qpid/broker/ cpp/src/qpid/broker/amqp/ cpp/src/tests/

Author: kpvdr
Date: Tue Oct 22 13:16:43 2013
New Revision: 1534627

URL: http://svn.apache.org/r1534627
Log:
QPID-4984: WIP - Merge from trunk r.1534626.

Modified:
    qpid/branches/linearstore/qpid/   (props changed)
    qpid/branches/linearstore/qpid/cpp/src/   (props changed)
    qpid/branches/linearstore/qpid/cpp/src/qpid/acl/   (props changed)
    qpid/branches/linearstore/qpid/cpp/src/qpid/acl/AclValidator.cpp
    qpid/branches/linearstore/qpid/cpp/src/qpid/broker/   (props changed)
    qpid/branches/linearstore/qpid/cpp/src/qpid/broker/Broker.cpp
    qpid/branches/linearstore/qpid/cpp/src/qpid/broker/QueueSettings.cpp
    qpid/branches/linearstore/qpid/cpp/src/qpid/broker/QueueSettings.h
    qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
    qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Outgoing.h
    qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Session.cpp
    qpid/branches/linearstore/qpid/cpp/src/tests/   (props changed)
    qpid/branches/linearstore/qpid/cpp/src/tests/acl.py

Propchange: qpid/branches/linearstore/qpid/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid:r1534400-1534626

Propchange: qpid/branches/linearstore/qpid/cpp/src/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src:r1534386-1534626

Propchange: qpid/branches/linearstore/qpid/cpp/src/qpid/acl/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src/qpid/acl:r1525057-1534626

Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/acl/AclValidator.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/acl/AclValidator.cpp?rev=1534627&r1=1534626&r2=1534627&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/acl/AclValidator.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/acl/AclValidator.cpp Tue Oct 22 13:16:43 2013
@@ -110,7 +110,7 @@ namespace acl {
                                     boost::shared_ptr<PropertyType>(
                                         new IntPropertyType(0,std::numeric_limits<int64_t>::max()))));
 
-        std::string policyTypes[] = {"ring", "ring_strict", "flow_to_disk", "reject"};
+        std::string policyTypes[] = {"ring", "self-destruct", "reject"};
         std::vector<std::string> v(policyTypes, policyTypes + sizeof(policyTypes) / sizeof(std::string));
         validators.insert(Validator(acl::SPECPROP_POLICYTYPE,
                           boost::shared_ptr<PropertyType>(

Propchange: qpid/branches/linearstore/qpid/cpp/src/qpid/broker/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src/qpid/broker:r1534386-1534626

Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/broker/Broker.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/broker/Broker.cpp?rev=1534627&r1=1534626&r2=1534627&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/broker/Broker.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/broker/Broker.cpp Tue Oct 22 13:16:43 2013
@@ -1285,7 +1285,7 @@ std::pair<boost::shared_ptr<Queue>, bool
         params.insert(make_pair(acl::PROP_DURABLE, settings.durable ? _TRUE : _FALSE));
         params.insert(make_pair(acl::PROP_EXCLUSIVE, owner ? _TRUE : _FALSE));
         params.insert(make_pair(acl::PROP_AUTODELETE, settings.autodelete ? _TRUE : _FALSE));
-        params.insert(make_pair(acl::PROP_POLICYTYPE, settings.dropMessagesAtLimit ? "ring" : "reject"));
+        params.insert(make_pair(acl::PROP_POLICYTYPE, settings.getLimitPolicy()));
         params.insert(make_pair(acl::PROP_MAXQUEUECOUNT, boost::lexical_cast<string>(settings.maxDepth.getCount())));
         params.insert(make_pair(acl::PROP_MAXQUEUESIZE, boost::lexical_cast<string>(settings.maxDepth.getSize())));
         params.insert(make_pair(acl::PROP_MAXFILECOUNT, boost::lexical_cast<string>(settings.maxFileCount)));
@@ -1338,7 +1338,7 @@ void Broker::deleteQueue(const std::stri
             params.insert(make_pair(acl::PROP_DURABLE, queue->isDurable() ? _TRUE : _FALSE));
             params.insert(make_pair(acl::PROP_EXCLUSIVE, queue->hasExclusiveOwner() ? _TRUE : _FALSE));
             params.insert(make_pair(acl::PROP_AUTODELETE, queue->isAutoDelete() ? _TRUE : _FALSE));
-            params.insert(make_pair(acl::PROP_POLICYTYPE, queue->getSettings().dropMessagesAtLimit ? "ring" : "reject"));
+            params.insert(make_pair(acl::PROP_POLICYTYPE, queue->getSettings().getLimitPolicy()));
 
             if (!acl->authorise(userId,acl::ACT_DELETE,acl::OBJ_QUEUE,name,&params) )
                 throw framing::UnauthorizedAccessException(QPID_MSG("ACL denied queue delete request from " << userId));

Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/broker/QueueSettings.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/broker/QueueSettings.cpp?rev=1534627&r1=1534626&r2=1534627&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/broker/QueueSettings.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/broker/QueueSettings.cpp Tue Oct 22 13:16:43 2013
@@ -314,4 +314,10 @@ QueueSettings::Aliases::Aliases()
     insert(value_type("x-qpid-maximum-message-size", "qpid.alert_size"));
 }
 
+std::string QueueSettings::getLimitPolicy() const
+{
+    if (dropMessagesAtLimit) return POLICY_TYPE_RING;
+    else if (selfDestructAtLimit) return POLICY_TYPE_SELF_DESTRUCT;
+    else return POLICY_TYPE_REJECT;
+}
 }} // namespace qpid::broker

Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/broker/QueueSettings.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/broker/QueueSettings.h?rev=1534627&r1=1534626&r2=1534627&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/broker/QueueSettings.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/broker/QueueSettings.h Tue Oct 22 13:16:43 2013
@@ -111,6 +111,7 @@ struct QueueSettings
     QPID_BROKER_EXTERN void populate(const std::map<std::string, qpid::types::Variant>& inputs, std::map<std::string, qpid::types::Variant>& unused);
     QPID_BROKER_EXTERN void populate(const qpid::framing::FieldTable& inputs, qpid::framing::FieldTable& unused);
     QPID_BROKER_EXTERN std::map<std::string, qpid::types::Variant> asMap() const;
+    std::string getLimitPolicy() const;
 
     struct Aliases : std::map<std::string, std::string>
     {

Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp?rev=1534627&r1=1534626&r2=1534627&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp Tue Oct 22 13:16:43 2013
@@ -300,6 +300,12 @@ size_t OutgoingFromQueue::Record::getInd
     return (size_t) buffer.getLong();
 }
 
+boost::shared_ptr<Queue> OutgoingFromQueue::getExclusiveSubscriptionQueue(Outgoing* o)
+{
+    OutgoingFromQueue* s = dynamic_cast<OutgoingFromQueue*>(o);
+    if (s && s->exclusive) return s->queue;
+    else return boost::shared_ptr<Queue>();
+}
 
 
 }}} // namespace qpid::broker::amqp

Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Outgoing.h
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Outgoing.h?rev=1534627&r1=1534626&r2=1534627&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Outgoing.h (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Outgoing.h Tue Oct 22 13:16:43 2013
@@ -107,6 +107,7 @@ class OutgoingFromQueue : public Outgoin
     void cancel();
     void acknowledged(const qpid::broker::DeliveryRecord&);
     qpid::broker::OwnershipToken* getSession();
+    static boost::shared_ptr<Queue> getExclusiveSubscriptionQueue(Outgoing*);
 
   private:
 

Modified: qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Session.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Session.cpp?rev=1534627&r1=1534626&r2=1534627&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Session.cpp (original)
+++ qpid/branches/linearstore/qpid/cpp/src/qpid/broker/amqp/Session.cpp Tue Oct 22 13:16:43 2013
@@ -396,7 +396,7 @@ void Session::setupOutgoing(pn_link_t* l
         authorise.access(node.exchange);//do separate access check before trying to create the queue
         bool shared = is_capability_requested(SHARED, pn_terminus_capabilities(source));
         bool durable = pn_terminus_get_durability(source);
-        bool autodelete = !durable && pn_link_remote_snd_settle_mode(link) == PN_SND_SETTLED;
+        bool autodelete = !durable && pn_link_remote_snd_settle_mode(link) != PN_SND_UNSETTLED;
         QueueSettings settings(durable, autodelete);
         std::string altExchange;
         if (node.topic) {
@@ -475,6 +475,8 @@ void Session::detach(pn_link_t* link)
         OutgoingLinks::iterator i = outgoing.find(link);
         if (i != outgoing.end()) {
             i->second->detached();
+            boost::shared_ptr<Queue> q = OutgoingFromQueue::getExclusiveSubscriptionQueue(i->second.get());
+            if (q) connection.getBroker().deleteQueue(q->getName(), connection.getUserId(), connection.getMgmtId());
             outgoing.erase(i);
             QPID_LOG(debug, "Outgoing link detached");
         }

Propchange: qpid/branches/linearstore/qpid/cpp/src/tests/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src/tests:r1534386-1534626

Modified: qpid/branches/linearstore/qpid/cpp/src/tests/acl.py
URL: http://svn.apache.org/viewvc/qpid/branches/linearstore/qpid/cpp/src/tests/acl.py?rev=1534627&r1=1534626&r2=1534627&view=diff
==============================================================================
--- qpid/branches/linearstore/qpid/cpp/src/tests/acl.py (original)
+++ qpid/branches/linearstore/qpid/cpp/src/tests/acl.py Tue Oct 22 13:16:43 2013
@@ -382,8 +382,7 @@ class ACLTests(TestBase010):
         aclf.close()
 
         result = self.reload_acl()
-        expected = "ding is not a valid value for 'policytype', possible values are one of" \
-                   " { 'ring' 'ring_strict' 'flow_to_disk' 'reject' }";
+        expected = "ding is not a valid value for 'policytype', possible values are one of"
         if (result.find(expected) == -1):
             self.fail(result)
 
@@ -802,6 +801,7 @@ class ACLTests(TestBase010):
         aclf.write('acl allow bob@QPID delete queue name=q4\n')
         aclf.write('acl allow bob@QPID create queue name=q5 maxqueuesize=1000 maxqueuecount=100\n')
         aclf.write('acl allow bob@QPID create queue name=q6 queuemaxsizelowerlimit=50 queuemaxsizeupperlimit=100 queuemaxcountlowerlimit=50 queuemaxcountupperlimit=100\n')
+        aclf.write('acl allow bob@QPID create queue name=q7 policytype=self-destruct\n')
         aclf.write('acl allow anonymous all all\n')
         aclf.write('acl deny all all')
         aclf.close()
@@ -915,6 +915,17 @@ class ACLTests(TestBase010):
                 self.fail("ACL should allow queue create request for q2 with exclusive=true policytype=ring");
 
         try:
+            session.queue_declare(queue="q7", arguments={"qpid.policy_type": "ring"})
+            self.fail("ACL should not allow queue create request for q7 with policytype=ring");
+        except qpid.session.SessionException, e:
+            session = self.get_session('bob','bob')
+
+        try:
+            session.queue_declare(queue="q7", arguments={"qpid.policy_type": "self-destruct"})
+        except qpid.session.SessionException, e:
+            self.fail("ACL should allow queue create request for q7 with policytype=self-destruct");
+
+        try:
             session.queue_declare(queue="q3")
             session.queue_declare(queue="q4")
         except qpid.session.SessionException, e:



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