activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r708728 - in /activemq/activemq-cpp/trunk/src/test-integration/integration: ./ connector/openwire/ connector/stomp/
Date Tue, 28 Oct 2008 23:42:30 GMT
Author: tabish
Date: Tue Oct 28 16:42:29 2008
New Revision: 708728

URL: http://svn.apache.org/viewvc?rev=708728&view=rev
Log:
Make CPPUnit Tests cleanup the TestSupport data quicker so there are less threads and sockets hanging around.

Modified:
    activemq/activemq-cpp/trunk/src/test-integration/integration/TestSupport.cpp
    activemq/activemq-cpp/trunk/src/test-integration/integration/TestSupport.h
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.cpp
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.h
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireDurableTest.h
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireSimpleTest.cpp
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.cpp
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.h
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.cpp
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.h
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/AsyncSenderTest.cpp
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/AsyncSenderTest.h
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/DurableTest.cpp
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/DurableTest.h
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/SimpleTest.cpp
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/TransactionTest.cpp
    activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/TransactionTest.h

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/TestSupport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/TestSupport.cpp?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/TestSupport.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/TestSupport.cpp Tue Oct 28 16:42:29 2008
@@ -43,16 +43,11 @@
 
 using namespace integration;
 
-TestSupport::TestSupport( const string& brokerUrl, cms::Session::AcknowledgeMode ackMode )
- :  connection( NULL ),
-    session( NULL )
-{
-    this->ackMode = ackMode;
-    this->brokerUrl = brokerUrl;
-}
+TestSupport::TestSupport(  )
+ :  connection( NULL ), session( NULL )
+{}
 
-TestSupport::~TestSupport()
-{
+TestSupport::~TestSupport() {
     close();
 }
 
@@ -76,10 +71,12 @@
     connection = NULL;
 }
 
-void TestSupport::initialize(){
+void TestSupport::initialize( const string& brokerUrl, cms::Session::AcknowledgeMode ackMode ){
     try
     {
-        numReceived = 0;
+        this->numReceived = 0;
+        this->ackMode = ackMode;
+        this->brokerUrl = brokerUrl;
 
         // Now create the connection
         connection = createDetachedConnection(

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/TestSupport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/TestSupport.h?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/TestSupport.h (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/TestSupport.h Tue Oct 28 16:42:29 2008
@@ -27,17 +27,21 @@
 #include <cms/ExceptionListener.h>
 #include <cms/MessageListener.h>
 
+#include <integration/IntegrationCommon.h>
+
 namespace integration{
 
     class TestSupport : public cms::ExceptionListener, public cms::MessageListener
     {
     public:
 
-      TestSupport( const std::string& brokerUrl,
-                     cms::Session::AcknowledgeMode ackMode = cms::Session::AUTO_ACKNOWLEDGE );
+      TestSupport();
       virtual ~TestSupport();
 
-        virtual void initialize();
+        virtual void initialize(
+            const std::string& brokerUrl,
+            cms::Session::AcknowledgeMode ackMode = cms::Session::AUTO_ACKNOWLEDGE );
+
         virtual void close();
 
         virtual decaf::util::concurrent::Mutex& getMutex() {

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.cpp?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.cpp Tue Oct 28 16:42:29 2008
@@ -73,16 +73,11 @@
 using namespace integration::connector::openwire;
 
 ////////////////////////////////////////////////////////////////////////////////
-OpenwireAsyncSenderTest::OpenwireAsyncSenderTest()
-:
-    testSupport( IntegrationCommon::getInstance().getOpenwireURL() + "&transport.useAsyncSend=true")
-{
-    testSupport.initialize();
+OpenwireAsyncSenderTest::OpenwireAsyncSenderTest() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-OpenwireAsyncSenderTest::~OpenwireAsyncSenderTest()
-{
+OpenwireAsyncSenderTest::~OpenwireAsyncSenderTest() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -120,26 +115,26 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
-        cms::Topic* topic = testSupport.getSession()->createTopic("mytopic");
+        cms::Session* session = testSupport->getSession();
+        cms::Topic* topic = testSupport->getSession()->createTopic("mytopic");
         cms::MessageConsumer* consumer =
             session->createConsumer( topic );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer =
             session->createProducer( topic );
 
         // Send some text messages
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Send some bytes messages.
-        testSupport.produceBytesMessages(
+        testSupport->produceBytesMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Wait for the messages to get here
-        testSupport.waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+        testSupport->waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.h?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.h Tue Oct 28 16:42:29 2008
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
+
 #ifndef _INTEGRATION_CONNECTOR_OPENWIRE_OPENWIREASYNCSENDERTEST_H_
 #define _INTEGRATION_CONNECTOR_OPENWIRE_OPENWIREASYNCSENDERTEST_H_
 
@@ -28,21 +28,27 @@
 namespace openwire{
 
     class OpenwireAsyncSenderTest : public CppUnit::TestFixture {
-        
+
         CPPUNIT_TEST_SUITE( OpenwireAsyncSenderTest );
         CPPUNIT_TEST( test1 );
         CPPUNIT_TEST( test2 );
         CPPUNIT_TEST_SUITE_END();
 
     private:
-    
-        TestSupport testSupport;
-        
+
+        TestSupport* testSupport;
+
     public:
-    
+
         OpenwireAsyncSenderTest();
         virtual ~OpenwireAsyncSenderTest();
 
+        virtual void setUp() {
+            testSupport = new TestSupport;
+            testSupport->initialize(IntegrationCommon::getInstance().getOpenwireURL() + "&transport.useAsyncSend=true");
+        };
+        virtual void tearDown() { delete testSupport; };
+
         virtual void test1();
         virtual void test2();
 

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp Tue Oct 28 16:42:29 2008
@@ -71,16 +71,9 @@
 using namespace integration;
 using namespace integration::connector::openwire;
 
-OpenwireDurableTest::OpenwireDurableTest()
-:
-    testSupport( IntegrationCommon::getInstance().getOpenwireURL() )
-{
-    testSupport.initialize();
+OpenwireDurableTest::OpenwireDurableTest() {
 }
 
-OpenwireDurableTest::~OpenwireDurableTest()
-{}
-
 void OpenwireDurableTest::test()
 {
     try
@@ -97,23 +90,23 @@
         std::string subName = UUID::randomUUID().toString();
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic( UUID::randomUUID().toString() );
         cms::MessageConsumer* consumer =
             session->createDurableConsumer( topic, subName, "" );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer =
             session->createProducer( topic );
 
         unsigned int sent;
 
         // Send some text messages
-        sent = testSupport.produceTextMessages( *producer, 3 );
+        sent = testSupport->produceTextMessages( *producer, 3 );
 
         // Wait for all messages
-        testSupport.waitForMessages( sent );
+        testSupport->waitForMessages( sent );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
 
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
@@ -125,18 +118,18 @@
         delete consumer;
 
         // Send some text messages
-        sent += testSupport.produceTextMessages( *producer, 3 );
+        sent += testSupport->produceTextMessages( *producer, 3 );
 
         consumer = session->createDurableConsumer( topic, subName, "" );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
 
         // Send some text messages
-        sent += testSupport.produceTextMessages( *producer, 3 );
+        sent += testSupport->produceTextMessages( *producer, 3 );
 
         // Wait for all remaining messages
-        testSupport.waitForMessages( sent );
+        testSupport->waitForMessages( sent );
 
-        numReceived = testSupport.getNumReceived();
+        numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireDurableTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireDurableTest.h?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireDurableTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireDurableTest.h Tue Oct 28 16:42:29 2008
@@ -34,16 +34,22 @@
         CPPUNIT_TEST_SUITE_END();
 
     private:
-    
-        TestSupport testSupport;
-        
+
+        TestSupport* testSupport;
+
     public:
 
-    	OpenwireDurableTest();
-    	virtual ~OpenwireDurableTest();
+        OpenwireDurableTest();
+        virtual ~OpenwireDurableTest() {}
+
+        virtual void setUp() {
+            testSupport = new TestSupport;
+            testSupport->initialize( IntegrationCommon::getInstance().getOpenwireURL() );
+        };
+        virtual void tearDown() { delete testSupport; };
 
         virtual void test();
-        
+
     };
 
 }}}

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireSimpleTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireSimpleTest.cpp?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireSimpleTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireSimpleTest.cpp Tue Oct 28 16:42:29 2008
@@ -83,8 +83,8 @@
 
     try {
 
-        TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL());
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize( IntegrationCommon::getInstance().getOpenwireURL() );
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -96,26 +96,26 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic("mytopic");
         cms::MessageConsumer* consumer =
             session->createConsumer( topic );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer =
             session->createProducer( topic );
 
         // Send some text messages
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Send some bytes messages.
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Wait for the messages to get here
-        testSupport.waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+        testSupport->waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }
@@ -128,6 +128,7 @@
         delete producer;
         delete consumer;
         delete topic;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }
@@ -136,8 +137,8 @@
 {
     try
     {
-        TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::CLIENT_ACKNOWLEDGE );
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize( IntegrationCommon::getInstance().getOpenwireURL() );
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -149,26 +150,26 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic("mytopic");
         cms::MessageConsumer* consumer =
             session->createConsumer( topic );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer =
             session->createProducer( topic );
 
         // Send some text messages
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Send some bytes messages.
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Wait for the messages to get here
-        testSupport.waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+        testSupport->waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }
@@ -181,6 +182,7 @@
         delete producer;
         delete consumer;
         delete topic;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }
@@ -189,8 +191,8 @@
 {
     try
     {
-        TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::CLIENT_ACKNOWLEDGE );
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize( IntegrationCommon::getInstance().getOpenwireURL() );
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -202,10 +204,10 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic(UUID::randomUUID().toString());
         cms::MessageConsumer* consumer =  session->createConsumer( topic );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer = session->createProducer( NULL );
 
         cms::TextMessage* textMsg = session->createTextMessage();
@@ -216,9 +218,9 @@
         delete textMsg;
 
         // Wait for the messages to get here
-        testSupport.waitForMessages( 1 );
+        testSupport->waitForMessages( 1 );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }
@@ -230,6 +232,7 @@
         delete producer;
         delete consumer;
         delete topic;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }
@@ -238,8 +241,8 @@
 {
     try
     {
-        TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::CLIENT_ACKNOWLEDGE );
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize( IntegrationCommon::getInstance().getOpenwireURL() );
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -251,7 +254,7 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic(UUID::randomUUID().toString());
         cms::MessageConsumer* consumer = session->createConsumer( topic );
         cms::MessageProducer* producer = session->createProducer( topic );
@@ -273,6 +276,7 @@
         delete producer;
         delete consumer;
         delete topic;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }
@@ -490,8 +494,8 @@
 void OpenwireSimpleTest::testWithZeroConsumerPrefetch() {
 
     try {
-        TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::CLIENT_ACKNOWLEDGE );
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize( IntegrationCommon::getInstance().getOpenwireURL() );
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -503,7 +507,7 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Queue* queue = session->createQueue(
             UUID::randomUUID().toString() + "?consumer.prefetchSize=0" );
         cms::MessageConsumer* consumer = session->createConsumer( queue );
@@ -527,6 +531,7 @@
         delete producer;
         delete consumer;
         delete queue;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }
@@ -534,8 +539,8 @@
 void OpenwireSimpleTest::testMapMessageSend() {
 
     try {
-        TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::CLIENT_ACKNOWLEDGE );
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize( IntegrationCommon::getInstance().getOpenwireURL() );
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -547,7 +552,7 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Queue* queue = session->createQueue( UUID::randomUUID().toString() );
         cms::MessageConsumer* consumer = session->createConsumer( queue );
         cms::MessageProducer* producer = session->createProducer( queue );
@@ -612,6 +617,7 @@
         delete producer;
         delete consumer;
         delete queue;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }
@@ -619,8 +625,8 @@
 void OpenwireSimpleTest::testMapMessageSend2() {
 
     try {
-        TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::CLIENT_ACKNOWLEDGE );
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize( IntegrationCommon::getInstance().getOpenwireURL() );
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -632,7 +638,7 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic( UUID::randomUUID().toString() );
         cms::MessageConsumer* consumer = session->createConsumer( topic );
         cms::MessageProducer* producer = session->createProducer( topic );
@@ -697,6 +703,7 @@
         delete producer;
         delete consumer;
         delete topic;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.cpp?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.cpp Tue Oct 28 16:42:29 2008
@@ -75,10 +75,7 @@
 using namespace integration::connector::openwire;
 
 ///////////////////////////////////////////////////////////////////////////////
-OpenwireTempDestinationTest::OpenwireTempDestinationTest()
-  : testSupport( IntegrationCommon::getInstance().getOpenwireURL() )
-{
-    testSupport.initialize();
+OpenwireTempDestinationTest::OpenwireTempDestinationTest() {
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -100,15 +97,15 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
 
         cms::Destination* requestTopic = session->createTopic( UUID::randomUUID().toString() );
         cms::Destination* responseTopic = session->createTemporaryTopic();
 
-        Consumer* requestConsumer = new Consumer( testSupport.getConnection(),
+        Consumer* requestConsumer = new Consumer( testSupport->getConnection(),
                                                   session,
                                                   requestTopic );
-        Consumer* responseConsumer = new Consumer( testSupport.getConnection(),
+        Consumer* responseConsumer = new Consumer( testSupport->getConnection(),
                                                    session,
                                                    responseTopic );
 
@@ -123,7 +120,7 @@
             session->createProducer( requestTopic );
 
         // Send some bytes messages.
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount, responseTopic );
 
         // Let the request consumer get all its messages

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.h?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.h Tue Oct 28 16:42:29 2008
@@ -37,7 +37,7 @@
 
     private:
 
-        TestSupport testSupport;
+        TestSupport* testSupport;
 
     public:
 
@@ -46,6 +46,12 @@
 
         virtual void test();
 
+        virtual void setUp() {
+            testSupport = new TestSupport;
+            testSupport->initialize(IntegrationCommon::getInstance().getOpenwireURL());
+        };
+        virtual void tearDown() { delete testSupport; };
+
     protected:
 
         class Consumer : public cms::MessageListener,

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.cpp?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.cpp Tue Oct 28 16:42:29 2008
@@ -72,11 +72,7 @@
 using namespace integration;
 using namespace integration::connector::openwire;
 
-OpenwireTransactionTest::OpenwireTransactionTest()
-:
-    testSupport( IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::SESSION_TRANSACTED )
-{
-    testSupport.initialize();
+OpenwireTransactionTest::OpenwireTransactionTest() {
 }
 
 OpenwireTransactionTest::~OpenwireTransactionTest()
@@ -96,48 +92,48 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic("mytopic");
         cms::MessageConsumer* consumer =
             session->createConsumer( topic );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer =
             session->createProducer( topic );
 
         // Send some text messages
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         session->commit();
 
         // Send some bytes messages.
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         session->commit();
 
         // Wait till we get all the messages
-        testSupport.waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+        testSupport->waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }
         CPPUNIT_ASSERT(
             numReceived == IntegrationCommon::defaultMsgCount * 2 );
 
-        testSupport.setNumReceived( 0 );
+        testSupport->setNumReceived( 0 );
 
         // Send some text messages
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         session->rollback();
 
         // Wait till we get all the messages
-        testSupport.waitForMessages( IntegrationCommon::defaultMsgCount );
+        testSupport->waitForMessages( IntegrationCommon::defaultMsgCount );
 
-        numReceived = testSupport.getNumReceived();
+        numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.h?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.h Tue Oct 28 16:42:29 2008
@@ -34,16 +34,22 @@
         CPPUNIT_TEST_SUITE_END();
 
     private:
-    
-        TestSupport testSupport;
-        
+
+        TestSupport* testSupport;
+
     public:
 
-    	OpenwireTransactionTest();
-    	virtual ~OpenwireTransactionTest();
+        OpenwireTransactionTest();
+        virtual ~OpenwireTransactionTest();
+
+        virtual void setUp() {
+            testSupport = new TestSupport;
+            testSupport->initialize(IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::SESSION_TRANSACTED);
+        };
+        virtual void tearDown() { delete testSupport; };
 
         virtual void test();
-        
+
     };
 
 }}}

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/AsyncSenderTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/AsyncSenderTest.cpp?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/AsyncSenderTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/AsyncSenderTest.cpp Tue Oct 28 16:42:29 2008
@@ -72,10 +72,7 @@
 using namespace integration::connector::stomp;
 
 ////////////////////////////////////////////////////////////////////////////////
-AsyncSenderTest::AsyncSenderTest()
-:  testSupport( IntegrationCommon::getInstance().getStompURL() + "&transport.useAsyncSend=true")
-{
-    testSupport.initialize();
+AsyncSenderTest::AsyncSenderTest() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -98,26 +95,26 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
-        cms::Topic* topic = testSupport.getSession()->createTopic("mytopic");
+        cms::Session* session = testSupport->getSession();
+        cms::Topic* topic = testSupport->getSession()->createTopic("mytopic");
         cms::MessageConsumer* consumer =
             session->createConsumer( topic );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer =
             session->createProducer( topic );
 
         // Send some text messages
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Send some bytes messages.
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Wait for the messages to get here
-        testSupport.waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+        testSupport->waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/AsyncSenderTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/AsyncSenderTest.h?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/AsyncSenderTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/AsyncSenderTest.h Tue Oct 28 16:42:29 2008
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
+
 #ifndef _INTEGRATION_CONNECTOR_STOMP_ASYNCSENDERTEST_H_
 #define _INTEGRATION_CONNECTOR_STOMP_ASYNCSENDERTEST_H_
 
@@ -28,20 +28,26 @@
 namespace stomp{
 
     class AsyncSenderTest : public CppUnit::TestFixture {
-        
+
         CPPUNIT_TEST_SUITE( AsyncSenderTest );
         CPPUNIT_TEST( test );
         CPPUNIT_TEST_SUITE_END();
 
     private:
-    
-        TestSupport testSupport;
-        
+
+        TestSupport* testSupport;
+
     public:
-    
+
         AsyncSenderTest();
         virtual ~AsyncSenderTest();
 
+        virtual void setUp() {
+            testSupport = new TestSupport;
+            testSupport->initialize( IntegrationCommon::getInstance().getStompURL() + "&transport.useAsyncSend=true" );
+        };
+        virtual void tearDown() { delete testSupport; };
+
         virtual void test();
 
     };

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/DurableTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/DurableTest.cpp?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/DurableTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/DurableTest.cpp Tue Oct 28 16:42:29 2008
@@ -73,11 +73,7 @@
 using namespace integration;
 using namespace integration::connector::stomp;
 
-DurableTest::DurableTest()
-:
-    testSupport( IntegrationCommon::getInstance().getStompURL() )
-{
-    testSupport.initialize();
+DurableTest::DurableTest() {
 }
 
 DurableTest::~DurableTest()
@@ -99,23 +95,23 @@
         std::string subName = UUID::randomUUID().toString();
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic(UUID::randomUUID().toString());
         cms::MessageConsumer* consumer =
             session->createDurableConsumer( topic, subName, "" );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer =
             session->createProducer( topic );
 
         unsigned int sent;
 
         // Send some text messages
-        sent = testSupport.produceTextMessages( *producer, 3 );
+        sent = testSupport->produceTextMessages( *producer, 3 );
 
         // Wait for all messages
-        testSupport.waitForMessages( sent );
+        testSupport->waitForMessages( sent );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
 
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
@@ -127,18 +123,18 @@
         delete consumer;
 
         // Send some text messages
-        sent += testSupport.produceTextMessages( *producer, 3 );
+        sent += testSupport->produceTextMessages( *producer, 3 );
 
         consumer = session->createDurableConsumer( topic, subName, "" );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
 
         // Send some text messages
-        sent += testSupport.produceTextMessages( *producer, 3 );
+        sent += testSupport->produceTextMessages( *producer, 3 );
 
         // Wait for all remaining messages
-        testSupport.waitForMessages( sent );
+        testSupport->waitForMessages( sent );
 
-        numReceived = testSupport.getNumReceived();
+        numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/DurableTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/DurableTest.h?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/DurableTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/DurableTest.h Tue Oct 28 16:42:29 2008
@@ -34,16 +34,22 @@
         CPPUNIT_TEST_SUITE_END();
 
     private:
-    
-        TestSupport testSupport;
-        
+
+        TestSupport* testSupport;
+
     public:
 
-    	DurableTest();
-    	virtual ~DurableTest();
+        DurableTest();
+        virtual ~DurableTest();
+
+        virtual void setUp() {
+            testSupport = new TestSupport;
+            testSupport->initialize( IntegrationCommon::getInstance().getStompURL() );
+        };
+        virtual void tearDown() { delete testSupport; };
 
         virtual void test();
-        
+
     };
 
 }}}

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/SimpleTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/SimpleTest.cpp?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/SimpleTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/SimpleTest.cpp Tue Oct 28 16:42:29 2008
@@ -81,12 +81,12 @@
 {
 }
 
-void SimpleTest::testAutoAck()
-{
-    try
-    {
-        TestSupport testSupport( IntegrationCommon::getInstance().getStompURL() );
-        testSupport.initialize();
+void SimpleTest::testAutoAck() {
+
+    try {
+
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize(IntegrationCommon::getInstance().getStompURL());
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -98,26 +98,26 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic("mytopic");
         cms::MessageConsumer* consumer =
             session->createConsumer( topic );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer =
             session->createProducer( topic );
 
         // Send some text messages
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Send some bytes messages.
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Wait for the messages to get here
-        testSupport.waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+        testSupport->waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }
@@ -130,6 +130,7 @@
         delete producer;
         delete consumer;
         delete topic;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }
@@ -138,8 +139,8 @@
 {
     try
     {
-        TestSupport testSupport(IntegrationCommon::getInstance().getStompURL(), cms::Session::CLIENT_ACKNOWLEDGE );
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize(IntegrationCommon::getInstance().getStompURL());
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -151,26 +152,26 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic("mytopic");
         cms::MessageConsumer* consumer =
             session->createConsumer( topic );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer =
             session->createProducer( topic );
 
         // Send some text messages
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Send some bytes messages.
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         // Wait for the messages to get here
-        testSupport.waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+        testSupport->waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }
@@ -183,6 +184,7 @@
         delete producer;
         delete consumer;
         delete topic;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }
@@ -191,8 +193,8 @@
 {
     try
     {
-        TestSupport testSupport(IntegrationCommon::getInstance().getStompURL(), cms::Session::CLIENT_ACKNOWLEDGE );
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize(IntegrationCommon::getInstance().getStompURL());
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -204,10 +206,10 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic(UUID::randomUUID().toString());
         cms::MessageConsumer* consumer =  session->createConsumer( topic );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer = session->createProducer( NULL );
 
         cms::TextMessage* textMsg = session->createTextMessage();
@@ -218,9 +220,9 @@
         delete textMsg;
 
         // Wait for the messages to get here
-        testSupport.waitForMessages( 1 );
+        testSupport->waitForMessages( 1 );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }
@@ -232,6 +234,7 @@
         delete producer;
         delete consumer;
         delete topic;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }
@@ -240,8 +243,8 @@
 {
     try
     {
-        TestSupport testSupport(IntegrationCommon::getInstance().getStompURL(), cms::Session::AUTO_ACKNOWLEDGE );
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize(IntegrationCommon::getInstance().getStompURL());
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -253,7 +256,7 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic(UUID::randomUUID().toString());
         cms::MessageConsumer* consumer = session->createConsumer( topic );
         cms::MessageProducer* producer = session->createProducer( topic );
@@ -275,6 +278,7 @@
         delete producer;
         delete consumer;
         delete topic;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }
@@ -283,8 +287,8 @@
 {
     try
     {
-        TestSupport testSupport(IntegrationCommon::getInstance().getStompURL(), cms::Session::CLIENT_ACKNOWLEDGE );
-        testSupport.initialize();
+        TestSupport* testSupport = new TestSupport;
+        testSupport->initialize(IntegrationCommon::getInstance().getStompURL());
 
         if( IntegrationCommon::debug ) {
             cout << "Starting activemqcms test (sending "
@@ -296,7 +300,7 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic(UUID::randomUUID().toString());
         cms::MessageConsumer* consumer = session->createConsumer( topic );
         cms::MessageProducer* producer = session->createProducer( topic );
@@ -319,6 +323,7 @@
         delete producer;
         delete consumer;
         delete topic;
+        delete testSupport;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
 }

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/TransactionTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/TransactionTest.cpp?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/TransactionTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/TransactionTest.cpp Tue Oct 28 16:42:29 2008
@@ -72,11 +72,7 @@
 using namespace integration;
 using namespace integration::connector::stomp;
 
-TransactionTest::TransactionTest()
-:
-    testSupport( IntegrationCommon::getInstance().getStompURL(), cms::Session::SESSION_TRANSACTED )
-{
-    testSupport.initialize();
+TransactionTest::TransactionTest() {
 }
 
 TransactionTest::~TransactionTest()
@@ -96,48 +92,48 @@
         }
 
         // Create CMS Object for Comms
-        cms::Session* session = testSupport.getSession();
+        cms::Session* session = testSupport->getSession();
         cms::Topic* topic = session->createTopic("mytopic");
         cms::MessageConsumer* consumer =
             session->createConsumer( topic );
-        consumer->setMessageListener( &testSupport );
+        consumer->setMessageListener( testSupport );
         cms::MessageProducer* producer =
             session->createProducer( topic );
 
         // Send some text messages
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         session->commit();
 
         // Send some bytes messages.
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         session->commit();
 
         // Wait till we get all the messages
-        testSupport.waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
+        testSupport->waitForMessages( IntegrationCommon::defaultMsgCount * 2 );
 
-        unsigned int numReceived = testSupport.getNumReceived();
+        unsigned int numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }
         CPPUNIT_ASSERT(
             numReceived == IntegrationCommon::defaultMsgCount * 2 );
 
-        testSupport.setNumReceived( 0 );
+        testSupport->setNumReceived( 0 );
 
         // Send some text messages
-        testSupport.produceTextMessages(
+        testSupport->produceTextMessages(
             *producer, IntegrationCommon::defaultMsgCount );
 
         session->rollback();
 
         // Wait till we get all the messages
-        testSupport.waitForMessages( IntegrationCommon::defaultMsgCount );
+        testSupport->waitForMessages( IntegrationCommon::defaultMsgCount );
 
-        numReceived = testSupport.getNumReceived();
+        numReceived = testSupport->getNumReceived();
         if( IntegrationCommon::debug ) {
             printf("received: %d\n", numReceived );
         }

Modified: activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/TransactionTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/TransactionTest.h?rev=708728&r1=708727&r2=708728&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/TransactionTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/integration/connector/stomp/TransactionTest.h Tue Oct 28 16:42:29 2008
@@ -34,16 +34,22 @@
         CPPUNIT_TEST_SUITE_END();
 
     private:
-    
-        TestSupport testSupport;
-        
+
+        TestSupport* testSupport;
+
     public:
 
-    	TransactionTest();
-    	virtual ~TransactionTest();
+        TransactionTest();
+        virtual ~TransactionTest();
+
+        virtual void setUp() {
+            testSupport = new TestSupport;
+            testSupport->initialize( IntegrationCommon::getInstance().getStompURL(), cms::Session::SESSION_TRANSACTED );
+        };
+        virtual void tearDown() { delete testSupport; };
 
         virtual void test();
-        
+
     };
 
 }}}



Mime
View raw message