activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1326190 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/core/ActiveMQConnectionFactory.cpp test/activemq/core/ActiveMQConnectionFactoryTest.cpp test/activemq/core/ActiveMQConnectionFactoryTest.h
Date Sat, 14 Apr 2012 19:49:39 GMT
Author: tabish
Date: Sat Apr 14 19:49:39 2012
New Revision: 1326190

URL: http://svn.apache.org/viewvc?rev=1326190&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQCPP-387

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp?rev=1326190&r1=1326189&r2=1326190&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
Sat Apr 14 19:49:39 2012
@@ -167,15 +167,15 @@ namespace core{
 
             this->clientId = properties->getProperty(
                 core::ActiveMQConstants::toString(
-                    core::ActiveMQConstants::PARAM_CLIENTID ), "" );
+                    core::ActiveMQConstants::PARAM_CLIENTID ), clientId );
 
             this->username = properties->getProperty(
                 core::ActiveMQConstants::toString(
-                    core::ActiveMQConstants::PARAM_USERNAME ), "" );
+                    core::ActiveMQConstants::PARAM_USERNAME ), username );
 
             this->password = properties->getProperty(
                 core::ActiveMQConstants::toString(
-                    core::ActiveMQConstants::PARAM_PASSWORD ), "" );
+                    core::ActiveMQConstants::PARAM_PASSWORD ), password );
 
             this->defaultPrefetchPolicy->configure( *properties );
             this->defaultRedeliveryPolicy->configure( *properties );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp?rev=1326190&r1=1326189&r2=1326190&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
Sat Apr 14 19:49:39 2012
@@ -138,6 +138,68 @@ void ActiveMQConnectionFactoryTest::test
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnectionFactoryTest::test3WithOpenWire()
+{
+    try
+    {
+        std::string URI = std::string() +
+            "mock://127.0.0.1:23232";
+
+        ActiveMQConnectionFactory connectionFactory( URI );
+
+        std::auto_ptr<cms::Connection> connection(
+            connectionFactory.createConnection(username, password) );
+        CPPUNIT_ASSERT( connection.get() != NULL );
+
+        connection->setClientID(clientId);
+
+        ActiveMQConnection* amqConnection =
+            dynamic_cast< ActiveMQConnection* >( connection.get() );
+        CPPUNIT_ASSERT( amqConnection != NULL );
+        CPPUNIT_ASSERT( username == amqConnection->getUsername() );
+        CPPUNIT_ASSERT( password == amqConnection->getPassword() );
+        CPPUNIT_ASSERT( clientId == amqConnection->getClientID() );
+
+        return;
+    }
+    AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
+    AMQ_CATCHALL_NOTHROW( )
+
+    CPPUNIT_ASSERT( false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnectionFactoryTest::test4WithOpenWire()
+{
+    try
+    {
+        std::string URI = std::string() +
+            "mock://127.0.0.1:23232";
+
+        ActiveMQConnectionFactory connectionFactory( URI, username, password );
+
+        std::auto_ptr<cms::Connection> connection(
+            connectionFactory.createConnection() );
+        CPPUNIT_ASSERT( connection.get() != NULL );
+
+        connection->setClientID(clientId);
+
+        ActiveMQConnection* amqConnection =
+            dynamic_cast< ActiveMQConnection* >( connection.get() );
+        CPPUNIT_ASSERT( amqConnection != NULL );
+        CPPUNIT_ASSERT( username == amqConnection->getUsername() );
+        CPPUNIT_ASSERT( password == amqConnection->getPassword() );
+        CPPUNIT_ASSERT( clientId == amqConnection->getClientID() );
+
+        return;
+    }
+    AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
+    AMQ_CATCHALL_NOTHROW( )
+
+    CPPUNIT_ASSERT( false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void ActiveMQConnectionFactoryTest::testExceptionWithPortOutOfRange() {
     try
     {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h?rev=1326190&r1=1326189&r2=1326190&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h
Sat Apr 14 19:49:39 2012
@@ -29,6 +29,8 @@ namespace core{
         CPPUNIT_TEST_SUITE( ActiveMQConnectionFactoryTest );
         CPPUNIT_TEST( test1WithOpenWire );
         CPPUNIT_TEST( test2WithOpenWire );
+        CPPUNIT_TEST( test3WithOpenWire );
+        CPPUNIT_TEST( test4WithOpenWire );
         CPPUNIT_TEST( testExceptionOnCreate );
         CPPUNIT_TEST( testCreateWithURIOptions );
         CPPUNIT_TEST( testTransportListener );
@@ -51,6 +53,8 @@ namespace core{
 
         void test1WithOpenWire();
         void test2WithOpenWire();
+        void test3WithOpenWire();
+        void test4WithOpenWire();
         void testExceptionOnCreate();
         void testExceptionWithPortOutOfRange();
         void testCreateWithURIOptions();



Mime
View raw message