You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/07/27 00:38:38 UTC

svn commit: r979478 - in /activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration: ./ activemq/test/ activemq/test/openwire/

Author: tabish
Date: Mon Jul 26 22:38:38 2010
New Revision: 979478

URL: http://svn.apache.org/viewvc?rev=979478&view=rev
Log:
Add a test to try and reproduce: https://issues.apache.org/activemq/browse/AMQCPP-306

Added:
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp   (with props)
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h   (with props)
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.cpp   (with props)
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h   (with props)
Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/Makefile.am
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/TestRegistry.cpp

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/Makefile.am?rev=979478&r1=979477&r2=979478&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/Makefile.am (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/Makefile.am Mon Jul 26 22:38:38 2010
@@ -22,6 +22,7 @@ cc_sources = \
     activemq/test/DurableTest.cpp \
     activemq/test/ExpirationTest.cpp \
     activemq/test/JmsMessageGroupsTest.cpp \
+    activemq/test/MapMessageTest.cpp \
     activemq/test/MessageCompressionTest.cpp \
     activemq/test/QueueBrowserTest.cpp \
     activemq/test/SimpleRollbackTest.cpp \
@@ -36,6 +37,7 @@ cc_sources = \
     activemq/test/openwire/OpenwireExpirationTest.cpp \
     activemq/test/openwire/OpenwireIndividualAckTest.cpp \
     activemq/test/openwire/OpenwireJmsMessageGroupsTest.cpp \
+    activemq/test/openwire/OpenwireMapMessageTest.cpp \
     activemq/test/openwire/OpenwireMessageCompressionTest.cpp \
     activemq/test/openwire/OpenwireQueueBrowserTest.cpp \
     activemq/test/openwire/OpenwireSimpleRollbackTest.cpp \
@@ -67,6 +69,7 @@ h_sources = \
     activemq/test/DurableTest.h \
     activemq/test/ExpirationTest.h \
     activemq/test/JmsMessageGroupsTest.h \
+    activemq/test/MapMessageTest.h \
     activemq/test/MessageCompressionTest.h \
     activemq/test/QueueBrowserTest.h \
     activemq/test/SimpleRollbackTest.h \
@@ -81,6 +84,7 @@ h_sources = \
     activemq/test/openwire/OpenwireExpirationTest.h \
     activemq/test/openwire/OpenwireIndividualAckTest.h \
     activemq/test/openwire/OpenwireJmsMessageGroupsTest.h \
+    activemq/test/openwire/OpenwireMapMessageTest.h \
     activemq/test/openwire/OpenwireMessageCompressionTest.h \
     activemq/test/openwire/OpenwireQueueBrowserTest.h \
     activemq/test/openwire/OpenwireSimpleRollbackTest.h \

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/TestRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/TestRegistry.cpp?rev=979478&r1=979477&r2=979478&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/TestRegistry.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/TestRegistry.cpp Mon Jul 26 22:38:38 2010
@@ -22,6 +22,7 @@
 #include "activemq/test/openwire/OpenwireExpirationTest.h"
 #include "activemq/test/openwire/OpenwireIndividualAckTest.h"
 #include "activemq/test/openwire/OpenwireMessageCompressionTest.h"
+#include "activemq/test/openwire/OpenwireMapMessageTest.h"
 #include "activemq/test/openwire/OpenwireQueueBrowserTest.h"
 #include "activemq/test/openwire/OpenwireSimpleRollbackTest.h"
 #include "activemq/test/openwire/OpenwireSimpleTest.h"
@@ -49,6 +50,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION( activem
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireExpirationTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireIndividualAckTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireMessageCompressionTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireMapMessageTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireQueueBrowserTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireSimpleRollbackTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireSimpleTest );

Added: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp?rev=979478&view=auto
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp (added)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp Mon Jul 26 22:38:38 2010
@@ -0,0 +1,93 @@
+/*
+ * 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 "MapMessageTest.h"
+
+#include <activemq/util/CMSListener.h>
+#include <activemq/exceptions/ActiveMQException.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/commands/ActiveMQMapMessage.h>
+
+using namespace std;
+using namespace cms;
+using namespace activemq;
+using namespace activemq::commands;
+using namespace activemq::core;
+using namespace activemq::test;
+using namespace activemq::util;
+using namespace activemq::exceptions;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::util;
+
+////////////////////////////////////////////////////////////////////////////////
+MapMessageTest::MapMessageTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+MapMessageTest::~MapMessageTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MapMessageTest::testEmptyMapSendReceive() {
+
+    // 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::MapMessage> mapMessage( session->createMapMessage() );
+
+    // Send some text messages
+    producer->send( mapMessage.get() );
+
+    auto_ptr<cms::Message> message( consumer->receive( 2000 ) );
+    CPPUNIT_ASSERT( message.get() != NULL );
+
+    cms::MapMessage* recvMapMessage = dynamic_cast<MapMessage*>( message.get() );
+    CPPUNIT_ASSERT( recvMapMessage != NULL );
+    CPPUNIT_ASSERT( recvMapMessage->itemExists( "SomeKey" ) == false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MapMessageTest::testMapWithEmptyStringValue() {
+
+    // 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::MapMessage> mapMessage( session->createMapMessage() );
+
+    mapMessage->setString("String1", "");
+    mapMessage->setString("String2", "value");
+
+    // Send some text messages
+    producer->send( mapMessage.get() );
+
+    auto_ptr<cms::Message> message( consumer->receive( 2000 ) );
+    CPPUNIT_ASSERT( message.get() != NULL );
+
+    cms::MapMessage* recvMapMessage = dynamic_cast<MapMessage*>( message.get() );
+    CPPUNIT_ASSERT( recvMapMessage != NULL );
+    CPPUNIT_ASSERT( recvMapMessage->itemExists( "String1" ) == true );
+    CPPUNIT_ASSERT( recvMapMessage->itemExists( "String2" ) == true );
+    CPPUNIT_ASSERT( recvMapMessage->itemExists( "String3" ) == false );
+    CPPUNIT_ASSERT( recvMapMessage->getString( "String2" ) == string( "value" ) );
+}

Propchange: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h?rev=979478&view=auto
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h (added)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h Mon Jul 26 22:38:38 2010
@@ -0,0 +1,40 @@
+/*
+ * 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_MAPMESSAGETEST_H_
+#define _ACTIVEMQ_TEST_MAPMESSAGETEST_H_
+
+#include <activemq/test/CMSTestFixture.h>
+#include <activemq/util/IntegrationCommon.h>
+
+namespace activemq {
+namespace test {
+
+    class MapMessageTest : public CMSTestFixture {
+    public:
+
+        MapMessageTest();
+        virtual ~MapMessageTest();
+
+        void testEmptyMapSendReceive();
+        void testMapWithEmptyStringValue();
+
+    };
+
+}}
+
+#endif /* _ACTIVEMQ_TEST_MAPMESSAGETEST_H_ */

Propchange: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.cpp?rev=979478&view=auto
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.cpp (added)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.cpp Mon Jul 26 22:38:38 2010
@@ -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 "OpenwireMapMessageTest.h"
+
+using namespace activemq;
+using namespace activemq::test;
+using namespace activemq::test::openwire;
+
+////////////////////////////////////////////////////////////////////////////////
+OpenwireMapMessageTest::OpenwireMapMessageTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+OpenwireMapMessageTest::~OpenwireMapMessageTest() {
+}

Propchange: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h?rev=979478&view=auto
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h (added)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h Mon Jul 26 22:38:38 2010
@@ -0,0 +1,47 @@
+/*
+ * 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_OPENWIREMAPMESSAGETEST_H_
+#define _ACTIVEMQ_TEST_OPENWIRE_OPENWIREMAPMESSAGETEST_H_
+
+#include <activemq/test/MapMessageTest.h>
+
+namespace activemq {
+namespace test {
+namespace openwire {
+
+    class OpenwireMapMessageTest : public MapMessageTest {
+    private:
+
+        CPPUNIT_TEST_SUITE( OpenwireMapMessageTest );
+        CPPUNIT_TEST( testEmptyMapSendReceive );
+        CPPUNIT_TEST( testMapWithEmptyStringValue );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        OpenwireMapMessageTest();
+        virtual ~OpenwireMapMessageTest();
+
+        virtual std::string getBrokerURL() const {
+            return activemq::util::IntegrationCommon::getInstance().getOpenwireURL();
+        }
+    };
+
+}}}
+
+#endif /* _ACTIVEMQ_TEST_OPENWIRE_OPENWIREMAPMESSAGETEST_H_ */

Propchange: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h
------------------------------------------------------------------------------
    svn:eol-style = native