activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq-cpp git commit: https://issues.apache.org/jira/browse/AMQCPP-591
Date Mon, 21 Dec 2015 23:23:41 GMT
Repository: activemq-cpp
Updated Branches:
  refs/heads/master 25ae0d1c2 -> c1c1aecc6


https://issues.apache.org/jira/browse/AMQCPP-591

Perform a complete conversion on the composite elements of a destination
passing through the STOMP wireFormat converter. 

Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/c1c1aecc
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/c1c1aecc
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/c1c1aecc

Branch: refs/heads/master
Commit: c1c1aecc61f1adfdd8bb52ec06a4bb8fce7fa105
Parents: 25ae0d1
Author: Timothy Bish <tabish121@gmail.com>
Authored: Mon Dec 21 18:23:26 2015 -0500
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Mon Dec 21 18:23:26 2015 -0500

----------------------------------------------------------------------
 .../activemq/wireformat/stomp/StompHelper.cpp   |  65 +++++--
 activemq-cpp/src/test-integration/Makefile.am   |   8 +-
 .../src/test-integration/TestRegistry.cpp       |   6 +-
 .../activemq/test/AdvisoryTest.cpp              | 128 +++++++++++++
 .../activemq/test/AdvisoryTest.h                |  38 ++++
 .../test/openwire/OpenwireAdvisoryTest.cpp      | 179 ++++++++++++++++++
 .../test/openwire/OpenwireAdvisoryTest.h        |  52 ++++++
 .../test/openwire/OpenwireAdvisorysTest.cpp     | 181 -------------------
 .../test/openwire/OpenwireAdvisorysTest.h       |  57 ------
 .../test/openwire/OpenwireAsyncSenderTest.h     |   6 +-
 .../activemq/test/stomp/StompAdvisoryTest.cpp   |  66 +++++++
 .../activemq/test/stomp/StompAdvisoryTest.h     |  47 +++++
 12 files changed, 568 insertions(+), 265 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/main/activemq/wireformat/stomp/StompHelper.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/activemq/wireformat/stomp/StompHelper.cpp b/activemq-cpp/src/main/activemq/wireformat/stomp/StompHelper.cpp
index a8945ea..01f8354 100644
--- a/activemq-cpp/src/main/activemq/wireformat/stomp/StompHelper.cpp
+++ b/activemq-cpp/src/main/activemq/wireformat/stomp/StompHelper.cpp
@@ -36,6 +36,36 @@ using namespace decaf::lang;
 using namespace decaf::util;
 
 ////////////////////////////////////////////////////////////////////////////////
+namespace {
+
+    std::string doConvertDestination(StompWireFormat* wireFormat, Pointer<ActiveMQDestination>
destination) {
+        switch (destination->getDestinationType()) {
+
+        case cms::Destination::TOPIC:
+            return std::string(wireFormat->getTopicPrefix()) + destination->getPhysicalName();
+        case cms::Destination::TEMPORARY_TOPIC:
+
+            if (destination->getPhysicalName().find("/remote-temp-topic/") == 0) {
+                return destination->getPhysicalName();
+            } else {
+                return std::string(wireFormat->getTempTopicPrefix()) + destination->getPhysicalName();
+            }
+
+        case cms::Destination::TEMPORARY_QUEUE:
+
+            if (destination->getPhysicalName().find("/remote-temp-queue/") == 0) {
+                return destination->getPhysicalName();
+            } else {
+                return std::string(wireFormat->getTempQueuePrefix()) + destination->getPhysicalName();
+            }
+
+        default:
+            return std::string(wireFormat->getQueuePrefix()) + destination->getPhysicalName();
+        }
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
 StompHelper::StompHelper(StompWireFormat* wireformat) : messageIdGenerator(), wireFormat(wireformat)
{
 }
 
@@ -159,34 +189,29 @@ void StompHelper::convertProperties(const Pointer<Message>&
message, const Point
 ////////////////////////////////////////////////////////////////////////////////
 std::string StompHelper::convertDestination(const Pointer<ActiveMQDestination>&
destination) {
 
-    if (destination == NULL) {
-        return "";
-    } else {
+    std::string result = "";
 
-        switch (destination->getDestinationType()) {
+    if (destination != NULL) {
 
-        case cms::Destination::TOPIC:
-            return std::string(wireFormat->getTopicPrefix()) + destination->getPhysicalName();
-        case cms::Destination::TEMPORARY_TOPIC:
+        if (destination->isComposite()) {
+            ArrayList< Pointer<ActiveMQDestination> > destinations = destination->getCompositeDestinations();
 
-            if (destination->getPhysicalName().find("/remote-temp-topic/") == 0) {
-                return destination->getPhysicalName();
-            } else {
-                return std::string(wireFormat->getTempTopicPrefix()) + destination->getPhysicalName();
-            }
+            Pointer<Iterator< Pointer<ActiveMQDestination> > > destIter(destinations.iterator());
+            while (destIter->hasNext()) {
+                Pointer<ActiveMQDestination> composite = destIter->next();
 
-        case cms::Destination::TEMPORARY_QUEUE:
+                if (!result.empty()) {
+                    result.append(",");
+                }
 
-            if (destination->getPhysicalName().find("/remote-temp-queue/") == 0) {
-                return destination->getPhysicalName();
-            } else {
-                return std::string(wireFormat->getTempQueuePrefix()) + destination->getPhysicalName();
+                result += doConvertDestination(wireFormat, composite);
             }
-
-        default:
-            return std::string(wireFormat->getQueuePrefix()) + destination->getPhysicalName();
+        } else {
+            result += doConvertDestination(wireFormat, destination);
         }
     }
+
+    return result;
 }
 
 ////////////////////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/Makefile.am
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/Makefile.am b/activemq-cpp/src/test-integration/Makefile.am
index 38e31bf..021f55e 100644
--- a/activemq-cpp/src/test-integration/Makefile.am
+++ b/activemq-cpp/src/test-integration/Makefile.am
@@ -17,6 +17,7 @@
 
 cc_sources = \
     TestRegistry.cpp \
+    activemq/test/AdvisoryTest.cpp \
     activemq/test/AsyncSenderTest.cpp \
     activemq/test/BulkMessageTest.cpp \
     activemq/test/CmsConnectionStartStopTest.cpp \
@@ -37,7 +38,7 @@ cc_sources = \
     activemq/test/openwire/OpenWireCmsSendWithAsyncCallbackTest.cpp \
     activemq/test/openwire/OpenWireMessageListenerRedeliveryTest.cpp \
     activemq/test/openwire/OpenWireRedeliveryPolicyTest.cpp \
-    activemq/test/openwire/OpenwireAdvisorysTest.cpp \
+    activemq/test/openwire/OpenwireAdvisoryTest.cpp \
     activemq/test/openwire/OpenwireAsyncSenderTest.cpp \
     activemq/test/openwire/OpenwireClientAckTest.cpp \
     activemq/test/openwire/OpenwireCmsConnectionStartStopTest.cpp \
@@ -61,6 +62,7 @@ cc_sources = \
     activemq/test/openwire/OpenwireTransactionTest.cpp \
     activemq/test/openwire/OpenwireVirtualTopicTest.cpp \
     activemq/test/openwire/OpenwireXATransactionsTest.cpp \
+    activemq/test/stomp/StompAdvisoryTest.cpp \
     activemq/test/stomp/StompAsyncSenderTest.cpp \
     activemq/test/stomp/StompBulkMessageTest.cpp \
     activemq/test/stomp/StompCmsConnectionStartStopTest.cpp \
@@ -80,6 +82,7 @@ cc_sources = \
 
 
 h_sources = \
+    activemq/test/AdvisoryTest.h \
     activemq/test/AsyncSenderTest.h \
     activemq/test/BulkMessageTest.h \
     activemq/test/CMSTestFixture.h \
@@ -101,7 +104,7 @@ h_sources = \
     activemq/test/openwire/OpenWireCmsSendWithAsyncCallbackTest.h \
     activemq/test/openwire/OpenWireMessageListenerRedeliveryTest.h \
     activemq/test/openwire/OpenWireRedeliveryPolicyTest.h \
-    activemq/test/openwire/OpenwireAdvisorysTest.h \
+    activemq/test/openwire/OpenwireAdvisoryTest.h \
     activemq/test/openwire/OpenwireAsyncSenderTest.h \
     activemq/test/openwire/OpenwireClientAckTest.h \
     activemq/test/openwire/OpenwireCmsConnectionStartStopTest.h \
@@ -125,6 +128,7 @@ h_sources = \
     activemq/test/openwire/OpenwireTransactionTest.h \
     activemq/test/openwire/OpenwireVirtualTopicTest.h \
     activemq/test/openwire/OpenwireXATransactionsTest.h \
+    activemq/test/stomp/StompAdvisoryTest.h \
     activemq/test/stomp/StompAsyncSenderTest.h \
     activemq/test/stomp/StompBulkMessageTest.h \
     activemq/test/stomp/StompCmsConnectionStartStopTest.h \

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/TestRegistry.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/TestRegistry.cpp b/activemq-cpp/src/test-integration/TestRegistry.cpp
index 5ac2c56..292cded 100644
--- a/activemq-cpp/src/test-integration/TestRegistry.cpp
+++ b/activemq-cpp/src/test-integration/TestRegistry.cpp
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-#include "activemq/test/openwire/OpenwireAdvisorysTest.h"
+#include "activemq/test/openwire/OpenwireAdvisoryTest.h"
 #include "activemq/test/openwire/OpenwireAsyncSenderTest.h"
 #include "activemq/test/openwire/OpenwireClientAckTest.h"
 #include "activemq/test/openwire/OpenwireCmsConnectionStartStopTest.h"
@@ -42,6 +42,7 @@
 #include "activemq/test/openwire/OpenwireSlowListenerTest.h"
 #include "activemq/test/openwire/OpenwireVirtualTopicTest.h"
 #include "activemq/test/openwire/OpenwireXATransactionsTest.h"
+#include "activemq/test/stomp/StompAdvisoryTest.h"
 #include "activemq/test/stomp/StompAsyncSenderTest.h"
 #include "activemq/test/stomp/StompBulkMessageTest.h"
 #include "activemq/test/stomp/StompCmsTemplateTest.h"
@@ -55,7 +56,7 @@
 #include "activemq/test/stomp/StompJmsMessageGroupsTest.h"
 
 // Openwire Tests
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireAdvisorysTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireAdvisoryTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireAsyncSenderTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireClientAckTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireCmsConnectionStartStopTest
);
@@ -84,6 +85,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireVirtualTopicT
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireXATransactionsTest );
 
 // Stomp Tests
+//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompAdvisoryTest );
 //CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompAsyncSenderTest );
 //CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompBulkMessageTest );
 //CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::stomp::StompCmsTemplateTest );

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/activemq/test/AdvisoryTest.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/AdvisoryTest.cpp b/activemq-cpp/src/test-integration/activemq/test/AdvisoryTest.cpp
new file mode 100644
index 0000000..7b3db25
--- /dev/null
+++ b/activemq-cpp/src/test-integration/activemq/test/AdvisoryTest.cpp
@@ -0,0 +1,128 @@
+/*
+ * 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 "AdvisoryTest.h"
+
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/core/ActiveMQSession.h>
+#include <activemq/commands/ActiveMQTempTopic.h>
+#include <activemq/commands/ActiveMQTempQueue.h>
+#include <activemq/commands/ActiveMQMessage.h>
+#include <activemq/commands/ConnectionInfo.h>
+#include <activemq/commands/DestinationInfo.h>
+#include <activemq/exceptions/ActiveMQException.h>
+#include <activemq/util/CMSListener.h>
+#include <activemq/util/IntegrationCommon.h>
+#include <activemq/util/AdvisorySupport.h>
+
+#include <decaf/lang/exceptions/ClassCastException.h>
+#include <decaf/lang/Pointer.h>
+#include <decaf/lang/Thread.h>
+#include <decaf/lang/Runnable.h>
+#include <decaf/util/concurrent/TimeUnit.h>
+#include <decaf/util/UUID.h>
+
+#include <cms/ConnectionFactory.h>
+#include <cms/Connection.h>
+#include <cms/Session.h>
+#include <cms/MessageConsumer.h>
+#include <cms/MessageProducer.h>
+#include <cms/MessageListener.h>
+#include <cms/ConnectionFactory.h>
+#include <cms/Connection.h>
+#include <cms/Message.h>
+#include <cms/Destination.h>
+#include <cms/TextMessage.h>
+
+#include <memory>
+
+using namespace cms;
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::util;
+using namespace activemq::commands;
+using namespace activemq::exceptions;
+using namespace activemq::test;
+
+////////////////////////////////////////////////////////////////////////////////
+AdvisoryTest::AdvisoryTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+AdvisoryTest::~AdvisoryTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void AdvisoryTest::testTempDestinationCompositeAdvisoryTopic() {
+
+    std::auto_ptr<ConnectionFactory> factory(
+        ConnectionFactory::createCMSConnectionFactory(getBrokerURL()));
+    CPPUNIT_ASSERT(factory.get() != NULL);
+
+    std::auto_ptr<Connection> connection(factory->createConnection());
+    CPPUNIT_ASSERT(connection.get() != NULL);
+
+    std::auto_ptr<Session> session(connection->createSession());
+    CPPUNIT_ASSERT(session.get() != NULL);
+
+    std::auto_ptr<ActiveMQDestination> composite(
+        AdvisorySupport::getTempDestinationCompositeAdvisoryTopic());
+
+    std::auto_ptr<MessageConsumer> consumer(session->createConsumer(dynamic_cast<Topic*>(composite.get())));
+
+    connection->start();
+
+    // Create one of each
+    std::auto_ptr<Topic> tempTopic(session->createTemporaryTopic());
+    std::auto_ptr<Queue> tempQueue(session->createTemporaryQueue());
+
+    // Create a consumer to ensure destination creation based on protocol.
+    std::auto_ptr<MessageConsumer> tempTopicConsumer(session->createConsumer(tempTopic.get()));
+    std::auto_ptr<MessageConsumer> tempQueueConsumer(session->createConsumer(tempQueue.get()));
+
+    // Should be an advisory for each
+    std::auto_ptr<cms::Message> advisory1(consumer->receive(2000));
+    CPPUNIT_ASSERT(advisory1.get() != NULL);
+    std::auto_ptr<cms::Message> advisory2(consumer->receive(2000));
+    CPPUNIT_ASSERT(advisory2.get() != NULL);
+
+    ActiveMQMessage* tempTopicAdvisory = dynamic_cast<ActiveMQMessage*>(advisory1.get());
+    ActiveMQMessage* tempQueueAdvisory = dynamic_cast<ActiveMQMessage*>(advisory2.get());
+
+    // Create one of each
+    std::auto_ptr<Topic> topic(session->createTopic(UUID::randomUUID().toString()));
+    std::auto_ptr<Queue> queue(session->createQueue(UUID::randomUUID().toString()));
+
+    // Create a producer to ensure destination creation based on protocol.
+    std::auto_ptr<MessageProducer> topicProducer(session->createProducer(topic.get()));
+    std::auto_ptr<MessageProducer> queueProducer(session->createProducer(queue.get()));
+
+    // Should not be an advisory for each
+    std::auto_ptr<cms::Message> advisory3(consumer->receive(500));
+    CPPUNIT_ASSERT(advisory3.get() == NULL);
+    std::auto_ptr<cms::Message> advisory4(consumer->receive(500));
+    CPPUNIT_ASSERT(advisory4.get() == NULL);
+
+    connection->close();
+}

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/activemq/test/AdvisoryTest.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/AdvisoryTest.h b/activemq-cpp/src/test-integration/activemq/test/AdvisoryTest.h
new file mode 100644
index 0000000..dd694a4
--- /dev/null
+++ b/activemq-cpp/src/test-integration/activemq/test/AdvisoryTest.h
@@ -0,0 +1,38 @@
+/*
+ * 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_ADVISORYTEST_H_
+#define _ACTIVEMQ_TEST_ADVISORYTEST_H_
+
+#include <activemq/test/CMSTestFixture.h>
+
+namespace activemq {
+namespace test {
+
+    class AdvisoryTest : public CMSTestFixture {
+    public:
+
+        AdvisoryTest();
+        virtual ~AdvisoryTest();
+
+        void testTempDestinationCompositeAdvisoryTopic();
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_TEST_ADVISORYTEST_H_*/

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisoryTest.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisoryTest.cpp
b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisoryTest.cpp
new file mode 100644
index 0000000..5890c8b
--- /dev/null
+++ b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisoryTest.cpp
@@ -0,0 +1,179 @@
+/*
+ * 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 <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/core/ActiveMQSession.h>
+#include <activemq/commands/Message.h>
+#include <activemq/commands/ConnectionInfo.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+#include <decaf/lang/exceptions/ClassCastException.h>
+#include <decaf/lang/Pointer.h>
+#include <decaf/lang/Thread.h>
+#include <decaf/lang/Runnable.h>
+#include <decaf/util/concurrent/TimeUnit.h>
+#include <decaf/util/UUID.h>
+
+#include <cms/ConnectionFactory.h>
+#include <cms/Connection.h>
+#include <cms/Session.h>
+#include <cms/MessageConsumer.h>
+#include <cms/MessageProducer.h>
+#include <cms/MessageListener.h>
+#include <cms/ConnectionFactory.h>
+#include <cms/Connection.h>
+#include <cms/Message.h>
+#include <cms/TextMessage.h>
+
+#include <memory>
+#include "OpenwireAdvisoryTest.h"
+
+using namespace cms;
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::commands;
+using namespace activemq::exceptions;
+using namespace activemq::test;
+using namespace activemq::test::openwire;
+
+////////////////////////////////////////////////////////////////////////////////
+OpenwireAdvisoryTest::OpenwireAdvisoryTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+OpenwireAdvisoryTest::~OpenwireAdvisoryTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenwireAdvisoryTest::testConnectionAdvisories() {
+
+    std::auto_ptr<ConnectionFactory> factory(ConnectionFactory::createCMSConnectionFactory(getBrokerURL()));
+    CPPUNIT_ASSERT(factory.get() != NULL);
+
+    std::auto_ptr<Connection> connection(factory->createConnection());
+    CPPUNIT_ASSERT(connection.get() != NULL);
+
+    std::auto_ptr<Session> session(connection->createSession());
+    CPPUNIT_ASSERT(session.get() != NULL);
+
+    std::auto_ptr<Destination> destination(session->createTopic("ActiveMQ.Advisory.Connection"));
+    std::auto_ptr<MessageConsumer> consumer(session->createConsumer(destination.get()));
+
+    connection->start();
+
+    std::auto_ptr<Connection> otherConnection(factory->createConnection());
+    CPPUNIT_ASSERT(otherConnection.get() != NULL);
+    otherConnection->start();
+
+    std::auto_ptr<cms::Message> message;
+    int connectionInfoCount = 0;
+
+    do {
+        message.reset(consumer->receive(3000));
+
+        commands::Message* amqMessage = dynamic_cast<commands::Message*>(message.get());
+        if (amqMessage != NULL) {
+            try {
+                Pointer<ConnectionInfo> connectionInfo =
+                    amqMessage->getDataStructure().dynamicCast<commands::ConnectionInfo>();
+
+                if (connectionInfo != NULL) {
+                    connectionInfoCount++;
+                }
+
+            } catch (ClassCastException& ex) {
+            }
+        }
+
+    } while (message.get() != NULL);
+
+    CPPUNIT_ASSERT(connectionInfoCount >= 2);
+
+    otherConnection->close();
+    connection->close();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+namespace {
+
+    class ConnectionLoadThread : public Thread {
+    private:
+
+        ConnectionFactory* factory;
+        bool noErrors;
+
+    public:
+
+        ConnectionLoadThread(ConnectionFactory* factory) :
+            Thread(), factory(factory), noErrors(true) {
+        }
+
+        virtual ~ConnectionLoadThread() {}
+
+        bool isNoErrors() const {
+            return this->noErrors;
+        }
+
+        virtual void run() {
+
+            try {
+                for (unsigned int i = 0; i < 50; ++i) {
+                    auto_ptr<Connection> connection(factory->createConnection());
+                    connection->start();
+                    auto_ptr<Session> session(connection->createSession(Session::AUTO_ACKNOWLEDGE));
+
+                    for (unsigned int j = 0; j < 100; ++j) {
+                        auto_ptr<Queue> queue(session->createTemporaryQueue());
+                        auto_ptr<MessageProducer> producer(session->createProducer(queue.get()));
+                    }
+
+                    TimeUnit::MILLISECONDS.sleep(20);
+                    connection->close();
+                }
+            } catch(...) {
+                noErrors = false;
+            }
+        }
+    };
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenwireAdvisoryTest::testConcurrentTempDestCreation() {
+
+    std::auto_ptr<ConnectionFactory> factory(
+        ConnectionFactory::createCMSConnectionFactory(getBrokerURL()));
+
+    ConnectionLoadThread thread1(factory.get());
+    ConnectionLoadThread thread2(factory.get());
+
+    thread1.start();
+    thread2.start();
+
+    thread1.join();
+    thread2.join();
+
+    CPPUNIT_ASSERT(thread1.isNoErrors());
+    CPPUNIT_ASSERT(thread2.isNoErrors());
+}

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisoryTest.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisoryTest.h
b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisoryTest.h
new file mode 100644
index 0000000..bf0c509
--- /dev/null
+++ b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisoryTest.h
@@ -0,0 +1,52 @@
+/*
+ * 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_OPENWIREADVISORYTEST_H_
+#define _ACTIVEMQ_TEST_OPENWIRE_OPENWIREADVISORYTEST_H_
+
+#include <activemq/test/AdvisoryTest.h>
+#include <activemq/util/IntegrationCommon.h>
+
+namespace activemq {
+namespace test {
+namespace openwire {
+
+    class OpenwireAdvisoryTest : public AdvisoryTest {
+
+        CPPUNIT_TEST_SUITE( OpenwireAdvisoryTest );
+        CPPUNIT_TEST( testConnectionAdvisories );
+        CPPUNIT_TEST( testConcurrentTempDestCreation );
+        CPPUNIT_TEST( testTempDestinationCompositeAdvisoryTopic );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        OpenwireAdvisoryTest();
+        virtual ~OpenwireAdvisoryTest();
+
+        virtual std::string getBrokerURL() const {
+            return activemq::util::IntegrationCommon::getInstance().getOpenwireURL();
+        }
+
+        void testConnectionAdvisories();
+        void testConcurrentTempDestCreation();
+
+    };
+
+}}}
+
+#endif /* _ACTIVEMQ_TEST_OPENWIRE_OPENWIREADVISORYTEST_H_ */

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.cpp
b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.cpp
deleted file mode 100644
index 9edd9f9..0000000
--- a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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 "OpenwireAdvisorysTest.h"
-
-#include <activemq/core/ActiveMQConnectionFactory.h>
-#include <activemq/core/ActiveMQConnection.h>
-#include <activemq/core/ActiveMQSession.h>
-#include <activemq/commands/Message.h>
-#include <activemq/commands/ConnectionInfo.h>
-#include <activemq/exceptions/ActiveMQException.h>
-
-#include <decaf/lang/exceptions/ClassCastException.h>
-#include <decaf/lang/Pointer.h>
-#include <decaf/lang/Thread.h>
-#include <decaf/lang/Runnable.h>
-#include <decaf/util/concurrent/TimeUnit.h>
-#include <decaf/util/UUID.h>
-
-#include <cms/ConnectionFactory.h>
-#include <cms/Connection.h>
-#include <cms/Session.h>
-#include <cms/MessageConsumer.h>
-#include <cms/MessageProducer.h>
-#include <cms/MessageListener.h>
-#include <cms/ConnectionFactory.h>
-#include <cms/Connection.h>
-#include <cms/Message.h>
-#include <cms/TextMessage.h>
-
-#include <memory>
-
-using namespace cms;
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-using namespace decaf::util;
-using namespace decaf::util::concurrent;
-using namespace activemq;
-using namespace activemq::core;
-using namespace activemq::commands;
-using namespace activemq::exceptions;
-using namespace activemq::test;
-using namespace activemq::test::openwire;
-
-////////////////////////////////////////////////////////////////////////////////
-OpenwireAdvisorysTest::OpenwireAdvisorysTest() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-OpenwireAdvisorysTest::~OpenwireAdvisorysTest() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void OpenwireAdvisorysTest::testConnectionAdvisories() {
-
-    std::auto_ptr<ConnectionFactory> factory(
-        ConnectionFactory::createCMSConnectionFactory( getBrokerURL() ) );
-    CPPUNIT_ASSERT( factory.get() != NULL );
-
-    std::auto_ptr<Connection> connection( factory->createConnection() );
-    CPPUNIT_ASSERT( connection.get() != NULL );
-
-    std::auto_ptr<Session> session( connection->createSession() );
-    CPPUNIT_ASSERT( session.get() != NULL );
-
-    std::auto_ptr<Destination> destination( session->createTopic("ActiveMQ.Advisory.Connection")
);
-    std::auto_ptr<MessageConsumer> consumer( session->createConsumer( destination.get()
) );
-
-    connection->start();
-
-    std::auto_ptr<Connection> otherConnection( factory->createConnection() );
-    CPPUNIT_ASSERT( otherConnection.get() != NULL );
-    otherConnection->start();
-
-    std::auto_ptr<cms::Message> message;
-    int connectionInfoCount = 0;
-
-    do {
-        message.reset( consumer->receive(3000) );
-
-        commands::Message* amqMessage = dynamic_cast<commands::Message*>( message.get()
);
-        if(amqMessage != NULL) {
-            try {
-                Pointer<ConnectionInfo> connectionInfo =
-                    amqMessage->getDataStructure().dynamicCast<commands::ConnectionInfo>();
-
-                if(connectionInfo != NULL) {
-                    connectionInfoCount++;
-                }
-
-            } catch(ClassCastException& ex) {
-            }
-        }
-
-    } while(message.get() != NULL);
-
-    CPPUNIT_ASSERT_EQUAL(2, connectionInfoCount);
-
-    otherConnection->close();
-    connection->close();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-namespace {
-
-    class ConnectionLoadThread : public Thread {
-    private:
-
-        ConnectionFactory* factory;
-        bool noErrors;
-
-    public:
-
-        ConnectionLoadThread(ConnectionFactory* factory) :
-            Thread(), factory(factory), noErrors(true) {
-        }
-
-        virtual ~ConnectionLoadThread() {}
-
-        bool isNoErrors() const {
-            return this->noErrors;
-        }
-
-        virtual void run() {
-
-            try {
-                for (unsigned int i = 0; i < 50; ++i) {
-                    auto_ptr<Connection> connection(factory->createConnection());
-                    connection->start();
-                    auto_ptr<Session> session(connection->createSession(Session::AUTO_ACKNOWLEDGE));
-
-                    for (unsigned int j = 0; j < 100; ++j) {
-                        auto_ptr<Queue> queue(session->createTemporaryQueue());
-                        auto_ptr<MessageProducer> producer(session->createProducer(queue.get()));
-                    }
-
-                    TimeUnit::MILLISECONDS.sleep(20);
-                    connection->close();
-                }
-            } catch(...) {
-                noErrors = false;
-            }
-        }
-    };
-
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void OpenwireAdvisorysTest::testConcurrentTempDestCreation() {
-
-    std::auto_ptr<ConnectionFactory> factory(
-        ConnectionFactory::createCMSConnectionFactory( getBrokerURL() ) );
-
-    ConnectionLoadThread thread1(factory.get());
-    ConnectionLoadThread thread2(factory.get());
-
-    thread1.start();
-    thread2.start();
-
-    thread1.join();
-    thread2.join();
-
-    CPPUNIT_ASSERT(thread1.isNoErrors());
-    CPPUNIT_ASSERT(thread2.isNoErrors());
-}

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.h
b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.h
deleted file mode 100644
index c92ebc3..0000000
--- a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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_OPENWIREADVISORYSTEST_H_
-#define _ACTIVEMQ_TEST_OPENWIRE_OPENWIREADVISORYSTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/util/IntegrationCommon.h>
-
-namespace activemq {
-namespace test {
-namespace openwire {
-
-    class OpenwireAdvisorysTest : public CppUnit::TestFixture {
-
-        CPPUNIT_TEST_SUITE( OpenwireAdvisorysTest );
-        CPPUNIT_TEST( testConnectionAdvisories );
-        CPPUNIT_TEST( testConcurrentTempDestCreation );
-        CPPUNIT_TEST_SUITE_END();
-
-    public:
-
-        OpenwireAdvisorysTest();
-
-        virtual ~OpenwireAdvisorysTest();
-
-        virtual std::string getBrokerURL() const {
-            return activemq::util::IntegrationCommon::getInstance().getOpenwireURL();
-        }
-
-        virtual void setUp() {}
-        virtual void tearDown() {}
-
-        void testConnectionAdvisories();
-        void testConcurrentTempDestCreation();
-
-    };
-
-}}}
-
-#endif /* _ACTIVEMQ_TEST_OPENWIRE_OPENWIREADVISORYSTEST_H_ */

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAsyncSenderTest.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAsyncSenderTest.h
b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAsyncSenderTest.h
index 54a95c9..0f8ad1c 100644
--- a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAsyncSenderTest.h
+++ b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAsyncSenderTest.h
@@ -21,9 +21,9 @@
 #include <activemq/test/AsyncSenderTest.h>
 #include <activemq/util/IntegrationCommon.h>
 
-namespace activemq{
-namespace test{
-namespace openwire{
+namespace activemq {
+namespace test {
+namespace openwire {
 
     class OpenwireAsyncSenderTest : public AsyncSenderTest {
 

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/activemq/test/stomp/StompAdvisoryTest.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/stomp/StompAdvisoryTest.cpp b/activemq-cpp/src/test-integration/activemq/test/stomp/StompAdvisoryTest.cpp
new file mode 100644
index 0000000..2555a41
--- /dev/null
+++ b/activemq-cpp/src/test-integration/activemq/test/stomp/StompAdvisoryTest.cpp
@@ -0,0 +1,66 @@
+/*
+ * 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 <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/core/ActiveMQSession.h>
+#include <activemq/commands/Message.h>
+#include <activemq/commands/ConnectionInfo.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+#include <decaf/lang/exceptions/ClassCastException.h>
+#include <decaf/lang/Pointer.h>
+#include <decaf/lang/Thread.h>
+#include <decaf/lang/Runnable.h>
+#include <decaf/util/concurrent/TimeUnit.h>
+#include <decaf/util/UUID.h>
+
+#include <cms/ConnectionFactory.h>
+#include <cms/Connection.h>
+#include <cms/Session.h>
+#include <cms/MessageConsumer.h>
+#include <cms/MessageProducer.h>
+#include <cms/MessageListener.h>
+#include <cms/ConnectionFactory.h>
+#include <cms/Connection.h>
+#include <cms/Message.h>
+#include <cms/TextMessage.h>
+
+#include <memory>
+#include "StompAdvisoryTest.h"
+
+using namespace cms;
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::commands;
+using namespace activemq::exceptions;
+using namespace activemq::test;
+using namespace activemq::test::stomp;
+
+////////////////////////////////////////////////////////////////////////////////
+StompAdvisoryTest::StompAdvisoryTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+StompAdvisoryTest::~StompAdvisoryTest() {
+}

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/c1c1aecc/activemq-cpp/src/test-integration/activemq/test/stomp/StompAdvisoryTest.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/stomp/StompAdvisoryTest.h b/activemq-cpp/src/test-integration/activemq/test/stomp/StompAdvisoryTest.h
new file mode 100644
index 0000000..ca09455
--- /dev/null
+++ b/activemq-cpp/src/test-integration/activemq/test/stomp/StompAdvisoryTest.h
@@ -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_STOMP_STOMPADVISORYTEST_H_
+#define _ACTIVEMQ_TEST_STOMP_STOMPADVISORYTEST_H_
+
+#include <activemq/test/AdvisoryTest.h>
+#include <activemq/util/IntegrationCommon.h>
+
+namespace activemq {
+namespace test {
+namespace stomp {
+
+    class StompAdvisoryTest : public AdvisoryTest {
+
+        CPPUNIT_TEST_SUITE( StompAdvisoryTest );
+        CPPUNIT_TEST( testTempDestinationCompositeAdvisoryTopic );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        StompAdvisoryTest();
+        virtual ~StompAdvisoryTest();
+
+        virtual std::string getBrokerURL() const {
+            return activemq::util::IntegrationCommon::getInstance().getStompURL();
+        }
+
+    };
+
+}}}
+
+#endif /* _ACTIVEMQ_TEST_STOMP_STOMPADVISORYTEST_H_ */


Mime
View raw message