activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r500817 - in /incubator/activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/connector/openwire/commands/ main/activemq/util/ test/activemq/connector/openwire/commands/
Date Sun, 28 Jan 2007 15:58:19 GMT
Author: tabish
Date: Sun Jan 28 07:58:19 2007
New Revision: 500817

URL: http://svn.apache.org/viewvc?view=rev&rev=500817
Log:
http://issues.apache.org/activemq/browse/AMQCPP-30

Modified:
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.cpp
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.h
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQDestinationTest2.cpp
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQDestinationTest2.h

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.cpp?view=diff&rev=500817&r1=500816&r2=500817
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.cpp
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.cpp
Sun Jan 28 07:58:19 2007
@@ -113,12 +113,12 @@
     std::string answer = "";
     if( destination != NULL && destination->isTemporary() ) {
         std::string name = destination->getPhysicalName();
-        size_t start = name.find_first_of( TEMP_PREFIX );
+        size_t start = name.find( TEMP_PREFIX );
         if( start != std::string::npos ) {
             start += TEMP_PREFIX.length();
-            size_t stop = name.find_last_of( TEMP_POSTFIX );
+            size_t stop = name.rfind( TEMP_POSTFIX );
             if( stop > start && stop < name.length() ) {
-                answer = name.substr( start, stop );
+                answer = name.substr( start, stop-start );
             }
         }
     }

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.h?view=diff&rev=500817&r1=500816&r2=500817
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.h
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.h
Sun Jan 28 07:58:19 2007
@@ -206,21 +206,15 @@
             this->orderedTarget = orderedTarget;
         }
 
-    public:
-    
-        /**
-         * Returns the Type of Destination that this object represents
-         * @returns int type qualifier.
-         */
-        virtual cms::Destination::DestinationType getDestinationType() const = 0;
-    
+    public:  // Statics
+        
         /**
          * Create a temporary name from the clientId
          *
          * @param clientId
          * @return
          */
-        static std::string CreateTemporaryName( 
+        static std::string createTemporaryName( 
             const std::string& clientId ) {
 
             return TEMP_PREFIX + clientId + TEMP_POSTFIX;
@@ -233,6 +227,14 @@
          * @return the clientId or null if not a temporary destination
          */
         static std::string getClientId( const ActiveMQDestination* destination );
+
+    public:
+    
+        /**
+         * Returns the Type of Destination that this object represents
+         * @returns int type qualifier.
+         */
+        virtual cms::Destination::DestinationType getDestinationType() const = 0;
 
         /**
          * Returns true if a temporary Destination

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp?view=diff&rev=500817&r1=500816&r2=500817
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp
Sun Jan 28 07:58:19 2007
@@ -28,7 +28,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 PrimitiveMap::PrimitiveMap( const PrimitiveMap& src ) {
-    this->valueNodeMap = src.valueNodeMap;
+    this->copy( src );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQDestinationTest2.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQDestinationTest2.cpp?view=diff&rev=500817&r1=500816&r2=500817
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQDestinationTest2.cpp
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQDestinationTest2.cpp
Sun Jan 28 07:58:19 2007
@@ -19,6 +19,8 @@
 
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::commands::ActiveMQDestinationTest
);
 
+#include <activemq/util/Guid.h>
+
 using namespace std;
 using namespace activemq;
 using namespace activemq::util;
@@ -42,5 +44,37 @@
     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 );
+
+    CPPUNIT_ASSERT( dest2.getPhysicalName().find( "test" ) != string::npos );
+    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() );
+
+    CPPUNIT_ASSERT( dest3 != NULL );
+    CPPUNIT_ASSERT( dest3->getPhysicalName().find( "test" ) != string::npos );
+    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 );
+    
+    std::string clientId = Guid::createGUIDString();
+    std::string result = dest.createTemporaryName( clientId );
+    CPPUNIT_ASSERT( result.find( clientId ) != string::npos );
+    dest.setPhysicalName( result );
+    CPPUNIT_ASSERT( clientId != dest.getClientId( &dest ) );
+    MyTempDestination tmpDest;
+    tmpDest.setPhysicalName( result );
+    CPPUNIT_ASSERT( clientId == ActiveMQDestination::getClientId( &tmpDest ) );
 
 }

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQDestinationTest2.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQDestinationTest2.h?view=diff&rev=500817&r1=500816&r2=500817
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQDestinationTest2.h
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQDestinationTest2.h
Sun Jan 28 07:58:19 2007
@@ -66,6 +66,19 @@
             }
         };
         
+        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