activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r471280 - in /incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration: common/AbstractTester.cpp common/AbstractTester.h durable/DurableTester.cpp
Date Sat, 04 Nov 2006 22:33:24 GMT
Author: tabish
Date: Sat Nov  4 14:33:23 2006
New Revision: 471280

URL: http://svn.apache.org/viewvc?view=rev&rev=471280
Log:
http://issues.apache.org/activemq/browse/AMQ-779

Fixed the code to use activemq.subcriptionName and corrected logic in the integration test
to count messages

Durable Integ Test passes now.

Modified:
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.h
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp?view=diff&rev=471280&r1=471279&r2=471280
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp
Sat Nov  4 14:33:23 2006
@@ -43,17 +43,16 @@
 using namespace integration::common;
 
 AbstractTester::AbstractTester( cms::Session::AcknowledgeMode ackMode )
+ : connectionFactory( NULL ),
+   connection( NULL )
 {
     try
     {
         string url = IntegrationCommon::defaultURL;
         numReceived = 0;
     
-        // Create a Factory
-        connectionFactory = new ActiveMQConnectionFactory( url );
-
         // Now create the connection
-        connection = connectionFactory->createConnection(
+        connection = createDetachedConnection( 
             "", "", Guid().createGUIDString() );
     
         // Set ourself as a recipient of Exceptions        
@@ -82,6 +81,30 @@
     AMQ_CATCHALL_NOTHROW( )
 }
 
+cms::Connection* AbstractTester::createDetachedConnection(
+    const std::string& username,
+    const std::string& password,
+    const std::string& clientId ) {
+
+    try
+    {
+        string url = IntegrationCommon::defaultURL;
+    
+        if( connectionFactory == NULL ) {
+            // Create a Factory
+            connectionFactory = new ActiveMQConnectionFactory( url );
+        }
+
+        // Now create the connection
+        cms::Connection* connection = connectionFactory->createConnection(
+            username, password, clientId );
+
+        return connection;
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
 void AbstractTester::doSleep(void) 
 {
     Thread::sleep( IntegrationCommon::defaultDelay );
@@ -194,7 +217,7 @@
     {
         std::string text = txtMsg->getText();
 
-//            printf("received text msg: %s\n", txtMsg.getText() );
+            printf("received text msg: %s\n", txtMsg->getText() );
 
         numReceived++;
 

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.h?view=diff&rev=471280&r1=471279&r2=471280
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.h
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.h
Sat Nov  4 14:33:23 2006
@@ -52,6 +52,11 @@
         virtual void onException( const cms::CMSException& error );
         virtual void onMessage( const cms::Message* message );
 
+        virtual cms::Connection* createDetachedConnection(
+            const std::string& username,
+            const std::string& password,
+            const std::string& clientId );
+
     public:
         
         cms::ConnectionFactory* connectionFactory;

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp?view=diff&rev=471280&r1=471279&r2=471280
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp
Sat Nov  4 14:33:23 2006
@@ -118,15 +118,16 @@
         sent += this->produceTextMessages( *producer, 3 );
 
         consumer = session->createDurableConsumer( topic, subName, "" );            
+        consumer->setMessageListener( this );
 
         // Send some text messages
         sent += this->produceTextMessages( *producer, 3 );
 
         // Wait for all remaining messages
-        waitForMessages( sent - numReceived );
+        waitForMessages( sent );
         
         printf("received: %d\n", numReceived );
- //       CPPUNIT_ASSERT( numReceived == sent );
+        CPPUNIT_ASSERT( numReceived == sent );
 
         printf("Shutting Down\n" );
         delete producer;                      



Mime
View raw message