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 2007/06/18 20:00:08 UTC
svn commit: r548423 - in /activemq/activemq-cpp/trunk/src/test/activemq/core:
ActiveMQConnectionFactoryTest.cpp ActiveMQConnectionFactoryTest.h
Author: tabish
Date: Mon Jun 18 11:00:06 2007
New Revision: 548423
URL: http://svn.apache.org/viewvc?view=rev&rev=548423
Log:
https://issues.apache.org/activemq/browse/AMQCPP-130
Modified:
activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.h
Modified: activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp?view=diff&rev=548423&r1=548422&r2=548423
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp Mon Jun 18 11:00:06 2007
@@ -33,7 +33,7 @@
using namespace activemq::core;
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnectionFactoryTest::test()
+void ActiveMQConnectionFactoryTest::test1WithStomp()
{
try
{
@@ -58,12 +58,77 @@
}
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnectionFactoryTest::test2()
+void ActiveMQConnectionFactoryTest::test2WithStomp()
{
try
{
std::string URI = std::string() +
"mock://127.0.0.1:23232&wireFormat=stomp?"
+ "username=" + username + "?password=" + password +
+ "?client-id=" + clientId;
+
+ ActiveMQConnectionFactory connectionFactory( URI );
+
+ cms::Connection* connection =
+ connectionFactory.createConnection();
+ CPPUNIT_ASSERT( connection != NULL );
+
+ ActiveMQConnection* amqConnection =
+ dynamic_cast< ActiveMQConnection* >( connection );
+ CPPUNIT_ASSERT( amqConnection != NULL );
+
+ connector::Connector* connector =
+ dynamic_cast< connector::Connector* >(
+ amqConnection->getConnectionData()->getConnector() );
+ CPPUNIT_ASSERT( connector != NULL );
+
+ CPPUNIT_ASSERT( username == connector->getUsername() );
+ CPPUNIT_ASSERT( password == connector->getPassword() );
+ CPPUNIT_ASSERT( clientId == connector->getClientId() );
+
+ // Free the allocated connection object.
+ delete connection;
+
+ return;
+ }
+ AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_NOTHROW( )
+
+ CPPUNIT_ASSERT( false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnectionFactoryTest::test1WithOpenWire()
+{
+ try
+ {
+ std::string URI =
+ "mock://127.0.0.1:23232&wireFormat=openwire";
+
+ ActiveMQConnectionFactory connectionFactory( URI );
+
+ cms::Connection* connection =
+ connectionFactory.createConnection();
+
+ CPPUNIT_ASSERT( connection != NULL );
+
+ delete connection;
+
+ return;
+ }
+ AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_NOTHROW( )
+
+ CPPUNIT_ASSERT( false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnectionFactoryTest::test2WithOpenWire()
+{
+ try
+ {
+ std::string URI = std::string() +
+ "mock://127.0.0.1:23232&wireFormat=openwire?"
"username=" + username + "?password=" + password +
"?client-id=" + clientId;
Modified: activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.h?view=diff&rev=548423&r1=548422&r2=548423
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.h Mon Jun 18 11:00:06 2007
@@ -27,8 +27,10 @@
class ActiveMQConnectionFactoryTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( ActiveMQConnectionFactoryTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST( test2 );
+ CPPUNIT_TEST( test1WithStomp );
+ CPPUNIT_TEST( test2WithStomp );
+ CPPUNIT_TEST( test1WithOpenWire );
+ CPPUNIT_TEST( test2WithOpenWire );
CPPUNIT_TEST_SUITE_END();
public:
@@ -44,8 +46,11 @@
}
virtual ~ActiveMQConnectionFactoryTest() {}
- void test();
- void test2();
+ void test1WithStomp();
+ void test2WithStomp();
+ void test1WithOpenWire();
+ void test2WithOpenWire();
+
};
}}