Adds an integration test case for MapMessage use cases.

git-svn-id: https://svn.apache.org/repos/asf/activemq/activemq-cpp/trunk@957961 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/activemq-cpp/src/test-integration/Makefile.am b/activemq-cpp/src/test-integration/Makefile.am
index 7991162..f45e955 100644
--- a/activemq-cpp/src/test-integration/Makefile.am
+++ b/activemq-cpp/src/test-integration/Makefile.am
@@ -22,6 +22,7 @@
     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 @@
     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 @@
     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 @@
     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 \
diff --git a/activemq-cpp/src/test-integration/TestRegistry.cpp b/activemq-cpp/src/test-integration/TestRegistry.cpp
index b929df0..9e203be 100644
--- a/activemq-cpp/src/test-integration/TestRegistry.cpp
+++ b/activemq-cpp/src/test-integration/TestRegistry.cpp
@@ -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( 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 );
diff --git a/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp b/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp
new file mode 100644
index 0000000..166c8b3
--- /dev/null
+++ b/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.cpp
@@ -0,0 +1,65 @@
+/*
+ * 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 );
+}
diff --git a/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h b/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h
new file mode 100644
index 0000000..ab5ccab
--- /dev/null
+++ b/activemq-cpp/src/test-integration/activemq/test/MapMessageTest.h
@@ -0,0 +1,39 @@
+/*
+ * 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();
+
+    };
+
+}}
+
+#endif /* _ACTIVEMQ_TEST_MAPMESSAGETEST_H_ */
diff --git a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.cpp b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.cpp
new file mode 100644
index 0000000..f68e996
--- /dev/null
+++ b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.cpp
@@ -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() {
+}
diff --git a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h
new file mode 100644
index 0000000..29f6f2b
--- /dev/null
+++ b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireMapMessageTest.h
@@ -0,0 +1,46 @@
+/*
+ * 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_SUITE_END();
+
+    public:
+
+        OpenwireMapMessageTest();
+        virtual ~OpenwireMapMessageTest();
+
+        virtual std::string getBrokerURL() const {
+            return activemq::util::IntegrationCommon::getInstance().getOpenwireURL();
+        }
+    };
+
+}}}
+
+#endif /* _ACTIVEMQ_TEST_OPENWIRE_OPENWIREMAPMESSAGETEST_H_ */