From commits-return-5893-apmail-activemq-commits-archive=activemq.apache.org@activemq.apache.org Mon Apr 30 13:22:27 2007 Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 43392 invoked from network); 30 Apr 2007 13:22:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Apr 2007 13:22:27 -0000 Received: (qmail 71360 invoked by uid 500); 30 Apr 2007 13:22:33 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 71338 invoked by uid 500); 30 Apr 2007 13:22:33 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 71329 invoked by uid 99); 30 Apr 2007 13:22:33 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Apr 2007 06:22:33 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Apr 2007 06:22:25 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id BF5731A9838; Mon, 30 Apr 2007 06:22:04 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r533743 - in /activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration: ./ connector/openwire/ connector/stomp/ Date: Mon, 30 Apr 2007 13:22:04 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070430132204.BF5731A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Mon Apr 30 06:22:02 2007 New Revision: 533743 URL: http://svn.apache.org/viewvc?view=rev&rev=533743 Log: Merging in fixes for 2.0.1 Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/IntegrationCommon.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/IntegrationCommon.h activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.h activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireExpirationTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSimpleRollbackTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSimpleTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSlowListenerTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/AsyncSenderTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/DurableTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/ExpirationTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleRollbackTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleTest.cpp activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleTest.h activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/TransactionTest.cpp Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/IntegrationCommon.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/IntegrationCommon.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/IntegrationCommon.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/IntegrationCommon.cpp Mon Apr 30 06:22:02 2007 @@ -19,6 +19,22 @@ using namespace integration; -const int IntegrationCommon::defaultDelay = 5; -const unsigned int IntegrationCommon::defaultMsgCount = 1000; +//////////////////////////////////////////////////////////////////////////////// +const int IntegrationCommon::defaultDelay = 5; +const unsigned int IntegrationCommon::defaultMsgCount = 1000; bool IntegrationCommon::debug = false; + +//////////////////////////////////////////////////////////////////////////////// +IntegrationCommon::IntegrationCommon() { + + this->urlCommon = "tcp://localhost:"; + this->stompURL = this->urlCommon + "61613?wireFormat=stomp"; + this->openwireURL = this->urlCommon + "61616?wireFormat=openwire"; +} + +//////////////////////////////////////////////////////////////////////////////// +IntegrationCommon& IntegrationCommon::getInstance() { + static IntegrationCommon instance; + + return instance; +} Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/IntegrationCommon.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/IntegrationCommon.h?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/IntegrationCommon.h (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/IntegrationCommon.h Mon Apr 30 06:22:02 2007 @@ -25,14 +25,35 @@ class IntegrationCommon { public: - - virtual ~IntegrationCommon(); - - static const int defaultDelay; + + virtual ~IntegrationCommon() {} + + virtual std::string getStompURL() const { + return this->stompURL; + } + + virtual std::string getOpenwireURL() const { + return this->openwireURL; + } + + public: // Statics + + static const int defaultDelay; static const unsigned int defaultMsgCount; - static bool debug; - + + static IntegrationCommon& getInstance(); + + protected: + + IntegrationCommon(); + + private: + + std::string urlCommon; + std::string stompURL; + std::string openwireURL; + }; } Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.cpp Mon Apr 30 06:22:02 2007 @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + #include "OpenwireAsyncSenderTest.h" #include @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -74,7 +75,7 @@ //////////////////////////////////////////////////////////////////////////////// OpenwireAsyncSenderTest::OpenwireAsyncSenderTest() : - testSupport("tcp://localhost:61616?wireFormat=openwire&useAsyncSend=true") + testSupport( IntegrationCommon::getInstance().getOpenwireURL() + "&transport.useAsyncSend=true") { testSupport.initialize(); } @@ -85,7 +86,27 @@ } //////////////////////////////////////////////////////////////////////////////// -void OpenwireAsyncSenderTest::test() +void OpenwireAsyncSenderTest::test1() +{ + try{ + std::string brokerURI = + IntegrationCommon::getInstance().getOpenwireURL() + + "&transport.useAsyncSend=true"; + ActiveMQConnectionFactory* connectionFactory = + new ActiveMQConnectionFactory(brokerURI); + cms::Connection* connection = connectionFactory->createConnection(); + delete connectionFactory; + connection->start(); + connection->stop(); + delete connection; + CPPUNIT_ASSERT( true ); + } catch(...) { + CPPUNIT_ASSERT( false ); + } +} + +//////////////////////////////////////////////////////////////////////////////// +void OpenwireAsyncSenderTest::test2() { try { @@ -93,42 +114,42 @@ cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = testSupport.getSession()->createTopic("mytopic"); - cms::MessageConsumer* consumer = - session->createConsumer( topic ); + cms::MessageConsumer* consumer = + session->createConsumer( topic ); consumer->setMessageListener( &testSupport ); - cms::MessageProducer* producer = + 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 ); - + unsigned int numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount * 2 ); if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.h?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.h (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireAsyncSenderTest.h Mon Apr 30 06:22:02 2007 @@ -30,7 +30,8 @@ class OpenwireAsyncSenderTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( OpenwireAsyncSenderTest ); - CPPUNIT_TEST( test ); + CPPUNIT_TEST( test1 ); + CPPUNIT_TEST( test2 ); CPPUNIT_TEST_SUITE_END(); private: @@ -42,7 +43,8 @@ OpenwireAsyncSenderTest(); virtual ~OpenwireAsyncSenderTest(); - virtual void test(); + virtual void test1(); + virtual void test2(); }; Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireDurableTest.cpp Mon Apr 30 06:22:02 2007 @@ -73,7 +73,7 @@ OpenwireDurableTest::OpenwireDurableTest() : - testSupport("tcp://localhost:61616?wireFormat=openwire") + testSupport( IntegrationCommon::getInstance().getOpenwireURL() ) { testSupport.initialize(); } @@ -89,36 +89,36 @@ cout << "Starting activemqcms durable test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + std::string subName = Guid().createGUID(); // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic(Guid::createGUIDString()); - cms::MessageConsumer* consumer = - session->createDurableConsumer( topic, subName, "" ); + cms::MessageConsumer* consumer = + session->createDurableConsumer( topic, subName, "" ); consumer->setMessageListener( &testSupport ); - cms::MessageProducer* producer = + cms::MessageProducer* producer = session->createProducer( topic ); unsigned int sent; // Send some text messages sent = testSupport.produceTextMessages( *producer, 3 ); - + // Wait for all messages testSupport.waitForMessages( sent ); unsigned int numReceived = testSupport.getNumReceived(); - + if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - + CPPUNIT_ASSERT_EQUAL( sent, numReceived ); // Nuke the consumer @@ -127,7 +127,7 @@ // Send some text messages sent += testSupport.produceTextMessages( *producer, 3 ); - consumer = session->createDurableConsumer( topic, subName, "" ); + consumer = session->createDurableConsumer( topic, subName, "" ); consumer->setMessageListener( &testSupport ); // Send some text messages @@ -135,7 +135,7 @@ // Wait for all remaining messages testSupport.waitForMessages( sent ); - + numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); @@ -145,7 +145,7 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireExpirationTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireExpirationTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireExpirationTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireExpirationTest.cpp Mon Apr 30 06:22:02 2007 @@ -17,6 +17,7 @@ #include "OpenwireExpirationTest.h" +#include #include #include @@ -75,8 +76,6 @@ using namespace integration; using namespace integration::connector::openwire; - - OpenwireExpirationTest::Producer::Producer( string topic, int numMessages, long long timeToLive ){ connection = NULL; session = NULL; @@ -103,7 +102,9 @@ void OpenwireExpirationTest::Producer::run() { try { // Create a ConnectionFactory - ActiveMQConnectionFactory* connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61613?wireFormat=stomp"); + ActiveMQConnectionFactory* connectionFactory = + new ActiveMQConnectionFactory( + IntegrationCommon::getInstance().getStompURL() ); // Create a Connection connection = connectionFactory->createConnection(); @@ -199,7 +200,7 @@ // Create a Connection connection = ActiveMQConnectionFactory::createConnection( - "tcp://localhost:61613?wireFormat=stomp", user, passwd, sID ); + IntegrationCommon::getInstance().getStompURL(), user, passwd, sID ); connection->start(); // Create a Session Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSimpleRollbackTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSimpleRollbackTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSimpleRollbackTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSimpleRollbackTest.cpp Mon Apr 30 06:22:02 2007 @@ -82,7 +82,7 @@ { try { - string url = "tcp://localhost:61616?wireFormat=openwire"; + string url = IntegrationCommon::getInstance().getOpenwireURL(); numReceived = 0; // Default amount to send and receive Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSimpleTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSimpleTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSimpleTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSimpleTest.cpp Mon Apr 30 06:22:02 2007 @@ -83,49 +83,49 @@ { try { - TestSupport testSupport("tcp://localhost:61616?wireFormat=openwire"); + TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL()); testSupport.initialize(); - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic("mytopic"); - cms::MessageConsumer* consumer = - session->createConsumer( topic ); + cms::MessageConsumer* consumer = + session->createConsumer( topic ); consumer->setMessageListener( &testSupport ); - cms::MessageProducer* producer = + 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 ); - + unsigned int numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount * 2 ); if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } @@ -136,49 +136,49 @@ { try { - TestSupport testSupport("tcp://localhost:61616?wireFormat=openwire", cms::Session::CLIENT_ACKNOWLEDGE ); + TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::CLIENT_ACKNOWLEDGE ); testSupport.initialize(); - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic("mytopic"); - cms::MessageConsumer* consumer = - session->createConsumer( topic ); + cms::MessageConsumer* consumer = + session->createConsumer( topic ); consumer->setMessageListener( &testSupport ); - cms::MessageProducer* producer = + 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 ); - + unsigned int numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount * 2 ); if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } @@ -189,35 +189,35 @@ { try { - TestSupport testSupport("tcp://localhost:61616?wireFormat=openwire", cms::Session::CLIENT_ACKNOWLEDGE ); + TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::CLIENT_ACKNOWLEDGE ); testSupport.initialize(); - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic(Guid::createGUIDString()); - cms::MessageConsumer* consumer = session->createConsumer( topic ); + cms::MessageConsumer* consumer = session->createConsumer( topic ); consumer->setMessageListener( &testSupport ); cms::MessageProducer* producer = session->createProducer( NULL ); cms::TextMessage* textMsg = session->createTextMessage(); - + // Send some text messages producer->send( topic, textMsg ); - + delete textMsg; // Wait for the messages to get here testSupport.waitForMessages( 1 ); - + unsigned int numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); @@ -227,7 +227,7 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } @@ -238,18 +238,18 @@ { try { - TestSupport testSupport("tcp://localhost:61616?wireFormat=openwire", cms::Session::CLIENT_ACKNOWLEDGE ); + TestSupport testSupport(IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::CLIENT_ACKNOWLEDGE ); testSupport.initialize(); - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic(Guid::createGUIDString()); @@ -257,10 +257,10 @@ cms::MessageProducer* producer = session->createProducer( topic ); cms::TextMessage* textMsg = session->createTextMessage(); - + // Send some text messages producer->send( textMsg ); - + delete textMsg; cms::Message* message = consumer->receive(1000); @@ -270,7 +270,7 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } @@ -281,48 +281,50 @@ { try { - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms - cms::ConnectionFactory* factory = new ActiveMQConnectionFactory("tcp://localhost:61616?wireFormat=openwire"); + cms::ConnectionFactory* factory = + new ActiveMQConnectionFactory( + IntegrationCommon::getInstance().getOpenwireURL() ); cms::Connection* connection1 = factory->createConnection(); connection1->start(); - + cms::Connection* connection2 = factory->createConnection(); connection2->start(); - + CPPUNIT_ASSERT( connection1->getClientID() != connection2->getClientID() ); - + cms::Session* session1 = connection1->createSession(); cms::Session* session2 = connection2->createSession(); - + cms::Topic* topic = session1->createTopic(Guid::createGUIDString()); - - + + cms::MessageConsumer* consumer1 = session1->createConsumer( topic ); cms::MessageConsumer* consumer2 = session2->createConsumer( topic ); - + cms::MessageProducer* producer = session2->createProducer( topic ); cms::TextMessage* textMsg = session2->createTextMessage(); - + // Send some text messages producer->send( textMsg ); - + delete textMsg; cms::Message* message = consumer1->receive(1000); CPPUNIT_ASSERT( message != NULL ); delete message; - + message = consumer2->receive(1000); CPPUNIT_ASSERT( message != NULL ); delete message; @@ -330,11 +332,11 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - + connection1->close(); connection2->close(); - - delete producer; + + delete producer; delete consumer1; delete consumer2; delete topic; @@ -351,42 +353,44 @@ { try { - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms - cms::ConnectionFactory* factory = new ActiveMQConnectionFactory("tcp://localhost:61616?wireFormat=openwire"); + cms::ConnectionFactory* factory = + new ActiveMQConnectionFactory( + IntegrationCommon::getInstance().getOpenwireURL() ); cms::Connection* connection = factory->createConnection(); connection->start(); - + cms::Session* session1 = connection->createSession(); cms::Session* session2 = connection->createSession(); - + cms::Topic* topic = session1->createTopic(Guid::createGUIDString()); - + cms::MessageConsumer* consumer1 = session1->createConsumer( topic ); cms::MessageConsumer* consumer2 = session2->createConsumer( topic ); - + cms::MessageProducer* producer = session2->createProducer( topic ); cms::TextMessage* textMsg = session2->createTextMessage(); - + // Send some text messages producer->send( textMsg ); - + delete textMsg; cms::Message* message = consumer1->receive(1000); CPPUNIT_ASSERT( message != NULL ); delete message; - + message = consumer2->receive(1000); CPPUNIT_ASSERT( message != NULL ); delete message; @@ -394,10 +398,10 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - + connection->close(); - - delete producer; + + delete producer; delete consumer1; delete consumer2; delete topic; @@ -410,40 +414,42 @@ } void OpenwireSimpleTest::testReceiveAlreadyInQueue() { - + try { - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms - cms::ConnectionFactory* factory = new ActiveMQConnectionFactory("tcp://localhost:61616?wireFormat=openwire"); + cms::ConnectionFactory* factory = + new ActiveMQConnectionFactory( + IntegrationCommon::getInstance().getOpenwireURL() ); cms::Connection* connection = factory->createConnection(); cms::Session* session = connection->createSession(); - + cms::Topic* topic = session->createTopic(Guid::createGUIDString()); - + cms::MessageConsumer* consumer = session->createConsumer( topic ); - + cms::MessageProducer* producer = session->createProducer( topic ); cms::TextMessage* textMsg = session->createTextMessage(); - + // Send some text messages producer->send( textMsg ); - + delete textMsg; - + Thread::sleep( 100 ); - + connection->start(); cms::Message* message = consumer->receive(1000); @@ -453,10 +459,10 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - + connection->close(); - - delete producer; + + delete producer; delete consumer; delete topic; delete session; Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSlowListenerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSlowListenerTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSlowListenerTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireSlowListenerTest.cpp Mon Apr 30 06:22:02 2007 @@ -98,7 +98,9 @@ SlowListener listener; ActiveMQConnectionFactory* connectionFactory; - connectionFactory = new activemq::core::ActiveMQConnectionFactory("tcp://127.0.0.1:61616?wireFormat=openwire"); + connectionFactory = + new activemq::core::ActiveMQConnectionFactory( + IntegrationCommon::getInstance().getOpenwireURL() ); cms::Connection* connection = connectionFactory->createConnection(); cms::Session* session = connection->createSession( cms::Session::AUTO_ACKNOWLEDGE ); cms::Destination* destination = session->createTopic(Guid::createGUIDString()); Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireTempDestinationTest.cpp Mon Apr 30 06:22:02 2007 @@ -74,7 +74,7 @@ /////////////////////////////////////////////////////////////////////////////// OpenwireTempDestinationTest::OpenwireTempDestinationTest() - : testSupport( "tcp://127.0.0.1:61616?wireFormat=openwire" ) + : testSupport( IntegrationCommon::getInstance().getOpenwireURL() ) { testSupport.initialize(); } Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/openwire/OpenwireTransactionTest.cpp Mon Apr 30 06:22:02 2007 @@ -72,7 +72,7 @@ OpenwireTransactionTest::OpenwireTransactionTest() : - testSupport( "tcp://127.0.0.1:61616?wireFormat=openwire", cms::Session::SESSION_TRANSACTED ) + testSupport( IntegrationCommon::getInstance().getOpenwireURL(), cms::Session::SESSION_TRANSACTED ) { testSupport.initialize(); } @@ -88,46 +88,46 @@ cout << "Starting activemqcms transactional test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic("mytopic"); - cms::MessageConsumer* consumer = - session->createConsumer( topic ); + cms::MessageConsumer* consumer = + session->createConsumer( topic ); consumer->setMessageListener( &testSupport ); - cms::MessageProducer* producer = + 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 ); - + unsigned int numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount * 2 ); testSupport.setNumReceived( 0 ); // Send some text messages - testSupport.produceTextMessages( + testSupport.produceTextMessages( *producer, IntegrationCommon::defaultMsgCount ); session->rollback(); @@ -139,13 +139,13 @@ if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount ); if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/AsyncSenderTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/AsyncSenderTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/AsyncSenderTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/AsyncSenderTest.cpp Mon Apr 30 06:22:02 2007 @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + #include "AsyncSenderTest.h" #include @@ -73,8 +73,7 @@ //////////////////////////////////////////////////////////////////////////////// AsyncSenderTest::AsyncSenderTest() -: - testSupport("tcp://localhost:61613?wireFormat=stomp&useAsyncSend=true") +: testSupport( IntegrationCommon::getInstance().getStompURL() + "&transport.useAsyncSend=true") { testSupport.initialize(); } @@ -93,42 +92,42 @@ cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = testSupport.getSession()->createTopic("mytopic"); - cms::MessageConsumer* consumer = - session->createConsumer( topic ); + cms::MessageConsumer* consumer = + session->createConsumer( topic ); consumer->setMessageListener( &testSupport ); - cms::MessageProducer* producer = + 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 ); - + unsigned int numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount * 2 ); if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/DurableTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/DurableTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/DurableTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/DurableTest.cpp Mon Apr 30 06:22:02 2007 @@ -73,7 +73,7 @@ DurableTest::DurableTest() : - testSupport("tcp://localhost:61613?wireFormat=stomp") + testSupport( IntegrationCommon::getInstance().getStompURL() ) { testSupport.initialize(); } @@ -89,36 +89,36 @@ cout << "Starting activemqcms durable test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + std::string subName = Guid().createGUID(); // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic(Guid::createGUIDString()); - cms::MessageConsumer* consumer = - session->createDurableConsumer( topic, subName, "" ); + cms::MessageConsumer* consumer = + session->createDurableConsumer( topic, subName, "" ); consumer->setMessageListener( &testSupport ); - cms::MessageProducer* producer = + cms::MessageProducer* producer = session->createProducer( topic ); unsigned int sent; // Send some text messages sent = testSupport.produceTextMessages( *producer, 3 ); - + // Wait for all messages testSupport.waitForMessages( sent ); unsigned int numReceived = testSupport.getNumReceived(); - + if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - + CPPUNIT_ASSERT_EQUAL( sent, numReceived ); // Nuke the consumer @@ -127,7 +127,7 @@ // Send some text messages sent += testSupport.produceTextMessages( *producer, 3 ); - consumer = session->createDurableConsumer( topic, subName, "" ); + consumer = session->createDurableConsumer( topic, subName, "" ); consumer->setMessageListener( &testSupport ); // Send some text messages @@ -135,7 +135,7 @@ // Wait for all remaining messages testSupport.waitForMessages( sent ); - + numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); @@ -145,7 +145,7 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/ExpirationTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/ExpirationTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/ExpirationTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/ExpirationTest.cpp Mon Apr 30 06:22:02 2007 @@ -16,6 +16,7 @@ */ #include "ExpirationTest.h" +#include #include @@ -75,8 +76,6 @@ using namespace integration; using namespace integration::connector::stomp; - - ExpirationTest::Producer::Producer( string topic, int numMessages, long long timeToLive ){ connection = NULL; session = NULL; @@ -103,7 +102,8 @@ void ExpirationTest::Producer::run() { try { // Create a ConnectionFactory - ActiveMQConnectionFactory* connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61613?wireFormat=stomp"); + ActiveMQConnectionFactory* connectionFactory = + new ActiveMQConnectionFactory( IntegrationCommon::getInstance().getStompURL() ); // Create a Connection connection = connectionFactory->createConnection(); @@ -199,7 +199,7 @@ // Create a Connection connection = ActiveMQConnectionFactory::createConnection( - "tcp://localhost:61613?wireFormat=stomp", user, passwd, sID ); + IntegrationCommon::getInstance().getStompURL(), user, passwd, sID ); connection->start(); Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleRollbackTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleRollbackTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleRollbackTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleRollbackTest.cpp Mon Apr 30 06:22:02 2007 @@ -82,7 +82,7 @@ { try { - string url = "tcp://localhost:61613?wireFormat=stomp"; + string url = IntegrationCommon::getInstance().getStompURL(); numReceived = 0; // Default amount to send and receive Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleTest.cpp Mon Apr 30 06:22:02 2007 @@ -83,49 +83,49 @@ { try { - TestSupport testSupport("tcp://localhost:61613?wireFormat=stomp"); + TestSupport testSupport( IntegrationCommon::getInstance().getStompURL() ); testSupport.initialize(); - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic("mytopic"); - cms::MessageConsumer* consumer = - session->createConsumer( topic ); + cms::MessageConsumer* consumer = + session->createConsumer( topic ); consumer->setMessageListener( &testSupport ); - cms::MessageProducer* producer = + 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 ); - + unsigned int numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount * 2 ); if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } @@ -136,49 +136,49 @@ { try { - TestSupport testSupport("tcp://localhost:61613?wireFormat=stomp", cms::Session::CLIENT_ACKNOWLEDGE ); + TestSupport testSupport(IntegrationCommon::getInstance().getStompURL(), cms::Session::CLIENT_ACKNOWLEDGE ); testSupport.initialize(); - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic("mytopic"); - cms::MessageConsumer* consumer = - session->createConsumer( topic ); + cms::MessageConsumer* consumer = + session->createConsumer( topic ); consumer->setMessageListener( &testSupport ); - cms::MessageProducer* producer = + 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 ); - + unsigned int numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount * 2 ); if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } @@ -189,35 +189,35 @@ { try { - TestSupport testSupport("tcp://localhost:61613?wireFormat=stomp", cms::Session::CLIENT_ACKNOWLEDGE ); + TestSupport testSupport(IntegrationCommon::getInstance().getStompURL(), cms::Session::CLIENT_ACKNOWLEDGE ); testSupport.initialize(); - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic(Guid::createGUIDString()); - cms::MessageConsumer* consumer = session->createConsumer( topic ); + cms::MessageConsumer* consumer = session->createConsumer( topic ); consumer->setMessageListener( &testSupport ); cms::MessageProducer* producer = session->createProducer( NULL ); cms::TextMessage* textMsg = session->createTextMessage(); - + // Send some text messages producer->send( topic, textMsg ); - + delete textMsg; // Wait for the messages to get here testSupport.waitForMessages( 1 ); - + unsigned int numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); @@ -227,7 +227,7 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; } @@ -238,18 +238,18 @@ { try { - TestSupport testSupport("tcp://localhost:61613?wireFormat=stomp", cms::Session::CLIENT_ACKNOWLEDGE ); + TestSupport testSupport(IntegrationCommon::getInstance().getStompURL(), cms::Session::AUTO_ACKNOWLEDGE ); testSupport.initialize(); - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic(Guid::createGUIDString()); @@ -257,10 +257,10 @@ cms::MessageProducer* producer = session->createProducer( topic ); cms::TextMessage* textMsg = session->createTextMessage(); - + // Send some text messages producer->send( textMsg ); - + delete textMsg; cms::Message* message = consumer->receive(1000); @@ -270,7 +270,51 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; + delete consumer; + delete topic; + } + AMQ_CATCH_RETHROW( ActiveMQException ) +} + +void SimpleTest::testSyncReceiveClientAck() +{ + try + { + TestSupport testSupport(IntegrationCommon::getInstance().getStompURL(), cms::Session::CLIENT_ACKNOWLEDGE ); + testSupport.initialize(); + + if( IntegrationCommon::debug ) { + cout << "Starting activemqcms test (sending " + << IntegrationCommon::defaultMsgCount + << " messages per type and sleeping " + << IntegrationCommon::defaultDelay + << " milli-seconds) ...\n" + << endl; + } + + // Create CMS Object for Comms + cms::Session* session = testSupport.getSession(); + cms::Topic* topic = session->createTopic(Guid::createGUIDString()); + cms::MessageConsumer* consumer = session->createConsumer( topic ); + cms::MessageProducer* producer = session->createProducer( topic ); + + cms::TextMessage* textMsg = session->createTextMessage(); + + // Send some text messages + producer->send( textMsg ); + + delete textMsg; + + cms::Message* message = consumer->receive(1000); + CPPUNIT_ASSERT( message != NULL ); + message->acknowledge(); + delete message; + + if( IntegrationCommon::debug ) { + printf("Shutting Down\n" ); + } + delete producer; delete consumer; delete topic; } @@ -281,48 +325,50 @@ { try { - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms - cms::ConnectionFactory* factory = new ActiveMQConnectionFactory("tcp://localhost:61613?wireFormat=stomp"); + cms::ConnectionFactory* factory = + new ActiveMQConnectionFactory( + IntegrationCommon::getInstance().getStompURL() ); cms::Connection* connection1 = factory->createConnection(); connection1->start(); - + cms::Connection* connection2 = factory->createConnection(); connection2->start(); - + CPPUNIT_ASSERT( connection1->getClientID() != connection2->getClientID() ); - + cms::Session* session1 = connection1->createSession(); cms::Session* session2 = connection2->createSession(); - + cms::Topic* topic = session1->createTopic(Guid::createGUIDString()); - - + + cms::MessageConsumer* consumer1 = session1->createConsumer( topic ); cms::MessageConsumer* consumer2 = session2->createConsumer( topic ); - + cms::MessageProducer* producer = session2->createProducer( topic ); cms::TextMessage* textMsg = session2->createTextMessage(); - + // Send some text messages producer->send( textMsg ); - + delete textMsg; cms::Message* message = consumer1->receive(1000); CPPUNIT_ASSERT( message != NULL ); delete message; - + message = consumer2->receive(1000); CPPUNIT_ASSERT( message != NULL ); delete message; @@ -330,11 +376,11 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - + connection1->close(); connection2->close(); - - delete producer; + + delete producer; delete consumer1; delete consumer2; delete topic; @@ -351,42 +397,43 @@ { try { - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms - cms::ConnectionFactory* factory = new ActiveMQConnectionFactory("tcp://localhost:61613?wireFormat=stomp"); + cms::ConnectionFactory* factory = + new ActiveMQConnectionFactory( IntegrationCommon::getInstance().getStompURL() ); cms::Connection* connection = factory->createConnection(); connection->start(); - + cms::Session* session1 = connection->createSession(); cms::Session* session2 = connection->createSession(); - + cms::Topic* topic = session1->createTopic(Guid::createGUIDString()); - + cms::MessageConsumer* consumer1 = session1->createConsumer( topic ); cms::MessageConsumer* consumer2 = session2->createConsumer( topic ); - + cms::MessageProducer* producer = session2->createProducer( topic ); cms::TextMessage* textMsg = session2->createTextMessage(); - + // Send some text messages producer->send( textMsg ); - + delete textMsg; cms::Message* message = consumer1->receive(1000); CPPUNIT_ASSERT( message != NULL ); delete message; - + message = consumer2->receive(1000); CPPUNIT_ASSERT( message != NULL ); delete message; @@ -394,10 +441,10 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - + connection->close(); - - delete producer; + + delete producer; delete consumer1; delete consumer2; delete topic; @@ -410,40 +457,42 @@ } void SimpleTest::testReceiveAlreadyInQueue() { - + try { - + if( IntegrationCommon::debug ) { cout << "Starting activemqcms test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms - cms::ConnectionFactory* factory = new ActiveMQConnectionFactory("tcp://localhost:61613?wireFormat=stomp"); + cms::ConnectionFactory* factory = + new ActiveMQConnectionFactory( + IntegrationCommon::getInstance().getStompURL() ); cms::Connection* connection = factory->createConnection(); cms::Session* session = connection->createSession(); - + cms::Topic* topic = session->createTopic(Guid::createGUIDString()); - + cms::MessageConsumer* consumer = session->createConsumer( topic ); - + cms::MessageProducer* producer = session->createProducer( topic ); cms::TextMessage* textMsg = session->createTextMessage(); - + // Send some text messages producer->send( textMsg ); - + delete textMsg; - + Thread::sleep( 100 ); - + connection->start(); cms::Message* message = consumer->receive(1000); @@ -453,10 +502,10 @@ if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - + connection->close(); - - delete producer; + + delete producer; delete consumer; delete topic; delete session; Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleTest.h?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleTest.h (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/SimpleTest.h Mon Apr 30 06:22:02 2007 @@ -26,7 +26,7 @@ namespace integration{ namespace connector{ namespace stomp{ - + class SimpleTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( SimpleTest ); @@ -34,20 +34,22 @@ CPPUNIT_TEST( testClientAck ); CPPUNIT_TEST( testProducerWithNullDestination ); CPPUNIT_TEST( testSyncReceive ); + CPPUNIT_TEST( testSyncReceiveClientAck ); CPPUNIT_TEST( testMultipleConnections ); CPPUNIT_TEST( testMultipleSessions ); CPPUNIT_TEST( testReceiveAlreadyInQueue ); CPPUNIT_TEST_SUITE_END(); - + public: - SimpleTest(); - virtual ~SimpleTest(); + SimpleTest(); + virtual ~SimpleTest(); virtual void testAutoAck(); virtual void testClientAck(); virtual void testProducerWithNullDestination(); virtual void testSyncReceive(); + virtual void testSyncReceiveClientAck(); virtual void testMultipleConnections(); virtual void testMultipleSessions(); virtual void testReceiveAlreadyInQueue(); Modified: activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/TransactionTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/TransactionTest.cpp?view=diff&rev=533743&r1=533742&r2=533743 ============================================================================== --- activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/TransactionTest.cpp (original) +++ activemq/activemq-cpp/tags/activemq-cpp-2.0.1/src/test-integration/integration/connector/stomp/TransactionTest.cpp Mon Apr 30 06:22:02 2007 @@ -72,7 +72,7 @@ TransactionTest::TransactionTest() : - testSupport( "tcp://127.0.0.1:61613?wireFormat=stomp", cms::Session::SESSION_TRANSACTED ) + testSupport( IntegrationCommon::getInstance().getStompURL(), cms::Session::SESSION_TRANSACTED ) { testSupport.initialize(); } @@ -88,46 +88,46 @@ cout << "Starting activemqcms transactional test (sending " << IntegrationCommon::defaultMsgCount << " messages per type and sleeping " - << IntegrationCommon::defaultDelay + << IntegrationCommon::defaultDelay << " milli-seconds) ...\n" << endl; } - + // Create CMS Object for Comms cms::Session* session = testSupport.getSession(); cms::Topic* topic = session->createTopic("mytopic"); - cms::MessageConsumer* consumer = - session->createConsumer( topic ); + cms::MessageConsumer* consumer = + session->createConsumer( topic ); consumer->setMessageListener( &testSupport ); - cms::MessageProducer* producer = + 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 ); - + unsigned int numReceived = testSupport.getNumReceived(); if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount * 2 ); testSupport.setNumReceived( 0 ); // Send some text messages - testSupport.produceTextMessages( + testSupport.produceTextMessages( *producer, IntegrationCommon::defaultMsgCount ); session->rollback(); @@ -139,13 +139,13 @@ if( IntegrationCommon::debug ) { printf("received: %d\n", numReceived ); } - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount ); if( IntegrationCommon::debug ) { printf("Shutting Down\n" ); } - delete producer; + delete producer; delete consumer; delete topic; }