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 2012/04/14 21:49:10 UTC
svn commit: r1326189 - in
/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src:
main/activemq/core/ActiveMQConnectionFactory.cpp
test/activemq/core/ActiveMQConnectionFactoryTest.cpp
test/activemq/core/ActiveMQConnectionFactoryTest.h
Author: tabish
Date: Sat Apr 14 19:49:10 2012
New Revision: 1326189
URL: http://svn.apache.org/viewvc?rev=1326189&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQCPP-387
Modified:
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp?rev=1326189&r1=1326188&r2=1326189&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp Sat Apr 14 19:49:10 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/branches/activemq-cpp-3.4.x/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp?rev=1326189&r1=1326188&r2=1326189&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp Sat Apr 14 19:49:10 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/branches/activemq-cpp-3.4.x/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h?rev=1326189&r1=1326188&r2=1326189&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h Sat Apr 14 19:49:10 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();