activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r548422 - in /activemq/activemq-cpp/trunk/src/test/activemq/core: ActiveMQConnectionTest.cpp ActiveMQConnectionTest.h
Date Mon, 18 Jun 2007 17:49:08 GMT
Author: tabish
Date: Mon Jun 18 10:49:03 2007
New Revision: 548422

URL: http://svn.apache.org/viewvc?view=rev&rev=548422
Log:
https://issues.apache.org/activemq/browse/AMQCPP-130

Modified:
    activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.cpp
    activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.h

Modified: activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.cpp?view=diff&rev=548422&r1=548421&r2=548422
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.cpp Mon Jun
18 10:49:03 2007
@@ -27,6 +27,7 @@
 #include <activemq/core/ActiveMQConnection.h>
 #include <activemq/core/ActiveMQConnectionData.h>
 #include <activemq/connector/stomp/StompConnector.h>
+#include <activemq/connector/openwire/OpenWireConnector.h>
 #include <activemq/util/Properties.h>
 #include <activemq/transport/MockTransportFactory.h>
 #include <activemq/transport/TransportFactoryMap.h>
@@ -43,7 +44,7 @@
 using namespace activemq::core;
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnectionTest::test()
+void ActiveMQConnectionTest::test1WithStomp()
 {
     try
     {
@@ -56,9 +57,11 @@
             new util::Properties();
         transport::Transport* transport = NULL;
 
+        // Default to Stomp
+        properties->setProperty( "wireFormat", "stomp" );
+
         transport::TransportFactory* factory =
-            transport::TransportFactoryMap::getInstance().lookup(
-                "mock" );
+            transport::TransportFactoryMap::getInstance().lookup( "mock" );
         if( factory == NULL ){
             CPPUNIT_ASSERT( false );
         }
@@ -179,7 +182,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnectionTest::test2()
+void ActiveMQConnectionTest::test2WithStomp()
 {
     try
     {
@@ -192,9 +195,11 @@
             new util::Properties();
         transport::Transport* transport = NULL;
 
+        // Default to Stomp
+        properties->setProperty( "wireFormat", "stomp" );
+
         transport::TransportFactory* factory =
-            transport::TransportFactoryMap::getInstance().lookup(
-                "mock" );
+            transport::TransportFactoryMap::getInstance().lookup( "mock" );
         if( factory == NULL ){
             CPPUNIT_ASSERT( false );
         }
@@ -214,6 +219,63 @@
 
         connector::stomp::StompConnector* connector =
             new connector::stomp::StompConnector(
+                transport, *properties );
+
+        connector->start();
+
+        ActiveMQConnection connection(
+            new ActiveMQConnectionData(
+                connector, transport, properties) );
+
+        connection.getClientID();
+        connection.close();
+
+        CPPUNIT_ASSERT( connection.getClientID() == "" );
+
+    } catch( exceptions::ActiveMQException& ex ) {
+        ex.printStackTrace();
+        throw ex;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnectionTest::test2WithOpenwire()
+{
+    try
+    {
+        MyMessageListener listener;
+        MyExceptionListener exListener;
+        MyCommandListener cmdListener;
+        MyDispatcher msgListener;
+        std::string connectionId = "testConnectionId";
+        util::Properties* properties =
+            new util::Properties();
+        transport::Transport* transport = NULL;
+
+        // Default to Stomp
+        properties->setProperty( "wireFormat", "openwire" );
+
+        transport::TransportFactory* factory =
+            transport::TransportFactoryMap::getInstance().lookup( "mock" );
+        if( factory == NULL ){
+            CPPUNIT_ASSERT( false );
+        }
+
+        // Create the transport.
+        transport = factory->createTransport( *properties );
+        if( transport == NULL ){
+            CPPUNIT_ASSERT( false );
+        }
+
+        transport::MockTransport* dTransport =
+            dynamic_cast< transport::MockTransport*>( transport );
+
+        CPPUNIT_ASSERT( dTransport != NULL );
+
+        dTransport->setCommandListener( &cmdListener );
+
+        connector::Connector* connector =
+            new connector::openwire::OpenWireConnector(
                 transport, *properties );
 
         connector->start();

Modified: activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.h?view=diff&rev=548422&r1=548421&r2=548422
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.h Mon Jun 18
10:49:03 2007
@@ -38,8 +38,9 @@
     class ActiveMQConnectionTest : public CppUnit::TestFixture
     {
         CPPUNIT_TEST_SUITE( ActiveMQConnectionTest );
-        CPPUNIT_TEST( test );
-        CPPUNIT_TEST( test2 );
+        CPPUNIT_TEST( test1WithStomp );
+        CPPUNIT_TEST( test2WithStomp );
+        CPPUNIT_TEST( test2WithOpenwire );
         CPPUNIT_TEST_SUITE_END();
 
     public:
@@ -113,8 +114,9 @@
             }
         };
 
-        void test();
-        void test2();
+        void test1WithStomp();
+        void test2WithStomp();
+        void test2WithOpenwire();
 
     };
 



Mime
View raw message