Return-Path: Delivered-To: apmail-geronimo-activemq-commits-archive@www.apache.org Received: (qmail 34704 invoked from network); 28 Jan 2007 15:58:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Jan 2007 15:58:41 -0000 Received: (qmail 93527 invoked by uid 500); 28 Jan 2007 15:58:47 -0000 Delivered-To: apmail-geronimo-activemq-commits-archive@geronimo.apache.org Received: (qmail 93501 invoked by uid 500); 28 Jan 2007 15:58:47 -0000 Mailing-List: contact activemq-commits-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-commits@geronimo.apache.org Received: (qmail 93492 invoked by uid 99); 28 Jan 2007 15:58:47 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Jan 2007 07:58:47 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Jan 2007 07:58:40 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 245F91A981A; Sun, 28 Jan 2007 07:58:20 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: activemq-commits@geronimo.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070128155820.245F91A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 + 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( 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() {}