You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/07/06 00:27:47 UTC
svn commit: r419365 [24/25] - in /incubator/activemq/trunk:
activemq-core/src/main/java/org/apache/activemq/thread/
activemq-core/src/test/java/org/apache/activemq/openwire/v1/
activemq-cpp/src/main/activemq/concurrent/
activemq-cpp/src/main/activemq/c...
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.h Wed Jul 5 15:27:34 2006
@@ -1,41 +1,41 @@
-#ifndef LOGGERTEST_H_
-#define LOGGERTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <activemq/logger/LoggerDefines.h>
-
-namespace activemq{
-namespace logger{
-
- class LoggerTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( LoggerTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- private:
-
- LOGCMS_DECLARE(testLogger);
-
- public:
-
- virtual ~LoggerTest() {}
-
- void test(void)
- {
- LOGCMS_DEBUG(testLogger, "Test Debug");
- LOGCMS_INFO(testLogger, "Test Info");
- LOGCMS_ERROR(testLogger, "Test Error");
- LOGCMS_WARN(testLogger, "Test Warn");
- LOGCMS_FATAL(testLogger, "Test Fatal");
-
- CPPUNIT_ASSERT( true );
- }
- };
-
- LOGCMS_INITIALIZE(testLogger, LoggerTest, "com.activemq.logger.LoggerTest");
-
-}}
-
-#endif /*LOGGERTEST_H_*/
+#ifndef LOGGERTEST_H_
+#define LOGGERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <activemq/logger/LoggerDefines.h>
+
+namespace activemq{
+namespace logger{
+
+ class LoggerTest : public CppUnit::TestFixture
+ {
+ CPPUNIT_TEST_SUITE( LoggerTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+
+ LOGCMS_DECLARE(testLogger);
+
+ public:
+
+ virtual ~LoggerTest() {}
+
+ void test(void)
+ {
+ LOGCMS_DEBUG(testLogger, "Test Debug");
+ LOGCMS_INFO(testLogger, "Test Info");
+ LOGCMS_ERROR(testLogger, "Test Error");
+ LOGCMS_WARN(testLogger, "Test Warn");
+ LOGCMS_FATAL(testLogger, "Test Fatal");
+
+ CPPUNIT_ASSERT( true );
+ }
+ };
+
+ LOGCMS_INITIALIZE(testLogger, LoggerTest, "com.activemq.logger.LoggerTest");
+
+}}
+
+#endif /*LOGGERTEST_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.cpp Wed Jul 5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "SocketFactoryTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::network::SocketFactoryTest );
+#include "SocketFactoryTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::network::SocketFactoryTest );
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.h Wed Jul 5 15:27:34 2006
@@ -1,196 +1,196 @@
-#ifndef _ACTIVEMQ_NETWORK_SOCKETFACTORYTEST_H_
-#define _ACTIVEMQ_NETWORK_SOCKETFACTORYTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/network/Socket.h>
-#include <activemq/network/TcpSocket.h>
-#include <activemq/network/BufferedSocket.h>
-#include <activemq/network/ServerSocket.h>
-#include <activemq/network/SocketFactory.h>
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/concurrent/Concurrent.h>
-#include <activemq/concurrent/Mutex.h>
-#include <activemq/concurrent/Thread.h>
-
-#include <sstream>
-
-namespace activemq{
-namespace network{
-
- class SocketFactoryTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( SocketFactoryTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- static const int port = 23232;
-
- class MyServerThread : public concurrent::Thread{
- private:
-
- bool done;
- int numClients;
- std::string lastMessage;
-
- public:
-
- concurrent::Mutex mutex;
-
- public:
- MyServerThread(){
- done = false;
- numClients = 0;
- }
- virtual ~MyServerThread(){
- stop();
- }
-
- std::string getLastMessage(){
- return lastMessage;
- }
-
- int getNumClients(){
- return numClients;
- }
-
- virtual void stop(){
- done = true;
- }
-
- virtual void run(){
- try{
- unsigned char buf[1000];
-
- ServerSocket server;
- server.bind( "127.0.0.1", port );
-
- network::Socket* socket = server.accept();
- server.close();
-
- socket->setSoTimeout( 10 );
- socket->setSoLinger( false );
-
- synchronized(&mutex)
- {
- numClients++;
-
- mutex.notifyAll();
- }
-
- while( !done && socket != NULL ){
-
- io::InputStream* stream = socket->getInputStream();
- if( stream->available() > 0 ){
-
- memset( buf, 0, 1000 );
- try{
- stream->read( buf, 1000 );
-
- lastMessage = (char*)buf;
-
- if( strcmp( (char*)buf, "reply" ) == 0 ){
- io::OutputStream* output = socket->getOutputStream();
- output->write( (unsigned char*)"hello", strlen("hello" ) );
- }
-
- }catch( io::IOException& ex ){
- done = true;
- }
-
- }else{
- Thread::sleep( 10 );
- }
- }
-
- socket->close();
- delete socket;
-
- numClients--;
-
- synchronized(&mutex)
- {
- mutex.notifyAll();
- }
-
- }catch( io::IOException& ex ){
- printf("%s\n", ex.getMessage() );
- CPPUNIT_ASSERT( false );
- }catch( ... ){
- CPPUNIT_ASSERT( false );
- }
- }
-
- };
-
- public:
-
- SocketFactoryTest() {}
- virtual ~SocketFactoryTest() {}
-
- void test(void)
- {
- try
- {
- MyServerThread serverThread;
- serverThread.start();
-
- concurrent::Thread::sleep( 40 );
-
- util::SimpleProperties properties;
-
- std::ostringstream ostream;
-
- ostream << "127.0.0.1:" << port;
-
- properties.setProperty("uri", ostream.str());
- properties.setProperty("soLinger", "false");
- properties.setProperty("soTimeout", "5");
-
- Socket* client = SocketFactory::createSocket(properties);
-
- BufferedSocket* buffSocket = dynamic_cast<BufferedSocket*>(client);
-
- CPPUNIT_ASSERT( buffSocket != NULL );
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 1)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( client->isConnected() );
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 1 );
-
- client->close();
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 0)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 0 );
-
- serverThread.stop();
- serverThread.join();
-
- delete client;
- }
- catch(exceptions::ActiveMQException ex)
- {
- CPPUNIT_ASSERT( false );
- }
- }
-
- };
-
-}}
-
-#endif /*_ACTIVEMQ_NETWORK_SOCKETFACTORYTEST_H_*/
+#ifndef _ACTIVEMQ_NETWORK_SOCKETFACTORYTEST_H_
+#define _ACTIVEMQ_NETWORK_SOCKETFACTORYTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/network/Socket.h>
+#include <activemq/network/TcpSocket.h>
+#include <activemq/network/BufferedSocket.h>
+#include <activemq/network/ServerSocket.h>
+#include <activemq/network/SocketFactory.h>
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/concurrent/Concurrent.h>
+#include <activemq/concurrent/Mutex.h>
+#include <activemq/concurrent/Thread.h>
+
+#include <sstream>
+
+namespace activemq{
+namespace network{
+
+ class SocketFactoryTest : public CppUnit::TestFixture
+ {
+ CPPUNIT_TEST_SUITE( SocketFactoryTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ static const int port = 23232;
+
+ class MyServerThread : public concurrent::Thread{
+ private:
+
+ bool done;
+ int numClients;
+ std::string lastMessage;
+
+ public:
+
+ concurrent::Mutex mutex;
+
+ public:
+ MyServerThread(){
+ done = false;
+ numClients = 0;
+ }
+ virtual ~MyServerThread(){
+ stop();
+ }
+
+ std::string getLastMessage(){
+ return lastMessage;
+ }
+
+ int getNumClients(){
+ return numClients;
+ }
+
+ virtual void stop(){
+ done = true;
+ }
+
+ virtual void run(){
+ try{
+ unsigned char buf[1000];
+
+ ServerSocket server;
+ server.bind( "127.0.0.1", port );
+
+ network::Socket* socket = server.accept();
+ server.close();
+
+ socket->setSoTimeout( 10 );
+ socket->setSoLinger( false );
+
+ synchronized(&mutex)
+ {
+ numClients++;
+
+ mutex.notifyAll();
+ }
+
+ while( !done && socket != NULL ){
+
+ io::InputStream* stream = socket->getInputStream();
+ if( stream->available() > 0 ){
+
+ memset( buf, 0, 1000 );
+ try{
+ stream->read( buf, 1000 );
+
+ lastMessage = (char*)buf;
+
+ if( strcmp( (char*)buf, "reply" ) == 0 ){
+ io::OutputStream* output = socket->getOutputStream();
+ output->write( (unsigned char*)"hello", strlen("hello" ) );
+ }
+
+ }catch( io::IOException& ex ){
+ done = true;
+ }
+
+ }else{
+ Thread::sleep( 10 );
+ }
+ }
+
+ socket->close();
+ delete socket;
+
+ numClients--;
+
+ synchronized(&mutex)
+ {
+ mutex.notifyAll();
+ }
+
+ }catch( io::IOException& ex ){
+ printf("%s\n", ex.getMessage() );
+ CPPUNIT_ASSERT( false );
+ }catch( ... ){
+ CPPUNIT_ASSERT( false );
+ }
+ }
+
+ };
+
+ public:
+
+ SocketFactoryTest() {}
+ virtual ~SocketFactoryTest() {}
+
+ void test(void)
+ {
+ try
+ {
+ MyServerThread serverThread;
+ serverThread.start();
+
+ concurrent::Thread::sleep( 40 );
+
+ util::SimpleProperties properties;
+
+ std::ostringstream ostream;
+
+ ostream << "127.0.0.1:" << port;
+
+ properties.setProperty("uri", ostream.str());
+ properties.setProperty("soLinger", "false");
+ properties.setProperty("soTimeout", "5");
+
+ Socket* client = SocketFactory::createSocket(properties);
+
+ BufferedSocket* buffSocket = dynamic_cast<BufferedSocket*>(client);
+
+ CPPUNIT_ASSERT( buffSocket != NULL );
+
+ synchronized(&serverThread.mutex)
+ {
+ if(serverThread.getNumClients() != 1)
+ {
+ serverThread.mutex.wait(1000);
+ }
+ }
+
+ CPPUNIT_ASSERT( client->isConnected() );
+
+ CPPUNIT_ASSERT( serverThread.getNumClients() == 1 );
+
+ client->close();
+
+ synchronized(&serverThread.mutex)
+ {
+ if(serverThread.getNumClients() != 0)
+ {
+ serverThread.mutex.wait(1000);
+ }
+ }
+
+ CPPUNIT_ASSERT( serverThread.getNumClients() == 0 );
+
+ serverThread.stop();
+ serverThread.join();
+
+ delete client;
+ }
+ catch(exceptions::ActiveMQException ex)
+ {
+ CPPUNIT_ASSERT( false );
+ }
+ }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_NETWORK_SOCKETFACTORYTEST_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/DummyTransport.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/DummyTransport.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/DummyTransport.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/DummyTransport.h Wed Jul 5 15:27:34 2006
@@ -1,230 +1,230 @@
-#ifndef ACTIVEMQ_TANSPORT_DUMMYTRANSPORT_H_
-#define ACTIVEMQ_TANSPORT_DUMMYTRANSPORT_H_
-
-#include <activemq/transport/Transport.h>
-#include <activemq/concurrent/Concurrent.h>
-#include <activemq/transport/CommandListener.h>
-#include <activemq/transport/TransportExceptionListener.h>
-#include <activemq/transport/CommandIOException.h>
-#include <activemq/concurrent/Concurrent.h>
-#include <activemq/concurrent/Mutex.h>
-#include <activemq/concurrent/Thread.h>
-
-namespace activemq{
-namespace transport{
-
- class DummyTransport : public Transport{
-
- public:
-
- class ResponseBuilder{
- public:
- virtual ~ResponseBuilder(){}
-
- virtual Response* buildResponse( const Command* cmd ) = 0;
- };
-
- class InternalCommandListener :
- public CommandListener,
- public concurrent::Thread
- {
- private:
-
- DummyTransport* transport;
- ResponseBuilder* responseBuilder;
- concurrent::Mutex mutex;
- Command* command;
- bool done;
-
- public:
-
- InternalCommandListener(void) {
- command = NULL;
- transport = NULL;
- responseBuilder = NULL;
- done = false;
-
- this->start();
- }
-
- virtual ~InternalCommandListener() {
- done = true;
- synchronized( &mutex )
- {
- mutex.notifyAll();
- }
- this->join();
- }
-
- void setTransport( DummyTransport* transport ){
- this->transport = transport;
- }
-
- void setResponseBuilder( ResponseBuilder* responseBuilder ) {
- this->responseBuilder = responseBuilder;
- }
-
- virtual void onCommand( Command* command )
- {
- synchronized( &mutex )
- {
- this->command = command;
-
- mutex.notifyAll();
- }
- }
-
- void run(void)
- {
- try
- {
- synchronized( &mutex )
- {
- while( !done )
- {
- mutex.wait();
-
- if( command == NULL )
- {
- continue;
- }
-
- concurrent::Thread::sleep( 100 );
-
- if( responseBuilder != NULL &&
- transport != NULL )
- {
- transport->fireCommand(
- responseBuilder->buildResponse(
- command ) );
-
- command = NULL;
-
- return;
- }
- }
- }
- }
- AMQ_CATCHALL_NOTHROW()
- }
- };
-
- private:
-
- ResponseBuilder* responseBuilder;
- CommandListener* commandListener;
- CommandListener* outgoingCommandListener;
- TransportExceptionListener* exceptionListener;
- unsigned int nextCommandId;
- concurrent::Mutex commandIdMutex;
- bool own;
- InternalCommandListener defaultListener;
-
- public:
-
- DummyTransport( ResponseBuilder* responseBuilder ,
- bool own = false,
- bool useDefOutgoing = false ){
-
- this->responseBuilder = NULL;
- this->commandListener = NULL;
- this->outgoingCommandListener = NULL;
- this->exceptionListener = NULL;
- this->responseBuilder = responseBuilder;
- this->own = own;
- this->nextCommandId = 0;
- if( useDefOutgoing )
- {
- this->outgoingCommandListener = &defaultListener;
- this->defaultListener.setTransport( this );
- this->defaultListener.setResponseBuilder( responseBuilder );
- }
- }
-
- virtual ~DummyTransport(){
- if( own ){
- delete responseBuilder;
- }
- }
-
- void setResponseBuilder( ResponseBuilder* responseBuilder ){
- this->responseBuilder = responseBuilder;
- }
-
- unsigned int getNextCommandId() throw (exceptions::ActiveMQException){
-
- try{
- synchronized( &commandIdMutex ){
- return ++nextCommandId;
- }
-
- // Should never get here, but some compilers aren't
- // smart enough to figure out we'll never get here.
- return 0;
- }
- AMQ_CATCHALL_THROW( transport::CommandIOException )
- }
-
- virtual void oneway( Command* command )
- throw(CommandIOException, exceptions::UnsupportedOperationException)
- {
- if( outgoingCommandListener != NULL ){
-
- command->setCommandId( getNextCommandId() );
- command->setResponseRequired( false );
- outgoingCommandListener->onCommand( command );
- return;
- }
- }
-
- virtual Response* request( Command* command )
- throw(CommandIOException,
- exceptions::UnsupportedOperationException)
- {
- if( responseBuilder != NULL ){
- command->setCommandId( getNextCommandId() );
- command->setResponseRequired( true );
- return responseBuilder->buildResponse( command );
- }
-
- throw CommandIOException( __FILE__, __LINE__,
- "no response builder available" );
- }
-
- virtual void setCommandListener( CommandListener* listener ){
- this->commandListener = listener;
- }
-
- virtual void setOutgoingCommandListener( CommandListener* listener ){
- outgoingCommandListener = listener;
- }
-
- virtual void setCommandReader( CommandReader* reader ){}
-
- virtual void setCommandWriter( CommandWriter* writer ){}
-
- virtual void setTransportExceptionListener(
- TransportExceptionListener* listener )
- {
- this->exceptionListener = listener;
- }
-
- virtual void fireCommand( Command* cmd ){
- if( commandListener != NULL ){
- commandListener->onCommand( cmd );
- }
- }
-
- virtual void fireException( const exceptions::ActiveMQException& ex ){
- if( exceptionListener != NULL ){
- exceptionListener->onTransportException( this, ex );
- }
- }
-
- virtual void start() throw (cms::CMSException){}
- virtual void close() throw (cms::CMSException){}
- };
-
-}}
-
-#endif /*ACTIVEMQ_TANSPORT_DUMMYTRANSPORT_H_*/
+#ifndef ACTIVEMQ_TANSPORT_DUMMYTRANSPORT_H_
+#define ACTIVEMQ_TANSPORT_DUMMYTRANSPORT_H_
+
+#include <activemq/transport/Transport.h>
+#include <activemq/concurrent/Concurrent.h>
+#include <activemq/transport/CommandListener.h>
+#include <activemq/transport/TransportExceptionListener.h>
+#include <activemq/transport/CommandIOException.h>
+#include <activemq/concurrent/Concurrent.h>
+#include <activemq/concurrent/Mutex.h>
+#include <activemq/concurrent/Thread.h>
+
+namespace activemq{
+namespace transport{
+
+ class DummyTransport : public Transport{
+
+ public:
+
+ class ResponseBuilder{
+ public:
+ virtual ~ResponseBuilder(){}
+
+ virtual Response* buildResponse( const Command* cmd ) = 0;
+ };
+
+ class InternalCommandListener :
+ public CommandListener,
+ public concurrent::Thread
+ {
+ private:
+
+ DummyTransport* transport;
+ ResponseBuilder* responseBuilder;
+ concurrent::Mutex mutex;
+ Command* command;
+ bool done;
+
+ public:
+
+ InternalCommandListener(void) {
+ command = NULL;
+ transport = NULL;
+ responseBuilder = NULL;
+ done = false;
+
+ this->start();
+ }
+
+ virtual ~InternalCommandListener() {
+ done = true;
+ synchronized( &mutex )
+ {
+ mutex.notifyAll();
+ }
+ this->join();
+ }
+
+ void setTransport( DummyTransport* transport ){
+ this->transport = transport;
+ }
+
+ void setResponseBuilder( ResponseBuilder* responseBuilder ) {
+ this->responseBuilder = responseBuilder;
+ }
+
+ virtual void onCommand( Command* command )
+ {
+ synchronized( &mutex )
+ {
+ this->command = command;
+
+ mutex.notifyAll();
+ }
+ }
+
+ void run(void)
+ {
+ try
+ {
+ synchronized( &mutex )
+ {
+ while( !done )
+ {
+ mutex.wait();
+
+ if( command == NULL )
+ {
+ continue;
+ }
+
+ concurrent::Thread::sleep( 100 );
+
+ if( responseBuilder != NULL &&
+ transport != NULL )
+ {
+ transport->fireCommand(
+ responseBuilder->buildResponse(
+ command ) );
+
+ command = NULL;
+
+ return;
+ }
+ }
+ }
+ }
+ AMQ_CATCHALL_NOTHROW()
+ }
+ };
+
+ private:
+
+ ResponseBuilder* responseBuilder;
+ CommandListener* commandListener;
+ CommandListener* outgoingCommandListener;
+ TransportExceptionListener* exceptionListener;
+ unsigned int nextCommandId;
+ concurrent::Mutex commandIdMutex;
+ bool own;
+ InternalCommandListener defaultListener;
+
+ public:
+
+ DummyTransport( ResponseBuilder* responseBuilder ,
+ bool own = false,
+ bool useDefOutgoing = false ){
+
+ this->responseBuilder = NULL;
+ this->commandListener = NULL;
+ this->outgoingCommandListener = NULL;
+ this->exceptionListener = NULL;
+ this->responseBuilder = responseBuilder;
+ this->own = own;
+ this->nextCommandId = 0;
+ if( useDefOutgoing )
+ {
+ this->outgoingCommandListener = &defaultListener;
+ this->defaultListener.setTransport( this );
+ this->defaultListener.setResponseBuilder( responseBuilder );
+ }
+ }
+
+ virtual ~DummyTransport(){
+ if( own ){
+ delete responseBuilder;
+ }
+ }
+
+ void setResponseBuilder( ResponseBuilder* responseBuilder ){
+ this->responseBuilder = responseBuilder;
+ }
+
+ unsigned int getNextCommandId() throw (exceptions::ActiveMQException){
+
+ try{
+ synchronized( &commandIdMutex ){
+ return ++nextCommandId;
+ }
+
+ // Should never get here, but some compilers aren't
+ // smart enough to figure out we'll never get here.
+ return 0;
+ }
+ AMQ_CATCHALL_THROW( transport::CommandIOException )
+ }
+
+ virtual void oneway( Command* command )
+ throw(CommandIOException, exceptions::UnsupportedOperationException)
+ {
+ if( outgoingCommandListener != NULL ){
+
+ command->setCommandId( getNextCommandId() );
+ command->setResponseRequired( false );
+ outgoingCommandListener->onCommand( command );
+ return;
+ }
+ }
+
+ virtual Response* request( Command* command )
+ throw(CommandIOException,
+ exceptions::UnsupportedOperationException)
+ {
+ if( responseBuilder != NULL ){
+ command->setCommandId( getNextCommandId() );
+ command->setResponseRequired( true );
+ return responseBuilder->buildResponse( command );
+ }
+
+ throw CommandIOException( __FILE__, __LINE__,
+ "no response builder available" );
+ }
+
+ virtual void setCommandListener( CommandListener* listener ){
+ this->commandListener = listener;
+ }
+
+ virtual void setOutgoingCommandListener( CommandListener* listener ){
+ outgoingCommandListener = listener;
+ }
+
+ virtual void setCommandReader( CommandReader* reader ){}
+
+ virtual void setCommandWriter( CommandWriter* writer ){}
+
+ virtual void setTransportExceptionListener(
+ TransportExceptionListener* listener )
+ {
+ this->exceptionListener = listener;
+ }
+
+ virtual void fireCommand( Command* cmd ){
+ if( commandListener != NULL ){
+ commandListener->onCommand( cmd );
+ }
+ }
+
+ virtual void fireException( const exceptions::ActiveMQException& ex ){
+ if( exceptionListener != NULL ){
+ exceptionListener->onTransportException( this, ex );
+ }
+ }
+
+ virtual void start() throw (cms::CMSException){}
+ virtual void close() throw (cms::CMSException){}
+ };
+
+}}
+
+#endif /*ACTIVEMQ_TANSPORT_DUMMYTRANSPORT_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/DummyTransport.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/DummyTransportFactory.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/DummyTransportFactory.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/IOTransportTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/IOTransportTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/ResponseCorrelatorTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/ResponseCorrelatorTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/TransportFactoryMapRegistrarTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/TransportFactoryMapRegistrarTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/TransportFactoryMapRegistrarTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/TransportFactoryMapRegistrarTest.cpp Wed Jul 5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "TransportFactoryMapRegistrarTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::transport::TransportFactoryMapRegistrarTest );
+#include "TransportFactoryMapRegistrarTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::transport::TransportFactoryMapRegistrarTest );
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/TransportFactoryMapRegistrarTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/TransportFactoryMapRegistrarTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/TransportFactoryMapTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/transport/TransportFactoryMapTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/BooleanTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/BooleanTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/BooleanTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/BooleanTest.cpp Wed Jul 5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "BooleanTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::BooleanTest );
+#include "BooleanTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::BooleanTest );
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/BooleanTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/BooleanTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/BooleanTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/BooleanTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/BooleanTest.h Wed Jul 5 15:27:34 2006
@@ -1,47 +1,47 @@
-#ifndef _ACTIVEMQ_UTIL_BOOLEANTEST_H_
-#define _ACTIVEMQ_UTIL_BOOLEANTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/util/Boolean.h>
-
-namespace activemq{
-namespace util{
-
- class BooleanTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( BooleanTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- BooleanTest() {}
- virtual ~BooleanTest() {}
-
- virtual void test(void)
- {
- bool x = Boolean::parseBoolean("false");
- bool y = Boolean::parseBoolean("true");
- bool z = Boolean::parseBoolean("false");
-
- CPPUNIT_ASSERT( x == false );
- CPPUNIT_ASSERT( y == true );
- CPPUNIT_ASSERT( z == false );
-
- std::string x1 = Boolean::toString( x );
- std::string y1 = Boolean::toString( y );
- std::string z1 = Boolean::toString( z );
-
- CPPUNIT_ASSERT( x1 == "false" );
- CPPUNIT_ASSERT( y1 == "true" );
- CPPUNIT_ASSERT( z1 == "false" );
-
- }
-
- };
-
-}}
-
-#endif /*_ACTIVEMQ_UTIL_BOOLEANTEST_H_*/
+#ifndef _ACTIVEMQ_UTIL_BOOLEANTEST_H_
+#define _ACTIVEMQ_UTIL_BOOLEANTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/util/Boolean.h>
+
+namespace activemq{
+namespace util{
+
+ class BooleanTest : public CppUnit::TestFixture
+ {
+ CPPUNIT_TEST_SUITE( BooleanTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ BooleanTest() {}
+ virtual ~BooleanTest() {}
+
+ virtual void test(void)
+ {
+ bool x = Boolean::parseBoolean("false");
+ bool y = Boolean::parseBoolean("true");
+ bool z = Boolean::parseBoolean("false");
+
+ CPPUNIT_ASSERT( x == false );
+ CPPUNIT_ASSERT( y == true );
+ CPPUNIT_ASSERT( z == false );
+
+ std::string x1 = Boolean::toString( x );
+ std::string y1 = Boolean::toString( y );
+ std::string z1 = Boolean::toString( z );
+
+ CPPUNIT_ASSERT( x1 == "false" );
+ CPPUNIT_ASSERT( y1 == "true" );
+ CPPUNIT_ASSERT( z1 == "false" );
+
+ }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_BOOLEANTEST_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/BooleanTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/GuidTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/GuidTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/GuidTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/GuidTest.cpp Wed Jul 5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "GuidTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::GuidTest );
+#include "GuidTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::GuidTest );
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/GuidTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/GuidTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/GuidTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/GuidTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/GuidTest.h Wed Jul 5 15:27:34 2006
@@ -1,78 +1,78 @@
-#ifndef _ACTIVEMQ_UTIL_GUIDTEST_H_
-#define _ACTIVEMQ_UTIL_GUIDTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/util/Guid.h>
-
-namespace activemq{
-namespace util{
-
- class GuidTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( GuidTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- virtual ~GuidTest() {}
-
- void test(void)
- {
- util::Guid guid;
-
- guid.createGUID();
-
- CPPUNIT_ASSERT( guid.toString() == (std::string)guid );
-
- Guid copy = guid;
-
- CPPUNIT_ASSERT( guid == copy );
- CPPUNIT_ASSERT( !(guid < copy) );
- CPPUNIT_ASSERT( guid <= copy );
- CPPUNIT_ASSERT( !(guid > copy) );
- CPPUNIT_ASSERT( guid >= copy );
-
- std::string less = "0f2bd21c-9fee-4067-d739-c4d84a5d7f62";
- std::string more = "1f2bd21c-9fee-4067-d739-c4d84a5d7f62";
-
- CPPUNIT_ASSERT( less < more );
- CPPUNIT_ASSERT( less <= more );
- CPPUNIT_ASSERT( !(less > more) );
- CPPUNIT_ASSERT( !(less >= more) );
-
- less = more;
-
- CPPUNIT_ASSERT( less == more );
-
- const unsigned char* bytes = guid.toBytes();
-
- Guid bytesGUID;
- bytesGUID.fromBytes(bytes);
-
- CPPUNIT_ASSERT( guid == bytesGUID );
-
- delete bytes;
-
- Guid bytesGUID2;
- bytesGUID2.fromBytes((const unsigned char*)guid);
-
- CPPUNIT_ASSERT( guid == bytesGUID2 );
-
- Guid stringGUID(guid.toString());
-
- CPPUNIT_ASSERT( stringGUID == guid );
-
- Guid stringGUID2(guid.toString().c_str());
-
- CPPUNIT_ASSERT( stringGUID2 == guid );
- CPPUNIT_ASSERT( !(stringGUID2 != guid) );
-
- }
- };
-
-}}
-
-#endif /*_ACTIVEMQ_UTIL_GUIDTEST_H_*/
+#ifndef _ACTIVEMQ_UTIL_GUIDTEST_H_
+#define _ACTIVEMQ_UTIL_GUIDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/util/Guid.h>
+
+namespace activemq{
+namespace util{
+
+ class GuidTest : public CppUnit::TestFixture
+ {
+ CPPUNIT_TEST_SUITE( GuidTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ virtual ~GuidTest() {}
+
+ void test(void)
+ {
+ util::Guid guid;
+
+ guid.createGUID();
+
+ CPPUNIT_ASSERT( guid.toString() == (std::string)guid );
+
+ Guid copy = guid;
+
+ CPPUNIT_ASSERT( guid == copy );
+ CPPUNIT_ASSERT( !(guid < copy) );
+ CPPUNIT_ASSERT( guid <= copy );
+ CPPUNIT_ASSERT( !(guid > copy) );
+ CPPUNIT_ASSERT( guid >= copy );
+
+ std::string less = "0f2bd21c-9fee-4067-d739-c4d84a5d7f62";
+ std::string more = "1f2bd21c-9fee-4067-d739-c4d84a5d7f62";
+
+ CPPUNIT_ASSERT( less < more );
+ CPPUNIT_ASSERT( less <= more );
+ CPPUNIT_ASSERT( !(less > more) );
+ CPPUNIT_ASSERT( !(less >= more) );
+
+ less = more;
+
+ CPPUNIT_ASSERT( less == more );
+
+ const unsigned char* bytes = guid.toBytes();
+
+ Guid bytesGUID;
+ bytesGUID.fromBytes(bytes);
+
+ CPPUNIT_ASSERT( guid == bytesGUID );
+
+ delete bytes;
+
+ Guid bytesGUID2;
+ bytesGUID2.fromBytes((const unsigned char*)guid);
+
+ CPPUNIT_ASSERT( guid == bytesGUID2 );
+
+ Guid stringGUID(guid.toString());
+
+ CPPUNIT_ASSERT( stringGUID == guid );
+
+ Guid stringGUID2(guid.toString().c_str());
+
+ CPPUNIT_ASSERT( stringGUID2 == guid );
+ CPPUNIT_ASSERT( !(stringGUID2 != guid) );
+
+ }
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_GUIDTEST_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/GuidTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/IntegerTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/IntegerTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/IntegerTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/IntegerTest.cpp Wed Jul 5 15:27:34 2006
@@ -1,4 +1,4 @@
-#include "IntegerTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::IntegerTest );
-
+#include "IntegerTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::IntegerTest );
+
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/IntegerTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/IntegerTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/IntegerTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/IntegerTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/IntegerTest.h Wed Jul 5 15:27:34 2006
@@ -1,47 +1,47 @@
-#ifndef INTEGERTEST_H_
-#define INTEGERTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/util/Integer.h>
-
-namespace activemq{
-namespace util{
-
- class IntegerTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( IntegerTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- IntegerTest(void) {}
- virtual ~IntegerTest(void) {}
-
- virtual void test(void)
- {
- int x = Integer::parseInt("12");
- int y = Integer::parseInt("12.1");
- int z = Integer::parseInt("42 24");
-
- CPPUNIT_ASSERT( x == 12 );
- CPPUNIT_ASSERT( y == 12 );
- CPPUNIT_ASSERT( z == 42 );
-
- std::string x1 = Integer::toString( x );
- std::string y1 = Integer::toString( y );
- std::string z1 = Integer::toString( z );
-
- CPPUNIT_ASSERT( x1 == "12" );
- CPPUNIT_ASSERT( y1 == "12" );
- CPPUNIT_ASSERT( z1 == "42" );
-
- }
-
- };
-
-}}
-
-#endif /*INTEGERTEST_H_*/
+#ifndef INTEGERTEST_H_
+#define INTEGERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/util/Integer.h>
+
+namespace activemq{
+namespace util{
+
+ class IntegerTest : public CppUnit::TestFixture
+ {
+ CPPUNIT_TEST_SUITE( IntegerTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ IntegerTest(void) {}
+ virtual ~IntegerTest(void) {}
+
+ virtual void test(void)
+ {
+ int x = Integer::parseInt("12");
+ int y = Integer::parseInt("12.1");
+ int z = Integer::parseInt("42 24");
+
+ CPPUNIT_ASSERT( x == 12 );
+ CPPUNIT_ASSERT( y == 12 );
+ CPPUNIT_ASSERT( z == 42 );
+
+ std::string x1 = Integer::toString( x );
+ std::string y1 = Integer::toString( y );
+ std::string z1 = Integer::toString( z );
+
+ CPPUNIT_ASSERT( x1 == "12" );
+ CPPUNIT_ASSERT( y1 == "12" );
+ CPPUNIT_ASSERT( z1 == "42" );
+
+ }
+
+ };
+
+}}
+
+#endif /*INTEGERTEST_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/IntegerTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/LongTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/LongTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/LongTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/LongTest.cpp Wed Jul 5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "LongTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::LongTest );
+#include "LongTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::LongTest );
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/LongTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/LongTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/LongTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/LongTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/LongTest.h Wed Jul 5 15:27:34 2006
@@ -1,47 +1,47 @@
-#ifndef _ACTIVEMQ_UTIL_LONGTEST_H_
-#define _ACTIVEMQ_UTIL_LONGTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/util/Long.h>
-
-namespace activemq{
-namespace util{
-
- class LongTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( LongTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- LongTest() {}
- virtual ~LongTest() {}
-
- virtual void test(void)
- {
- long x = Long::parseLong("12");
- long y = Long::parseLong("12.1");
- long z = Long::parseLong("42 24");
-
- CPPUNIT_ASSERT( x == 12 );
- CPPUNIT_ASSERT( y == 12 );
- CPPUNIT_ASSERT( z == 42 );
-
- std::string x1 = Long::toString( x );
- std::string y1 = Long::toString( y );
- std::string z1 = Long::toString( z );
-
- CPPUNIT_ASSERT( x1 == "12" );
- CPPUNIT_ASSERT( y1 == "12" );
- CPPUNIT_ASSERT( z1 == "42" );
-
- }
-
- };
-
-}}
-
-#endif /*_ACTIVEMQ_UTIL_LONGTEST_H_*/
+#ifndef _ACTIVEMQ_UTIL_LONGTEST_H_
+#define _ACTIVEMQ_UTIL_LONGTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/util/Long.h>
+
+namespace activemq{
+namespace util{
+
+ class LongTest : public CppUnit::TestFixture
+ {
+ CPPUNIT_TEST_SUITE( LongTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ LongTest() {}
+ virtual ~LongTest() {}
+
+ virtual void test(void)
+ {
+ long x = Long::parseLong("12");
+ long y = Long::parseLong("12.1");
+ long z = Long::parseLong("42 24");
+
+ CPPUNIT_ASSERT( x == 12 );
+ CPPUNIT_ASSERT( y == 12 );
+ CPPUNIT_ASSERT( z == 42 );
+
+ std::string x1 = Long::toString( x );
+ std::string y1 = Long::toString( y );
+ std::string z1 = Long::toString( z );
+
+ CPPUNIT_ASSERT( x1 == "12" );
+ CPPUNIT_ASSERT( y1 == "12" );
+ CPPUNIT_ASSERT( z1 == "42" );
+
+ }
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_LONGTEST_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/LongTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/QueueTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/QueueTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/QueueTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/QueueTest.cpp Wed Jul 5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "QueueTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::QueueTest );
+#include "QueueTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::QueueTest );
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/QueueTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/QueueTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/QueueTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/QueueTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/QueueTest.h Wed Jul 5 15:27:34 2006
@@ -1,50 +1,50 @@
-#ifndef _ACTIVEMQ_UTIL_QUEUETEST_H_
-#define _ACTIVEMQ_UTIL_QUEUETEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/util/Queue.h>
-
-namespace activemq{
-namespace util{
-
- class QueueTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( QueueTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- virtual ~QueueTest() {}
-
- void test()
- {
- Queue<char> q;
-
- CPPUNIT_ASSERT( q.empty() == true );
- CPPUNIT_ASSERT( q.size() == 0 );
-
- q.push('a');
-
- CPPUNIT_ASSERT( q.front() == 'a' );
-
- q.pop();
-
- CPPUNIT_ASSERT( q.empty() == true );
-
- q.push('b');
- q.push('c');
-
- CPPUNIT_ASSERT( q.size() == 2 );
-
- CPPUNIT_ASSERT( q.front() == 'b' );
- CPPUNIT_ASSERT( q.back() == 'c' );
-
- }
- };
-
-}}
-
-#endif /*_ACTIVEMQ_UTIL_QUEUETEST_H_*/
+#ifndef _ACTIVEMQ_UTIL_QUEUETEST_H_
+#define _ACTIVEMQ_UTIL_QUEUETEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/util/Queue.h>
+
+namespace activemq{
+namespace util{
+
+ class QueueTest : public CppUnit::TestFixture {
+
+ CPPUNIT_TEST_SUITE( QueueTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+
+ virtual ~QueueTest() {}
+
+ void test()
+ {
+ Queue<char> q;
+
+ CPPUNIT_ASSERT( q.empty() == true );
+ CPPUNIT_ASSERT( q.size() == 0 );
+
+ q.push('a');
+
+ CPPUNIT_ASSERT( q.front() == 'a' );
+
+ q.pop();
+
+ CPPUNIT_ASSERT( q.empty() == true );
+
+ q.push('b');
+ q.push('c');
+
+ CPPUNIT_ASSERT( q.size() == 2 );
+
+ CPPUNIT_ASSERT( q.front() == 'b' );
+ CPPUNIT_ASSERT( q.back() == 'c' );
+
+ }
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_QUEUETEST_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/QueueTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/StringTokenizerTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/StringTokenizerTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/StringTokenizerTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/StringTokenizerTest.cpp Wed Jul 5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "StringTokenizerTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::StringTokenizerTest );
+#include "StringTokenizerTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::StringTokenizerTest );
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/StringTokenizerTest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/StringTokenizerTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/StringTokenizerTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/StringTokenizerTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/StringTokenizerTest.h Wed Jul 5 15:27:34 2006
@@ -1,99 +1,99 @@
-#ifndef _ACTIVEMQ_UTIL_STRINGTOKENIZERTEST_H_
-#define _ACTIVEMQ_UTIL_STRINGTOKENIZERTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/util/StringTokenizer.h>
-
-namespace activemq{
-namespace util{
-
- class StringTokenizerTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( StringTokenizerTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
- public:
-
- virtual ~StringTokenizerTest() {}
-
- void test()
- {
- StringTokenizer tokenizer("stomp://127.0.0.1:23232", "://");
- CPPUNIT_ASSERT( tokenizer.countTokens() == 3 );
- CPPUNIT_ASSERT( tokenizer.nextToken() == "stomp" );
- CPPUNIT_ASSERT( tokenizer.nextToken() == "127.0.0.1" );
- CPPUNIT_ASSERT( tokenizer.nextToken() == "23232" );
-
- StringTokenizer tokenizer1("::://stomp://127.0.0.1:23232:", ":/");
- CPPUNIT_ASSERT( tokenizer1.countTokens() == 3 );
- CPPUNIT_ASSERT( tokenizer1.nextToken() == "stomp" );
- CPPUNIT_ASSERT( tokenizer1.nextToken() == "127.0.0.1" );
- CPPUNIT_ASSERT( tokenizer1.nextToken() == "23232" );
-
- StringTokenizer tokenizer2("test");
- CPPUNIT_ASSERT( tokenizer2.countTokens() == 1 );
- CPPUNIT_ASSERT( tokenizer2.hasMoreTokens() == true );
- CPPUNIT_ASSERT( tokenizer2.nextToken() == "test" );
- CPPUNIT_ASSERT( tokenizer2.hasMoreTokens() == false );
-
- StringTokenizer tokenizer3(":", ":");
- CPPUNIT_ASSERT( tokenizer3.countTokens() == 0 );
- CPPUNIT_ASSERT( tokenizer3.hasMoreTokens() == false );
- CPPUNIT_ASSERT( tokenizer3.nextToken(" ") == ":" );
-
- try
- {
- tokenizer3.nextToken();
-
- CPPUNIT_ASSERT( false );
- }
- catch(exceptions::NoSuchElementException ex)
- {
- CPPUNIT_ASSERT( true );
- }
-
- StringTokenizer tokenizer4("the quick brown fox");
- CPPUNIT_ASSERT( tokenizer4.countTokens() == 4 );
- CPPUNIT_ASSERT( tokenizer4.hasMoreTokens() == true );
- CPPUNIT_ASSERT( tokenizer4.nextToken() == "the" );
- CPPUNIT_ASSERT( tokenizer4.nextToken() == "quick" );
- CPPUNIT_ASSERT( tokenizer4.nextToken() == "brown" );
- CPPUNIT_ASSERT( tokenizer4.nextToken() == "fox" );
- CPPUNIT_ASSERT( tokenizer4.countTokens() == 0 );
- CPPUNIT_ASSERT( tokenizer4.hasMoreTokens() == false );
-
- StringTokenizer tokenizer5("the:quick:brown:fox", ":", true);
- CPPUNIT_ASSERT( tokenizer5.countTokens() == 7 );
- CPPUNIT_ASSERT( tokenizer5.hasMoreTokens() == true );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == "the" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == ":" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == "quick" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == ":" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == "brown" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == ":" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == "fox" );
- CPPUNIT_ASSERT( tokenizer5.countTokens() == 0 );
- CPPUNIT_ASSERT( tokenizer5.hasMoreTokens() == false );
-
- std::vector<std::string> myArray;
- StringTokenizer tokenizer6("the:quick:brown:fox", ":");
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 4 );
- CPPUNIT_ASSERT( tokenizer6.toArray(myArray) == 4 );
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 0 );
- tokenizer6.reset();
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 4 );
- tokenizer6.reset("the:quick:brown:fox", "$");
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 1 );
- tokenizer6.reset("this$is$a$test");
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 4 );
- tokenizer6.reset("this$is$a$test", "$", true);
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 7 );
-
- }
- };
-
-}}
-
-#endif /*_ACTIVEMQ_UTIL_STRINGTOKENIZERTEST_H_*/
+#ifndef _ACTIVEMQ_UTIL_STRINGTOKENIZERTEST_H_
+#define _ACTIVEMQ_UTIL_STRINGTOKENIZERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/util/StringTokenizer.h>
+
+namespace activemq{
+namespace util{
+
+ class StringTokenizerTest : public CppUnit::TestFixture
+ {
+ CPPUNIT_TEST_SUITE( StringTokenizerTest );
+ CPPUNIT_TEST( test );
+ CPPUNIT_TEST_SUITE_END();
+ public:
+
+ virtual ~StringTokenizerTest() {}
+
+ void test()
+ {
+ StringTokenizer tokenizer("stomp://127.0.0.1:23232", "://");
+ CPPUNIT_ASSERT( tokenizer.countTokens() == 3 );
+ CPPUNIT_ASSERT( tokenizer.nextToken() == "stomp" );
+ CPPUNIT_ASSERT( tokenizer.nextToken() == "127.0.0.1" );
+ CPPUNIT_ASSERT( tokenizer.nextToken() == "23232" );
+
+ StringTokenizer tokenizer1("::://stomp://127.0.0.1:23232:", ":/");
+ CPPUNIT_ASSERT( tokenizer1.countTokens() == 3 );
+ CPPUNIT_ASSERT( tokenizer1.nextToken() == "stomp" );
+ CPPUNIT_ASSERT( tokenizer1.nextToken() == "127.0.0.1" );
+ CPPUNIT_ASSERT( tokenizer1.nextToken() == "23232" );
+
+ StringTokenizer tokenizer2("test");
+ CPPUNIT_ASSERT( tokenizer2.countTokens() == 1 );
+ CPPUNIT_ASSERT( tokenizer2.hasMoreTokens() == true );
+ CPPUNIT_ASSERT( tokenizer2.nextToken() == "test" );
+ CPPUNIT_ASSERT( tokenizer2.hasMoreTokens() == false );
+
+ StringTokenizer tokenizer3(":", ":");
+ CPPUNIT_ASSERT( tokenizer3.countTokens() == 0 );
+ CPPUNIT_ASSERT( tokenizer3.hasMoreTokens() == false );
+ CPPUNIT_ASSERT( tokenizer3.nextToken(" ") == ":" );
+
+ try
+ {
+ tokenizer3.nextToken();
+
+ CPPUNIT_ASSERT( false );
+ }
+ catch(exceptions::NoSuchElementException ex)
+ {
+ CPPUNIT_ASSERT( true );
+ }
+
+ StringTokenizer tokenizer4("the quick brown fox");
+ CPPUNIT_ASSERT( tokenizer4.countTokens() == 4 );
+ CPPUNIT_ASSERT( tokenizer4.hasMoreTokens() == true );
+ CPPUNIT_ASSERT( tokenizer4.nextToken() == "the" );
+ CPPUNIT_ASSERT( tokenizer4.nextToken() == "quick" );
+ CPPUNIT_ASSERT( tokenizer4.nextToken() == "brown" );
+ CPPUNIT_ASSERT( tokenizer4.nextToken() == "fox" );
+ CPPUNIT_ASSERT( tokenizer4.countTokens() == 0 );
+ CPPUNIT_ASSERT( tokenizer4.hasMoreTokens() == false );
+
+ StringTokenizer tokenizer5("the:quick:brown:fox", ":", true);
+ CPPUNIT_ASSERT( tokenizer5.countTokens() == 7 );
+ CPPUNIT_ASSERT( tokenizer5.hasMoreTokens() == true );
+ CPPUNIT_ASSERT( tokenizer5.nextToken() == "the" );
+ CPPUNIT_ASSERT( tokenizer5.nextToken() == ":" );
+ CPPUNIT_ASSERT( tokenizer5.nextToken() == "quick" );
+ CPPUNIT_ASSERT( tokenizer5.nextToken() == ":" );
+ CPPUNIT_ASSERT( tokenizer5.nextToken() == "brown" );
+ CPPUNIT_ASSERT( tokenizer5.nextToken() == ":" );
+ CPPUNIT_ASSERT( tokenizer5.nextToken() == "fox" );
+ CPPUNIT_ASSERT( tokenizer5.countTokens() == 0 );
+ CPPUNIT_ASSERT( tokenizer5.hasMoreTokens() == false );
+
+ std::vector<std::string> myArray;
+ StringTokenizer tokenizer6("the:quick:brown:fox", ":");
+ CPPUNIT_ASSERT( tokenizer6.countTokens() == 4 );
+ CPPUNIT_ASSERT( tokenizer6.toArray(myArray) == 4 );
+ CPPUNIT_ASSERT( tokenizer6.countTokens() == 0 );
+ tokenizer6.reset();
+ CPPUNIT_ASSERT( tokenizer6.countTokens() == 4 );
+ tokenizer6.reset("the:quick:brown:fox", "$");
+ CPPUNIT_ASSERT( tokenizer6.countTokens() == 1 );
+ tokenizer6.reset("this$is$a$test");
+ CPPUNIT_ASSERT( tokenizer6.countTokens() == 4 );
+ tokenizer6.reset("this$is$a$test", "$", true);
+ CPPUNIT_ASSERT( tokenizer6.countTokens() == 7 );
+
+ }
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_STRINGTOKENIZERTEST_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/util/StringTokenizerTest.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/test/main.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/AcknowledgementMode.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/AcknowledgementMode.hpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/AcknowledgementMode.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/AcknowledgementMode.hpp Wed Jul 5 15:27:34 2006
@@ -1,31 +1,31 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ActiveMQ_AcknowledgementMode_hpp_
-#define ActiveMQ_AcknowledgementMode_hpp_
-
-namespace apache
-{
- namespace activemq
- {
- enum AcknowledgementMode {
- UnknownAckMode, AutoAckMode, ClientAckMode, TransactionalAckMode
- };
- }
-}
-
-#endif /*ActiveMQ_AcknowledgementMode_hpp_*/
-
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ActiveMQ_AcknowledgementMode_hpp_
+#define ActiveMQ_AcknowledgementMode_hpp_
+
+namespace apache
+{
+ namespace activemq
+ {
+ enum AcknowledgementMode {
+ UnknownAckMode, AutoAckMode, ClientAckMode, TransactionalAckMode
+ };
+ }
+}
+
+#endif /*ActiveMQ_AcknowledgementMode_hpp_*/
+
Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/AcknowledgementMode.hpp
------------------------------------------------------------------------------
svn:eol-style = native