activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r779282 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/core/ test-integration/ test-integration/activemq/test/ test-integration/activemq/test/openwire/
Date Wed, 27 May 2009 19:37:50 GMT
Author: tabish
Date: Wed May 27 19:37:50 2009
New Revision: 779282

URL: http://svn.apache.org/viewvc?rev=779282&view=rev
Log:
fix for: http://issues.apache.org/activemq/browse/AMQCPP-243

Added:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.cpp
  (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.h
  (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.cpp
  (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.h
  (with props)
Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/TestRegistry.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp?rev=779282&r1=779281&r2=779282&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp Wed
May 27 19:37:50 2009
@@ -624,13 +624,14 @@
 
         if( !dispatchedMessages.empty() ) {
 
-            Pointer<Message> message = dispatchedMessages.front()->getMessage();
+            Pointer<MessageDispatch> dispatched = dispatchedMessages.front();
+
             Pointer<MessageAck> ack( new MessageAck() );
             ack->setAckType( type );
-            ack->setConsumerId( this->consumerInfo->getConsumerId() );
-            ack->setDestination( message->getDestination() );
+            ack->setConsumerId( dispatched->getConsumerId() );
+            ack->setDestination( dispatched->getDestination() );
             ack->setMessageCount( (int)dispatchedMessages.size() );
-            ack->setLastMessageId( message->getMessageId() );
+            ack->setLastMessageId( dispatched->getMessage()->getMessageId() );
             ack->setFirstMessageId( dispatchedMessages.back()->getMessage()->getMessageId()
);
 
             return ack;
@@ -710,8 +711,8 @@
             }
 
             // Only increase the redelivery delay after the first redelivery..
-            Pointer<Message> lastMsg = dispatchedMessages.front()->getMessage();
-            const int currentRedeliveryCount = lastMsg->getRedeliveryCounter();
+            Pointer<MessageDispatch> lastMsg = dispatchedMessages.front();
+            const int currentRedeliveryCount = lastMsg->getMessage()->getRedeliveryCounter();
             if( currentRedeliveryCount > 0 ) {
                 redeliveryDelay = transaction->getRedeliveryDelay();
             }
@@ -735,7 +736,7 @@
                 ack->setConsumerId( this->consumerInfo->getConsumerId() );
                 ack->setDestination( lastMsg->getDestination() );
                 ack->setMessageCount( (int)dispatchedMessages.size() );
-                ack->setLastMessageId( lastMsg->getMessageId() );
+                ack->setLastMessageId( lastMsg->getMessage()->getMessageId() );
                 ack->setFirstMessageId( firstMsgId );
 
                 session->oneway( ack );
@@ -753,7 +754,7 @@
                     ack->setConsumerId( this->consumerInfo->getConsumerId() );
                     ack->setDestination( lastMsg->getDestination() );
                     ack->setMessageCount( (int)dispatchedMessages.size() );
-                    ack->setLastMessageId( lastMsg->getMessageId() );
+                    ack->setLastMessageId( lastMsg->getMessage()->getMessageId()
);
                     ack->setFirstMessageId( firstMsgId );
 
                     session->oneway( ack );

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=779282&r1=779281&r2=779282&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 Wed May 27 19:37:50
2009
@@ -23,6 +23,7 @@
     activemq/test/openwire/OpenwireCmsTemplateTest.cpp \
     activemq/test/openwire/OpenwireTempDestinationTest.cpp \
     activemq/test/openwire/OpenwireTransactionTest.cpp \
+    activemq/test/openwire/OpenwireVirtualTopicTest.cpp \
     activemq/test/openwire/OpenwireSimpleTest.cpp \
     activemq/test/openwire/OpenwireExpirationTest.cpp \
     activemq/test/openwire/OpenwireSlowListenerTest.cpp \
@@ -40,6 +41,7 @@
     activemq/test/stomp/StompJmsMessageGroupsTest.cpp \
     activemq/test/stomp/StompDurableTest.cpp \
     activemq/test/stomp/StompSimpleRollbackTest.cpp \
+    activemq/test/VirtualTopicTest.cpp \
     activemq/test/AsyncSenderTest.cpp \
     activemq/test/TransactionTest.cpp \
     activemq/test/ExpirationTest.cpp \
@@ -56,6 +58,7 @@
     util/teamcity/TeamCityProgressListener.h \
     activemq/test/openwire/OpenwireAsyncSenderTest.h \
     activemq/test/openwire/OpenwireTransactionTest.h \
+    activemq/test/openwire/OpenwireVirtualTopicTest.h \
     activemq/test/openwire/OpenwireJmsMessageGroupsTest.h \
     activemq/test/openwire/OpenwireCmsTemplateTest.h \
     activemq/test/openwire/OpenwireSimpleRollbackTest.h \
@@ -65,6 +68,7 @@
     activemq/test/openwire/OpenwireSlowListenerTest.h \
     activemq/test/openwire/OpenwireExpirationTest.h \
     activemq/test/JmsMessageGroupsTest.h \
+    activemq/test/VirtualTopicTest.h \
     activemq/test/AsyncSenderTest.h \
     activemq/test/CMSTestFixture.h \
     activemq/test/stomp/StompSlowListenerTest.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=779282&r1=779281&r2=779282&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 Wed May
27 19:37:50 2009
@@ -25,6 +25,7 @@
 #include "activemq/test/openwire/OpenwireTempDestinationTest.h"
 #include "activemq/test/openwire/OpenwireSlowListenerTest.h"
 #include "activemq/test/openwire/OpenwireJmsMessageGroupsTest.h"
+#include "activemq/test/openwire/OpenwireVirtualTopicTest.h"
 
 #include "activemq/test/stomp/StompAsyncSenderTest.h"
 #include "activemq/test/stomp/StompCmsTemplateTest.h"
@@ -47,6 +48,7 @@
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireSlowListenerTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireTempDestinationTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireJmsMessageGroupsTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireVirtualTopicTest );
 
 // Stomp Tests
 //CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompAsyncSenderTest );

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.cpp?rev=779282&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.cpp
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.cpp
Wed May 27 19:37:50 2009
@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "VirtualTopicTest.h"
+
+#include <activemq/exceptions/ActiveMQException.h>
+#include <memory>
+#include <string>
+
+#include <cms/Topic.h>
+#include <cms/TextMessage.h>
+#include <cms/MessageConsumer.h>
+#include <cms/MessageProducer.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::util;
+using namespace activemq::test;
+using namespace activemq::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+const string VirtualTopicTest::PRODUCER_DESTINATION_NAME = "VirtualTopic.TestDestination";
+const string VirtualTopicTest::CONSUMER_A_DESTINATION_NAME = "Consumer.A.VirtualTopic.TestDestination";
+const string VirtualTopicTest::CONSUMER_B_DESTINATION_NAME = "Consumer.B.VirtualTopic.TestDestination";
+
+////////////////////////////////////////////////////////////////////////////////
+VirtualTopicTest::VirtualTopicTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+VirtualTopicTest::~VirtualTopicTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void VirtualTopicTest::testVirtualTopicSyncReceiveAutoAck() {
+    this->testRunnerSync( cms::Session::AUTO_ACKNOWLEDGE );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void VirtualTopicTest::testVirtualTopicSyncReceiveClinetAck() {
+    this->testRunnerSync( cms::Session::CLIENT_ACKNOWLEDGE );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void VirtualTopicTest::testVirtualTopicSyncReceiveTransacted() {
+    this->testRunnerSync( cms::Session::SESSION_TRANSACTED );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void VirtualTopicTest::testRunnerSync( cms::Session::AcknowledgeMode mode ) {
+
+    cmsProvider->setAckMode( mode );
+    cmsProvider->reconnectSession();
+
+    // Create CMS Object for Comms
+    cms::Session* session( cmsProvider->getSession() );
+
+    auto_ptr<cms::Destination> topic( session->createTopic( PRODUCER_DESTINATION_NAME
) );
+    auto_ptr<cms::Destination> queueA( session->createQueue( CONSUMER_A_DESTINATION_NAME
) );
+    auto_ptr<cms::Destination> queueB( session->createQueue( CONSUMER_B_DESTINATION_NAME
) );
+
+    auto_ptr<cms::MessageProducer> producer( session->createProducer( topic.get()
) );
+    auto_ptr<cms::MessageConsumer> consumerA( session->createConsumer( queueA.get()
) );
+    auto_ptr<cms::MessageConsumer> consumerB( session->createConsumer( queueB.get()
) );
+
+    producer->setDeliveryMode( cms::DeliveryMode::NON_PERSISTENT );
+
+    auto_ptr<cms::TextMessage> txtMessage( session->createTextMessage( "TEST MESSAGE"
) );
+
+    for( std::size_t i = 0; i < IntegrationCommon::defaultMsgCount; ++i ) {
+        producer->send( txtMessage.get() );
+    }
+
+    if( cms::Session::SESSION_TRANSACTED == mode ) {
+        session->commit();
+    }
+
+    for( std::size_t i = 0; i < IntegrationCommon::defaultMsgCount; ++i ) {
+
+        auto_ptr<cms::Message> messageA( consumerA->receive( 2000 ) );
+        CPPUNIT_ASSERT( messageA.get() != NULL );
+        if( cms::Session::CLIENT_ACKNOWLEDGE == mode ) {
+            messageA->acknowledge();
+        }
+
+        auto_ptr<cms::Message> messageB( consumerB->receive( 2000 ) );
+        CPPUNIT_ASSERT( messageB.get() != NULL );
+        if( cms::Session::CLIENT_ACKNOWLEDGE == mode ) {
+            messageB->acknowledge();
+        }
+    }
+
+    if( cms::Session::SESSION_TRANSACTED == mode ) {
+        session->commit();
+    }
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.h?rev=779282&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.h
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.h
Wed May 27 19:37:50 2009
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_TEST_VIRTUALTOPICTEST_H_
+#define _ACTIVEMQ_TEST_VIRTUALTOPICTEST_H_
+
+#include <activemq/test/CMSTestFixture.h>
+#include <activemq/util/IntegrationCommon.h>
+
+namespace activemq {
+namespace test {
+
+    class VirtualTopicTest : public CMSTestFixture {
+    private:
+
+        static const std::string PRODUCER_DESTINATION_NAME;
+        static const std::string CONSUMER_A_DESTINATION_NAME;
+        static const std::string CONSUMER_B_DESTINATION_NAME;
+
+    public:
+
+        VirtualTopicTest();
+        virtual ~VirtualTopicTest();
+
+        void testVirtualTopicSyncReceiveAutoAck();
+        void testVirtualTopicSyncReceiveClinetAck();
+        void testVirtualTopicSyncReceiveTransacted();
+
+    private:
+
+        void testRunnerSync( cms::Session::AcknowledgeMode mode );
+
+    };
+
+}}
+
+#endif /* _ACTIVEMQ_TEST_VIRTUALTOPICTEST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/VirtualTopicTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.cpp?rev=779282&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.cpp
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.cpp
Wed May 27 19:37:50 2009
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "OpenwireVirtualTopicTest.h"
+
+using namespace activemq;
+using namespace activemq::test;
+using namespace activemq::test::openwire;
+
+////////////////////////////////////////////////////////////////////////////////
+OpenwireVirtualTopicTest::OpenwireVirtualTopicTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+OpenwireVirtualTopicTest::~OpenwireVirtualTopicTest() {
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.h?rev=779282&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.h
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.h
Wed May 27 19:37:50 2009
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_TEST_OPENWIRE_OPENWIREVIRTUALTOPICTEST_H_
+#define _ACTIVEMQ_TEST_OPENWIRE_OPENWIREVIRTUALTOPICTEST_H_
+
+#include <activemq/test/VirtualTopicTest.h>
+
+namespace activemq {
+namespace test {
+namespace openwire {
+
+    class OpenwireVirtualTopicTest : public VirtualTopicTest {
+    private:
+
+        CPPUNIT_TEST_SUITE( OpenwireVirtualTopicTest );
+        CPPUNIT_TEST( testVirtualTopicSyncReceiveAutoAck );
+        CPPUNIT_TEST( testVirtualTopicSyncReceiveClinetAck );
+//        CPPUNIT_TEST( testVirtualTopicSyncReceiveTransacted );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        OpenwireVirtualTopicTest();
+        virtual ~OpenwireVirtualTopicTest();
+
+        virtual std::string getBrokerURL() const {
+            return activemq::util::IntegrationCommon::getInstance().getOpenwireURL();
+        }
+
+    };
+
+}}}
+
+#endif /* _ACTIVEMQ_TEST_OPENWIRE_OPENWIREVIRTUALTOPICTEST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireVirtualTopicTest.h
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message