activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1088662 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration: Makefile.am TestRegistry.cpp activemq/test/openwire/OpenwireAdvisorysTest.cpp activemq/test/openwire/OpenwireAdvisorysTest.h
Date Mon, 04 Apr 2011 15:27:59 GMT
Author: tabish
Date: Mon Apr  4 15:27:58 2011
New Revision: 1088662

URL: http://svn.apache.org/viewvc?rev=1088662&view=rev
Log:
Add new test case to try and reproduce: https://issues.apache.org/jira/browse/AMQCPP-360

Added:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.cpp
  (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.h
  (with props)
Modified:
    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/test-integration/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/Makefile.am?rev=1088662&r1=1088661&r2=1088662&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 Mon Apr  4 15:27:58
2011
@@ -31,6 +31,7 @@ cc_sources = \
     activemq/test/SlowListenerTest.cpp \
     activemq/test/TransactionTest.cpp \
     activemq/test/VirtualTopicTest.cpp \
+    activemq/test/openwire/OpenwireAdvisorysTest.cpp \
     activemq/test/openwire/OpenwireAsyncSenderTest.cpp \
     activemq/test/openwire/OpenwireClientAckTest.cpp \
     activemq/test/openwire/OpenwireCmsTemplateTest.cpp \
@@ -81,6 +82,7 @@ h_sources = \
     activemq/test/SlowListenerTest.h \
     activemq/test/TransactionTest.h \
     activemq/test/VirtualTopicTest.h \
+    activemq/test/openwire/OpenwireAdvisorysTest.h \
     activemq/test/openwire/OpenwireAsyncSenderTest.h \
     activemq/test/openwire/OpenwireClientAckTest.h \
     activemq/test/openwire/OpenwireCmsTemplateTest.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=1088662&r1=1088661&r2=1088662&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 Mon Apr
 4 15:27:58 2011
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+#include "activemq/test/openwire/OpenwireAdvisorysTest.h"
 #include "activemq/test/openwire/OpenwireAsyncSenderTest.h"
 #include "activemq/test/openwire/OpenwireClientAckTest.h"
 #include "activemq/test/openwire/OpenwireCmsTemplateTest.h"
@@ -45,6 +46,7 @@
 #include "activemq/test/stomp/StompJmsMessageGroupsTest.h"
 
 // Openwire Tests
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireAdvisorysTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireAsyncSenderTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireClientAckTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::test::openwire::OpenwireCmsTemplateTest );

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.cpp?rev=1088662&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.cpp
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.cpp
Mon Apr  4 15:27:58 2011
@@ -0,0 +1,114 @@
+/*
+ * 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/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 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 );
+
+    std::auto_ptr<cms::Message> message;
+    int connectionInfoCount = 0;
+
+    do {
+        message.reset( consumer->receive(2000) );
+
+        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();
+}
+

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

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.h?rev=1088662&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.h
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireAdvisorysTest.h
Mon Apr  4 15:27:58 2011
@@ -0,0 +1,55 @@
+/*
+ * 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_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();
+
+    };
+
+}}}
+
+#endif /* _ACTIVEMQ_TEST_OPENWIRE_OPENWIREADVISORYSTEST_H_ */

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



Mime
View raw message