activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r900608 - in /activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src: examples/main.cpp main/activemq/transport/failover/FailoverTransport.cpp test/activemq/core/ActiveMQSessionTest.cpp test/activemq/core/ActiveMQSessionTest.h
Date Mon, 18 Jan 2010 23:40:33 GMT
Author: tabish
Date: Mon Jan 18 23:40:32 2010
New Revision: 900608

URL: http://svn.apache.org/viewvc?rev=900608&view=rev
Log:
Minor code cleanups, new unit test, fix to Failover Transport exception text.

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/examples/main.cpp
    activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp
    activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp
    activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/examples/main.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/examples/main.cpp?rev=900608&r1=900607&r2=900608&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/examples/main.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/examples/main.cpp Mon
Jan 18 23:40:32 2010
@@ -22,6 +22,7 @@
 #include <decaf/lang/Runnable.h>
 #include <decaf/util/concurrent/CountDownLatch.h>
 #include <decaf/lang/Integer.h>
+#include <decaf/lang/Long.h>
 #include <decaf/lang/System.h>
 #include <activemq/core/ActiveMQConnectionFactory.h>
 #include <activemq/util/Config.h>
@@ -110,7 +111,7 @@
             producer->setDeliveryMode( DeliveryMode::NON_PERSISTENT );
 
             // Create the Thread Id String
-            string threadIdStr = Integer::toString( Thread::getId() );
+            string threadIdStr = Long::toString( Thread::getId() );
 
             // Create a messages
             string text = (string)"Hello world! from thread " + threadIdStr;

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp?rev=900608&r1=900607&r2=900608&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp
Mon Jan 18 23:40:32 2010
@@ -228,7 +228,7 @@
                         } else if( timedout == true ) {
                             error.reset( new IOException(
                                 __FILE__, __LINE__,
-                                "Failover timeout of %d ms reached.", timedout ) );
+                                "Failover timeout of %d ms reached.", timeout ) );
                         } else {
                             error.reset( new IOException(
                                 __FILE__, __LINE__, "Unexpected failure.") );

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp?rev=900608&r1=900607&r2=900608&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp
Mon Jan 18 23:40:32 2010
@@ -105,6 +105,37 @@
 }}
 
 ////////////////////////////////////////////////////////////////////////////////
+void ActiveMQSessionTest::testCreateManyConsumersAndSetListeners() {
+
+    MyCMSMessageListener msgListener1;
+
+    CPPUNIT_ASSERT( connection.get() != NULL );
+    CPPUNIT_ASSERT( connection->isStarted() == true );
+
+    // Create an Auto Ack Session
+    std::auto_ptr<cms::Session> session( connection->createSession() );
+
+    // Create a Topic
+    std::auto_ptr<cms::Topic> topic1( session->createTopic( "TestTopic1" ) );
+
+    CPPUNIT_ASSERT( topic1.get() != NULL );
+
+    std::list<cms::MessageConsumer*> consumers;
+    for( int ix = 0; ix < 100; ++ix ) {
+        cms::MessageConsumer* consumer = session->createConsumer( topic1.get() );
+        consumer->setMessageListener( &msgListener1 );
+        consumers.push_back( consumer );
+    }
+
+    std::list<cms::MessageConsumer*>::iterator iter = consumers.begin();
+    for( ; iter != consumers.end(); ++iter ) {
+        (*iter)->close();
+        delete *iter;
+    }
+    consumers.clear();
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void ActiveMQSessionTest::testAutoAcking() {
 
     MyCMSMessageListener msgListener1;

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h?rev=900608&r1=900607&r2=900608&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h
Mon Jan 18 23:40:32 2010
@@ -46,6 +46,7 @@
         CPPUNIT_TEST( testTransactionRollbackTwoConsumer );
         CPPUNIT_TEST( testTransactionCloseWithoutCommit );
         CPPUNIT_TEST( testExpiration );
+        CPPUNIT_TEST( testCreateManyConsumersAndSetListeners );
         CPPUNIT_TEST_SUITE_END();
 
     private:
@@ -86,6 +87,7 @@
 
         void testAutoAcking();
         void testClientAck();
+        void testCreateManyConsumersAndSetListeners();
         void testTransactionCommitOneConsumer();
         void testTransactionCommitTwoConsumer();
         void testTransactionRollbackOneConsumer();



Mime
View raw message