Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 58C869624 for ; Sat, 14 Apr 2012 19:50:01 +0000 (UTC) Received: (qmail 8002 invoked by uid 500); 14 Apr 2012 19:50:01 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 7976 invoked by uid 500); 14 Apr 2012 19:50:01 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 7969 invoked by uid 99); 14 Apr 2012 19:50:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Apr 2012 19:50:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Apr 2012 19:49:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BF21F238897A for ; Sat, 14 Apr 2012 19:49:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120414194939.BF21F238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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 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();