activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmitt...@apache.org
Subject svn commit: r418749 [15/17] - in /incubator/activemq/trunk/activemq-cpp: ./ src/ src/main/ src/main/activemq/ src/main/activemq/concurrent/ src/main/activemq/connector/ src/main/activemq/connector/openwire/ src/main/activemq/connector/stomp/ src/main/a...
Date Mon, 03 Jul 2006 11:51:54 GMT
Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/SubscribeCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/SubscribeCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/SubscribeCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/SubscribeCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,91 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMAND_SUBSCRIBECOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMAND_SUBSCRIBECOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/SubscribeCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class SubscribeCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( SubscribeCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+        
+    public:
+
+    	SubscribeCommandTest() {}
+    	virtual ~SubscribeCommandTest() {}
+
+        void test(void)
+        {
+            SubscribeCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::SUBSCRIBE );
+            
+            CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
+            cmd.setResponseRequired( true );
+            cmd.setCommandId( 123 );
+            CPPUNIT_ASSERT( cmd.isResponseRequired() == true );
+            CPPUNIT_ASSERT( cmd.getCommandId() == 123 );
+            cmd.setCorrelationId( 99 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
+            CPPUNIT_ASSERT( cmd.getTransactionId() == NULL );
+            cmd.setTransactionId( "ID:123456" );
+            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+                            "ID:123456" );
+            CPPUNIT_ASSERT( cmd.getDestination() == NULL );
+            cmd.setDestination( "456987" );
+            CPPUNIT_ASSERT( std::string( cmd.getDestination() ) == 
+                            "456987" );
+            CPPUNIT_ASSERT( cmd.getAckMode()  == 
+                            CommandConstants::ACK_AUTO );
+            cmd.setAckMode( CommandConstants::ACK_CLIENT );
+            CPPUNIT_ASSERT( cmd.getAckMode()  == 
+                            CommandConstants::ACK_CLIENT );
+            CPPUNIT_ASSERT( cmd.getMessageSelector() == NULL );
+            cmd.setMessageSelector( "Selector" );
+            CPPUNIT_ASSERT( std::string( cmd.getMessageSelector() ) == 
+                            "Selector" );
+            CPPUNIT_ASSERT( cmd.getSubscriptionName() == NULL );
+            cmd.setSubscriptionName( "subscription" );
+            CPPUNIT_ASSERT( std::string( cmd.getSubscriptionName() ) == 
+                            "subscription" );
+            CPPUNIT_ASSERT( cmd.getNoLocal() == false );
+            cmd.setNoLocal( true );
+            CPPUNIT_ASSERT( cmd.getNoLocal() == true );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            SubscribeCommand cmd1( frame );
+            
+            CPPUNIT_ASSERT( cmd.getCommandId() == cmd1.getCommandId() );
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == cmd1.getStompCommandId() );
+            CPPUNIT_ASSERT( cmd.isResponseRequired() == cmd1.isResponseRequired() );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == cmd1.getCorrelationId() );
+            CPPUNIT_ASSERT( std::string(cmd.getTransactionId()) == 
+                            cmd1.getTransactionId() );
+            CPPUNIT_ASSERT( std::string( cmd.getDestination() ) == 
+                            cmd1.getDestination() );
+            CPPUNIT_ASSERT( cmd.getAckMode() == cmd1.getAckMode() );
+            CPPUNIT_ASSERT( std::string( cmd.getMessageSelector() ) == 
+                            cmd1.getMessageSelector() );
+            CPPUNIT_ASSERT( std::string( cmd.getSubscriptionName() ) == 
+                            cmd1.getSubscriptionName() );
+            CPPUNIT_ASSERT( cmd.getNoLocal() == cmd1.getNoLocal() );
+            
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMAND_SUBSCRIBECOMMANDTEST_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.cpp?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,3 @@
+#include "TextMessageCommandTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::stomp::commands::TextMessageCommandTest );

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,180 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_TEXTMESSAGECOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_TEXTMESSAGECOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <activemq/connector/stomp/StompTopic.h>
+#include <cms/Message.h>
+
+#include <activemq/connector/stomp/commands/TextMessageCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class TextMessageCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( TextMessageCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();        
+
+    protected:
+
+        class TestAckHandler : public core::ActiveMQAckHandler
+        {
+        public:
+        
+            TestAckHandler(void) { wasAcked = false; }
+            virtual ~TestAckHandler(void) {}
+            
+            virtual void acknowledgeMessage( const core::ActiveMQMessage* message)
+                throw ( cms::CMSException ) 
+            {
+                wasAcked = true;
+            }
+            
+        public:
+        
+            bool wasAcked;
+
+        };
+
+    public:
+
+    	TextMessageCommandTest() {}
+    	virtual ~TextMessageCommandTest() {}
+
+        void test(void)
+        {
+            TestAckHandler ackHandler;
+            TextMessageCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::SEND );
+            
+            CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
+            cmd.setResponseRequired( true );
+            cmd.setCommandId( 123 );
+            CPPUNIT_ASSERT( cmd.isResponseRequired() == true );
+            CPPUNIT_ASSERT( cmd.getCommandId() == 123 );
+            cmd.setCorrelationId( 99 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
+            CPPUNIT_ASSERT( cmd.getTransactionId() == NULL );
+            cmd.setTransactionId( "ID:123456" );
+            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+                            "ID:123456" );
+            StompTopic topic("testTopic");
+            cmd.setCMSDestination( topic );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            TextMessageCommand cmd1( frame );
+            
+            CPPUNIT_ASSERT( cmd.getCommandId() == cmd1.getCommandId() );
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == cmd1.getStompCommandId() );
+            CPPUNIT_ASSERT( cmd.isResponseRequired() == cmd1.isResponseRequired() );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == cmd1.getCorrelationId() );
+            CPPUNIT_ASSERT( std::string(cmd.getTransactionId()) == cmd1.getTransactionId() );
+            
+            cmd.setAckHandler( &ackHandler );
+            cmd.acknowledge();
+            CPPUNIT_ASSERT( ackHandler.wasAcked == true );
+            
+            CPPUNIT_ASSERT( 
+                cmd.getProperties().hasProperty( "test" ) == false );
+            cmd.getProperties().setProperty( "test", "value" );
+            CPPUNIT_ASSERT( 
+                cmd.getProperties().hasProperty( "test" ) == true );
+            CPPUNIT_ASSERT( 
+                std::string( cmd.getProperties().getProperty( "test" ) ) ==
+                "value" );
+                
+            CPPUNIT_ASSERT( cmd.getCMSCorrelationId() == NULL );
+            cmd.setCMSCorrelationId( "ID:1234567" );
+            CPPUNIT_ASSERT( std::string( cmd.getCMSCorrelationId() ) == 
+                            "ID:1234567" );
+            CPPUNIT_ASSERT( cmd.getCMSDeliveryMode() == 
+                            cms::Message::PERSISTANT );
+            cmd.setCMSDeliveryMode( cms::Message::NONPERSISTANT );
+            CPPUNIT_ASSERT( cmd.getCMSDeliveryMode() == 
+                            cms::Message::NONPERSISTANT );
+            CPPUNIT_ASSERT( cmd.getCMSDestination().toString() == 
+                            "testTopic" );
+            CPPUNIT_ASSERT( cmd.getCMSExpiration() == 0 );
+            cmd.setCMSExpiration( 123 );
+            CPPUNIT_ASSERT( cmd.getCMSExpiration() == 123 );
+            CPPUNIT_ASSERT( cmd.getCMSMessageId() == NULL );
+            cmd.setCMSMessageId( "ID:1234567" );
+            CPPUNIT_ASSERT( std::string( cmd.getCMSMessageId() ) == 
+                            "ID:1234567" );
+            CPPUNIT_ASSERT( cmd.getCMSPriority() == 0 );
+            cmd.setCMSPriority( 5 );
+            CPPUNIT_ASSERT( cmd.getCMSPriority() == 5 );
+            CPPUNIT_ASSERT( cmd.getCMSRedelivered() == false );
+            cmd.setCMSRedelivered( true );
+            CPPUNIT_ASSERT( cmd.getCMSRedelivered() == true );
+            CPPUNIT_ASSERT( cmd.getCMSReplyTo() == NULL );
+            cmd.setCMSReplyTo( "topic" );
+            CPPUNIT_ASSERT( std::string( cmd.getCMSReplyTo() ) == 
+                            "topic" );
+            CPPUNIT_ASSERT( cmd.getCMSTimeStamp() == 0 );
+            cmd.setCMSTimeStamp( 123 );
+            CPPUNIT_ASSERT( cmd.getCMSTimeStamp() == 123 );
+            CPPUNIT_ASSERT( cmd.getCMSMessageType() == NULL );
+            cmd.setCMSMessageType( "text" );
+            CPPUNIT_ASSERT( std::string( cmd.getCMSMessageType() ) == 
+                            "text" );
+            CPPUNIT_ASSERT( cmd.getRedeliveryCount() == 0 );
+            cmd.setRedeliveryCount( 123 );
+            CPPUNIT_ASSERT( cmd.getRedeliveryCount() == 123 );
+
+            CPPUNIT_ASSERT( cmd.getText() == NULL );
+            cmd.setText( "TESTMESSAGE" );
+            CPPUNIT_ASSERT( std::string( cmd.getText() ) == "TESTMESSAGE" );
+
+            cms::Message* cmd2 = cmd.clone();
+            
+            CPPUNIT_ASSERT( cmd.getCMSPriority() == cmd2->getCMSPriority() );
+            CPPUNIT_ASSERT( cmd.getCMSTimeStamp() == cmd2->getCMSTimeStamp() );
+            CPPUNIT_ASSERT( cmd.getCMSExpiration() == cmd2->getCMSExpiration() );
+            CPPUNIT_ASSERT( cmd.getCMSDeliveryMode() == cmd2->getCMSDeliveryMode() );
+            CPPUNIT_ASSERT( std::string(cmd.getCMSCorrelationId()) == cmd2->getCMSCorrelationId() );
+            CPPUNIT_ASSERT( std::string(cmd.getCMSReplyTo()) == cmd2->getCMSReplyTo() );
+            CPPUNIT_ASSERT( std::string(cmd.getCMSMessageType()) == cmd2->getCMSMessageType() );
+            CPPUNIT_ASSERT( std::string(cmd.getCMSMessageId()) == cmd2->getCMSMessageId() );
+
+            core::ActiveMQMessage* message = 
+                dynamic_cast< core::ActiveMQMessage* >( cmd2 );
+                
+            CPPUNIT_ASSERT( message != NULL );
+            CPPUNIT_ASSERT( cmd.getRedeliveryCount() == 
+                            message->getRedeliveryCount() );
+            
+            StompCommand* cmd4 = 
+                dynamic_cast< StompCommand* >( cmd2 );
+
+            CPPUNIT_ASSERT( cmd4 != NULL );
+            CPPUNIT_ASSERT( cmd.getCommandId() == cmd4->getCommandId() );
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == cmd4->getStompCommandId() );
+            CPPUNIT_ASSERT( cmd.isResponseRequired() == cmd4->isResponseRequired() );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == cmd4->getCorrelationId() );
+            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+                            cmd4->getTransactionId() );
+
+            TextMessageCommand* cmd5 = 
+                dynamic_cast< TextMessageCommand* >(message);
+
+            CPPUNIT_ASSERT( cmd5 != NULL );
+            CPPUNIT_ASSERT( std::string( cmd.getText() ) == cmd5->getText() );
+            
+            delete cmd2;
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_TEXTMESSAGECOMMANDTEST_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.cpp?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,3 @@
+#include "UnsubscribeCommandTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::stomp::commands::UnsubscribeCommandTest );

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,67 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMAND_UNSUBSCRIBECOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMAND_UNSUBSCRIBECOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/UnsubscribeCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class UnsubscribeCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( UnsubscribeCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+        
+    public:
+    	UnsubscribeCommandTest() {}
+    	virtual ~UnsubscribeCommandTest() {}
+
+        void test(void)
+        {
+            UnsubscribeCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::UNSUBSCRIBE );
+            
+            CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
+            cmd.setResponseRequired( true );
+            cmd.setCommandId( 123 );
+            CPPUNIT_ASSERT( cmd.isResponseRequired() == true );
+            CPPUNIT_ASSERT( cmd.getCommandId() == 123 );
+            cmd.setCorrelationId( 99 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
+            CPPUNIT_ASSERT( cmd.getTransactionId() == NULL );
+            cmd.setTransactionId( "ID:123456" );
+            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+                            "ID:123456" );
+            CPPUNIT_ASSERT( cmd.getDestination() == NULL );
+            cmd.setDestination( "456987" );
+            CPPUNIT_ASSERT( std::string( cmd.getDestination() ) == 
+                            "456987" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            UnsubscribeCommand cmd1( frame );
+            
+            CPPUNIT_ASSERT( cmd.getCommandId() == cmd1.getCommandId() );
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == cmd1.getStompCommandId() );
+            CPPUNIT_ASSERT( cmd.isResponseRequired() == cmd1.isResponseRequired() );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == cmd1.getCorrelationId() );
+            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+                            cmd1.getTransactionId() );
+            CPPUNIT_ASSERT( std::string( cmd.getDestination() ) == 
+                            cmd1.getDestination() );
+            
+        }
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMAND_UNSUBSCRIBECOMMANDTEST_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/marshal/MarshalerTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/marshal/MarshalerTest.cpp?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/marshal/MarshalerTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/marshal/MarshalerTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,3 @@
+#include "MarshalerTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::stomp::marshal::MarshalerTest );

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/marshal/MarshalerTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/marshal/MarshalerTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +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_*/

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,3 @@
+#include "ActiveMQConnectionFactoryTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQConnectionFactoryTest );

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +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_*/

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,4 @@
+#include "ActiveMQConnectionTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQConnectionTest );
+

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +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_*/

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,3 @@
+#include "ActiveMQSessionTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::core::ActiveMQSessionTest );

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +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_*/

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/exceptions/ActiveMQExceptionTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/exceptions/ActiveMQExceptionTest.cpp?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/exceptions/ActiveMQExceptionTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/exceptions/ActiveMQExceptionTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,4 @@
+#include "ActiveMQExceptionTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::exceptions::ActiveMQExceptionTest );
+

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/exceptions/ActiveMQExceptionTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/exceptions/ActiveMQExceptionTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/exceptions/ActiveMQExceptionTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/exceptions/ActiveMQExceptionTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,39 @@
+#ifndef ACTIVEMQ_EXCEPTIONS_ACTIVEMQEXCEPTIONTEST_H_
+#define ACTIVEMQ_EXCEPTIONS_ACTIVEMQEXCEPTIONTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/exceptions/ActiveMQException.h>
+#include <string.h>
+
+namespace activemq{
+namespace exceptions{
+	
+	class ActiveMQExceptionTest : public CppUnit::TestFixture {
+		
+	  CPPUNIT_TEST_SUITE( ActiveMQExceptionTest );
+	  CPPUNIT_TEST( testMessage0 );
+	  CPPUNIT_TEST( testMessage3 );
+	  CPPUNIT_TEST_SUITE_END();
+	  
+	public:
+	
+		virtual void setUp(){};	
+	 	virtual void tearDown(){};
+		void testMessage0(){
+		  	char* text = "This is a test";
+		  	ActiveMQException ex( __FILE__, __LINE__, text );
+		  	CPPUNIT_ASSERT( strcmp( ex.getMessage(), text ) == 0 );
+		}
+	  
+	  	void testMessage3(){
+	  		ActiveMQException ex( __FILE__, __LINE__, 
+                "This is a test %d %d %d", 1, 100, 1000 );
+	  		CPPUNIT_ASSERT( strcmp( ex.getMessage(), "This is a test 1 100 1000" ) == 0 );
+	  	}
+	};
+	
+}}
+
+#endif /*ACTIVEMQ_EXCEPTIONS_ACTIVEMQEXCEPTIONTEST_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.cpp?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,4 @@
+#include "BufferedInputStreamTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::BufferedInputStreamTest );
+

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,163 @@
+#ifndef ACTIVEMQ_IO_BUFFEREDINPUTSTREAMTEST_H_
+#define ACTIVEMQ_IO_BUFFEREDINPUTSTREAMTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/io/BufferedInputStream.h>
+
+
+namespace activemq{
+namespace io{
+	
+	class BufferedInputStreamTest : public CppUnit::TestFixture {
+		
+	  CPPUNIT_TEST_SUITE( BufferedInputStreamTest );
+	  CPPUNIT_TEST( testSmallerBuffer );
+	  CPPUNIT_TEST( testBiggerBuffer );
+	  CPPUNIT_TEST_SUITE_END();
+	  
+	public:
+	
+		class MyInputStream : public InputStream{
+		private:
+			std::string data;
+			unsigned int pos;
+		public:
+		
+			MyInputStream( const std::string& data ){
+				this->data = data;
+				pos = 0;
+			}
+			virtual ~MyInputStream(){}
+			
+			virtual int available() const{
+				int len = data.length();
+				return len - (int)pos;
+			}
+			virtual unsigned char read() throw (IOException){
+				if( pos >= data.length() ){
+					throw IOException();
+				}
+				
+				return data.c_str()[pos++];
+			}
+			virtual int read( unsigned char* buffer, const int bufferSize ) throw (IOException){
+				unsigned int numToRead = std::min( bufferSize, available() );
+				
+				const char* str = data.c_str();
+				for( unsigned int ix=0; ix<numToRead; ++ix ){
+					buffer[ix] = str[pos+ix];
+				}
+				
+				pos += numToRead;
+				
+				return numToRead;
+			}
+
+			virtual void close() throw(cms::CMSException){
+				// do nothing.
+			}
+			
+		    virtual void lock() throw(exceptions::ActiveMQException){
+		    }
+		    virtual void unlock() throw(exceptions::ActiveMQException){
+		    }
+            virtual void wait() throw(exceptions::ActiveMQException){
+            }
+            virtual void wait(unsigned long millisecs) throw(exceptions::ActiveMQException){                
+            }
+            virtual void notify() throw(exceptions::ActiveMQException){
+            }
+            virtual void notifyAll() throw(exceptions::ActiveMQException){
+            }
+		};
+		
+	public:
+	
+		virtual void setUp(){};	
+	 	virtual void tearDown(){};
+		void testSmallerBuffer(){
+			
+			std::string testStr = "TEST12345678910";
+			MyInputStream myStream( testStr );
+			BufferedInputStream bufStream( &myStream, 1 );
+			
+			int available = bufStream.available();
+			CPPUNIT_ASSERT( available == (int)testStr.length() );
+			
+			unsigned char dummy = bufStream.read();
+			CPPUNIT_ASSERT( dummy == 'T' );
+			
+			available = bufStream.available();
+			CPPUNIT_ASSERT( available == ((int)testStr.length() - 1 ) );
+			
+			dummy = bufStream.read();
+			CPPUNIT_ASSERT( dummy == 'E' );
+			
+			available = bufStream.available();
+			CPPUNIT_ASSERT( available == ((int)testStr.length() - 2 ) );
+			
+			dummy = bufStream.read();
+			CPPUNIT_ASSERT( dummy == 'S' );
+			
+			available = bufStream.available();
+			CPPUNIT_ASSERT( available == ((int)testStr.length() - 3 ) );
+			
+			dummy = bufStream.read();
+			CPPUNIT_ASSERT( dummy == 'T' );
+			
+			unsigned char dummyBuf[20];
+			memset( dummyBuf, 0, 20 );
+			int numRead = bufStream.read( dummyBuf, 10 );
+			CPPUNIT_ASSERT( numRead == 10 );
+			CPPUNIT_ASSERT( strcmp( (char*)dummyBuf, "1234567891" ) == 0 );			
+			
+			available = bufStream.available();
+			CPPUNIT_ASSERT( available == 1 );
+		}
+		
+		void testBiggerBuffer(){
+			
+			std::string testStr = "TEST12345678910";
+			MyInputStream myStream( testStr );
+			BufferedInputStream bufStream( &myStream, 10 );
+			
+			int available = bufStream.available();
+			CPPUNIT_ASSERT( available == (int)testStr.length() );
+			
+			unsigned char dummy = bufStream.read();
+			CPPUNIT_ASSERT( dummy == 'T' );
+			
+			available = bufStream.available();
+			CPPUNIT_ASSERT( available == ((int)testStr.length() - 1 ) );
+			
+			dummy = bufStream.read();
+			CPPUNIT_ASSERT( dummy == 'E' );
+			
+			available = bufStream.available();
+			CPPUNIT_ASSERT( available == ((int)testStr.length() - 2 ) );
+			
+			dummy = bufStream.read();
+			CPPUNIT_ASSERT( dummy == 'S' );
+			
+			available = bufStream.available();
+			CPPUNIT_ASSERT( available == ((int)testStr.length() - 3 ) );
+			
+			dummy = bufStream.read();
+			CPPUNIT_ASSERT( dummy == 'T' );
+			
+			unsigned char dummyBuf[20];
+			memset( dummyBuf, 0, 20 );
+			int numRead = bufStream.read( dummyBuf, 10 );
+			CPPUNIT_ASSERT( numRead == 10 );
+			CPPUNIT_ASSERT( strcmp( (char*)dummyBuf, "1234567891" ) == 0 );			
+			
+			available = bufStream.available();
+			CPPUNIT_ASSERT( available == 1 );
+		}
+	};
+	
+}}
+
+#endif /*ACTIVEMQ_IO_BUFFEREDINPUTSTREAMTEST_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.cpp?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,4 @@
+#include "BufferedOutputStreamTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::BufferedOutputStreamTest );
+

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,131 @@
+#ifndef ACTIVEMQ_IO_BUFFEREDOUTPUTSTREAMTEST_H_
+#define ACTIVEMQ_IO_BUFFEREDOUTPUTSTREAMTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/io/BufferedOutputStream.h>
+#include <string.h>
+
+namespace activemq{
+namespace io{
+	
+	class BufferedOutputStreamTest : public CppUnit::TestFixture {
+		
+	  CPPUNIT_TEST_SUITE( BufferedOutputStreamTest );
+	  CPPUNIT_TEST( testSmallerBuffer );
+	  CPPUNIT_TEST( testBiggerBuffer );
+	  CPPUNIT_TEST_SUITE_END();
+	  
+	public:
+	
+		class MyOutputStream : public OutputStream{
+		private:
+			char buffer[100];
+			unsigned int pos;
+		public:
+		
+			MyOutputStream(){
+				pos = 0;
+				memset( buffer, 0, 100 );
+			}
+			virtual ~MyOutputStream(){}
+			
+			const char* getBuffer() const{ return buffer; }
+			
+			virtual void write( const unsigned char c ) throw (IOException){
+				if( pos >= 100 ){
+					throw IOException();
+				}
+				
+				buffer[pos++] = c;
+			}
+		
+			virtual void write( const unsigned char* buffer, const int len ) throw (IOException){
+				
+				if( (pos + len) > 100 ){
+					throw IOException();
+				}
+				
+				memcpy( this->buffer + pos, buffer, len );
+				
+				pos += len;
+			}
+		
+			virtual void flush() throw (IOException){
+			}
+
+			virtual void close() throw(cms::CMSException){
+				// do nothing.
+			}
+			
+		    virtual void lock() throw(exceptions::ActiveMQException){
+            }
+            virtual void unlock() throw(exceptions::ActiveMQException){
+            }
+            virtual void wait() throw(exceptions::ActiveMQException){
+            }
+            virtual void wait(unsigned long millisecs) throw(exceptions::ActiveMQException){
+            }
+            virtual void notify() throw(exceptions::ActiveMQException){
+            }
+            virtual void notifyAll() throw(exceptions::ActiveMQException){
+            }
+		};
+		
+	public:
+	
+		virtual void setUp(){};	
+	 	virtual void tearDown(){};
+		void testSmallerBuffer(){
+			
+			MyOutputStream myStream;
+			BufferedOutputStream bufStream( &myStream, 1 );
+			
+			const char* buffer = myStream.getBuffer();
+			
+			bufStream.write( (unsigned char)'T' );
+			// Should not be written yet.
+			CPPUNIT_ASSERT( strcmp( buffer, "" ) == 0 );
+			
+			bufStream.write( (unsigned char)'E' );
+			// This time the T should have been written.
+			CPPUNIT_ASSERT( strcmp( buffer, "T" ) == 0 );
+			
+			bufStream.write( (unsigned char*)"ST", 2 );
+			// This time the ES should have been written.
+			CPPUNIT_ASSERT( strcmp( buffer, "TES" ) == 0 );
+			
+			bufStream.flush();
+			CPPUNIT_ASSERT( strcmp( buffer, "TEST" ) == 0 );			
+		}
+		
+		void testBiggerBuffer(){
+			
+			MyOutputStream myStream;
+			BufferedOutputStream bufStream( &myStream, 10 );
+			
+			const char* buffer = myStream.getBuffer();
+			
+			bufStream.write( (unsigned char*)"TEST", 4 );
+			
+			// Should not be written yet.
+			CPPUNIT_ASSERT( strcmp( buffer, "" ) == 0 );
+			
+			bufStream.flush();
+			CPPUNIT_ASSERT( strcmp( buffer, "TEST" ) == 0 );
+			
+			bufStream.write( (unsigned char*)"TEST", 4 );
+			bufStream.write( (unsigned char*)"12345678910", 11);
+			
+			CPPUNIT_ASSERT( strcmp( buffer, "TESTTEST123456" ) == 0 );
+			
+			bufStream.flush();
+			CPPUNIT_ASSERT( strcmp( buffer, "TESTTEST12345678910" ) == 0 );
+			
+		}
+	};
+	
+}}
+
+#endif /*ACTIVEMQ_IO_BUFFEREDOUTPUTSTREAMTEST_H_*/

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,3 @@
+#include "ByteArrayInputStreamTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::ByteArrayInputStreamTest );

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayInputStreamTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +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_*/

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,3 @@
+#include "ByteArrayOutputStreamTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::ByteArrayOutputStreamTest );

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/ByteArrayOutputStreamTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +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_*/

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianReaderTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianReaderTest.cpp?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianReaderTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianReaderTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,4 @@
+#include "EndianReaderTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::EndianReaderTest );
+

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianReaderTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianReaderTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianReaderTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianReaderTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,167 @@
+#ifndef ACTIVEMQ_IO_ENDIANREADERTEST_H_
+#define ACTIVEMQ_IO_ENDIANREADERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/exceptions/ActiveMQException.h>
+#include <activemq/io/BufferedInputStream.h>
+#include <activemq/util/Endian.h>
+#include <activemq/io/EndianReader.h>
+
+#ifdef min
+#undef min
+#endif
+
+#include <algorithm>
+
+namespace activemq{
+namespace io{
+	
+	class EndianReaderTest : public CppUnit::TestFixture {
+		
+	  CPPUNIT_TEST_SUITE( EndianReaderTest );
+	  CPPUNIT_TEST( test );
+	  CPPUNIT_TEST_SUITE_END();
+	  
+	public:
+	
+		class MyInputStream : public InputStream{
+		private:
+			unsigned char* buffer;
+			int len;
+			unsigned int pos;
+		public:
+		
+			MyInputStream( unsigned char* buffer, int len ){
+				this->buffer = buffer;
+				this->len = len;
+				pos = 0;
+			}
+			virtual ~MyInputStream(){}
+			
+			virtual int available() const{
+				return len - (int)pos;
+			}
+			virtual unsigned char read() throw (IOException){
+				if( (int)pos >= len ){
+					throw IOException();
+				}
+				
+				return buffer[pos++];
+			}
+			virtual int read( unsigned char* buffer, const int bufferSize ) throw (IOException){
+				unsigned int numToRead = std::min( bufferSize, available() );
+				
+				for( unsigned int ix=0; ix<numToRead; ++ix ){
+					buffer[ix] = this->buffer[pos+ix];
+				}
+				
+				pos += numToRead;
+				
+				return numToRead;
+			}
+
+			virtual void close() throw(cms::CMSException){
+				// do nothing.
+			}
+			
+		    virtual void lock() throw(exceptions::ActiveMQException){
+            }
+            virtual void unlock() throw(exceptions::ActiveMQException){
+            }
+            virtual void wait() throw(exceptions::ActiveMQException){
+            }
+            virtual void wait(unsigned long millisecs) throw(exceptions::ActiveMQException){
+            }
+            virtual void notify() throw(exceptions::ActiveMQException){
+            }
+            virtual void notifyAll() throw(exceptions::ActiveMQException){
+            }
+		};
+		
+	public:
+	
+		virtual void setUp(){};	
+	 	virtual void tearDown(){};
+		void test(){
+			
+			unsigned char buffer[1000];			
+			int ix = 0;	
+			
+			unsigned char byteVal = (unsigned char)'T';
+			uint16_t shortVal = 5;
+			uint32_t intVal = 10000;
+			uint64_t longVal = 1000000000;
+			float floatVal = 10.0f;
+			double doubleVal = 100.0;
+			unsigned char arrayVal[3] = {
+				'a', 'b', 'c'
+			};
+			
+			int size = sizeof(char);
+			memcpy( (char*)(buffer+ix), (char*)&byteVal, size );
+			ix += size;
+			
+			size = sizeof(uint16_t);
+			uint16_t tempShort = util::Endian::byteSwap(shortVal);
+			memcpy( (char*)(buffer+ix), (char*)&tempShort, size );
+			ix += size;
+			
+			size = sizeof(uint32_t);
+			uint32_t tempInt = util::Endian::byteSwap(intVal);
+			memcpy( (char*)(buffer+ix), (char*)&tempInt, size );
+			ix += size;
+			
+			size = sizeof(uint64_t);
+			uint64_t tempLong = util::Endian::byteSwap(longVal);
+			memcpy( (char*)(buffer+ix), (char*)&tempLong, size );
+			ix += size;
+			
+			size = sizeof(float);
+			float tempFloat = util::Endian::byteSwap(floatVal);
+			memcpy( (char*)(buffer+ix), (char*)&tempFloat, size );
+			ix += size;
+			
+			size = sizeof(double);
+			double tempDouble = util::Endian::byteSwap(doubleVal);
+			memcpy( (char*)(buffer+ix), (char*)&tempDouble, size );
+			ix += size;
+			
+			size = 3;
+			memcpy( (char*)(buffer+ix), (char*)&arrayVal, size );
+			ix += size;
+
+			// Create the stream with the buffer we just wrote to.
+			MyInputStream myStream( buffer, 1000 );
+			EndianReader reader( &myStream );
+			
+			byteVal = reader.readByte();
+			CPPUNIT_ASSERT( byteVal == (unsigned char)'T' );
+			
+			shortVal = reader.readUInt16();
+			CPPUNIT_ASSERT( shortVal == 5 );
+			
+			intVal = reader.readUInt32();
+			CPPUNIT_ASSERT( intVal == 10000 );
+			
+			longVal = reader.readUInt64();
+			CPPUNIT_ASSERT( longVal == 1000000000 );
+			
+			floatVal = reader.readFloat();
+			CPPUNIT_ASSERT( floatVal == 10.0f );
+			
+			doubleVal = reader.readDouble();
+			CPPUNIT_ASSERT( doubleVal == 100.0 );
+			
+			reader.read( arrayVal, 3 );
+			CPPUNIT_ASSERT( arrayVal[0] == 'a' );
+			CPPUNIT_ASSERT( arrayVal[1] == 'b' );
+			CPPUNIT_ASSERT( arrayVal[2] == 'c' );
+		}
+
+	};
+	
+}}
+
+#endif /*ACTIVEMQ_IO_ENDIANREADERTEST_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianWriterTest.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianWriterTest.cpp?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianWriterTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianWriterTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,4 @@
+#include "EndianWriterTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::io::EndianWriterTest );
+

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianWriterTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianWriterTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianWriterTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/io/EndianWriterTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,137 @@
+#ifndef ACTIVEMQ_IO_ENDIANWRITERTEST_H_
+#define ACTIVEMQ_IO_ENDIANWRITERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/util/Endian.h>
+#include <activemq/io/EndianWriter.h>
+
+namespace activemq{
+namespace io{
+	
+	class EndianWriterTest : public CppUnit::TestFixture {
+		
+	  CPPUNIT_TEST_SUITE( EndianWriterTest );
+	  CPPUNIT_TEST( test );
+	  CPPUNIT_TEST_SUITE_END();
+	  
+	public:
+	
+		class MyOutputStream : public OutputStream{
+		private:
+			
+			unsigned char buffer[1000];
+			unsigned int pos;
+		public:
+		
+			MyOutputStream(){
+				pos = 0;
+				memset( buffer, 0, 1000 );
+			}
+			virtual ~MyOutputStream(){}
+			
+			const unsigned char* getBuffer() const{ return buffer; }
+			
+			virtual void write( const unsigned char c ) throw (IOException){
+				if( pos >= 1000 ){
+					throw IOException();
+				}
+				
+				buffer[pos++] = c;
+			}
+		
+			virtual void write( const unsigned char* buffer, const int len ) throw (IOException){
+				
+				if( (pos + len) > 1000 ){
+					throw IOException();
+				}
+				
+				memcpy( this->buffer + pos, buffer, len );
+				
+				pos += len;
+			}
+		
+			virtual void flush() throw (IOException){
+			}
+
+			virtual void close() throw(cms::CMSException){
+				// do nothing.
+			}
+			
+		    virtual void lock() throw(exceptions::ActiveMQException){
+            }
+            virtual void unlock() throw(exceptions::ActiveMQException){
+            }
+            virtual void wait() throw(exceptions::ActiveMQException){
+            }
+            virtual void wait(unsigned long millisecs) throw(exceptions::ActiveMQException){
+            }
+            virtual void notify() throw(exceptions::ActiveMQException){
+            }
+            virtual void notifyAll() throw(exceptions::ActiveMQException){
+            }
+		};
+		
+	public:
+	
+		virtual void setUp(){};	
+	 	virtual void tearDown(){};
+		void test(){
+			
+			unsigned char byteVal = (unsigned char)'T';
+			uint16_t shortVal = 5;
+			uint32_t intVal = 10000;
+			uint64_t longVal = 1000000000;
+			float floatVal = 10.0f;
+			double doubleVal = 100.0;
+			unsigned char arrayVal[3] = {
+				'a', 'b', 'c'
+			};
+			
+			// Create the stream with the buffer we just wrote to.
+			MyOutputStream myStream;
+			EndianWriter writer( &myStream );
+			
+			writer.writeByte( byteVal );
+			writer.writeUInt16( shortVal );
+			writer.writeUInt32( intVal );
+			writer.writeUInt64( longVal );
+			writer.writeFloat( floatVal );
+			writer.writeDouble( doubleVal );
+			writer.write( arrayVal, 3 );
+			
+			
+			const unsigned char* buffer = myStream.getBuffer();
+			int ix = 0;
+			
+			unsigned char tempByte = buffer[ix];
+			CPPUNIT_ASSERT( tempByte == byteVal );
+			ix += sizeof( tempByte );
+
+			uint16_t tempShort = util::Endian::byteSwap( *(uint16_t*)(buffer+ix) );
+			CPPUNIT_ASSERT( tempShort == shortVal );
+			ix += sizeof( tempShort );
+			
+			uint32_t tempInt = util::Endian::byteSwap( *(uint32_t*)(buffer+ix) );
+			CPPUNIT_ASSERT( tempInt == intVal );
+			ix += sizeof( tempInt );
+			
+			uint64_t tempLong = util::Endian::byteSwap( *(uint64_t*)(buffer+ix) );
+			CPPUNIT_ASSERT( tempLong == longVal );
+			ix += sizeof( tempLong );
+			
+			float tempFloat = util::Endian::byteSwap( *(float*)(buffer+ix) );
+			CPPUNIT_ASSERT( tempFloat == floatVal );
+			ix += sizeof( tempFloat );
+			
+			double tempDouble = util::Endian::byteSwap( *(double*)(buffer+ix) );
+			CPPUNIT_ASSERT( tempDouble == doubleVal );
+			ix += sizeof( tempDouble );
+		}
+
+	};
+	
+}}
+
+#endif /*ACTIVEMQ_IO_ENDIANWRITERTEST_H_*/

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,4 @@
+#include "LoggerTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::logger::LoggerTest );
+

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/logger/LoggerTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +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_*/

Added: 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=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,3 @@
+#include "SocketFactoryTest.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::network::SocketFactoryTest );



Mime
View raw message