activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1334465 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/commands/ test/activemq/commands/
Date Sat, 05 May 2012 18:51:02 GMT
Author: tabish
Date: Sat May  5 18:51:01 2012
New Revision: 1334465

URL: http://svn.apache.org/viewvc?rev=1334465&view=rev
Log:
Fix the isComposite method and clean up the API a bit.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQDestinationTest2.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQDestinationTest2.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.cpp?rev=1334465&r1=1334464&r2=1334465&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.cpp
Sat May  5 18:51:01 2012
@@ -18,6 +18,7 @@
 #include <decaf/lang/exceptions/NullPointerException.h>
 #include <activemq/util/URISupport.h>
 #include <activemq/util/CMSExceptionSupport.h>
+#include <activemq/util/AdvisorySupport.h>
 
 #include <activemq/commands/ActiveMQTopic.h>
 #include <activemq/commands/ActiveMQQueue.h>
@@ -37,13 +38,6 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-const std::string ActiveMQDestination::ADVISORY_PREFIX = "ActiveMQ.Advisory.";
-const std::string ActiveMQDestination::CONSUMER_ADVISORY_PREFIX =
-    ActiveMQDestination::ADVISORY_PREFIX + "Consumers.";
-const std::string ActiveMQDestination::PRODUCER_ADVISORY_PREFIX =
-    ActiveMQDestination::ADVISORY_PREFIX + "Producers.";
-const std::string ActiveMQDestination::CONNECTION_ADVISORY_PREFIX =
-    ActiveMQDestination::ADVISORY_PREFIX + "Connections.";
 const std::string ActiveMQDestination::DEFAULT_ORDERED_TARGET = "coordinator";
 const std::string ActiveMQDestination::TEMP_PREFIX = "{TD{";
 const std::string ActiveMQDestination::TEMP_POSTFIX = "}TD}";
@@ -103,7 +97,7 @@ void ActiveMQDestination::setPhysicalNam
         URISupport::parseQuery(optstring, &options.getProperties());
     }
 
-    this->advisory = physicalName.find_first_of(ADVISORY_PREFIX) == 0;
+    this->advisory = physicalName.find_first_of(AdvisorySupport::ADVISORY_TOPIC_PREFIX)
== 0;
     this->compositeDestinations.clear();
 }
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.h?rev=1334465&r1=1334464&r2=1334465&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.h
Sat May  5 18:51:01 2012
@@ -50,26 +50,6 @@ namespace commands{
         };
 
         /**
-         * prefix for Advisory message destinations
-         */
-        static const std::string ADVISORY_PREFIX;
-
-        /**
-         * prefix for consumer advisory destinations
-         */
-        static const std::string CONSUMER_ADVISORY_PREFIX;
-
-        /**
-         * prefix for producer advisory destinations
-         */
-        static const std::string PRODUCER_ADVISORY_PREFIX;
-
-        /**
-         * prefix for connection advisory destinations
-         */
-        static const std::string CONNECTION_ADVISORY_PREFIX;
-
-        /**
          * The default target for ordered destinations
          */
         static const std::string DEFAULT_ORDERED_TARGET;
@@ -154,29 +134,26 @@ namespace commands{
             this->advisory = advisory;
         }
 
-        /**
-         * @return true if this is a destination for Consumer advisories
-         */
-        virtual bool isConsumerAdvisory() const {
-            return isAdvisory() &&
-                   physicalName.find(CONSUMER_ADVISORY_PREFIX) == 0;
-        }
-
-        /**
-         * @return true if this is a destination for Producer advisories
-         */
-        virtual bool isProducerAdvisory() const {
-            return isAdvisory() &&
-                   physicalName.find(PRODUCER_ADVISORY_PREFIX) == 0;
-        }
-
-        /**
-         * @return true if this is a destination for Connection advisories
-         */
-        virtual bool isConnectionAdvisory() const {
-            return isAdvisory() &&
-                   physicalName.find(CONNECTION_ADVISORY_PREFIX) == 0;
-        }
+//        /**
+//         * @return true if this is a destination for Consumer advisories
+//         */
+//        virtual bool isConsumerAdvisory() const {
+//            return isAdvisory() && physicalName.find(CONSUMER_ADVISORY_PREFIX)
== 0;
+//        }
+//
+//        /**
+//         * @return true if this is a destination for Producer advisories
+//         */
+//        virtual bool isProducerAdvisory() const {
+//            return isAdvisory() && physicalName.find(PRODUCER_ADVISORY_PREFIX)
== 0;
+//        }
+//
+//        /**
+//         * @return true if this is a destination for Connection advisories
+//         */
+//        virtual bool isConnectionAdvisory() const {
+//            return isAdvisory() && physicalName.find(CONNECTION_ADVISORY_PREFIX)
== 0;
+//        }
 
         /**
          * @return Returns the exclusive.
@@ -269,7 +246,7 @@ namespace commands{
          *         destinations.
          */
         virtual bool isComposite() const {
-            return physicalName.find_first_of(COMPOSITE_SEPARATOR) > 0;
+            return physicalName.find_first_of(COMPOSITE_SEPARATOR) != std::string::npos;
         }
 
         /**

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQDestinationTest2.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQDestinationTest2.cpp?rev=1334465&r1=1334464&r2=1334465&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQDestinationTest2.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQDestinationTest2.cpp
Sat May  5 18:51:01 2012
@@ -27,6 +27,56 @@ using namespace activemq::util;
 using namespace activemq::commands;
 
 ////////////////////////////////////////////////////////////////////////////////
+namespace {
+
+    class MyDestination : public ActiveMQDestination {
+    public:
+
+        /**
+         * Returns the Type of Destination that this object represents
+         * @returns int type qualifier.
+         */
+        virtual cms::Destination::DestinationType getDestinationType() const {
+            return cms::Destination::TOPIC;
+        }
+
+        /**
+         * Clone this object and return a new instance that the
+         * caller now owns, this will be an exact copy of this one
+         * @returns new copy of this object.
+         */
+        virtual MyDestination* cloneDataStructure() const {
+            MyDestination* message = new MyDestination();
+            message->copyDataStructure( this );
+            return message;
+        }
+
+        /**
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
+         */
+        virtual void copyDataStructure( const DataStructure* src ) {
+            ActiveMQDestination::copyDataStructure( src );
+        }
+    };
+
+    class MyTempDestination : public MyDestination {
+    public:
+
+        /**
+         * Returns the Type of Destination that this object represents
+         * @returns int type qualifier.
+         */
+        virtual cms::Destination::DestinationType getDestinationType() const {
+            return cms::Destination::TEMPORARY_TOPIC;
+        }
+
+    };
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void ActiveMQDestinationTest::test()
 {
     MyDestination dest;
@@ -40,9 +90,6 @@ void ActiveMQDestinationTest::test()
     CPPUNIT_ASSERT( dest.isAdvisory() == true );
     CPPUNIT_ASSERT( dest.isExclusive() == true );
     CPPUNIT_ASSERT( dest.isAdvisory() == true );
-    CPPUNIT_ASSERT( dest.isConsumerAdvisory() == false );
-    CPPUNIT_ASSERT( dest.isProducerAdvisory() == false );
-    CPPUNIT_ASSERT( dest.isConnectionAdvisory() == false );
 
     MyDestination dest2;
     dest2.copyDataStructure( &dest );
@@ -51,8 +98,6 @@ void ActiveMQDestinationTest::test()
     CPPUNIT_ASSERT( dest2.isAdvisory() == true );
     CPPUNIT_ASSERT( dest2.isExclusive() == true );
     CPPUNIT_ASSERT( dest2.isAdvisory() == true );
-    CPPUNIT_ASSERT( dest2.isConsumerAdvisory() == false );
-    CPPUNIT_ASSERT( dest2.isProducerAdvisory() == false );
 
     MyDestination* dest3 = NULL;
     dest3 = dynamic_cast<MyDestination*>( dest.cloneDataStructure() );
@@ -62,8 +107,6 @@ void ActiveMQDestinationTest::test()
     CPPUNIT_ASSERT( dest3->isAdvisory() == true );
     CPPUNIT_ASSERT( dest3->isExclusive() == true );
     CPPUNIT_ASSERT( dest3->isAdvisory() == true );
-    CPPUNIT_ASSERT( dest3->isConsumerAdvisory() == false );
-    CPPUNIT_ASSERT( dest3->isProducerAdvisory() == false );
 
     delete dest3;
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQDestinationTest2.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQDestinationTest2.h?rev=1334465&r1=1334464&r2=1334465&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQDestinationTest2.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQDestinationTest2.h
Sat May  5 18:51:01 2012
@@ -33,51 +33,6 @@ namespace commands{
         CPPUNIT_TEST( testOptions );
         CPPUNIT_TEST_SUITE_END();
 
-        class MyDestination : public ActiveMQDestination {
-        public:
-
-            /**
-             * Returns the Type of Destination that this object represents
-             * @returns int type qualifier.
-             */
-            virtual cms::Destination::DestinationType getDestinationType() const {
-                return cms::Destination::TOPIC;
-            }
-
-            /**
-             * Clone this object and return a new instance that the
-             * caller now owns, this will be an exact copy of this one
-             * @returns new copy of this object.
-             */
-            virtual MyDestination* cloneDataStructure() const {
-                MyDestination* message = new MyDestination();
-                message->copyDataStructure( this );
-                return message;
-            }
-
-            /**
-             * Copy the contents of the passed object into this objects
-             * members, overwriting any existing data.
-             * @return src - Source Object
-             */
-            virtual void copyDataStructure( const DataStructure* src ) {
-                ActiveMQDestination::copyDataStructure( src );
-            }
-        };
-
-        class MyTempDestination : public MyDestination {
-        public:
-
-            /**
-             * Returns the Type of Destination that this object represents
-             * @returns int type qualifier.
-             */
-            virtual cms::Destination::DestinationType getDestinationType() const {
-                return cms::Destination::TEMPORARY_TOPIC;
-            }
-
-        };
-
     public:
 
         ActiveMQDestinationTest() {}



Mime
View raw message