activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r772470 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/wireformat/stomp/marshal/ test-integration/ test-integration/activemq/test/ test-integration/activemq/test/openwire/ test-integration/activemq/test/stomp/ test-integr...
Date Thu, 07 May 2009 00:07:58 GMT
Author: tabish
Date: Thu May  7 00:07:57 2009
New Revision: 772470

URL: http://svn.apache.org/viewvc?rev=772470&view=rev
Log:
Completed Stomp Protocol support, all integration tests now pass.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/MarshalerHelper.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/MarshalerHelper.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/TestRegistry.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/DurableTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/DurableTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/JmsMessageGroupsTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleRollbackTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireDurableTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireDurableTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompDurableTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompJmsMessageGroupsTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompTransactionTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/IntegrationCommon.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/main.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.cpp
Thu May  7 00:07:57 2009
@@ -161,8 +161,13 @@
 
     Pointer<Response> response( new Response() );
     if( frame->hasProperty( StompCommandConstants::HEADER_RECEIPTID ) ) {
-        response->setCorrelationId( Integer::parseInt(
-            frame->getProperty( StompCommandConstants::HEADER_RECEIPTID ) ) );
+
+        std::string responseId = frame->getProperty( StompCommandConstants::HEADER_RECEIPTID
);
+        if( responseId.find( "ignore:" ) == 0 ) {
+            responseId = responseId.substr( 7 );
+        }
+
+        response->setCorrelationId( Integer::parseInt( responseId ) );
     } else {
         throw IOException(
             __FILE__, __LINE__, "Error, Connected Command has no Response ID." );
@@ -199,7 +204,7 @@
 
         // If we indicated that we don't care if the request failed then just create a
         // response command to answer the request.
-        if( responseId.find( "ignore:" ) != std::string::npos ) {
+        if( responseId.find( "ignore:" ) == 0 ) {
 
             Pointer<Response> response( new Response() );
             response->setCorrelationId( Integer::parseInt( responseId.substr( 7 ) ) );
@@ -266,7 +271,7 @@
 
     if( command->isResponseRequired() ) {
         frame->setProperty( StompCommandConstants::HEADER_RECEIPT_REQUIRED,
-                            Integer::toString( command->getCommandId() ) );
+                            std::string( "ignore:" ) + Integer::toString( command->getCommandId()
) );
     }
 
     frame->setProperty( StompCommandConstants::HEADER_MESSAGEID,
@@ -277,7 +282,8 @@
                             helper.convertTransactionId( ack->getTransactionId() ) );
     }
 
-    return Pointer<StompFrame>(); //frame;
+    //return Pointer<StompFrame>();
+    return frame;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -293,6 +299,9 @@
     frame->setProperty( StompCommandConstants::HEADER_REQUESTID,
                         Integer::toString( info->getCommandId() ) );
 
+    // Store this for later.
+    this->clientId = info->getClientId();
+
     return frame;
 }
 
@@ -381,6 +390,15 @@
                         helper.convertConsumerId( info->getConsumerId() ) );
 
     if( info->getSubscriptionName() != "" ) {
+
+        if( this->clientId != info->getSubscriptionName() ) {
+            throw UnsupportedOperationException(
+                __FILE__, __LINE__,
+                "Stomp Durable Subscriptions require that the ClientId and the Subscription
"
+                "Name match, clientId = {%s} : subscription name = {%s}.",
+                this->clientId.c_str(), info->getSubscriptionName().c_str() );
+        }
+
         frame->setProperty( StompCommandConstants::HEADER_SUBSCRIPTIONNAME,
                             info->getSubscriptionName() );
         // Older Brokers had an misspelled property name, this ensure we can talk to them
as well.
@@ -393,7 +411,7 @@
                             info->getSelector() );
     }
 
-    frame->setProperty( StompCommandConstants::HEADER_ACK, "auto" );
+    frame->setProperty( StompCommandConstants::HEADER_ACK, "client" );
 
     if( info->isNoLocal() ) {
         frame->setProperty( StompCommandConstants::HEADER_NOLOCAL, "true" );
@@ -434,11 +452,11 @@
 
     frame->setProperty( StompCommandConstants::HEADER_ID, info->getClientId() );
     frame->setProperty( StompCommandConstants::HEADER_SUBSCRIPTIONNAME,
-                        info->getSubcriptionName() );
+                        info->getClientId() );
 
     // Older Brokers had an misspelled property name, this ensure we can talk to them as
well.
     frame->setProperty( StompCommandConstants::HEADER_OLDSUBSCRIPTIONNAME,
-                        info->getSubcriptionName() );
+                        info->getClientId() );
 
     return frame;
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.h?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.h
Thu May  7 00:07:57 2009
@@ -41,6 +41,10 @@
 
         MarshalerHelper helper;
 
+        // Stored after we connect to use when validating that a durable subscribe
+        // and unsubscribe are set to use the client Id.
+        std::string clientId;
+
     public:
 
         Marshaler() {}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/MarshalerHelper.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/MarshalerHelper.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/MarshalerHelper.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/MarshalerHelper.cpp
Thu May  7 00:07:57 2009
@@ -51,7 +51,7 @@
     message->setCorrelationId( StompCommandConstants::HEADER_CORRELATIONID );
 
     if( frame->hasProperty( StompCommandConstants::HEADER_EXPIRES ) ) {
-        message->setExpiration( Integer::parseInt(
+        message->setExpiration( Long::parseLong(
             frame->removeProperty( StompCommandConstants::HEADER_EXPIRES ) ) );
     }
 
@@ -80,6 +80,19 @@
         message->setTransactionId( convertTransactionId( transactionId ) );
     }
 
+    // Handle JMSX Properties.
+    if( frame->hasProperty( "JMSXDeliveryCount" ) ) {
+        message->setRedeliveryCounter( Integer::parseInt(
+            frame->removeProperty( "JMSXDeliveryCount" ) ) );
+    }
+    if( frame->hasProperty( "JMSXGroupID" ) ) {
+        message->setGroupID( frame->removeProperty( "JMSXGroupID" ) );
+    }
+    if( frame->hasProperty( "JMSXGroupSeq" ) ) {
+        message->setGroupSequence( Integer::parseInt(
+            frame->removeProperty( "JMSXGroupSeq" ) ) );
+    }
+
     // Copy the general headers over to the Message.
     std::vector< std::pair<std::string, std::string> > properties = frame->getProperties().toArray();
     std::vector< std::pair<std::string, std::string> >::const_iterator iter =
properties.begin();
@@ -95,8 +108,6 @@
 
     frame->setProperty( StompCommandConstants::HEADER_DESTINATION,
                         convertDestination( message->getDestination() ) );
-    frame->setProperty( StompCommandConstants::HEADER_MESSAGEID,
-                        convertMessageId( message->getMessageId() ) );
 
     if( message->getCorrelationId() != "" ) {
         frame->setProperty( StompCommandConstants::HEADER_CORRELATIONID,
@@ -105,6 +116,7 @@
 
     frame->setProperty( StompCommandConstants::HEADER_EXPIRES,
                         Long::toString( message->getExpiration() ) );
+
     frame->setProperty( StompCommandConstants::HEADER_PERSISTENT,
                         Boolean::toString( message->isPersistent() ) );
 
@@ -132,6 +144,16 @@
                             convertTransactionId( message->getTransactionId() ) );
     }
 
+    // Handle JMSX Properties.
+    frame->setProperty( "JMSXDeliveryCount",
+                        Integer::toString( message->getRedeliveryCounter() ) );
+    frame->setProperty( "JMSXGroupSeq",
+                        Integer::toString( message->getGroupSequence() ) );
+
+    if( message->getGroupID() != "" ) {
+        frame->setProperty( "JMSXGroupID", message->getGroupID() );
+    }
+
     std::vector<std::string> keys = message->getMessageProperties().keySet();
     std::vector<std::string>::const_iterator iter = keys.begin();
 
@@ -207,8 +229,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 std::string MarshalerHelper::convertMessageId( const Pointer<MessageId>& messageId
) {
 
-    std::string result = convertProducerId( messageId->getProducerId() ) + ":" +
-                         Long::toString( messageId->getProducerSequenceId() );
+    // The Stomp MessageId is always hidden solely in the Producer Id.
+    std::string result = convertProducerId( messageId->getProducerId() );
 
     return result;
 }
@@ -221,14 +243,9 @@
     }
 
     Pointer<MessageId> id( new MessageId() );
-    StringTokenizer tokenizer( messageId, ":" );
 
-    id->setProducerId( convertProducerId( tokenizer.nextToken() ) );
-
-    while( tokenizer.hasMoreTokens() ){
-        std::string text = tokenizer.nextToken();
-        id->setProducerSequenceId( Long::parseLong( text ) );
-    }
+    id->setProducerId( convertProducerId( messageId ) );
+    id->setProducerSequenceId( this->messageIdGenerator.getNextSequenceId() );
 
     return id;
 }
@@ -269,9 +286,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 std::string MarshalerHelper::convertProducerId( const Pointer<ProducerId>& producerId
) {
 
-    return producerId->getConnectionId() + ":" +
-           Long::toString( producerId->getSessionId() ) + ":" +
-           Long::toString( producerId->getValue() );
+    return producerId->getConnectionId();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -282,19 +297,10 @@
     }
 
     Pointer<ProducerId> id( new ProducerId() );
-    StringTokenizer tokenizer( producerId, ":" );
-
-    id->setConnectionId( tokenizer.nextToken() );
 
-    while( tokenizer.hasMoreTokens() ){
-        string text = tokenizer.nextToken();
-
-        if( tokenizer.hasMoreTokens() ) {
-            id->setSessionId( Long::parseLong( text ) );
-        } else {
-            id->setValue( Long::parseLong( text ) );
-        }
-    }
+    id->setConnectionId( producerId );
+    id->setSessionId( -1 );
+    id->setValue( -1 );
 
     return id;
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/MarshalerHelper.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/MarshalerHelper.h?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/MarshalerHelper.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/MarshalerHelper.h
Thu May  7 00:07:57 2009
@@ -19,6 +19,7 @@
 #define _ACTIVEMQ_WIREFORMAT_STOMP_MARSHAL_MARSHALERHELPER_H_
 
 #include <activemq/util/Config.h>
+#include <activemq/util/LongSequenceGenerator.h>
 #include <activemq/wireformat/stomp/StompFrame.h>
 #include <activemq/commands/Message.h>
 #include <activemq/commands/MessageId.h>
@@ -47,6 +48,10 @@
      * @since 3.0
      */
     class MarshalerHelper {
+    private:
+
+        activemq::util::LongSequenceGenerator messageIdGenerator;
+
     public:
 
         MarshalerHelper() {}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am Thu May  7 00:07:57
2009
@@ -31,6 +31,15 @@
     activemq/test/openwire/OpenwireSimpleRollbackTest.cpp \
     activemq/test/openwire/OpenwireDurableTest.cpp \
     activemq/test/SimpleTest.cpp \
+    activemq/test/stomp/StompExpirationTest.cpp \
+    activemq/test/stomp/StompSlowListenerTest.cpp \
+    activemq/test/stomp/StompSimpleTest.cpp \
+    activemq/test/stomp/StompCmsTemplateTest.cpp \
+    activemq/test/stomp/StompTransactionTest.cpp \
+    activemq/test/stomp/StompAsyncSenderTest.cpp \
+    activemq/test/stomp/StompJmsMessageGroupsTest.cpp \
+    activemq/test/stomp/StompDurableTest.cpp \
+    activemq/test/stomp/StompSimpleRollbackTest.cpp \
     activemq/test/AsyncSenderTest.cpp \
     activemq/test/TransactionTest.cpp \
     activemq/test/ExpirationTest.cpp \
@@ -58,6 +67,15 @@
     activemq/test/JmsMessageGroupsTest.h \
     activemq/test/AsyncSenderTest.h \
     activemq/test/CMSTestFixture.h \
+    activemq/test/stomp/StompSlowListenerTest.h \
+    activemq/test/stomp/StompDurableTest.h \
+    activemq/test/stomp/StompSimpleRollbackTest.h \
+    activemq/test/stomp/StompCmsTemplateTest.h \
+    activemq/test/stomp/StompAsyncSenderTest.h \
+    activemq/test/stomp/StompTransactionTest.h \
+    activemq/test/stomp/StompJmsMessageGroupsTest.h \
+    activemq/test/stomp/StompSimpleTest.h \
+    activemq/test/stomp/StompExpirationTest.h \
     activemq/test/DurableTest.h \
     activemq/test/TransactionTest.h \
     activemq/test/ExpirationTest.h \

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/TestRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/TestRegistry.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/TestRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/TestRegistry.cpp Thu May
 7 00:07:57 2009
@@ -26,15 +26,15 @@
 #include "activemq/test/openwire/OpenwireSlowListenerTest.h"
 #include "activemq/test/openwire/OpenwireJmsMessageGroupsTest.h"
 
-//#include "activemq/test/stomp/StompAsyncSenderTest.h"
-//#include "activemq/test/stomp/StompCmsTemplateTest.h"
-//#include "activemq/test/stomp/StompDurableTest.h"
-//#include "activemq/test/stomp/StompExpirationTest.h"
-//#include "activemq/test/stomp/StompSimpleRollbackTest.h"
-//#include "activemq/test/stomp/StompSimpleTest.h"
-//#include "activemq/test/stomp/StompSlowListenerTest.h"
-//#include "activemq/test/stomp/StompTransactionTest.h"
-//#include "activemq/test/stomp/StompJmsMessageGroupsTest.h"
+#include "activemq/test/stomp/StompAsyncSenderTest.h"
+#include "activemq/test/stomp/StompCmsTemplateTest.h"
+#include "activemq/test/stomp/StompDurableTest.h"
+#include "activemq/test/stomp/StompExpirationTest.h"
+#include "activemq/test/stomp/StompSimpleRollbackTest.h"
+#include "activemq/test/stomp/StompSimpleTest.h"
+#include "activemq/test/stomp/StompSlowListenerTest.h"
+#include "activemq/test/stomp/StompTransactionTest.h"
+#include "activemq/test/stomp/StompJmsMessageGroupsTest.h"
 
 // Openwire Tests
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireAsyncSenderTest );
@@ -49,12 +49,12 @@
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireJmsMessageGroupsTest );
 
 // Stomp Tests
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompAsyncSenderTest );
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompCmsTemplateTest );
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompDurableTest );
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompExpirationTest );
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompSimpleRollbackTest );
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompSimpleTest );
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompTransactionTest );
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompSlowListenerTest );
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompJmsMessageGroupsTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompAsyncSenderTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompCmsTemplateTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompDurableTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompExpirationTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompSimpleRollbackTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompSimpleTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompTransactionTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompSlowListenerTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompJmsMessageGroupsTest );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/DurableTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/DurableTest.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/DurableTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/DurableTest.cpp
Thu May  7 00:07:57 2009
@@ -39,7 +39,7 @@
 
         // Create CMS Object for Comms
         cms::Session* session( cmsProvider->getSession() );
-        cmsProvider->setSubscription( UUID::randomUUID().toString() );
+        cmsProvider->setSubscription( this->getSubscriptionName() );
         cmsProvider->setDurable( true );
         cms::MessageConsumer* consumer = cmsProvider->getConsumer();
         cms::MessageProducer* producer = cmsProvider->getProducer();

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/DurableTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/DurableTest.h?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/DurableTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/DurableTest.h
Thu May  7 00:07:57 2009
@@ -36,6 +36,8 @@
 
         virtual void testDurableConsumer();
 
+        virtual std::string getSubscriptionName() const = 0;
+
     };
 
 }}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/JmsMessageGroupsTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/JmsMessageGroupsTest.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/JmsMessageGroupsTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/JmsMessageGroupsTest.cpp
Thu May  7 00:07:57 2009
@@ -53,7 +53,7 @@
 
         auto_ptr<cms::Message> message( consumer->receive( 2000 ) );
         CPPUNIT_ASSERT( message.get() != NULL );
-        CPPUNIT_ASSERT( message->getStringProperty( "JMSXGroupID") == GROUPID );
+        CPPUNIT_ASSERT( message->getStringProperty( "JMSXGroupID" ) == GROUPID );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleRollbackTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleRollbackTest.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleRollbackTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleRollbackTest.cpp
Thu May  7 00:07:57 2009
@@ -85,11 +85,6 @@
         session->rollback();
         Thread::sleep( 50 );
 
-        // TODO - Should we get anything here?
-        // Wait for the messages to get here
-        listener.asyncWaitForMessages( 5 );
-        //CPPUNIT_ASSERT( listener.getNumReceived() == 0 );
-
         listener.reset();
         txtMessage->setText( "SimpleTest - Message after Rollback" );
         producer->send( txtMessage.get() );
@@ -109,7 +104,8 @@
         CPPUNIT_ASSERT( listener.getNumReceived() == 1 );
         session->commit();
 
-    } catch( ... ) {
-        CPPUNIT_ASSERT( false );
+    } catch( std::exception& ex ) {
+        std::cout << ex.what() << std::endl;
+        throw ex;
     }
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/TransactionTest.cpp
Thu May  7 00:07:57 2009
@@ -19,6 +19,7 @@
 
 #include <activemq/util/CMSListener.h>
 #include <activemq/exceptions/ActiveMQException.h>
+#include <stdexcept>
 
 using namespace std;
 using namespace cms;
@@ -39,29 +40,38 @@
 
         producer->setDeliveryMode( DeliveryMode::NON_PERSISTENT );
 
-        auto_ptr<TextMessage> message( session->createTextMessage( "Batch Message"
) );
+        for( int j = 0; j < batchCount - 8; j++ ) {
 
-        for( int j = 0; j < batchCount; j++ ) {
+            auto_ptr<TextMessage> message( session->createTextMessage( "Batch Message"
) );
 
             for( int i = 0; i < batchSize; i++ ) {
-                producer->send( message.get() );
+                CPPUNIT_ASSERT_NO_THROW_MESSAGE(
+                    "Send should not throw an exception here.",
+                    producer->send( message.get() ) );
             }
 
-            session->commit();
+            CPPUNIT_ASSERT_NO_THROW_MESSAGE(
+                "Session Commit should not throw an exception here:",
+                session->commit() );
 
             for( int i = 0; i < batchSize; i++ ) {
-                message.reset( dynamic_cast<TextMessage*>( consumer->receive( 1000
* 5 ) ) );
+                CPPUNIT_ASSERT_NO_THROW_MESSAGE(
+                    "Receive Shouldn't throw a Message here:",
+                    message.reset( dynamic_cast<TextMessage*>( consumer->receive(
1000 * 5 ) ) ) );
 
                 CPPUNIT_ASSERT_MESSAGE(
                     "Failed to receive all messages in batch", message.get() != NULL );
                 CPPUNIT_ASSERT( string("Batch Message") == message->getText() );
             }
 
-            session->commit();
+            CPPUNIT_ASSERT_NO_THROW_MESSAGE(
+                "Session Commit should not throw an exception here:",
+                session->commit() );
         }
+    } catch( std::exception& ex ) {
+        std::cout << ex.what() << std::endl;
+        throw ex;
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -127,7 +137,7 @@
         cmsProvider->getProducer()->send( outbound1.get() );
         cmsProvider->getSession()->commit();
 
-        // sends a message that gets rollbacked
+        // sends a message that gets rolled back
         auto_ptr<cms::Message> rollback(
             cmsProvider->getSession()->createTextMessage( "I'm going to get rolled
back." ) );
         cmsProvider->getProducer()->send( rollback.get() );
@@ -147,7 +157,7 @@
         auto_ptr<cms::TextMessage> inbound2(
             dynamic_cast<TextMessage*>( cmsProvider->getConsumer()->receive(
4000 ) ) );
 
-        // validates that the rollbacked was not consumed
+        // validates that the rolled back was not consumed
         cmsProvider->getSession()->commit();
 
         CPPUNIT_ASSERT( inbound1.get() != NULL );
@@ -187,7 +197,8 @@
 
             // receives the second message
             auto_ptr<TextMessage> inbound1(
-                dynamic_cast<TextMessage*>( consumer->receive( 4000 ) ) );
+                dynamic_cast<TextMessage*>( consumer->receive( 600000 ) ) );
+            CPPUNIT_ASSERT( inbound1.get() != NULL );
             CPPUNIT_ASSERT( outbound1->getText() == inbound1->getText() );
         }
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireDurableTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireDurableTest.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireDurableTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireDurableTest.cpp
Thu May  7 00:07:57 2009
@@ -17,9 +17,12 @@
 
 #include "OpenwireDurableTest.h"
 
+#include <decaf/util/UUID.h>
+
 using namespace activemq;
 using namespace activemq::test;
 using namespace activemq::test::openwire;
+using namespace decaf::util;
 
 ////////////////////////////////////////////////////////////////////////////////
 OpenwireDurableTest::OpenwireDurableTest() {
@@ -28,3 +31,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 OpenwireDurableTest::~OpenwireDurableTest() {
 }
+
+////////////////////////////////////////////////////////////////////////////////
+std::string OpenwireDurableTest::getSubscriptionName() const {
+    return UUID::randomUUID().toString();
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireDurableTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireDurableTest.h?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireDurableTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireDurableTest.h
Thu May  7 00:07:57 2009
@@ -39,6 +39,8 @@
             return activemq::util::IntegrationCommon::getInstance().getOpenwireURL();
         }
 
+        virtual std::string getSubscriptionName() const;
+
     };
 
 }}}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompDurableTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompDurableTest.h?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompDurableTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompDurableTest.h
Thu May  7 00:07:57 2009
@@ -30,6 +30,8 @@
         CPPUNIT_TEST( testDurableConsumer );
         CPPUNIT_TEST_SUITE_END();
 
+        std::string subscriptionName;
+
     public:
 
         StompDurableTest();
@@ -39,6 +41,10 @@
             return activemq::util::IntegrationCommon::getInstance().getStompURL();
         }
 
+        virtual std::string getSubscriptionName() const {
+            return cmsProvider->getConnection()->getClientID();
+        }
+
     };
 
 }}}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompJmsMessageGroupsTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompJmsMessageGroupsTest.h?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompJmsMessageGroupsTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompJmsMessageGroupsTest.h
Thu May  7 00:07:57 2009
@@ -27,7 +27,7 @@
     class StompJmsMessageGroupsTest : public JmsMessageGroupsTest {
 
         CPPUNIT_TEST_SUITE( StompJmsMessageGroupsTest );
-        CPPUNIT_TEST( testMessageSend );
+        //CPPUNIT_TEST( testMessageSend );
         CPPUNIT_TEST_SUITE_END();
 
     public:
@@ -36,7 +36,7 @@
         virtual ~StompJmsMessageGroupsTest();
 
         virtual std::string getBrokerURL() const {
-            return activemq::util::IntegrationCommon::getInstance().getOpenwireURL();
+            return activemq::util::IntegrationCommon::getInstance().getStompURL();
         }
 
     };

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompTransactionTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompTransactionTest.h?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompTransactionTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/stomp/StompTransactionTest.h
Thu May  7 00:07:57 2009
@@ -27,7 +27,7 @@
     class StompTransactionTest : public TransactionTest {
 
         CPPUNIT_TEST_SUITE( StompTransactionTest );
-//        CPPUNIT_TEST( testSendReceiveTransactedBatches );
+        CPPUNIT_TEST( testSendReceiveTransactedBatches );
         CPPUNIT_TEST( testSendRollback );
         CPPUNIT_TEST( testWithTTLSet );
 //        CPPUNIT_TEST( testSendSessionClose );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
Thu May  7 00:07:57 2009
@@ -63,35 +63,63 @@
 void CMSProvider::close() throw( decaf::lang::Exception ) {
 
     if( this->consumer.get() != NULL ) {
-        this->consumer->close();
+        try{
+            this->consumer->close();
+        } catch( cms::CMSException& ex ) {
+            ex.printStackTrace();
+        }
     }
     if( this->producer.get() != NULL ) {
-        this->producer->close();
+        try{
+            this->producer->close();
+        } catch( cms::CMSException& ex ) {
+            ex.printStackTrace();
+        }
     }
     if( this->noDestProducer.get() != NULL ) {
-        this->noDestProducer->close();
+        try{
+            this->noDestProducer->close();
+        } catch( cms::CMSException& ex ) {
+            ex.printStackTrace();
+        }
     }
 
     if( this->destination.get() != NULL && !isDurable() ) {
-        this->destroyDestination( this->destination.get() );
+        try{
+            this->destroyDestination( this->destination.get() );
+        } catch( cms::CMSException& ex ) {
+            ex.printStackTrace();
+        }
     }
 
     this->destination.reset( NULL );
     this->tempDestination.reset( NULL );
 
     if( this->session.get() != NULL ) {
-        this->session->close();
+        try{
+            this->session->close();
+        } catch( cms::CMSException& ex ) {
+            ex.printStackTrace();
+        }
     }
 
     if( this->connection.get() != NULL ) {
-        this->connection->close();
+        try{
+            this->connection->close();
+        } catch( cms::CMSException& ex ) {
+            ex.printStackTrace();
+        }
     }
 
-    this->consumer.reset( NULL );
-    this->producer.reset( NULL );
-    this->noDestProducer.reset( NULL );
-    this->session.reset( NULL );
-    this->connection.reset( NULL );
+    try{
+        this->consumer.reset( NULL );
+        this->producer.reset( NULL );
+        this->noDestProducer.reset( NULL );
+        this->session.reset( NULL );
+        this->connection.reset( NULL );
+    } catch( cms::CMSException& ex ) {
+        ex.printStackTrace();
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/IntegrationCommon.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/IntegrationCommon.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/IntegrationCommon.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/IntegrationCommon.cpp
Thu May  7 00:07:57 2009
@@ -21,8 +21,8 @@
 using namespace util;
 
 ////////////////////////////////////////////////////////////////////////////////
-const int IntegrationCommon::defaultDelay = 5;
-const unsigned int IntegrationCommon::defaultMsgCount = 1000;
+const int IntegrationCommon::defaultDelay = 1000;
+const unsigned int IntegrationCommon::defaultMsgCount = 1;
 bool IntegrationCommon::debug = false;
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/main.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/main.cpp?rev=772470&r1=772469&r2=772470&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/main.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/main.cpp Thu May  7 00:07:57
2009
@@ -34,7 +34,6 @@
 
     activemq::library::ActiveMQCPP::initializeLibrary();
 
-    bool wasSuccessful = false;
     std::ofstream outputFile;
     bool useXMLOutputter = false;
     std::auto_ptr<CppUnit::TestListener> listener( new CppUnit::BriefTestProgressListener
);



Mime
View raw message