activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r753305 - in /activemq/activemq-cpp/trunk/src/test/activemq/transport/failover: FailoverTransportTest.cpp FailoverTransportTest.h
Date Fri, 13 Mar 2009 16:00:38 GMT
Author: tabish
Date: Fri Mar 13 16:00:37 2009
New Revision: 753305

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

Add Test to validate that the transport can function even when creating backup transports
is failing.

Modified:
    activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.cpp
    activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.h

Modified: activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.cpp?rev=753305&r1=753304&r2=753305&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.cpp
Fri Mar 13 16:00:37 2009
@@ -125,3 +125,30 @@
 
     transport->close();
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void FailoverTransportTest::testFailingBackupCreation() {
+
+    std::string uri =
+        "failover://(mock://localhost:61616,"
+                    "mock://localhost:61618?failOnCreate=true)?randomize=false&backup=true";
+
+    DefaultTransportListener listener;
+    FailoverTransportFactory factory;
+
+    Pointer<Transport> transport( factory.create( uri ) );
+    CPPUNIT_ASSERT( transport != NULL );
+    transport->setTransportListener( &listener );
+
+    FailoverTransport* failover = dynamic_cast<FailoverTransport*>(
+        transport->narrow( typeid( FailoverTransport ) ) );
+
+    CPPUNIT_ASSERT( failover != NULL );
+    CPPUNIT_ASSERT( failover->isRandomize() == false );
+    CPPUNIT_ASSERT( failover->isBackup() == true );
+
+    Thread::sleep( 2000 );
+
+    transport->start();
+    transport->close();
+}

Modified: activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.h?rev=753305&r1=753304&r2=753305&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.h
(original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.h
Fri Mar 13 16:00:37 2009
@@ -32,6 +32,7 @@
         CPPUNIT_TEST( testTransportCreate );
         CPPUNIT_TEST( testTransportCreateWithBackups );
         CPPUNIT_TEST( testTransportCreateFailOnCreate );
+        CPPUNIT_TEST( testFailingBackupCreation );
         CPPUNIT_TEST_SUITE_END();
 
     public:
@@ -39,10 +40,22 @@
         FailoverTransportTest();
         virtual ~FailoverTransportTest();
 
+        // Tests that a Failover Transport can be created, started and stopped.
         void testTransportCreate();
+
+        // Tests that a Failover Transport can be created with backups enabled and
+        // be created, started and stopped.
         void testTransportCreateWithBackups();
+
+        // Tests that a Transport will try and reconnect to a Transport that fails
+        // at its creation time and will retry until the max reconnect amount has been
+        // reached at which point it calls its listeners onException method.
         void testTransportCreateFailOnCreate();
 
+        // Tests that a Transport with a Connected Primary Transport but failing backup
+        // transports won't segfault and can be started, and stopped without error.
+        void testFailingBackupCreation();
+
     };
 
 }}}



Mime
View raw message