You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2010/04/12 19:25:35 UTC

svn commit: r933330 - in /qpid/trunk/qpid/cpp/src: qpid/client/amqp0_10/AddressResolution.cpp tests/MessagingSessionTests.cpp

Author: gsim
Date: Mon Apr 12 17:25:35 2010
New Revision: 933330

URL: http://svn.apache.org/viewvc?rev=933330&view=rev
Log:
QPID-664: changed option verifier to use constants rather than duplicating string literals; added a test to make sure all valid options are allowed and illegal ones are not

Modified:
    qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp
    qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp?rev=933330&r1=933329&r2=933330&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp Mon Apr 12 17:25:35 2010
@@ -72,7 +72,6 @@ class Verifier
 };
 
 namespace{
-const Verifier verifier;
 const Variant EMPTY_VARIANT;
 const FieldTable EMPTY_FIELD_TABLE;
 const Variant::List EMPTY_LIST;
@@ -129,6 +128,8 @@ const std::string DIRECT_EXCHANGE("direc
 const std::string HEADERS_EXCHANGE("headers");
 const std::string XML_EXCHANGE("xml");
 const std::string WILDCARD_ANY("*");
+
+const Verifier verifier;
 }
 
 struct Binding
@@ -922,24 +923,24 @@ std::vector<std::string> Node::SENDER_MO
 
 Verifier::Verifier()
 {
-    defined["create"] = true;
-    defined["assert"] = true;
-    defined["delete"] = true;
-    defined["mode"] = true;
+    defined[CREATE] = true;
+    defined[ASSERT] = true;
+    defined[DELETE] = true;
+    defined[MODE] = true;
     Variant::Map node;
-    node["type"] = true;
-    node["durable"] = true;
-    node["x-declare"] = true;
-    node["x-bindings"] = true;
-    defined["node"] = node;
+    node[TYPE] = true;
+    node[DURABLE] = true;
+    node[X_DECLARE] = true;
+    node[X_BINDINGS] = true;
+    defined[NODE] = node;
     Variant::Map link;
-    link["name"] = true;
-    link["durable"] = true;
-    link["reliable"] = true;
-    link["x-subscribe"] = true;
-    link["x-declare"] = true;
-    link["x-bindings"] = true;
-    defined["link"] = link;
+    link[NAME] = true;
+    link[DURABLE] = true;
+    link[RELIABILITY] = true;
+    link[X_SUBSCRIBE] = true;
+    link[X_DECLARE] = true;
+    link[X_BINDINGS] = true;
+    defined[LINK] = link;
 }
 void Verifier::verify(const Address& address) const
 {

Modified: qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp?rev=933330&r1=933329&r2=933330&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp Mon Apr 12 17:25:35 2010
@@ -872,6 +872,13 @@ QPID_AUTO_TEST_CASE(testRelease)
     fix.session.acknowledge(true);
 }
 
+QPID_AUTO_TEST_CASE(testOptionVerification)
+{
+    MessagingFixture fix;
+    fix.session.createReceiver("my-queue; {create: always, assert: always, delete: always, node: {type: queue, durable: false, x-declare: {arguments: {a: b}}, x-bindings: [{exchange: amq.fanout}]}, link: {name: abc, durable: false, reliability: exactly-once, x-subscribe: {arguments:{a:b}}, x-bindings:[{exchange: amq.fanout}]}, mode: browse}");
+    BOOST_CHECK_THROW(fix.session.createReceiver("my-queue; {invalid-option:blah}"), qpid::messaging::AddressError);    
+}
+
 QPID_AUTO_TEST_SUITE_END()
 
 }} // namespace qpid::tests



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org