activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r723877 - in /activemq/activemq-cpp/trunk/src/test-integration/activemq/test: CmsTemplateTest.cpp CmsTemplateTest.h
Date Fri, 05 Dec 2008 21:37:33 GMT
Author: tabish
Date: Fri Dec  5 13:37:32 2008
New Revision: 723877

URL: http://svn.apache.org/viewvc?rev=723877&view=rev
Log:
Update integration test CMSProvider class to attempt to remove the Topics and Queue that it
creates.

Modified:
    activemq/activemq-cpp/trunk/src/test-integration/activemq/test/CmsTemplateTest.cpp
    activemq/activemq-cpp/trunk/src/test-integration/activemq/test/CmsTemplateTest.h

Modified: activemq/activemq-cpp/trunk/src/test-integration/activemq/test/CmsTemplateTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/activemq/test/CmsTemplateTest.cpp?rev=723877&r1=723876&r2=723877&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/activemq/test/CmsTemplateTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/activemq/test/CmsTemplateTest.cpp Fri
Dec  5 13:37:32 2008
@@ -18,26 +18,14 @@
 #include "CmsTemplateTest.h"
 
 #include <activemq/util/IntegrationCommon.h>
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/cmsutil/CmsTemplate.h>
+#include <activemq/cmsutil/MessageCreator.h>
 #include <activemq/exceptions/ActiveMQException.h>
 
+#include <decaf/util/concurrent/CountDownLatch.h>
 #include <decaf/lang/Thread.h>
 
-#include <cms/Connection.h>
-#include <cms/MessageConsumer.h>
-#include <cms/MessageProducer.h>
-#include <cms/MessageListener.h>
-#include <cms/Startable.h>
-#include <cms/Closeable.h>
-#include <cms/MessageListener.h>
-#include <cms/ExceptionListener.h>
-#include <cms/Topic.h>
-#include <cms/Queue.h>
-#include <cms/TemporaryTopic.h>
-#include <cms/TemporaryQueue.h>
-#include <cms/Session.h>
-#include <cms/BytesMessage.h>
-#include <cms/TextMessage.h>
-
 using namespace std;
 using namespace cms;
 using namespace activemq;
@@ -51,6 +39,123 @@
 using namespace decaf::lang;
 
 ////////////////////////////////////////////////////////////////////////////////
+namespace activemq {
+namespace test {
+
+    class TextMessageCreator : public activemq::cmsutil::MessageCreator {
+    private:
+
+        std::string text;
+
+    public:
+
+        TextMessageCreator( const std::string& text) {
+            this->text = text;
+        }
+
+        virtual ~TextMessageCreator() {}
+
+        std::string getText() const {
+            return text;
+        }
+
+        virtual cms::Message* createMessage( cms::Session* session )
+            throw ( cms::CMSException ) {
+
+            return session->createTextMessage(text);
+        }
+    };
+
+    class Sender : public decaf::lang::Runnable {
+    private:
+
+        activemq::core::ActiveMQConnectionFactory cf;
+        activemq::cmsutil::CmsTemplate cmsTemplate;
+        int count;
+
+    public:
+
+        Sender( const std::string& url, bool pubSub, const std::string& destName,
int count ) {
+            cf.setBrokerURL(url);
+            cmsTemplate.setConnectionFactory(&cf);
+            cmsTemplate.setPubSubDomain(pubSub);
+            cmsTemplate.setDefaultDestinationName(destName);
+            cmsTemplate.setDeliveryPersistent(false);
+            this->count = count;
+        }
+
+        virtual ~Sender(){
+        }
+
+        virtual void run() {
+            try {
+
+                // Send a batch of messages.
+                TextMessageCreator tmc("hello world");
+                for( int ix=0; ix<count; ++ix ) {
+                    cmsTemplate.send( &tmc );
+                }
+
+            } catch( cms::CMSException& ex) {
+                ex.printStackTrace();
+            }
+        }
+    };
+
+    class Receiver : public decaf::lang::Runnable {
+    private:
+
+        activemq::core::ActiveMQConnectionFactory cf;
+        activemq::cmsutil::CmsTemplate cmsTemplate;
+        int count;
+        int numReceived;
+        decaf::util::concurrent::CountDownLatch ready;
+
+    public:
+
+        Receiver( const std::string& url, bool pubSub, const std::string& destName,
int count )
+            : ready(1) {
+
+            cf.setBrokerURL(url);
+            cmsTemplate.setConnectionFactory(&cf);
+            cmsTemplate.setPubSubDomain(pubSub);
+            cmsTemplate.setDefaultDestinationName(destName);
+            cmsTemplate.setDeliveryPersistent(false);
+            this->count = count;
+        }
+
+        virtual ~Receiver(){
+        }
+
+        int getNumReceived() const {
+            return numReceived;
+        }
+
+        virtual void waitUntilReady() {
+            ready.await();
+        }
+
+        virtual void run() {
+
+            try {
+                numReceived = 0;
+
+                ready.countDown();
+                // Receive a batch of messages.
+                for( int ix=0; ix<count; ++ix ) {
+                    cms::Message* message = cmsTemplate.receive();
+                    numReceived++;
+                    delete message;
+                }
+
+            } catch( cms::CMSException& ex) {
+                ex.printStackTrace();
+            }
+        }
+    };
+}}
+
+////////////////////////////////////////////////////////////////////////////////
 void CmsTemplateTest::testBasics() {
 
     try {

Modified: activemq/activemq-cpp/trunk/src/test-integration/activemq/test/CmsTemplateTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/activemq/test/CmsTemplateTest.h?rev=723877&r1=723876&r2=723877&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/activemq/test/CmsTemplateTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/activemq/test/CmsTemplateTest.h Fri Dec
 5 13:37:32 2008
@@ -20,119 +20,10 @@
 
 #include <activemq/test/CMSTestFixture.h>
 
-#include <activemq/cmsutil/CmsTemplate.h>
-#include <activemq/cmsutil/MessageCreator.h>
-#include <activemq/core/ActiveMQConnectionFactory.h>
-#include <decaf/util/concurrent/CountDownLatch.h>
-
 namespace activemq{
 namespace test{
 
     class CmsTemplateTest : public CMSTestFixture {
-
-        class TextMessageCreator : public activemq::cmsutil::MessageCreator {
-        private:
-            std::string text;
-        public:
-            TextMessageCreator( const std::string& text) {
-                this->text = text;
-            }
-            virtual ~TextMessageCreator() {}
-
-            std::string getText() const {
-                return text;
-            }
-
-            virtual cms::Message* createMessage(cms::Session* session )
-                        throw (cms::CMSException) {
-                return session->createTextMessage(text);
-            }
-        };
-
-        class Sender : public decaf::lang::Runnable {
-        private:
-
-            activemq::core::ActiveMQConnectionFactory cf;
-            activemq::cmsutil::CmsTemplate cmsTemplate;
-            int count;
-
-        public:
-
-            Sender( const std::string& url, bool pubSub, const std::string& destName,
int count ) {
-                cf.setBrokerURL(url);
-                cmsTemplate.setConnectionFactory(&cf);
-                cmsTemplate.setPubSubDomain(pubSub);
-                cmsTemplate.setDefaultDestinationName(destName);
-                cmsTemplate.setDeliveryPersistent(false);
-                this->count = count;
-            }
-
-            virtual ~Sender(){
-            }
-
-            virtual void run() {
-                try {
-
-                    // Send a batch of messages.
-                    TextMessageCreator tmc("hello world");
-                    for( int ix=0; ix<count; ++ix ) {
-                        cmsTemplate.send(&tmc);
-                    }
-
-                } catch( cms::CMSException& ex) {
-                    ex.printStackTrace();
-                }
-            }
-        };
-
-        class Receiver : public decaf::lang::Runnable {
-        private:
-
-            activemq::core::ActiveMQConnectionFactory cf;
-            activemq::cmsutil::CmsTemplate cmsTemplate;
-            int count;
-            int numReceived;
-            decaf::util::concurrent::CountDownLatch ready;
-
-        public:
-
-            Receiver( const std::string& url, bool pubSub, const std::string& destName,
int count )
-                : ready(1) {
-
-                cf.setBrokerURL(url);
-                cmsTemplate.setConnectionFactory(&cf);
-                cmsTemplate.setPubSubDomain(pubSub);
-                cmsTemplate.setDefaultDestinationName(destName);
-                cmsTemplate.setDeliveryPersistent(false);
-                this->count = count;
-            }
-            virtual ~Receiver(){
-            }
-            int getNumReceived() const {
-                return numReceived;
-            }
-            virtual void waitUntilReady() {
-                ready.await();
-            }
-
-            virtual void run() {
-
-                try {
-                    numReceived = 0;
-
-                    ready.countDown();
-                    // Receive a batch of messages.
-                    for( int ix=0; ix<count; ++ix ) {
-                        cms::Message* message = cmsTemplate.receive();
-                        numReceived++;
-                        delete message;
-                    }
-                } catch( cms::CMSException& ex) {
-                    ex.printStackTrace();
-                }
-            }
-        };
-
     public:
 
         CmsTemplateTest(){}



Mime
View raw message