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 2008/11/19 15:53:39 UTC

svn commit: r718977 - in /activemq/activemq-cpp/trunk/src/test/activemq/core: ActiveMQConnectionFactoryTest.cpp ActiveMQConnectionFactoryTest.h

Author: tabish
Date: Wed Nov 19 06:53:39 2008
New Revision: 718977

URL: http://svn.apache.org/viewvc?rev=718977&view=rev
Log:
Add an additional test to check for leaks when a ConnectionFactory fails to create a valid connection object.

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?rev=718977&r1=718976&r2=718977&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp Wed Nov 19 06:53:39 2008
@@ -26,7 +26,9 @@
 #include <activemq/transport/TransportFactoryMapRegistrar.h>
 #include <activemq/transport/MockTransportFactory.h>
 #include <activemq/connector/Connector.h>
+#include <memory>
 
+using namespace std;
 using namespace activemq;
 using namespace activemq::core;
 
@@ -159,3 +161,21 @@
 
     CPPUNIT_ASSERT( false );
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnectionFactoryTest::testExceptionOnCreate() {
+    try
+    {
+        std::string URI =
+            "tcp://127.0.0.2:23232&wireFormat=openwire";
+
+        ActiveMQConnectionFactory connectionFactory( URI );
+
+        auto_ptr<cms::Connection> connection(
+            connectionFactory.createConnection() );
+
+        CPPUNIT_ASSERT( false );
+    }
+    AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
+    AMQ_CATCHALL_NOTHROW( )
+}

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?rev=718977&r1=718976&r2=718977&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionFactoryTest.h Wed Nov 19 06:53:39 2008
@@ -31,6 +31,7 @@
         CPPUNIT_TEST( test2WithStomp );
         CPPUNIT_TEST( test1WithOpenWire );
         CPPUNIT_TEST( test2WithOpenWire );
+        CPPUNIT_TEST( testExceptionOnCreate );
         CPPUNIT_TEST_SUITE_END();
 
     public:
@@ -50,6 +51,7 @@
         void test2WithStomp();
         void test1WithOpenWire();
         void test2WithOpenWire();
+        void testExceptionOnCreate();
 
     };