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 [23/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/connector/stomp/marshal/MarshalerTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/marshal/MarshalerTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/marshal/MarshalerTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/marshal/MarshalerTest.h Wed Jul  5 15:27:34 2006
@@ -1,104 +1,104 @@
-#ifndef _ACTIVEMQ_CONNECTOR_STOMP_MARSHAL_MARSHALERTEST_H_
-#define _ACTIVEMQ_CONNECTOR_STOMP_MARSHAL_MARSHALERTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/transport/Command.h>
-#include <activemq/connector/stomp/StompTopic.h>
-#include <activemq/connector/stomp/commands/ConnectedCommand.h>
-#include <activemq/connector/stomp/commands/TextMessageCommand.h>
-#include <activemq/connector/stomp/commands/BytesMessageCommand.h>
-#include <activemq/connector/stomp/marshal/Marshaler.h>
-
-namespace activemq{
-namespace connector{
-namespace stomp{
-namespace marshal{
-
-    class MarshalerTest : public CppUnit::TestFixture
-    {
-        CPPUNIT_TEST_SUITE( MarshalerTest );
-        CPPUNIT_TEST( test );
-        CPPUNIT_TEST_SUITE_END();
-
-    public:
-    
-    	MarshalerTest() {}
-    	virtual ~MarshalerTest() {}
-
-        void test( void )
-        {
-            Marshaler marshaler;
-            
-            commands::ConnectedCommand   connectedCommand;
-            commands::TextMessageCommand textCommand;
-            commands::BytesMessageCommand bytesCommand;
-            
-            // Sync to expected output
-            connectedCommand.setSessionId( "test" );
-
-            // Sync to expected output
-            textCommand.setCMSDestination( StompTopic("a") );
-            textCommand.setCMSMessageId( "123" );
-            textCommand.getProperties().setProperty( 
-                "sampleProperty", "testvalue" );
-            textCommand.setText( "testMessage" );
-
-            // Sync to expected output
-            bytesCommand.setCMSDestination( StompTopic("a") );
-            bytesCommand.setCMSMessageId( "123" );
-            bytesCommand.getProperties().setProperty( 
-                "sampleProperty", "testvalue" );
-            bytesCommand.setBodyBytes( 
-                (const unsigned char*)"123456789\0", 10 );
-            
-            StompFrame* connectedFrame = 
-                marshaler.marshal( &connectedCommand ).clone();
-            StompFrame* textFrame = 
-                marshaler.marshal( &textCommand ).clone();
-            StompFrame* bytesFrame = 
-                marshaler.marshal( &bytesCommand ).clone();
-
-            CPPUNIT_ASSERT( connectedFrame != NULL );
-            CPPUNIT_ASSERT( textFrame != NULL );
-            CPPUNIT_ASSERT( bytesFrame != NULL );
-
-            commands::ConnectedCommand   connectedCommand1( connectedFrame );
-            commands::TextMessageCommand textCommand1( textFrame );
-            commands::BytesMessageCommand bytesCommand1( bytesFrame );
-            
-            // Connected Tests
-            CPPUNIT_ASSERT( connectedCommand.getCommandId() == 
-                            connectedCommand1.getCommandId() );
-            CPPUNIT_ASSERT( connectedCommand.getStompCommandId() == 
-                            connectedCommand1.getStompCommandId() );
-            CPPUNIT_ASSERT( connectedCommand.isResponseRequired() == 
-                            connectedCommand1.isResponseRequired() );
-            CPPUNIT_ASSERT( connectedCommand.getCorrelationId() == 
-                            connectedCommand1.getCorrelationId() );
-
-            // TextMessage Tests
-            CPPUNIT_ASSERT( textCommand.getCommandId() == 
-                            textCommand1.getCommandId() );
-            CPPUNIT_ASSERT( textCommand.getStompCommandId() == 
-                            textCommand1.getStompCommandId() );
-            CPPUNIT_ASSERT( std::string( textCommand.getText() ) == 
-                            textCommand1.getText() );
-
-            // BytesMessage Tests
-            CPPUNIT_ASSERT( bytesCommand.getCommandId() == 
-                            bytesCommand1.getCommandId() );
-            CPPUNIT_ASSERT( bytesCommand.getStompCommandId() == 
-                            bytesCommand1.getStompCommandId() );
-            CPPUNIT_ASSERT( std::string( (const char*)bytesCommand.getBodyBytes() ) == 
-                            (const char*)bytesCommand1.getBodyBytes() );
-            
-
-        }
-
-    };
-
-}}}}
-
-#endif /*_ACTIVEMQ_CONNECTOR_STOMP_MARSHAL_MARSHALERTEST_H_*/
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_MARSHAL_MARSHALERTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_MARSHAL_MARSHALERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/transport/Command.h>
+#include <activemq/connector/stomp/StompTopic.h>
+#include <activemq/connector/stomp/commands/ConnectedCommand.h>
+#include <activemq/connector/stomp/commands/TextMessageCommand.h>
+#include <activemq/connector/stomp/commands/BytesMessageCommand.h>
+#include <activemq/connector/stomp/marshal/Marshaler.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace marshal{
+
+    class MarshalerTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( MarshalerTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+    
+    	MarshalerTest() {}
+    	virtual ~MarshalerTest() {}
+
+        void test( void )
+        {
+            Marshaler marshaler;
+            
+            commands::ConnectedCommand   connectedCommand;
+            commands::TextMessageCommand textCommand;
+            commands::BytesMessageCommand bytesCommand;
+            
+            // Sync to expected output
+            connectedCommand.setSessionId( "test" );
+
+            // Sync to expected output
+            textCommand.setCMSDestination( StompTopic("a") );
+            textCommand.setCMSMessageId( "123" );
+            textCommand.getProperties().setProperty( 
+                "sampleProperty", "testvalue" );
+            textCommand.setText( "testMessage" );
+
+            // Sync to expected output
+            bytesCommand.setCMSDestination( StompTopic("a") );
+            bytesCommand.setCMSMessageId( "123" );
+            bytesCommand.getProperties().setProperty( 
+                "sampleProperty", "testvalue" );
+            bytesCommand.setBodyBytes( 
+                (const unsigned char*)"123456789\0", 10 );
+            
+            StompFrame* connectedFrame = 
+                marshaler.marshal( &connectedCommand ).clone();
+            StompFrame* textFrame = 
+                marshaler.marshal( &textCommand ).clone();
+            StompFrame* bytesFrame = 
+                marshaler.marshal( &bytesCommand ).clone();
+
+            CPPUNIT_ASSERT( connectedFrame != NULL );
+            CPPUNIT_ASSERT( textFrame != NULL );
+            CPPUNIT_ASSERT( bytesFrame != NULL );
+
+            commands::ConnectedCommand   connectedCommand1( connectedFrame );
+            commands::TextMessageCommand textCommand1( textFrame );
+            commands::BytesMessageCommand bytesCommand1( bytesFrame );
+            
+            // Connected Tests
+            CPPUNIT_ASSERT( connectedCommand.getCommandId() == 
+                            connectedCommand1.getCommandId() );
+            CPPUNIT_ASSERT( connectedCommand.getStompCommandId() == 
+                            connectedCommand1.getStompCommandId() );
+            CPPUNIT_ASSERT( connectedCommand.isResponseRequired() == 
+                            connectedCommand1.isResponseRequired() );
+            CPPUNIT_ASSERT( connectedCommand.getCorrelationId() == 
+                            connectedCommand1.getCorrelationId() );
+
+            // TextMessage Tests
+            CPPUNIT_ASSERT( textCommand.getCommandId() == 
+                            textCommand1.getCommandId() );
+            CPPUNIT_ASSERT( textCommand.getStompCommandId() == 
+                            textCommand1.getStompCommandId() );
+            CPPUNIT_ASSERT( std::string( textCommand.getText() ) == 
+                            textCommand1.getText() );
+
+            // BytesMessage Tests
+            CPPUNIT_ASSERT( bytesCommand.getCommandId() == 
+                            bytesCommand1.getCommandId() );
+            CPPUNIT_ASSERT( bytesCommand.getStompCommandId() == 
+                            bytesCommand1.getStompCommandId() );
+            CPPUNIT_ASSERT( std::string( (const char*)bytesCommand.getBodyBytes() ) == 
+                            (const char*)bytesCommand1.getBodyBytes() );
+            
+
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_MARSHAL_MARSHALERTEST_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/marshal/MarshalerTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp Wed Jul  5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "ActiveMQConnectionFactoryTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQConnectionFactoryTest );
+#include "ActiveMQConnectionFactoryTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQConnectionFactoryTest );

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h Wed Jul  5 15:27:34 2006
@@ -1,63 +1,63 @@
-#ifndef _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORYTEST_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORYTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/network/Socket.h>
-#include <activemq/network/ServerSocket.h>
-#include <activemq/concurrent/Concurrent.h>
-#include <activemq/concurrent/Mutex.h>
-#include <activemq/concurrent/Thread.h>
-#include <activemq/core/ActiveMQConnectionFactory.h>
-#include <cms/Connection.h>
-#include <activemq/transport/TransportFactoryMapRegistrar.h>
-#include <activemq/transport/DummyTransportFactory.h>
-
-namespace activemq{
-namespace core{
-
-    class ActiveMQConnectionFactoryTest : public CppUnit::TestFixture
-    {
-        CPPUNIT_TEST_SUITE( ActiveMQConnectionFactoryTest );
-        CPPUNIT_TEST( test );
-        CPPUNIT_TEST_SUITE_END();
-
-    public:
-    
-    	ActiveMQConnectionFactoryTest() {}
-    	virtual ~ActiveMQConnectionFactoryTest() {}
-        
-        void test()
-        {
-            try
-            {
-                transport::TransportFactoryMapRegistrar registrar(
-                    "dummy", new transport::DummyTransportFactory() );
-                    
-                std::string URI = 
-                    "dummy://127.0.0.1:23232&wireFormat=stomp";
-
-                ActiveMQConnectionFactory connectionFactory(URI);
-
-                cms::Connection* connection = 
-
-                connectionFactory.createConnection();
-
-                CPPUNIT_ASSERT( connection != NULL );
-                
-                delete connection;
-                
-                return;
-            }
-            AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
-            AMQ_CATCHALL_NOTHROW( )
-            
-            CPPUNIT_ASSERT( false );
-        }
-        
-    };
-    
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORYTEST_H_*/
+#ifndef _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORYTEST_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORYTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/network/Socket.h>
+#include <activemq/network/ServerSocket.h>
+#include <activemq/concurrent/Concurrent.h>
+#include <activemq/concurrent/Mutex.h>
+#include <activemq/concurrent/Thread.h>
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <cms/Connection.h>
+#include <activemq/transport/TransportFactoryMapRegistrar.h>
+#include <activemq/transport/DummyTransportFactory.h>
+
+namespace activemq{
+namespace core{
+
+    class ActiveMQConnectionFactoryTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( ActiveMQConnectionFactoryTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+    
+    	ActiveMQConnectionFactoryTest() {}
+    	virtual ~ActiveMQConnectionFactoryTest() {}
+        
+        void test()
+        {
+            try
+            {
+                transport::TransportFactoryMapRegistrar registrar(
+                    "dummy", new transport::DummyTransportFactory() );
+                    
+                std::string URI = 
+                    "dummy://127.0.0.1:23232&wireFormat=stomp";
+
+                ActiveMQConnectionFactory connectionFactory(URI);
+
+                cms::Connection* connection = 
+
+                connectionFactory.createConnection();
+
+                CPPUNIT_ASSERT( connection != NULL );
+                
+                delete connection;
+                
+                return;
+            }
+            AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
+            AMQ_CATCHALL_NOTHROW( )
+            
+            CPPUNIT_ASSERT( false );
+        }
+        
+    };
+    
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORYTEST_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp Wed Jul  5 15:27:34 2006
@@ -1,4 +1,4 @@
-#include "ActiveMQConnectionTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQConnectionTest );
-
+#include "ActiveMQConnectionTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQConnectionTest );
+

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.h Wed Jul  5 15:27:34 2006
@@ -1,243 +1,243 @@
-#ifndef _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONTEST_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/network/Socket.h>
-#include <activemq/network/ServerSocket.h>
-#include <activemq/concurrent/Concurrent.h>
-#include <activemq/concurrent/Mutex.h>
-#include <activemq/concurrent/Thread.h>
-#include <activemq/core/ActiveMQConnectionFactory.h>
-#include <cms/Connection.h>
-#include <activemq/transport/DummyTransport.h>
-#include <activemq/core/ActiveMQConnection.h>
-#include <activemq/core/ActiveMQConnectionData.h>
-#include <activemq/connector/ConsumerMessageListener.h>
-#include <activemq/connector/ConsumerInfo.h>
-#include <activemq/connector/stomp/StompConnector.h>
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/transport/DummyTransportFactory.h>
-#include <activemq/transport/TransportFactoryMap.h>
-#include <activemq/transport/TransportFactoryMapRegistrar.h>
-#include <activemq/connector/stomp/StompConsumerInfo.h>
-#include <activemq/connector/stomp/StompProducerInfo.h>
-#include <activemq/connector/stomp/StompTransactionInfo.h>
-#include <activemq/connector/stomp/StompSessionInfo.h>
-#include <activemq/connector/stomp/StompTopic.h>
-#include <activemq/connector/stomp/commands/TextMessageCommand.h>
-
-namespace activemq{
-namespace core{
-
-    class ActiveMQConnectionTest : public CppUnit::TestFixture
-    {
-        CPPUNIT_TEST_SUITE( ActiveMQConnectionTest );
-        CPPUNIT_TEST( test );
-        CPPUNIT_TEST_SUITE_END();
-
-    public:
-
-    	ActiveMQConnectionTest() {};
-    	virtual ~ActiveMQConnectionTest() {}
-
-        class MyCommandListener : public transport::CommandListener{
-        public:
-        
-            transport::Command* cmd;
-            
-        public:
-        
-            MyCommandListener(){
-                cmd = NULL;
-            }
-            virtual ~MyCommandListener(){}
-            
-            virtual void onCommand( transport::Command* command ){
-                cmd = command;
-            }
-        };
-        
-        class MyMessageListener : 
-            public connector::ConsumerMessageListener
-        {
-        public:
-        
-            std::vector<connector::ConsumerInfo*> consumers;
-            
-        public:
-            virtual ~MyMessageListener(){}
-            
-            virtual void onConsumerMessage( 
-                connector::ConsumerInfo* consumer,
-                core::ActiveMQMessage* msg )
-            {
-                consumers.push_back( consumer );
-            }
-        };
-
-        class MyExceptionListener : public cms::ExceptionListener{
-        public:
-        
-            bool caughtOne;
-
-        public:
-        
-            MyExceptionListener(){ caughtOne = false; }
-            virtual ~MyExceptionListener(){}
-            
-            virtual void onException(const cms::CMSException& ex){
-                caughtOne = true;
-            }
-        };
-        
-        class MyActiveMQMessageListener : public ActiveMQMessageListener
-        {
-        public:
-        
-            std::vector<ActiveMQMessage*> messages;
-            
-        public:
-            virtual ~MyActiveMQMessageListener(){}
-            
-            virtual void onActiveMQMessage( ActiveMQMessage* message )
-                throw ( exceptions::ActiveMQException )
-            {
-                messages.push_back( message );
-            }
-        };
-
-        void test()
-        {
-            try
-            {
-                transport::TransportFactoryMapRegistrar registrar(
-                    "dummy", new transport::DummyTransportFactory() );
-
-                MyMessageListener listener;
-                MyExceptionListener exListener;
-                MyCommandListener cmdListener;
-                MyActiveMQMessageListener msgListener;
-                std::string connectionId = "testConnectionId";
-                util::SimpleProperties* properties = 
-                    new util::SimpleProperties();
-                transport::Transport* transport = NULL;
-    
-                transport::TransportFactory* factory = 
-                    transport::TransportFactoryMap::getInstance().lookup( 
-                        "dummy" );
-                if( factory == NULL ){
-                    CPPUNIT_ASSERT( false );
-                }
-                
-                // Create the transport.
-                transport = factory->createTransport( *properties );
-                if( transport == NULL ){
-                    CPPUNIT_ASSERT( false );
-                }
-                
-                transport::DummyTransport* dTransport = 
-                    dynamic_cast< transport::DummyTransport*>( transport );
-                    
-                CPPUNIT_ASSERT( dTransport != NULL );
-                
-                dTransport->setCommandListener( &cmdListener );
-
-                connector::stomp::StompConnector* connector = 
-                    new connector::stomp::StompConnector( 
-                        transport, *properties );
-
-                connector->start();
-                
-                ActiveMQConnection connection( 
-                    new ActiveMQConnectionData(
-                        connector, transport, properties) );
-
-                connection.setExceptionListener( &exListener );
-                        
-                cms::Session* session1 = connection.createSession();
-                cms::Session* session2 = connection.createSession();
-                cms::Session* session3 = connection.createSession();
-                
-                CPPUNIT_ASSERT( session1 != NULL );
-                CPPUNIT_ASSERT( session2 != NULL );
-                CPPUNIT_ASSERT( session3 != NULL );
-                
-                connector::stomp::StompSessionInfo session;
-                connector::stomp::StompConsumerInfo consumer;
-                
-                session.setSessionId( 1 );
-                session.setConnectionId( "TEST:123" );
-                session.setAckMode( cms::Session::AutoAcknowledge );
-                
-                consumer.setConsumerId( 1 );
-                consumer.setSessionInfo( &session );
-                consumer.setDestination( 
-                    connector::stomp::StompTopic( "test" ) );
-                    
-                connection.addMessageListener( 1, &msgListener );
-
-                connector::stomp::commands::TextMessageCommand* cmd = 
-                    new connector::stomp::commands::TextMessageCommand;
-
-                cmd->setCMSDestination( 
-                    connector::stomp::StompTopic( "test" ) );
-                
-                connector::ConsumerMessageListener* consumerListener = 
-                    dynamic_cast< connector::ConsumerMessageListener* >( 
-                        &connection );
-
-                connection.start();
-
-                CPPUNIT_ASSERT( consumerListener != NULL );
-                
-                consumerListener->onConsumerMessage( &consumer, cmd );
-
-                CPPUNIT_ASSERT( msgListener.messages.size() == 1 );
-
-                connection.removeMessageListener( 1 );
-                
-                msgListener.messages.clear();
-                consumerListener->onConsumerMessage( &consumer, cmd );
-                
-                CPPUNIT_ASSERT( msgListener.messages.size() == 0 );
-
-                connection.addMessageListener( 1, &msgListener );
-
-                connection.stop();
-                consumerListener->onConsumerMessage( &consumer, cmd );
-                connection.start();
-                CPPUNIT_ASSERT( msgListener.messages.size() == 0 );
-
-                cmd = new connector::stomp::commands::TextMessageCommand;
-
-                cmd->setCMSDestination( 
-                    connector::stomp::StompTopic( "test" ) );
-
-                consumerListener->onConsumerMessage( &consumer, cmd );
-                CPPUNIT_ASSERT( msgListener.messages.size() == 1 );
-
-                connection.removeMessageListener( 1 );                
-                msgListener.messages.clear();
-
-                connection.close();
-
-                consumerListener->onConsumerMessage( &consumer, cmd );
-                CPPUNIT_ASSERT( exListener.caughtOne == true );
-
-                delete cmd;
-            }
-            catch(...)
-            {
-                bool exceptionThrown = false;
-                
-                CPPUNIT_ASSERT( exceptionThrown );
-            }
-        }
-
-    };
-
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQCONNECTIONTEST_H_*/
+#ifndef _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONTEST_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/network/Socket.h>
+#include <activemq/network/ServerSocket.h>
+#include <activemq/concurrent/Concurrent.h>
+#include <activemq/concurrent/Mutex.h>
+#include <activemq/concurrent/Thread.h>
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <cms/Connection.h>
+#include <activemq/transport/DummyTransport.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/core/ActiveMQConnectionData.h>
+#include <activemq/connector/ConsumerMessageListener.h>
+#include <activemq/connector/ConsumerInfo.h>
+#include <activemq/connector/stomp/StompConnector.h>
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/transport/DummyTransportFactory.h>
+#include <activemq/transport/TransportFactoryMap.h>
+#include <activemq/transport/TransportFactoryMapRegistrar.h>
+#include <activemq/connector/stomp/StompConsumerInfo.h>
+#include <activemq/connector/stomp/StompProducerInfo.h>
+#include <activemq/connector/stomp/StompTransactionInfo.h>
+#include <activemq/connector/stomp/StompSessionInfo.h>
+#include <activemq/connector/stomp/StompTopic.h>
+#include <activemq/connector/stomp/commands/TextMessageCommand.h>
+
+namespace activemq{
+namespace core{
+
+    class ActiveMQConnectionTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( ActiveMQConnectionTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+    	ActiveMQConnectionTest() {};
+    	virtual ~ActiveMQConnectionTest() {}
+
+        class MyCommandListener : public transport::CommandListener{
+        public:
+        
+            transport::Command* cmd;
+            
+        public:
+        
+            MyCommandListener(){
+                cmd = NULL;
+            }
+            virtual ~MyCommandListener(){}
+            
+            virtual void onCommand( transport::Command* command ){
+                cmd = command;
+            }
+        };
+        
+        class MyMessageListener : 
+            public connector::ConsumerMessageListener
+        {
+        public:
+        
+            std::vector<connector::ConsumerInfo*> consumers;
+            
+        public:
+            virtual ~MyMessageListener(){}
+            
+            virtual void onConsumerMessage( 
+                connector::ConsumerInfo* consumer,
+                core::ActiveMQMessage* msg )
+            {
+                consumers.push_back( consumer );
+            }
+        };
+
+        class MyExceptionListener : public cms::ExceptionListener{
+        public:
+        
+            bool caughtOne;
+
+        public:
+        
+            MyExceptionListener(){ caughtOne = false; }
+            virtual ~MyExceptionListener(){}
+            
+            virtual void onException(const cms::CMSException& ex){
+                caughtOne = true;
+            }
+        };
+        
+        class MyActiveMQMessageListener : public ActiveMQMessageListener
+        {
+        public:
+        
+            std::vector<ActiveMQMessage*> messages;
+            
+        public:
+            virtual ~MyActiveMQMessageListener(){}
+            
+            virtual void onActiveMQMessage( ActiveMQMessage* message )
+                throw ( exceptions::ActiveMQException )
+            {
+                messages.push_back( message );
+            }
+        };
+
+        void test()
+        {
+            try
+            {
+                transport::TransportFactoryMapRegistrar registrar(
+                    "dummy", new transport::DummyTransportFactory() );
+
+                MyMessageListener listener;
+                MyExceptionListener exListener;
+                MyCommandListener cmdListener;
+                MyActiveMQMessageListener msgListener;
+                std::string connectionId = "testConnectionId";
+                util::SimpleProperties* properties = 
+                    new util::SimpleProperties();
+                transport::Transport* transport = NULL;
+    
+                transport::TransportFactory* factory = 
+                    transport::TransportFactoryMap::getInstance().lookup( 
+                        "dummy" );
+                if( factory == NULL ){
+                    CPPUNIT_ASSERT( false );
+                }
+                
+                // Create the transport.
+                transport = factory->createTransport( *properties );
+                if( transport == NULL ){
+                    CPPUNIT_ASSERT( false );
+                }
+                
+                transport::DummyTransport* dTransport = 
+                    dynamic_cast< transport::DummyTransport*>( transport );
+                    
+                CPPUNIT_ASSERT( dTransport != NULL );
+                
+                dTransport->setCommandListener( &cmdListener );
+
+                connector::stomp::StompConnector* connector = 
+                    new connector::stomp::StompConnector( 
+                        transport, *properties );
+
+                connector->start();
+                
+                ActiveMQConnection connection( 
+                    new ActiveMQConnectionData(
+                        connector, transport, properties) );
+
+                connection.setExceptionListener( &exListener );
+                        
+                cms::Session* session1 = connection.createSession();
+                cms::Session* session2 = connection.createSession();
+                cms::Session* session3 = connection.createSession();
+                
+                CPPUNIT_ASSERT( session1 != NULL );
+                CPPUNIT_ASSERT( session2 != NULL );
+                CPPUNIT_ASSERT( session3 != NULL );
+                
+                connector::stomp::StompSessionInfo session;
+                connector::stomp::StompConsumerInfo consumer;
+                
+                session.setSessionId( 1 );
+                session.setConnectionId( "TEST:123" );
+                session.setAckMode( cms::Session::AutoAcknowledge );
+                
+                consumer.setConsumerId( 1 );
+                consumer.setSessionInfo( &session );
+                consumer.setDestination( 
+                    connector::stomp::StompTopic( "test" ) );
+                    
+                connection.addMessageListener( 1, &msgListener );
+
+                connector::stomp::commands::TextMessageCommand* cmd = 
+                    new connector::stomp::commands::TextMessageCommand;
+
+                cmd->setCMSDestination( 
+                    connector::stomp::StompTopic( "test" ) );
+                
+                connector::ConsumerMessageListener* consumerListener = 
+                    dynamic_cast< connector::ConsumerMessageListener* >( 
+                        &connection );
+
+                connection.start();
+
+                CPPUNIT_ASSERT( consumerListener != NULL );
+                
+                consumerListener->onConsumerMessage( &consumer, cmd );
+
+                CPPUNIT_ASSERT( msgListener.messages.size() == 1 );
+
+                connection.removeMessageListener( 1 );
+                
+                msgListener.messages.clear();
+                consumerListener->onConsumerMessage( &consumer, cmd );
+                
+                CPPUNIT_ASSERT( msgListener.messages.size() == 0 );
+
+                connection.addMessageListener( 1, &msgListener );
+
+                connection.stop();
+                consumerListener->onConsumerMessage( &consumer, cmd );
+                connection.start();
+                CPPUNIT_ASSERT( msgListener.messages.size() == 0 );
+
+                cmd = new connector::stomp::commands::TextMessageCommand;
+
+                cmd->setCMSDestination( 
+                    connector::stomp::StompTopic( "test" ) );
+
+                consumerListener->onConsumerMessage( &consumer, cmd );
+                CPPUNIT_ASSERT( msgListener.messages.size() == 1 );
+
+                connection.removeMessageListener( 1 );                
+                msgListener.messages.clear();
+
+                connection.close();
+
+                consumerListener->onConsumerMessage( &consumer, cmd );
+                CPPUNIT_ASSERT( exListener.caughtOne == true );
+
+                delete cmd;
+            }
+            catch(...)
+            {
+                bool exceptionThrown = false;
+                
+                CPPUNIT_ASSERT( exceptionThrown );
+            }
+        }
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQCONNECTIONTEST_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp Wed Jul  5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "ActiveMQSessionTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQSessionTest );
+#include "ActiveMQSessionTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQSessionTest );

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h Wed Jul  5 15:27:34 2006
@@ -1,558 +1,558 @@
-#ifndef _ACTIVEMQ_CORE_ACTIVEMQSESSIONTEST_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQSESSIONTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <cms/Connection.h>
-#include <cms/MessageListener.h>
-
-#include <activemq/network/Socket.h>
-#include <activemq/network/ServerSocket.h>
-#include <activemq/concurrent/Concurrent.h>
-#include <activemq/concurrent/Mutex.h>
-#include <activemq/concurrent/Thread.h>
-#include <activemq/core/ActiveMQConnectionFactory.h>
-#include <activemq/core/ActiveMQConnection.h>
-#include <activemq/core/ActiveMQConnectionData.h>
-#include <activemq/core/ActiveMQSession.h>
-#include <activemq/core/ActiveMQConsumer.h>
-#include <activemq/core/ActiveMQProducer.h>
-#include <activemq/util/SimpleProperties.h>
-#include <activemq/transport/DummyTransport.h>
-#include <activemq/transport/DummyTransportFactory.h>
-#include <activemq/transport/TransportFactoryMap.h>
-#include <activemq/transport/TransportFactoryMapRegistrar.h>
-#include <activemq/connector/ConsumerMessageListener.h>
-#include <activemq/connector/ConsumerInfo.h>
-#include <activemq/connector/stomp/StompConnector.h>
-#include <activemq/connector/stomp/StompConsumerInfo.h>
-#include <activemq/connector/stomp/StompProducerInfo.h>
-#include <activemq/connector/stomp/StompTransactionInfo.h>
-#include <activemq/connector/stomp/StompSessionInfo.h>
-#include <activemq/connector/stomp/StompTopic.h>
-#include <activemq/connector/stomp/commands/TextMessageCommand.h>
-
-namespace activemq{
-namespace core{
-
-    class ActiveMQSessionTest : public CppUnit::TestFixture
-    {
-        CPPUNIT_TEST_SUITE( ActiveMQSessionTest );
-        CPPUNIT_TEST( testAutoAcking );
-        CPPUNIT_TEST( testClientAck );
-        CPPUNIT_TEST( testTransactional );
-        CPPUNIT_TEST_SUITE_END();
-        
-    private:
-    
-        class MyCommandListener : public transport::CommandListener{
-        public:
-        
-            transport::Command* cmd;
-            
-        public:
-        
-            MyCommandListener(){
-                cmd = NULL;
-            }
-            virtual ~MyCommandListener(){}
-            
-            virtual void onCommand( transport::Command* command ){
-                cmd = command;
-            }
-        };
-
-        class MyExceptionListener : public cms::ExceptionListener{
-        public:
-        
-            bool caughtOne;
-
-        public:
-        
-            MyExceptionListener(){ caughtOne = false; }
-            virtual ~MyExceptionListener(){}
-            
-            virtual void onException(const cms::CMSException& ex){
-                caughtOne = true;
-            }
-        };
-        
-        class MyCMSMessageListener : public cms::MessageListener
-        {
-        public:
-        
-            std::vector<cms::Message*> messages;
-            concurrent::Mutex mutex;
-            bool ack;
-            
-        public:
-
-            MyCMSMessageListener( bool ack = false ){
-                this->ack = ack;
-            }
-
-            virtual ~MyCMSMessageListener(){
-                clear();
-            }
-
-            virtual void setAck( bool ack ){
-                this->ack = ack;
-            }
-
-            virtual void clear() {
-                std::vector<cms::Message*>::iterator itr = 
-                    messages.begin();
-                    
-                for( ; itr != messages.end(); ++itr )
-                {
-                    delete *itr;
-                }
-
-                messages.clear();
-            }
-            
-            virtual void onMessage( const cms::Message& message )
-            {
-                synchronized( &mutex )
-                {
-                    if( ack ){
-                        message.acknowledge();
-                    }
-
-                    messages.push_back( message.clone() );
-
-                    mutex.notifyAll();
-                }
-            }
-        };
-
-        ActiveMQConnection* connection;
-        transport::DummyTransport* dTransport;
-        MyExceptionListener exListener;
-        MyCommandListener cmdListener;
-
-    public:    // CPPUNIT Method Overrides.
-    
-        void setUp()
-        {
-            try
-            {
-                transport::TransportFactoryMapRegistrar registrar(
-                    "dummy", new transport::DummyTransportFactory() );
-    
-                ActiveMQConnectionFactory factory("dummy://127.0.0.1:12345");
-                
-                connection = dynamic_cast< ActiveMQConnection*>( 
-                    factory.createConnection() );
-
-                // Get the Transport and make sure we got a dummy Transport
-                // then add our command listener, so we can verify that when
-                // we send a message it hits the wire.
-                dTransport = dynamic_cast< transport::DummyTransport*>( 
-                    connection->getConnectionData()->getTransport() );
-                CPPUNIT_ASSERT( dTransport != NULL );                
-                dTransport->setOutgoingCommandListener( &cmdListener );
-
-                connection->setExceptionListener( &exListener );
-                connection->start();
-            }
-            catch(...)
-            {
-                bool exceptionThrown = false;
-                
-                CPPUNIT_ASSERT( exceptionThrown );
-            }
-        }
-        
-        void tearDown()
-        {
-            delete connection;
-        }
-        
-        void injectTextMessage( const std::string message,
-                                const cms::Destination& destination )
-        {
-            connector::stomp::StompFrame* frame = 
-                new connector::stomp::StompFrame();
-            frame->setCommand( "MESSAGE" );
-            frame->getProperties().setProperty( 
-                "destination", destination.toProviderString() );
-            const char* buffer = strdup( message.c_str() );
-            frame->setBody( buffer, 12 );
-
-            connector::stomp::commands::TextMessageCommand* msg = 
-                new connector::stomp::commands::TextMessageCommand( frame );
-
-            // Init Message
-            msg->setText( message.c_str() );
-            msg->setCMSDestination( destination );
-            msg->setCMSMessageId( "Id: 123456" );
-
-            // Send the Message
-            CPPUNIT_ASSERT( dTransport != NULL );
-            
-            dTransport->fireCommand( msg );
-        }
-        
-    public:
-
-    	ActiveMQSessionTest(void) {}
-    	virtual ~ActiveMQSessionTest(void) {}
-
-        void testAutoAcking()
-        {
-            MyCMSMessageListener msgListener1;
-            MyCMSMessageListener msgListener2;
-            
-            CPPUNIT_ASSERT( connection != NULL );
-            
-            // Create an Auto Ack Session
-            cms::Session* session = connection->createSession();
-
-            // Create a Topic
-            cms::Topic* topic1 = session->createTopic( "TestTopic1");
-            cms::Topic* topic2 = session->createTopic( "TestTopic2");
-            
-            CPPUNIT_ASSERT( topic1 != NULL );                
-            CPPUNIT_ASSERT( topic2 != NULL );                
-
-            // Create a consumer
-            cms::MessageConsumer* consumer1 = 
-                session->createConsumer( *topic1 );
-            cms::MessageConsumer* consumer2 = 
-                session->createConsumer( *topic2 );
-
-            CPPUNIT_ASSERT( consumer1 != NULL );                
-            CPPUNIT_ASSERT( consumer2 != NULL );
-            
-            CPPUNIT_ASSERT( consumer1->getMessageSelector() == "" );            
-            CPPUNIT_ASSERT( consumer2->getMessageSelector() == "" );            
-
-            CPPUNIT_ASSERT( consumer1->receiveNoWait() == NULL );
-            CPPUNIT_ASSERT( consumer1->receive( 5 ) == NULL );
-            CPPUNIT_ASSERT( consumer2->receiveNoWait() == NULL );
-            CPPUNIT_ASSERT( consumer2->receive( 5 ) == NULL );
-
-            consumer1->setMessageListener( &msgListener1 );
-            consumer2->setMessageListener( &msgListener2 );
-            
-            injectTextMessage( "This is a Test 1" , *topic1 );
-
-            synchronized( &msgListener1.mutex )
-            {
-                if( msgListener1.messages.size() == 0 )
-                {
-                    msgListener1.mutex.wait( 3000 );
-                }
-            }
-
-            CPPUNIT_ASSERT( msgListener1.messages.size() == 1 );
-
-            injectTextMessage( "This is a Test 2" , *topic2 );
-
-            synchronized( &msgListener2.mutex )
-            {
-                if( msgListener2.messages.size() == 0 )
-                {
-                    msgListener2.mutex.wait( 3000 );
-                }
-            }
-
-            CPPUNIT_ASSERT( msgListener2.messages.size() == 1 );
-            
-            cms::TextMessage* msg1 = 
-                dynamic_cast< cms::TextMessage* >( 
-                    msgListener1.messages[0] );
-            cms::TextMessage* msg2 = 
-                dynamic_cast< cms::TextMessage* >( 
-                    msgListener2.messages[0] );
-
-            CPPUNIT_ASSERT( msg1 != NULL );                
-            CPPUNIT_ASSERT( msg2 != NULL );                
-            
-            std::string text1 = msg1->getText();
-            std::string text2 = msg2->getText();
-            
-            CPPUNIT_ASSERT( text1 == "This is a Test 1" );
-            CPPUNIT_ASSERT( text2 == "This is a Test 2" );
-
-            delete consumer1;
-            delete consumer2;
-
-            delete session;
-        }
-
-        void testClientAck()
-        {
-            MyCMSMessageListener msgListener1( true );
-            MyCMSMessageListener msgListener2( true );
-            
-            CPPUNIT_ASSERT( connection != NULL );
-            
-            // Create an Auto Ack Session
-            cms::Session* session = connection->createSession( 
-                cms::Session::ClientAcknowledge );
-
-            // Create a Topic
-            cms::Topic* topic1 = session->createTopic( "TestTopic1");
-            cms::Topic* topic2 = session->createTopic( "TestTopic2");
-            
-            CPPUNIT_ASSERT( topic1 != NULL );                
-            CPPUNIT_ASSERT( topic2 != NULL );                
-
-            // Create a consumer
-            cms::MessageConsumer* consumer1 = 
-                session->createConsumer( *topic1 );
-            cms::MessageConsumer* consumer2 = 
-                session->createConsumer( *topic2 );
-
-            CPPUNIT_ASSERT( consumer1 != NULL );                
-            CPPUNIT_ASSERT( consumer2 != NULL );
-            
-            CPPUNIT_ASSERT( consumer1->getMessageSelector() == "" );            
-            CPPUNIT_ASSERT( consumer2->getMessageSelector() == "" );            
-
-            CPPUNIT_ASSERT( consumer1->receiveNoWait() == NULL );
-            CPPUNIT_ASSERT( consumer1->receive( 5 ) == NULL );
-            CPPUNIT_ASSERT( consumer2->receiveNoWait() == NULL );
-            CPPUNIT_ASSERT( consumer2->receive( 5 ) == NULL );
-
-            consumer1->setMessageListener( &msgListener1 );
-            consumer2->setMessageListener( &msgListener2 );
-            
-            injectTextMessage( "This is a Test 1" , *topic1 );
-
-            synchronized( &msgListener1.mutex )
-            {
-                if( msgListener1.messages.size() == 0 )
-                {
-                    msgListener1.mutex.wait( 3000 );
-                }
-            }
-
-            CPPUNIT_ASSERT( msgListener1.messages.size() == 1 );
-
-            msgListener1.messages[0]->acknowledge();
-
-            injectTextMessage( "This is a Test 2" , *topic2 );
-
-            synchronized( &msgListener2.mutex )
-            {
-                if( msgListener2.messages.size() == 0 )
-                {
-                    msgListener2.mutex.wait( 3000 );
-                }
-            }
-
-            CPPUNIT_ASSERT( msgListener2.messages.size() == 1 );
-            
-            msgListener2.messages[0]->acknowledge();
-
-            cms::TextMessage* msg1 = 
-                dynamic_cast< cms::TextMessage* >( 
-                    msgListener1.messages[0] );
-            cms::TextMessage* msg2 = 
-                dynamic_cast< cms::TextMessage* >( 
-                    msgListener2.messages[0] );
-
-            CPPUNIT_ASSERT( msg1 != NULL );                
-            CPPUNIT_ASSERT( msg2 != NULL );                
-            
-            std::string text1 = msg1->getText();
-            std::string text2 = msg2->getText();
-            
-            CPPUNIT_ASSERT( text1 == "This is a Test 1" );
-            CPPUNIT_ASSERT( text2 == "This is a Test 2" );
-
-            delete consumer1;
-            delete consumer2;
-
-            delete session;
-        }
-
-        void testTransactional()
-        {
-            MyCMSMessageListener msgListener1;
-            MyCMSMessageListener msgListener2;
-            
-            CPPUNIT_ASSERT( connection != NULL );
-            
-            // Create an Auto Ack Session
-            cms::Session* session = connection->createSession( 
-                cms::Session::Transactional );
-
-            // Create a Topic
-            cms::Topic* topic1 = session->createTopic( "TestTopic1");
-            cms::Topic* topic2 = session->createTopic( "TestTopic2");
-            
-            CPPUNIT_ASSERT( topic1 != NULL );                
-            CPPUNIT_ASSERT( topic2 != NULL );                
-
-            // Create a consumer
-            cms::MessageConsumer* consumer1 = 
-                session->createConsumer( *topic1 );
-            cms::MessageConsumer* consumer2 = 
-                session->createConsumer( *topic2 );
-
-            CPPUNIT_ASSERT( consumer1 != NULL );                
-            CPPUNIT_ASSERT( consumer2 != NULL );
-            
-            CPPUNIT_ASSERT( consumer1->getMessageSelector() == "" );            
-            CPPUNIT_ASSERT( consumer2->getMessageSelector() == "" );            
-
-            CPPUNIT_ASSERT( consumer1->receiveNoWait() == NULL );
-            CPPUNIT_ASSERT( consumer1->receive( 5 ) == NULL );
-            CPPUNIT_ASSERT( consumer2->receiveNoWait() == NULL );
-            CPPUNIT_ASSERT( consumer2->receive( 5 ) == NULL );
-
-            consumer1->setMessageListener( &msgListener1 );
-            consumer2->setMessageListener( &msgListener2 );
-            
-            injectTextMessage( "This is a Test 1" , *topic1 );
-
-            synchronized( &msgListener1.mutex )
-            {
-                if( msgListener1.messages.size() == 0 )
-                {
-                    msgListener1.mutex.wait( 3000 );
-                }
-            }
-
-            CPPUNIT_ASSERT( msgListener1.messages.size() == 1 );
-
-            session->commit();
-
-            injectTextMessage( "This is a Test 2" , *topic2 );
-
-            synchronized( &msgListener2.mutex )
-            {
-                if( msgListener2.messages.size() == 0 )
-                {
-                    msgListener2.mutex.wait( 3000 );
-                }
-            }
-
-            CPPUNIT_ASSERT( msgListener2.messages.size() == 1 );
-            
-            session->commit();
-
-            cms::TextMessage* msg1 = 
-                dynamic_cast< cms::TextMessage* >( 
-                    msgListener1.messages[0] );
-            cms::TextMessage* msg2 = 
-                dynamic_cast< cms::TextMessage* >( 
-                    msgListener2.messages[0] );
-
-            CPPUNIT_ASSERT( msg1 != NULL );                
-            CPPUNIT_ASSERT( msg2 != NULL );                
-            
-            std::string text1 = msg1->getText();
-            std::string text2 = msg2->getText();
-            
-            CPPUNIT_ASSERT( text1 == "This is a Test 1" );
-            CPPUNIT_ASSERT( text2 == "This is a Test 2" );
-
-            msgListener1.clear();
-            msgListener2.clear();
-
-            const unsigned int msgCount = 50;
-
-            for( unsigned int i = 0; i < msgCount; ++i )
-            {
-                std::ostringstream stream;
-
-                stream << "This is test message #" << i << std::ends;
-
-                injectTextMessage( stream.str() , *topic1 );
-            }
-        
-            for( unsigned int i = 0; i < msgCount; ++i )
-            {
-                std::ostringstream stream;
-
-                stream << "This is test message #" << i << std::ends;
-
-                injectTextMessage( stream.str() , *topic2 );
-            }
-
-            synchronized( &msgListener1.mutex )
-            {
-                const unsigned int interval = msgCount + 10;
-                unsigned int count = 0;
-
-                while( msgListener1.messages.size() != msgCount && 
-                       count < interval )
-                {
-                    msgListener1.mutex.wait( 3000 );
-
-                    ++count;
-                }
-            }
-
-            CPPUNIT_ASSERT( msgListener1.messages.size() == msgCount );
-
-            synchronized( &msgListener2.mutex )
-            {
-                const int interval = msgCount + 10;
-                int count = 0;
-
-                while( msgListener2.messages.size() != msgCount && 
-                       count < interval )
-                {
-                    msgListener2.mutex.wait( 3000 );
-
-                    ++count;
-                }
-            }
-
-            CPPUNIT_ASSERT( msgListener2.messages.size() == msgCount );
-
-            msgListener1.clear();
-            msgListener2.clear();
-
-            session->rollback();
-
-            synchronized( &msgListener1.mutex )
-            {
-                const int interval = msgCount + 10;
-                int count = 0;
-
-                while( msgListener1.messages.size() != msgCount && 
-                       count < interval )
-                {
-                    msgListener1.mutex.wait( 3000 );
-
-                    ++count;
-                }
-            }
-
-            CPPUNIT_ASSERT( msgListener1.messages.size() == msgCount );
-
-            synchronized( &msgListener2.mutex )
-            {
-                const int interval = msgCount + 10;
-                int count = 0;
-
-                while( msgListener2.messages.size() != msgCount && 
-                       count < interval )
-                {
-                    msgListener2.mutex.wait( 3000 );
-
-                    ++count;
-                }
-            }
-
-            CPPUNIT_ASSERT( msgListener2.messages.size() == msgCount );
-
-            delete consumer1;
-            delete consumer2;
-
-            delete session;
-        }
-
-    };
-
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQSESSIONTEST_H_*/
+#ifndef _ACTIVEMQ_CORE_ACTIVEMQSESSIONTEST_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQSESSIONTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <cms/Connection.h>
+#include <cms/MessageListener.h>
+
+#include <activemq/network/Socket.h>
+#include <activemq/network/ServerSocket.h>
+#include <activemq/concurrent/Concurrent.h>
+#include <activemq/concurrent/Mutex.h>
+#include <activemq/concurrent/Thread.h>
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/core/ActiveMQConnectionData.h>
+#include <activemq/core/ActiveMQSession.h>
+#include <activemq/core/ActiveMQConsumer.h>
+#include <activemq/core/ActiveMQProducer.h>
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/transport/DummyTransport.h>
+#include <activemq/transport/DummyTransportFactory.h>
+#include <activemq/transport/TransportFactoryMap.h>
+#include <activemq/transport/TransportFactoryMapRegistrar.h>
+#include <activemq/connector/ConsumerMessageListener.h>
+#include <activemq/connector/ConsumerInfo.h>
+#include <activemq/connector/stomp/StompConnector.h>
+#include <activemq/connector/stomp/StompConsumerInfo.h>
+#include <activemq/connector/stomp/StompProducerInfo.h>
+#include <activemq/connector/stomp/StompTransactionInfo.h>
+#include <activemq/connector/stomp/StompSessionInfo.h>
+#include <activemq/connector/stomp/StompTopic.h>
+#include <activemq/connector/stomp/commands/TextMessageCommand.h>
+
+namespace activemq{
+namespace core{
+
+    class ActiveMQSessionTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( ActiveMQSessionTest );
+        CPPUNIT_TEST( testAutoAcking );
+        CPPUNIT_TEST( testClientAck );
+        CPPUNIT_TEST( testTransactional );
+        CPPUNIT_TEST_SUITE_END();
+        
+    private:
+    
+        class MyCommandListener : public transport::CommandListener{
+        public:
+        
+            transport::Command* cmd;
+            
+        public:
+        
+            MyCommandListener(){
+                cmd = NULL;
+            }
+            virtual ~MyCommandListener(){}
+            
+            virtual void onCommand( transport::Command* command ){
+                cmd = command;
+            }
+        };
+
+        class MyExceptionListener : public cms::ExceptionListener{
+        public:
+        
+            bool caughtOne;
+
+        public:
+        
+            MyExceptionListener(){ caughtOne = false; }
+            virtual ~MyExceptionListener(){}
+            
+            virtual void onException(const cms::CMSException& ex){
+                caughtOne = true;
+            }
+        };
+        
+        class MyCMSMessageListener : public cms::MessageListener
+        {
+        public:
+        
+            std::vector<cms::Message*> messages;
+            concurrent::Mutex mutex;
+            bool ack;
+            
+        public:
+
+            MyCMSMessageListener( bool ack = false ){
+                this->ack = ack;
+            }
+
+            virtual ~MyCMSMessageListener(){
+                clear();
+            }
+
+            virtual void setAck( bool ack ){
+                this->ack = ack;
+            }
+
+            virtual void clear() {
+                std::vector<cms::Message*>::iterator itr = 
+                    messages.begin();
+                    
+                for( ; itr != messages.end(); ++itr )
+                {
+                    delete *itr;
+                }
+
+                messages.clear();
+            }
+            
+            virtual void onMessage( const cms::Message& message )
+            {
+                synchronized( &mutex )
+                {
+                    if( ack ){
+                        message.acknowledge();
+                    }
+
+                    messages.push_back( message.clone() );
+
+                    mutex.notifyAll();
+                }
+            }
+        };
+
+        ActiveMQConnection* connection;
+        transport::DummyTransport* dTransport;
+        MyExceptionListener exListener;
+        MyCommandListener cmdListener;
+
+    public:    // CPPUNIT Method Overrides.
+    
+        void setUp()
+        {
+            try
+            {
+                transport::TransportFactoryMapRegistrar registrar(
+                    "dummy", new transport::DummyTransportFactory() );
+    
+                ActiveMQConnectionFactory factory("dummy://127.0.0.1:12345");
+                
+                connection = dynamic_cast< ActiveMQConnection*>( 
+                    factory.createConnection() );
+
+                // Get the Transport and make sure we got a dummy Transport
+                // then add our command listener, so we can verify that when
+                // we send a message it hits the wire.
+                dTransport = dynamic_cast< transport::DummyTransport*>( 
+                    connection->getConnectionData()->getTransport() );
+                CPPUNIT_ASSERT( dTransport != NULL );                
+                dTransport->setOutgoingCommandListener( &cmdListener );
+
+                connection->setExceptionListener( &exListener );
+                connection->start();
+            }
+            catch(...)
+            {
+                bool exceptionThrown = false;
+                
+                CPPUNIT_ASSERT( exceptionThrown );
+            }
+        }
+        
+        void tearDown()
+        {
+            delete connection;
+        }
+        
+        void injectTextMessage( const std::string message,
+                                const cms::Destination& destination )
+        {
+            connector::stomp::StompFrame* frame = 
+                new connector::stomp::StompFrame();
+            frame->setCommand( "MESSAGE" );
+            frame->getProperties().setProperty( 
+                "destination", destination.toProviderString() );
+            const char* buffer = strdup( message.c_str() );
+            frame->setBody( buffer, 12 );
+
+            connector::stomp::commands::TextMessageCommand* msg = 
+                new connector::stomp::commands::TextMessageCommand( frame );
+
+            // Init Message
+            msg->setText( message.c_str() );
+            msg->setCMSDestination( destination );
+            msg->setCMSMessageId( "Id: 123456" );
+
+            // Send the Message
+            CPPUNIT_ASSERT( dTransport != NULL );
+            
+            dTransport->fireCommand( msg );
+        }
+        
+    public:
+
+    	ActiveMQSessionTest(void) {}
+    	virtual ~ActiveMQSessionTest(void) {}
+
+        void testAutoAcking()
+        {
+            MyCMSMessageListener msgListener1;
+            MyCMSMessageListener msgListener2;
+            
+            CPPUNIT_ASSERT( connection != NULL );
+            
+            // Create an Auto Ack Session
+            cms::Session* session = connection->createSession();
+
+            // Create a Topic
+            cms::Topic* topic1 = session->createTopic( "TestTopic1");
+            cms::Topic* topic2 = session->createTopic( "TestTopic2");
+            
+            CPPUNIT_ASSERT( topic1 != NULL );                
+            CPPUNIT_ASSERT( topic2 != NULL );                
+
+            // Create a consumer
+            cms::MessageConsumer* consumer1 = 
+                session->createConsumer( *topic1 );
+            cms::MessageConsumer* consumer2 = 
+                session->createConsumer( *topic2 );
+
+            CPPUNIT_ASSERT( consumer1 != NULL );                
+            CPPUNIT_ASSERT( consumer2 != NULL );
+            
+            CPPUNIT_ASSERT( consumer1->getMessageSelector() == "" );            
+            CPPUNIT_ASSERT( consumer2->getMessageSelector() == "" );            
+
+            CPPUNIT_ASSERT( consumer1->receiveNoWait() == NULL );
+            CPPUNIT_ASSERT( consumer1->receive( 5 ) == NULL );
+            CPPUNIT_ASSERT( consumer2->receiveNoWait() == NULL );
+            CPPUNIT_ASSERT( consumer2->receive( 5 ) == NULL );
+
+            consumer1->setMessageListener( &msgListener1 );
+            consumer2->setMessageListener( &msgListener2 );
+            
+            injectTextMessage( "This is a Test 1" , *topic1 );
+
+            synchronized( &msgListener1.mutex )
+            {
+                if( msgListener1.messages.size() == 0 )
+                {
+                    msgListener1.mutex.wait( 3000 );
+                }
+            }
+
+            CPPUNIT_ASSERT( msgListener1.messages.size() == 1 );
+
+            injectTextMessage( "This is a Test 2" , *topic2 );
+
+            synchronized( &msgListener2.mutex )
+            {
+                if( msgListener2.messages.size() == 0 )
+                {
+                    msgListener2.mutex.wait( 3000 );
+                }
+            }
+
+            CPPUNIT_ASSERT( msgListener2.messages.size() == 1 );
+            
+            cms::TextMessage* msg1 = 
+                dynamic_cast< cms::TextMessage* >( 
+                    msgListener1.messages[0] );
+            cms::TextMessage* msg2 = 
+                dynamic_cast< cms::TextMessage* >( 
+                    msgListener2.messages[0] );
+
+            CPPUNIT_ASSERT( msg1 != NULL );                
+            CPPUNIT_ASSERT( msg2 != NULL );                
+            
+            std::string text1 = msg1->getText();
+            std::string text2 = msg2->getText();
+            
+            CPPUNIT_ASSERT( text1 == "This is a Test 1" );
+            CPPUNIT_ASSERT( text2 == "This is a Test 2" );
+
+            delete consumer1;
+            delete consumer2;
+
+            delete session;
+        }
+
+        void testClientAck()
+        {
+            MyCMSMessageListener msgListener1( true );
+            MyCMSMessageListener msgListener2( true );
+            
+            CPPUNIT_ASSERT( connection != NULL );
+            
+            // Create an Auto Ack Session
+            cms::Session* session = connection->createSession( 
+                cms::Session::ClientAcknowledge );
+
+            // Create a Topic
+            cms::Topic* topic1 = session->createTopic( "TestTopic1");
+            cms::Topic* topic2 = session->createTopic( "TestTopic2");
+            
+            CPPUNIT_ASSERT( topic1 != NULL );                
+            CPPUNIT_ASSERT( topic2 != NULL );                
+
+            // Create a consumer
+            cms::MessageConsumer* consumer1 = 
+                session->createConsumer( *topic1 );
+            cms::MessageConsumer* consumer2 = 
+                session->createConsumer( *topic2 );
+
+            CPPUNIT_ASSERT( consumer1 != NULL );                
+            CPPUNIT_ASSERT( consumer2 != NULL );
+            
+            CPPUNIT_ASSERT( consumer1->getMessageSelector() == "" );            
+            CPPUNIT_ASSERT( consumer2->getMessageSelector() == "" );            
+
+            CPPUNIT_ASSERT( consumer1->receiveNoWait() == NULL );
+            CPPUNIT_ASSERT( consumer1->receive( 5 ) == NULL );
+            CPPUNIT_ASSERT( consumer2->receiveNoWait() == NULL );
+            CPPUNIT_ASSERT( consumer2->receive( 5 ) == NULL );
+
+            consumer1->setMessageListener( &msgListener1 );
+            consumer2->setMessageListener( &msgListener2 );
+            
+            injectTextMessage( "This is a Test 1" , *topic1 );
+
+            synchronized( &msgListener1.mutex )
+            {
+                if( msgListener1.messages.size() == 0 )
+                {
+                    msgListener1.mutex.wait( 3000 );
+                }
+            }
+
+            CPPUNIT_ASSERT( msgListener1.messages.size() == 1 );
+
+            msgListener1.messages[0]->acknowledge();
+
+            injectTextMessage( "This is a Test 2" , *topic2 );
+
+            synchronized( &msgListener2.mutex )
+            {
+                if( msgListener2.messages.size() == 0 )
+                {
+                    msgListener2.mutex.wait( 3000 );
+                }
+            }
+
+            CPPUNIT_ASSERT( msgListener2.messages.size() == 1 );
+            
+            msgListener2.messages[0]->acknowledge();
+
+            cms::TextMessage* msg1 = 
+                dynamic_cast< cms::TextMessage* >( 
+                    msgListener1.messages[0] );
+            cms::TextMessage* msg2 = 
+                dynamic_cast< cms::TextMessage* >( 
+                    msgListener2.messages[0] );
+
+            CPPUNIT_ASSERT( msg1 != NULL );                
+            CPPUNIT_ASSERT( msg2 != NULL );                
+            
+            std::string text1 = msg1->getText();
+            std::string text2 = msg2->getText();
+            
+            CPPUNIT_ASSERT( text1 == "This is a Test 1" );
+            CPPUNIT_ASSERT( text2 == "This is a Test 2" );
+
+            delete consumer1;
+            delete consumer2;
+
+            delete session;
+        }
+
+        void testTransactional()
+        {
+            MyCMSMessageListener msgListener1;
+            MyCMSMessageListener msgListener2;
+            
+            CPPUNIT_ASSERT( connection != NULL );
+            
+            // Create an Auto Ack Session
+            cms::Session* session = connection->createSession( 
+                cms::Session::Transactional );
+
+            // Create a Topic
+            cms::Topic* topic1 = session->createTopic( "TestTopic1");
+            cms::Topic* topic2 = session->createTopic( "TestTopic2");
+            
+            CPPUNIT_ASSERT( topic1 != NULL );                
+            CPPUNIT_ASSERT( topic2 != NULL );                
+
+            // Create a consumer
+            cms::MessageConsumer* consumer1 = 
+                session->createConsumer( *topic1 );
+            cms::MessageConsumer* consumer2 = 
+                session->createConsumer( *topic2 );
+
+            CPPUNIT_ASSERT( consumer1 != NULL );                
+            CPPUNIT_ASSERT( consumer2 != NULL );
+            
+            CPPUNIT_ASSERT( consumer1->getMessageSelector() == "" );            
+            CPPUNIT_ASSERT( consumer2->getMessageSelector() == "" );            
+
+            CPPUNIT_ASSERT( consumer1->receiveNoWait() == NULL );
+            CPPUNIT_ASSERT( consumer1->receive( 5 ) == NULL );
+            CPPUNIT_ASSERT( consumer2->receiveNoWait() == NULL );
+            CPPUNIT_ASSERT( consumer2->receive( 5 ) == NULL );
+
+            consumer1->setMessageListener( &msgListener1 );
+            consumer2->setMessageListener( &msgListener2 );
+            
+            injectTextMessage( "This is a Test 1" , *topic1 );
+
+            synchronized( &msgListener1.mutex )
+            {
+                if( msgListener1.messages.size() == 0 )
+                {
+                    msgListener1.mutex.wait( 3000 );
+                }
+            }
+
+            CPPUNIT_ASSERT( msgListener1.messages.size() == 1 );
+
+            session->commit();
+
+            injectTextMessage( "This is a Test 2" , *topic2 );
+
+            synchronized( &msgListener2.mutex )
+            {
+                if( msgListener2.messages.size() == 0 )
+                {
+                    msgListener2.mutex.wait( 3000 );
+                }
+            }
+
+            CPPUNIT_ASSERT( msgListener2.messages.size() == 1 );
+            
+            session->commit();
+
+            cms::TextMessage* msg1 = 
+                dynamic_cast< cms::TextMessage* >( 
+                    msgListener1.messages[0] );
+            cms::TextMessage* msg2 = 
+                dynamic_cast< cms::TextMessage* >( 
+                    msgListener2.messages[0] );
+
+            CPPUNIT_ASSERT( msg1 != NULL );                
+            CPPUNIT_ASSERT( msg2 != NULL );                
+            
+            std::string text1 = msg1->getText();
+            std::string text2 = msg2->getText();
+            
+            CPPUNIT_ASSERT( text1 == "This is a Test 1" );
+            CPPUNIT_ASSERT( text2 == "This is a Test 2" );
+
+            msgListener1.clear();
+            msgListener2.clear();
+
+            const unsigned int msgCount = 50;
+
+            for( unsigned int i = 0; i < msgCount; ++i )
+            {
+                std::ostringstream stream;
+
+                stream << "This is test message #" << i << std::ends;
+
+                injectTextMessage( stream.str() , *topic1 );
+            }
+        
+            for( unsigned int i = 0; i < msgCount; ++i )
+            {
+                std::ostringstream stream;
+
+                stream << "This is test message #" << i << std::ends;
+
+                injectTextMessage( stream.str() , *topic2 );
+            }
+
+            synchronized( &msgListener1.mutex )
+            {
+                const unsigned int interval = msgCount + 10;
+                unsigned int count = 0;
+
+                while( msgListener1.messages.size() != msgCount && 
+                       count < interval )
+                {
+                    msgListener1.mutex.wait( 3000 );
+
+                    ++count;
+                }
+            }
+
+            CPPUNIT_ASSERT( msgListener1.messages.size() == msgCount );
+
+            synchronized( &msgListener2.mutex )
+            {
+                const int interval = msgCount + 10;
+                int count = 0;
+
+                while( msgListener2.messages.size() != msgCount && 
+                       count < interval )
+                {
+                    msgListener2.mutex.wait( 3000 );
+
+                    ++count;
+                }
+            }
+
+            CPPUNIT_ASSERT( msgListener2.messages.size() == msgCount );
+
+            msgListener1.clear();
+            msgListener2.clear();
+
+            session->rollback();
+
+            synchronized( &msgListener1.mutex )
+            {
+                const int interval = msgCount + 10;
+                int count = 0;
+
+                while( msgListener1.messages.size() != msgCount && 
+                       count < interval )
+                {
+                    msgListener1.mutex.wait( 3000 );
+
+                    ++count;
+                }
+            }
+
+            CPPUNIT_ASSERT( msgListener1.messages.size() == msgCount );
+
+            synchronized( &msgListener2.mutex )
+            {
+                const int interval = msgCount + 10;
+                int count = 0;
+
+                while( msgListener2.messages.size() != msgCount && 
+                       count < interval )
+                {
+                    msgListener2.mutex.wait( 3000 );
+
+                    ++count;
+                }
+            }
+
+            CPPUNIT_ASSERT( msgListener2.messages.size() == msgCount );
+
+            delete consumer1;
+            delete consumer2;
+
+            delete session;
+        }
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQSESSIONTEST_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/exceptions/ActiveMQExceptionTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/exceptions/ActiveMQExceptionTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.cpp Wed Jul  5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "ByteArrayInputStreamTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::ByteArrayInputStreamTest );
+#include "ByteArrayInputStreamTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::ByteArrayInputStreamTest );

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.h Wed Jul  5 15:27:34 2006
@@ -1,73 +1,73 @@
-#ifndef ACTIVEMQ_IO_BYTEARRAYINPUTSTREAMTEST_H_
-#define ACTIVEMQ_IO_BYTEARRAYINPUTSTREAMTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/io/ByteArrayInputStream.h>
-
-namespace activemq{
-namespace io{
-
-   class ByteArrayInputStreamTest : public CppUnit::TestFixture 
-   {
-     CPPUNIT_TEST_SUITE( ByteArrayInputStreamTest );
-     CPPUNIT_TEST( testStream );
-     CPPUNIT_TEST_SUITE_END();
-
-   public:
-   
-   	ByteArrayInputStreamTest() {}
-
-   	virtual ~ByteArrayInputStreamTest() {}
-
-      void testStream()
-      {
-         std::vector<unsigned char> testBuffer;
-         
-         testBuffer.push_back('t');
-         testBuffer.push_back('e');
-         testBuffer.push_back('s');
-         testBuffer.push_back('t');
-
-         ByteArrayInputStream stream_a(&testBuffer[0], testBuffer.size());
-         
-         CPPUNIT_ASSERT( stream_a.available() == 4 );
-         
-         char a = stream_a.read();
-         char b = stream_a.read();
-         char c = stream_a.read();
-         char d = stream_a.read();
-
-         CPPUNIT_ASSERT( a == 't' && b == 'e' && c == 's' && d == 't' );
-         CPPUNIT_ASSERT( stream_a.available() == 0 );
-
-         testBuffer.push_back('e');
-         
-         stream_a.setByteArray(&testBuffer[0], testBuffer.size());
-         
-         CPPUNIT_ASSERT( stream_a.available() == 5 );
-         
-         unsigned char* buffer = new unsigned char[6];
-         
-         buffer[5] = '\0';
-      
-         CPPUNIT_ASSERT( stream_a.read(buffer, 5) == 5 );         
-         CPPUNIT_ASSERT( std::string((const char*)buffer) == std::string("teste") );
-         CPPUNIT_ASSERT( stream_a.available() == 0 );
-         
-         stream_a.setByteArray(&testBuffer[0], testBuffer.size());
-
-         memset(buffer, 0, 6);
-
-         CPPUNIT_ASSERT( stream_a.read(buffer, 3) == 3 );
-         CPPUNIT_ASSERT( stream_a.read(&buffer[3], 5) == 2 );
-         CPPUNIT_ASSERT( std::string((const char*)buffer) == std::string("teste") );
-         
-         delete buffer;
-      }
-   };
-
-}}
-
-#endif /*ACTIVEMQ_IO_BYTEARRAYINPUTSTREAMTEST_H_*/
+#ifndef ACTIVEMQ_IO_BYTEARRAYINPUTSTREAMTEST_H_
+#define ACTIVEMQ_IO_BYTEARRAYINPUTSTREAMTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/io/ByteArrayInputStream.h>
+
+namespace activemq{
+namespace io{
+
+   class ByteArrayInputStreamTest : public CppUnit::TestFixture 
+   {
+     CPPUNIT_TEST_SUITE( ByteArrayInputStreamTest );
+     CPPUNIT_TEST( testStream );
+     CPPUNIT_TEST_SUITE_END();
+
+   public:
+   
+   	ByteArrayInputStreamTest() {}
+
+   	virtual ~ByteArrayInputStreamTest() {}
+
+      void testStream()
+      {
+         std::vector<unsigned char> testBuffer;
+         
+         testBuffer.push_back('t');
+         testBuffer.push_back('e');
+         testBuffer.push_back('s');
+         testBuffer.push_back('t');
+
+         ByteArrayInputStream stream_a(&testBuffer[0], testBuffer.size());
+         
+         CPPUNIT_ASSERT( stream_a.available() == 4 );
+         
+         char a = stream_a.read();
+         char b = stream_a.read();
+         char c = stream_a.read();
+         char d = stream_a.read();
+
+         CPPUNIT_ASSERT( a == 't' && b == 'e' && c == 's' && d == 't' );
+         CPPUNIT_ASSERT( stream_a.available() == 0 );
+
+         testBuffer.push_back('e');
+         
+         stream_a.setByteArray(&testBuffer[0], testBuffer.size());
+         
+         CPPUNIT_ASSERT( stream_a.available() == 5 );
+         
+         unsigned char* buffer = new unsigned char[6];
+         
+         buffer[5] = '\0';
+      
+         CPPUNIT_ASSERT( stream_a.read(buffer, 5) == 5 );         
+         CPPUNIT_ASSERT( std::string((const char*)buffer) == std::string("teste") );
+         CPPUNIT_ASSERT( stream_a.available() == 0 );
+         
+         stream_a.setByteArray(&testBuffer[0], testBuffer.size());
+
+         memset(buffer, 0, 6);
+
+         CPPUNIT_ASSERT( stream_a.read(buffer, 3) == 3 );
+         CPPUNIT_ASSERT( stream_a.read(&buffer[3], 5) == 2 );
+         CPPUNIT_ASSERT( std::string((const char*)buffer) == std::string("teste") );
+         
+         delete buffer;
+      }
+   };
+
+}}
+
+#endif /*ACTIVEMQ_IO_BYTEARRAYINPUTSTREAMTEST_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.cpp Wed Jul  5 15:27:34 2006
@@ -1,3 +1,3 @@
-#include "ByteArrayOutputStreamTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::ByteArrayOutputStreamTest );
+#include "ByteArrayOutputStreamTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::ByteArrayOutputStreamTest );

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.h Wed Jul  5 15:27:34 2006
@@ -1,59 +1,59 @@
-#ifndef ACTIVEMQ_IO_BYTEARRAYOUTPUTSTREAMTEST_H_
-#define ACTIVEMQ_IO_BYTEARRAYOUTPUTSTREAMTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <activemq/io/ByteArrayOutputStream.h>
-
-namespace activemq{
-namespace io{
-
-   class ByteArrayOutputStreamTest : public CppUnit::TestFixture 
-   {
-     CPPUNIT_TEST_SUITE( ByteArrayOutputStreamTest );
-     CPPUNIT_TEST( testStream );
-     CPPUNIT_TEST_SUITE_END();
-
-   public:
-
-   	ByteArrayOutputStreamTest() {}
-
-   	virtual ~ByteArrayOutputStreamTest() {}
-
-      void testStream()
-      {
-         ByteArrayOutputStream stream_a;
-         
-         stream_a.write('a');
-         stream_a.write(60);
-         stream_a.write('c');
-         
-         CPPUNIT_ASSERT( stream_a.getByteArraySize() == 3 );
-         
-         stream_a.clear();
-         
-         CPPUNIT_ASSERT( stream_a.getByteArraySize() == 0 );
-         
-         stream_a.write((const unsigned char*)("abc"), 3);
-  
-         CPPUNIT_ASSERT( stream_a.getByteArraySize() == 3 );
-         
-         stream_a.clear();
-
-         CPPUNIT_ASSERT( stream_a.getByteArraySize() == 0 );
-         
-         stream_a.write((const unsigned char*)("abc"), 3);
-
-         unsigned char buffer[4];
-         
-         memset(buffer, 0, 4);
-         memcpy(buffer, stream_a.getByteArray(), stream_a.getByteArraySize());
-         
-         CPPUNIT_ASSERT( std::string((const char*)buffer) == std::string("abc") );
-      }
-   };
-
-}}
-
-#endif /*ACTIVEMQ_IO_BYTEARRAYOUTPUTSTREAMTEST_H_*/
+#ifndef ACTIVEMQ_IO_BYTEARRAYOUTPUTSTREAMTEST_H_
+#define ACTIVEMQ_IO_BYTEARRAYOUTPUTSTREAMTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/io/ByteArrayOutputStream.h>
+
+namespace activemq{
+namespace io{
+
+   class ByteArrayOutputStreamTest : public CppUnit::TestFixture 
+   {
+     CPPUNIT_TEST_SUITE( ByteArrayOutputStreamTest );
+     CPPUNIT_TEST( testStream );
+     CPPUNIT_TEST_SUITE_END();
+
+   public:
+
+   	ByteArrayOutputStreamTest() {}
+
+   	virtual ~ByteArrayOutputStreamTest() {}
+
+      void testStream()
+      {
+         ByteArrayOutputStream stream_a;
+         
+         stream_a.write('a');
+         stream_a.write(60);
+         stream_a.write('c');
+         
+         CPPUNIT_ASSERT( stream_a.getByteArraySize() == 3 );
+         
+         stream_a.clear();
+         
+         CPPUNIT_ASSERT( stream_a.getByteArraySize() == 0 );
+         
+         stream_a.write((const unsigned char*)("abc"), 3);
+  
+         CPPUNIT_ASSERT( stream_a.getByteArraySize() == 3 );
+         
+         stream_a.clear();
+
+         CPPUNIT_ASSERT( stream_a.getByteArraySize() == 0 );
+         
+         stream_a.write((const unsigned char*)("abc"), 3);
+
+         unsigned char buffer[4];
+         
+         memset(buffer, 0, 4);
+         memcpy(buffer, stream_a.getByteArray(), stream_a.getByteArraySize());
+         
+         CPPUNIT_ASSERT( std::string((const char*)buffer) == std::string("abc") );
+      }
+   };
+
+}}
+
+#endif /*ACTIVEMQ_IO_BYTEARRAYOUTPUTSTREAMTEST_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianReaderTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianReaderTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianWriterTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianWriterTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.cpp Wed Jul  5 15:27:34 2006
@@ -1,4 +1,4 @@
-#include "LoggerTest.h"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::logger::LoggerTest );
-
+#include "LoggerTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::logger::LoggerTest );
+

Propchange: incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native