activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1481097 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/commands/ main/activemq/core/kernels/ test-integration/activemq/test/ test-integration/activemq/test/openwire/
Date Fri, 10 May 2013 16:59:06 GMT
Author: tabish
Date: Fri May 10 16:59:06 2013
New Revision: 1481097

URL: http://svn.apache.org/r1481097
Log:
fix and test for: https://issues.apache.org/jira/browse/AMQCPP-482

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h?rev=1481097&r1=1481096&r2=1481097&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h
Fri May 10 16:59:06 2013
@@ -387,7 +387,17 @@ namespace commands {
             AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
         }
 
-        virtual void setCMSMessageID(const std::string& id AMQCPP_UNUSED ) {
+        virtual void setCMSMessageID(const std::string& value) {
+            try {
+                Pointer<MessageId> id(new MessageId(value));
+                this->setMessageId(id);
+            } catch (decaf::lang::exceptions::NumberFormatException& e) {
+                // we must be some foreign JMS provider or strange user-supplied
+                // String so lets set the IDs to be 1
+                Pointer<MessageId> id(new MessageId);
+                id->setTextView(value);
+                this->setMessageId(messageId);
+            }
         }
 
         virtual int getCMSPriority() const {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp?rev=1481097&r1=1481096&r2=1481097&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
Fri May 10 16:59:06 2013
@@ -963,12 +963,14 @@ void ActiveMQSessionKernel::send(kernels
             // to clone it.
             if (ActiveMQMessageTransformation::transformMessage(message, connection, &transformed))
{
                 amqMessage.reset(transformed);
-                // Sets the Message ID on the original message per spec.
-                message->setCMSMessageID(id->toString());
             } else {
                 amqMessage.reset(transformed->cloneDataStructure());
             }
 
+            // Sets the Message ID on the original message per spec.
+            message->setCMSMessageID(id->toString());
+            message->setCMSDestination(destination.dynamicCast<cms::Destination>().get());
+
             amqMessage->setMessageId(id);
             amqMessage->getBrokerPath().clear();
             amqMessage->setTransactionId(txId);

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp?rev=1481097&r1=1481096&r2=1481097&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
Fri May 10 16:59:06 2013
@@ -388,7 +388,7 @@ void SimpleTest::testBytesMessageSendRec
 
     unsigned char* result = bytesMessage2->getBodyBytes();
     CPPUNIT_ASSERT( result != NULL );
-    delete result;
+    delete [] result;
 
     bytesMessage2->reset();
 
@@ -432,7 +432,7 @@ namespace {
 
                 unsigned char* result = bytesMessage->getBodyBytes();
                 CPPUNIT_ASSERT( result != NULL );
-                delete result;
+                delete [] result;
 
                 passed = true;
             } catch(...) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.cpp?rev=1481097&r1=1481096&r2=1481097&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.cpp
Fri May 10 16:59:06 2013
@@ -367,3 +367,19 @@ void OpenwireSimpleTest::tesstStreamMess
     CPPUNIT_ASSERT( rcvStreamMessage->readDouble() == doubleValue );
     CPPUNIT_ASSERT( rcvStreamMessage->readBytes( readBytes ) == (int)bytes.size() );
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenwireSimpleTest::testMessageIdSetOnSend() {
+
+    // Create CMS Object for Comms
+    cms::Session* session(cmsProvider->getSession());
+    cms::MessageConsumer* consumer = cmsProvider->getConsumer();
+    cms::MessageProducer* producer = cmsProvider->getProducer();
+    producer->setDeliveryMode(DeliveryMode::NON_PERSISTENT);
+
+    auto_ptr<cms::Message> message(session->createMessage());
+    producer->send(message.get());
+
+    CPPUNIT_ASSERT(message->getCMSMessageID() != "");
+    CPPUNIT_ASSERT(message->getCMSDestination() != NULL);
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h?rev=1481097&r1=1481096&r2=1481097&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h
Fri May 10 16:59:06 2013
@@ -49,6 +49,7 @@ namespace openwire{
         CPPUNIT_TEST( tesstStreamMessage );
         CPPUNIT_TEST( testLibraryInitShutdownInit );
         CPPUNIT_TEST( testBytesMessageSendRecvAsync );
+        CPPUNIT_TEST( testMessageIdSetOnSend );
         CPPUNIT_TEST_SUITE_END();
 
     public:
@@ -68,6 +69,7 @@ namespace openwire{
         void testMapMessageSendToTopic();
         void tesstStreamMessage();
         void testDestroyDestination();
+        void testMessageIdSetOnSend();
 
     };
 



Mime
View raw message