activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1337379 - /activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
Date Fri, 11 May 2012 21:07:53 GMT
Author: tabish
Date: Fri May 11 21:07:53 2012
New Revision: 1337379

URL: http://svn.apache.org/viewvc?rev=1337379&view=rev
Log:
Fix test failures

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp?rev=1337379&r1=1337378&r2=1337379&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
Fri May 11 21:07:53 2012
@@ -17,6 +17,7 @@
 
 #include "SimpleTest.h"
 
+#include <activemq/core/ActiveMQConnectionFactory.h>
 #include <activemq/library/ActiveMQCPP.h>
 #include <activemq/util/CMSListener.h>
 #include <activemq/exceptions/ActiveMQException.h>
@@ -27,6 +28,7 @@
 using namespace std;
 using namespace cms;
 using namespace activemq;
+using namespace activemq::core;
 using namespace activemq::test;
 using namespace activemq::util;
 using namespace activemq::exceptions;
@@ -240,7 +242,7 @@ void SimpleTest::testMultipleConnections
     try {
 
         // Create CMS Object for Comms
-        cms::ConnectionFactory* factory = cmsProvider->getConnectionFactory();
+        auto_ptr<ActiveMQConnectionFactory> factory(new ActiveMQConnectionFactory(cmsProvider->getBrokerURL()));
         auto_ptr<cms::Connection> connection1( factory->createConnection() );
         connection1->start();
 
@@ -330,24 +332,24 @@ void SimpleTest::testReceiveAlreadyInQue
     try {
 
         // Create CMS Object for Comms
-        cms::ConnectionFactory* factory = cmsProvider->getConnectionFactory();
-        auto_ptr<cms::Connection> connection( factory->createConnection() );
+        auto_ptr<ActiveMQConnectionFactory> factory(new ActiveMQConnectionFactory(cmsProvider->getBrokerURL()));
+        auto_ptr<cms::Connection> connection(factory->createConnection());
 
-        auto_ptr<cms::Session> session( connection->createSession() );
-        auto_ptr<cms::Topic> topic( session->createTopic( UUID::randomUUID().toString()
) );
-        auto_ptr<cms::MessageConsumer> consumer( session->createConsumer( topic.get()
) );
-        auto_ptr<cms::MessageProducer> producer( session->createProducer( topic.get()
) );
-        producer->setDeliveryMode( DeliveryMode::NON_PERSISTENT );
-        auto_ptr<cms::TextMessage> textMessage( session->createTextMessage() );
+        auto_ptr<cms::Session> session(connection->createSession());
+        auto_ptr<cms::Topic> topic(session->createTopic(UUID::randomUUID().toString()));
+        auto_ptr<cms::MessageConsumer> consumer(session->createConsumer(topic.get()));
+        auto_ptr<cms::MessageProducer> producer(session->createProducer(topic.get()));
+        producer->setDeliveryMode(DeliveryMode::NON_PERSISTENT);
+        auto_ptr<cms::TextMessage> textMessage(session->createTextMessage());
 
         // Send some text messages
-        producer->send( textMessage.get() );
+        producer->send(textMessage.get());
 
-        Thread::sleep( 250 );
+        Thread::sleep(250);
 
         connection->start();
 
-        auto_ptr<cms::Message> message( consumer->receive( 2000 ) );
+        auto_ptr<cms::Message> message(consumer->receive(2000));
         CPPUNIT_ASSERT( message.get() != NULL );
 
         // Clean up if we can
@@ -355,7 +357,7 @@ void SimpleTest::testReceiveAlreadyInQue
         producer->close();
         session->close();
 
-        this->cmsProvider->destroyDestination( topic.get() );
+        this->cmsProvider->destroyDestination(topic.get());
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
@@ -366,7 +368,7 @@ void SimpleTest::testQuickCreateAndDestr
 
     try{
 
-        cms::ConnectionFactory* factory = cmsProvider->getConnectionFactory();
+        auto_ptr<ActiveMQConnectionFactory> factory(new ActiveMQConnectionFactory(cmsProvider->getBrokerURL()));
         auto_ptr<cms::Connection> connection( factory->createConnection() );
         auto_ptr<cms::Session> session( connection->createSession() );
 
@@ -399,18 +401,18 @@ void SimpleTest::testBytesMessageSendRec
     try {
 
         // Create CMS Object for Comms
-        cms::Session* session( cmsProvider->getSession() );
+        cms::Session* session(cmsProvider->getSession());
         cms::MessageConsumer* consumer = cmsProvider->getConsumer();
         cms::MessageProducer* producer = cmsProvider->getProducer();
-        producer->setDeliveryMode( DeliveryMode::NON_PERSISTENT );
+        producer->setDeliveryMode(DeliveryMode::NON_PERSISTENT);
 
-        auto_ptr<cms::BytesMessage> bytesMessage( session->createBytesMessage()
);
+        auto_ptr<cms::BytesMessage> bytesMessage(session->createBytesMessage());
 
-        bytesMessage->writeBoolean( true );
-        bytesMessage->writeByte( 127 );
-        bytesMessage->writeDouble( 123456.789 );
-        bytesMessage->writeInt( 65537 );
-        bytesMessage->writeString( "TEST-STRING" );
+        bytesMessage->writeBoolean(true);
+        bytesMessage->writeByte(127);
+        bytesMessage->writeDouble(123456.789);
+        bytesMessage->writeInt(65537);
+        bytesMessage->writeString("TEST-STRING");
 
         // Send some text messages
         producer->send( bytesMessage.get() );
@@ -445,15 +447,12 @@ void SimpleTest::testLibraryInitShutdown
 
     {
         this->tearDown();
-
         // Shutdown the ActiveMQ library
         CPPUNIT_ASSERT_NO_THROW( activemq::library::ActiveMQCPP::shutdownLibrary() );
     }
-
     {
         // Initialize the ActiveMQ library
         CPPUNIT_ASSERT_NO_THROW( activemq::library::ActiveMQCPP::initializeLibrary() );
-
-        cmsProvider.reset( new util::CMSProvider( getBrokerURL() ) );
+        cmsProvider.reset(new util::CMSProvider(getBrokerURL()));
     }
 }



Mime
View raw message