activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r788362 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core: ActiveMQConnectionFactoryTest.cpp ActiveMQConnectionFactoryTest.h
Date Thu, 25 Jun 2009 14:24:20 GMT
Author: tabish
Date: Thu Jun 25 14:24:19 2009
New Revision: 788362

URL: http://svn.apache.org/viewvc?rev=788362&view=rev
Log:
Tests for the fix to: https://issues.apache.org/activemq/browse/AMQCPP-252


Modified:
    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/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp?rev=788362&r1=788361&r2=788362&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
Thu Jun 25 14:24:19 2009
@@ -23,6 +23,8 @@
 #include <decaf/lang/Thread.h>
 #include <activemq/core/ActiveMQConnectionFactory.h>
 #include <activemq/core/ActiveMQConnection.h>
+#include <activemq/core/ActiveMQSession.h>
+#include <activemq/core/ActiveMQProducer.h>
 #include <memory>
 
 using namespace std;
@@ -131,20 +133,17 @@
 
         ActiveMQConnectionFactory connectionFactory( URI );
 
-        cms::Connection* connection =
-            connectionFactory.createConnection();
-        CPPUNIT_ASSERT( connection != NULL );
+        std::auto_ptr<cms::Connection> connection(
+            connectionFactory.createConnection() );
+        CPPUNIT_ASSERT( connection.get() != NULL );
 
         ActiveMQConnection* amqConnection =
-            dynamic_cast< ActiveMQConnection* >( connection );
+            dynamic_cast< ActiveMQConnection* >( connection.get() );
         CPPUNIT_ASSERT( amqConnection != NULL );
         CPPUNIT_ASSERT( username == amqConnection->getUsername() );
         CPPUNIT_ASSERT( password == amqConnection->getPassword() );
         CPPUNIT_ASSERT( clientId == amqConnection->getClientId() );
 
-        // Free the allocated connection object.
-        delete connection;
-
         return;
     }
     AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
@@ -170,3 +169,36 @@
     AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_NOTHROW( )
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnectionFactoryTest::testCreateWithURIOptions()
+{
+    try
+    {
+        std::string URI = std::string() +
+            "mock://127.0.0.1:23232?connection.producerWindowSize=65536";
+
+        ActiveMQConnectionFactory connectionFactory( URI );
+
+        std::auto_ptr<cms::Connection> connection(
+            connectionFactory.createConnection() );
+        CPPUNIT_ASSERT( connection.get() != NULL );
+
+        ActiveMQConnection* amqConnection =
+            dynamic_cast< ActiveMQConnection* >( connection.get() );
+
+        std::auto_ptr<ActiveMQSession> session( dynamic_cast<ActiveMQSession*>(
+            amqConnection->createSession() ) );
+
+        std::auto_ptr<ActiveMQProducer> producer( dynamic_cast<ActiveMQProducer*>(
+            session->createProducer( NULL ) ) );
+
+        CPPUNIT_ASSERT( producer->getProducerInfo().getWindowSize() == 65536 );
+
+        return;
+    }
+    AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
+    AMQ_CATCHALL_NOTHROW( )
+
+    CPPUNIT_ASSERT( false );
+}

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=788362&r1=788361&r2=788362&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
Thu Jun 25 14:24:19 2009
@@ -32,6 +32,7 @@
         CPPUNIT_TEST( test1WithOpenWire );
         CPPUNIT_TEST( test2WithOpenWire );
         CPPUNIT_TEST( testExceptionOnCreate );
+        CPPUNIT_TEST( testCreateWithURIOptions );
         CPPUNIT_TEST_SUITE_END();
 
     public:
@@ -52,6 +53,7 @@
         void test1WithOpenWire();
         void test2WithOpenWire();
         void testExceptionOnCreate();
+        void testCreateWithURIOptions();
 
     };
 



Mime
View raw message