You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/02/28 15:12:25 UTC

svn commit: r1075336 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/util/URISupport.cpp test/activemq/util/URISupportTest.cpp

Author: tabish
Date: Mon Feb 28 14:12:25 2011
New Revision: 1075336

URL: http://svn.apache.org/viewvc?rev=1075336&view=rev
Log:
fix for https://issues.apache.org/jira/browse/AMQCPP-352 with new tests to verify.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/URISupportTest.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.cpp?rev=1075336&r1=1075335&r2=1075336&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/URISupport.cpp Mon Feb 28 14:12:25 2011
@@ -340,7 +340,7 @@ LinkedList<std::string> URISupport::spli
             break;
         case ',':
             if( depth == 0 ) {
-                std::string s = str.substr( last, i );
+                std::string s = str.substr( last, i - last );
                 components.add( s );
                 last = i + 1;
             }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/URISupportTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/URISupportTest.cpp?rev=1075336&r1=1075335&r2=1075336&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/URISupportTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/URISupportTest.cpp Mon Feb 28 14:12:25 2011
@@ -193,4 +193,20 @@ void URISupportTest::testParseComposite(
     CPPUNIT_ASSERT( data.getComponents().get(0).toString() ==
                     "tcp://localhost:61616" );
 
+    data = URISupport::parseComposite(
+        URI( "test:(part1://host,part2://host,part3://host,part4://host)" ) );
+    CPPUNIT_ASSERT( 4 == data.getComponents().size() );
+    CPPUNIT_ASSERT( data.getComponents().get(0).toString() == "part1://host" );
+    CPPUNIT_ASSERT( data.getComponents().get(1).toString() == "part2://host" );
+    CPPUNIT_ASSERT( data.getComponents().get(2).toString() == "part3://host" );
+    CPPUNIT_ASSERT( data.getComponents().get(3).toString() == "part4://host" );
+
+    data = URISupport::parseComposite(
+        URI( "test:(part1://host,part2://host,part3://host,part4://host?option=value)" ) );
+    CPPUNIT_ASSERT( 4 == data.getComponents().size() );
+    CPPUNIT_ASSERT( data.getComponents().get(0).toString() == "part1://host" );
+    CPPUNIT_ASSERT( data.getComponents().get(1).toString() == "part2://host" );
+    CPPUNIT_ASSERT( data.getComponents().get(2).toString() == "part3://host" );
+    CPPUNIT_ASSERT( data.getComponents().get(3).toString() == "part4://host?option=value" );
+
 }