activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmitt...@apache.org
Subject svn commit: r418749 [14/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/StompConnectorTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompConnectorTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompConnectorTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompConnectorTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,319 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_STOMPCONNECTORTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_STOMPCONNECTORTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/StompResponseBuilder.h>
+#include <activemq/connector/stomp/StompConnector.h>
+#include <activemq/transport/Command.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/StompTopic.h>
+#include <activemq/connector/stomp/StompQueue.h>
+#include <activemq/transport/DummyTransport.h>
+
+#include <activemq/io/ByteArrayOutputStream.h>
+#include <algorithm>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+
+    class StompConnectorTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( StompConnectorTest );
+        CPPUNIT_TEST( testSessions );
+        CPPUNIT_TEST( testConsumers );
+        CPPUNIT_TEST( testProducers );
+        CPPUNIT_TEST( testCommand );
+        CPPUNIT_TEST( testSendingCommands );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+    
+    	StompConnectorTest() {}
+    	virtual ~StompConnectorTest() {}
+        
+        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 ConsumerMessageListener{
+        public:
+        
+            std::vector<ConsumerInfo*> consumers;
+            
+        public:
+            virtual ~MyMessageListener(){}
+            
+            virtual void onConsumerMessage( ConsumerInfo* consumer,
+                core::ActiveMQMessage* msg )
+            {
+                consumers.push_back( consumer );
+            }
+        };
+
+        void testSessions()
+        {
+            std::string connectionId = "testConnectionId";
+            StompResponseBuilder responseBuilder("testConnectionId");
+            transport::DummyTransport transport( &responseBuilder );
+            util::SimpleProperties properties;
+            StompConnector connector( &transport, properties );
+            connector.start();
+            
+            SessionInfo* info1 = connector.createSession( cms::Session::AutoAcknowledge );
+            CPPUNIT_ASSERT( info1->getAckMode() == cms::Session::AutoAcknowledge );
+            CPPUNIT_ASSERT( info1->getConnectionId() == connectionId );
+            
+            SessionInfo* info2 = connector.createSession( cms::Session::DupsOkAcknowledge );
+            CPPUNIT_ASSERT( info2->getAckMode() == cms::Session::DupsOkAcknowledge );
+            CPPUNIT_ASSERT( info2->getConnectionId() == connectionId );
+            
+            SessionInfo* info3 = connector.createSession( cms::Session::ClientAcknowledge );
+            CPPUNIT_ASSERT( info3->getAckMode() == cms::Session::ClientAcknowledge );
+            CPPUNIT_ASSERT( info3->getConnectionId() == connectionId );
+            
+            SessionInfo* info4 = connector.createSession( cms::Session::Transactional );
+            CPPUNIT_ASSERT( info4->getAckMode() == cms::Session::Transactional );
+            CPPUNIT_ASSERT( info4->getConnectionId() == connectionId );
+            
+            connector.destroyResource( info1 );
+            connector.destroyResource( info2 );
+            connector.destroyResource( info3 );
+            connector.destroyResource( info4 );
+
+        }
+        
+        void testConsumers()
+        {
+            std::string connectionId = "testConnectionId";
+            StompResponseBuilder responseBuilder("testConnectionId");
+            transport::DummyTransport transport( &responseBuilder );
+            util::SimpleProperties properties;
+            StompConnector connector( &transport, properties );
+            connector.start();
+            
+            SessionInfo* info1 = connector.createSession( cms::Session::AutoAcknowledge );
+            std::string sel1 = "";
+            StompTopic dest1( "dummy.topic.1" );
+            ConsumerInfo* cinfo1 = connector.createConsumer( &dest1, info1, sel1 );
+            CPPUNIT_ASSERT( cinfo1->getSessionInfo() == info1 );
+            CPPUNIT_ASSERT( cinfo1->getDestination().toString() == dest1.toString() );
+            CPPUNIT_ASSERT( cinfo1->getMessageSelector() == sel1 );
+            
+            SessionInfo* info2 = connector.createSession( cms::Session::DupsOkAcknowledge );
+            std::string sel2 = "mysel2";
+            StompTopic dest2( "dummy.topic.2" );
+            ConsumerInfo* cinfo2 = connector.createConsumer( &dest2, info2, sel2 );
+            CPPUNIT_ASSERT( cinfo2->getSessionInfo() == info2 );
+            CPPUNIT_ASSERT( cinfo2->getDestination().toString() == dest2.toString() );
+            CPPUNIT_ASSERT( cinfo2->getMessageSelector() == sel2 );
+            
+            SessionInfo* info3 = connector.createSession( cms::Session::ClientAcknowledge );
+            std::string sel3 = "mysel3";
+            StompQueue dest3( "dummy.queue.1" );
+            ConsumerInfo* cinfo3 = connector.createConsumer( &dest3, info3, sel3 );
+            CPPUNIT_ASSERT( cinfo3->getSessionInfo() == info3 );
+            CPPUNIT_ASSERT( cinfo3->getDestination().toString() == dest3.toString() );
+            CPPUNIT_ASSERT( cinfo3->getMessageSelector() == sel3 );
+            
+            SessionInfo* info4 = connector.createSession( cms::Session::Transactional );
+            std::string sel4 = "";
+            StompTopic dest4( "dummy.queue.2" );
+            ConsumerInfo* cinfo4 = connector.createConsumer( &dest4, info4, sel4 );
+            CPPUNIT_ASSERT( cinfo4->getSessionInfo() == info4 );
+            CPPUNIT_ASSERT( cinfo4->getDestination().toString() == dest4.toString() );
+            CPPUNIT_ASSERT( cinfo4->getMessageSelector() == sel4 );
+            
+            connector.destroyResource( cinfo1 );
+            connector.destroyResource( cinfo2 );
+            connector.destroyResource( cinfo3 );
+            connector.destroyResource( cinfo4 );
+
+            connector.destroyResource( info1 );
+            connector.destroyResource( info2 );
+            connector.destroyResource( info3 );
+            connector.destroyResource( info4 );
+        }
+
+        void testProducers()
+        {
+            std::string connectionId = "testConnectionId";
+            StompResponseBuilder responseBuilder("testConnectionId");
+            transport::DummyTransport transport( &responseBuilder );
+            util::SimpleProperties properties;
+            StompConnector connector( &transport, properties );
+            connector.start();
+            
+            SessionInfo* info1 = connector.createSession( cms::Session::AutoAcknowledge );
+            StompTopic dest1( "dummy.topic.1" );
+            ProducerInfo* pinfo1 = connector.createProducer( &dest1, info1 );
+            CPPUNIT_ASSERT( pinfo1->getSessionInfo() == info1 );
+            CPPUNIT_ASSERT( pinfo1->getDestination().toString() == dest1.toString() );
+            
+            SessionInfo* info2 = connector.createSession( cms::Session::DupsOkAcknowledge );
+            StompTopic dest2( "dummy.topic.2" );
+            ProducerInfo* pinfo2 = connector.createProducer( &dest2, info2 );
+            CPPUNIT_ASSERT( pinfo2->getSessionInfo() == info2 );
+            CPPUNIT_ASSERT( pinfo2->getDestination().toString() == dest2.toString() );
+            
+            SessionInfo* info3 = connector.createSession( cms::Session::ClientAcknowledge );
+            StompQueue dest3( "dummy.queue.1" );
+            ProducerInfo* pinfo3 = connector.createProducer( &dest3, info3 );
+            CPPUNIT_ASSERT( pinfo3->getSessionInfo() == info3 );
+            CPPUNIT_ASSERT( pinfo3->getDestination().toString() == dest3.toString() );
+            
+            SessionInfo* info4 = connector.createSession( cms::Session::Transactional );
+            StompTopic dest4( "dummy.queue.2" );
+            ProducerInfo* pinfo4 = connector.createProducer( &dest4, info4 );
+            CPPUNIT_ASSERT( pinfo4->getSessionInfo() == info4 );
+            CPPUNIT_ASSERT( pinfo4->getDestination().toString() == dest4.toString() );
+            
+            connector.destroyResource( pinfo1 );
+            connector.destroyResource( pinfo2 );
+            connector.destroyResource( pinfo3 );
+            connector.destroyResource( pinfo4 );
+
+            connector.destroyResource( info1 );
+            connector.destroyResource( info2 );
+            connector.destroyResource( info3 );
+            connector.destroyResource( info4 );
+        }
+        
+        void testCommand()
+        {
+            std::string connectionId = "testConnectionId";
+            StompResponseBuilder responseBuilder("testConnectionId");
+            transport::DummyTransport transport( &responseBuilder );
+            util::SimpleProperties properties;
+            StompConnector connector( &transport, properties );
+            connector.start();
+            
+            StompTopic dest1( "dummy.topic" );
+            StompTopic dest2( "dummy.topic2" );
+            
+            SessionInfo* info1 = connector.createSession( cms::Session::AutoAcknowledge );
+            ConsumerInfo* cinfo1 = connector.createConsumer( &dest1, info1, "" );
+            
+            SessionInfo* info2 = connector.createSession( cms::Session::DupsOkAcknowledge );
+            ConsumerInfo* cinfo2 = connector.createConsumer( &dest1, info2, "" );
+            
+            SessionInfo* info3 = connector.createSession( cms::Session::ClientAcknowledge );
+            ConsumerInfo* cinfo3 = connector.createConsumer( &dest2, info3, "" );
+            
+            SessionInfo* info4 = connector.createSession( cms::Session::Transactional );
+            ConsumerInfo* cinfo4 = connector.createConsumer( &dest2, info4, "" );
+            
+            MyMessageListener listener;
+            connector.setConsumerMessageListener( &listener );
+            
+            StompFrame* frame = new StompFrame();
+            frame->setCommand( "MESSAGE" );
+            frame->getProperties().setProperty( 
+                "destination", dest1.toProviderString() );
+            const char* buffer = strdup("hello world");
+            frame->setBody( buffer, 12 );
+
+            commands::TextMessageCommand* msg = 
+                new commands::TextMessageCommand( frame );
+            transport.fireCommand( msg );
+            
+            CPPUNIT_ASSERT( listener.consumers.size() == 2 );
+            for( unsigned int ix=0; ix<listener.consumers.size(); ++ix ){
+                CPPUNIT_ASSERT( listener.consumers[ix] == cinfo1 || 
+                    listener.consumers[ix] == cinfo2 );
+            }
+            
+            // Clean up the consumers list
+            listener.consumers.clear();
+            
+            frame = new StompFrame();
+            frame->setCommand( "MESSAGE" );
+            frame->getProperties().setProperty( 
+                "destination", dest2.toProviderString() );
+            buffer = strdup("hello world");
+            frame->setBody( buffer, 12 );
+
+            msg = new commands::TextMessageCommand( frame );
+            transport.fireCommand( msg );
+            
+            CPPUNIT_ASSERT( listener.consumers.size() == 2 );
+            for( unsigned int ix=0; ix<listener.consumers.size(); ++ix ){
+                CPPUNIT_ASSERT( listener.consumers[ix] == cinfo3 || 
+                    listener.consumers[ix] == cinfo4 );
+            }
+                        
+            connector.destroyResource( cinfo1 );
+            connector.destroyResource( cinfo2 );
+            connector.destroyResource( cinfo3 );
+            connector.destroyResource( cinfo4 );
+
+            connector.destroyResource( info1 );
+            connector.destroyResource( info2 );
+            connector.destroyResource( info3 );
+            connector.destroyResource( info4 );
+        }
+        
+        void testSendingCommands()
+        {
+            std::string connectionId = "testConnectionId";
+            StompResponseBuilder responseBuilder("testConnectionId");
+            transport::DummyTransport transport( &responseBuilder );
+            util::SimpleProperties properties;
+            StompConnector* connector = 
+                new StompConnector( &transport, properties );
+            connector->start();
+            
+            StompTopic dest1( "dummy.topic.1" );
+            
+            MyCommandListener cmdListener;
+            transport.setOutgoingCommandListener( &cmdListener );
+            
+            SessionInfo* info1 = connector->createSession( cms::Session::AutoAcknowledge );
+            ConsumerInfo* cinfo1 = connector->createConsumer( &dest1, info1, "" );                    
+            CPPUNIT_ASSERT( cmdListener.cmd != NULL );
+            
+            cmdListener.cmd = NULL;
+            
+            SessionInfo* info2 = connector->createSession( cms::Session::DupsOkAcknowledge );
+            ConsumerInfo* cinfo2 = connector->createConsumer( &dest1, info2, "" );
+            CPPUNIT_ASSERT( cmdListener.cmd == NULL );
+            
+            cmdListener.cmd = NULL;
+            
+            connector->destroyResource( cinfo1 );
+            CPPUNIT_ASSERT( cmdListener.cmd == NULL );
+            
+            cmdListener.cmd = NULL;
+            
+            connector->destroyResource( cinfo2 );
+            CPPUNIT_ASSERT( cmdListener.cmd != NULL );
+            
+            connector->destroyResource( info1 );
+            connector->destroyResource( info2 );
+            
+            delete connector;
+            CPPUNIT_ASSERT( cmdListener.cmd != NULL );
+        }
+
+    };
+
+}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_STOMPCONNECTORTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompFrameTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompFrameTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompFrameTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompFrameTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,52 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_STOMPFRAMETEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_STOMPFRAMETEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/StompFrame.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+
+   class StompFrameTest : public CppUnit::TestFixture
+   {
+
+     CPPUNIT_TEST_SUITE( StompFrameTest );
+     CPPUNIT_TEST( test );
+     CPPUNIT_TEST_SUITE_END();
+
+   public:
+
+   	virtual ~StompFrameTest() {}
+
+      void test()
+      {
+         StompFrame frame;
+         
+         CPPUNIT_ASSERT( frame.getCommand() == "" );
+         frame.setCommand("test");
+         CPPUNIT_ASSERT( frame.getCommand() == "test" );
+                  
+         frame.getProperties().setProperty("key", "value");
+         
+         std::string result = frame.getProperties().getProperty("key");
+         
+         CPPUNIT_ASSERT( result == "value" );         
+         
+         CPPUNIT_ASSERT( frame.getBody() == NULL );
+         CPPUNIT_ASSERT( frame.getBodyLength() == 0 );
+         
+         frame.setBody( strdup("ABC"), 4 );
+         
+         CPPUNIT_ASSERT( frame.getBody() != NULL );
+         CPPUNIT_ASSERT( frame.getBodyLength() == 4 );
+         CPPUNIT_ASSERT( std::string(frame.getBody()) == "ABC" );
+      }
+      
+   };
+
+}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_STOMPFRAMETEST_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompResponseBuilder.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompResponseBuilder.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompResponseBuilder.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompResponseBuilder.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,45 @@
+#ifndef ACTIVEMQ_CONNECTOR_STOMP_STOMPRESPONSEBUILDER_H_
+#define ACTIVEMQ_CONNECTOR_STOMP_STOMPRESPONSEBUILDER_H_
+
+#include <activemq/transport/DummyTransport.h>
+#include <activemq/connector/stomp/commands/ConnectCommand.h>
+#include <activemq/connector/stomp/commands/ConnectedCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+    
+    class StompResponseBuilder : public transport::DummyTransport::ResponseBuilder{
+        
+    private:
+    
+        std::string sessionId;
+        
+    public:
+    
+        StompResponseBuilder( const std::string& sessionId ){
+            this->sessionId = sessionId;
+        }
+        
+        virtual ~StompResponseBuilder(){}
+        
+        virtual transport::Response* buildResponse( const transport::Command* cmd ){
+            
+            const commands::ConnectCommand* connectCommand = 
+                dynamic_cast<const commands::ConnectCommand*>(cmd);
+                
+            if( connectCommand != NULL ){
+                commands::ConnectedCommand* resp = new commands::ConnectedCommand();
+                resp->setCorrelationId( connectCommand->getCommandId() );
+                resp->setSessionId( sessionId );
+                return resp;                
+            }
+            
+            throw transport::CommandIOException( __FILE__, __LINE__,
+                "StompResponseBuilder - unrecognized command" );
+        }
+    };
+    
+}}}
+
+#endif /*ACTIVEMQ_CONNECTOR_STOMP_STOMPRESPONSEBUILDER_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompSessionManagerTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompSessionManagerTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompSessionManagerTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/StompSessionManagerTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,252 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_STOMPSESSIONMANAGERTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_STOMPSESSIONMANAGERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/StompSessionManager.h>
+#include <activemq/connector/stomp/StompResponseBuilder.h>
+#include <activemq/connector/stomp/StompTopic.h>
+#include <activemq/connector/stomp/StompQueue.h>
+#include <activemq/transport/DummyTransport.h>
+#include <activemq/connector/stomp/commands/TextMessageCommand.h>
+#include <activemq/transport/CommandListener.h>
+#include <cms/Session.h>
+#include <vector>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+
+    class StompSessionManagerTest : public CppUnit::TestFixture
+    {
+
+        CPPUNIT_TEST_SUITE( StompSessionManagerTest );
+        CPPUNIT_TEST( testSessions );
+        CPPUNIT_TEST( testConsumers );
+        CPPUNIT_TEST( testCommand );
+        CPPUNIT_TEST( testSendingCommands );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+    
+        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 ConsumerMessageListener{
+        public:
+        
+            std::vector<ConsumerInfo*> consumers;
+            
+        public:
+            virtual ~MyMessageListener(){}
+            
+            virtual void onConsumerMessage( ConsumerInfo* consumer,
+                core::ActiveMQMessage* msg )
+            {
+                consumers.push_back( consumer );
+            }
+        };
+
+        virtual ~StompSessionManagerTest() {}
+
+        void testSessions()
+        {
+            std::string connectionId = "testConnectionId";
+            StompResponseBuilder responseBuilder("testSessionId");
+            transport::DummyTransport transport( &responseBuilder );
+            StompSessionManager manager( connectionId, &transport );
+            
+            SessionInfo* info1 = manager.createSession( cms::Session::AutoAcknowledge );
+            CPPUNIT_ASSERT( info1->getAckMode() == cms::Session::AutoAcknowledge );
+            CPPUNIT_ASSERT( info1->getConnectionId() == connectionId );
+            
+            SessionInfo* info2 = manager.createSession( cms::Session::DupsOkAcknowledge );
+            CPPUNIT_ASSERT( info2->getAckMode() == cms::Session::DupsOkAcknowledge );
+            CPPUNIT_ASSERT( info2->getConnectionId() == connectionId );
+            
+            SessionInfo* info3 = manager.createSession( cms::Session::ClientAcknowledge );
+            CPPUNIT_ASSERT( info3->getAckMode() == cms::Session::ClientAcknowledge );
+            CPPUNIT_ASSERT( info3->getConnectionId() == connectionId );
+            
+            SessionInfo* info4 = manager.createSession( cms::Session::Transactional );
+            CPPUNIT_ASSERT( info4->getAckMode() == cms::Session::Transactional );
+            CPPUNIT_ASSERT( info4->getConnectionId() == connectionId );
+            
+            delete info1;
+            delete info2;
+            delete info3;
+            delete info4;
+        }
+        
+        void testConsumers()
+        {
+            std::string connectionId = "testConnectionId";
+            StompResponseBuilder responseBuilder("testSessionId");
+            transport::DummyTransport transport( &responseBuilder );
+            StompSessionManager manager( connectionId, &transport );
+            
+            SessionInfo* info1 = manager.createSession( cms::Session::AutoAcknowledge );
+            std::string sel1 = "";
+            StompTopic dest1( "dummy.topic.1" );
+            ConsumerInfo* cinfo1 = manager.createConsumer( &dest1, info1, sel1 );
+            CPPUNIT_ASSERT( cinfo1->getSessionInfo() == info1 );
+            CPPUNIT_ASSERT( cinfo1->getDestination().toString() == dest1.toString() );
+            CPPUNIT_ASSERT( cinfo1->getMessageSelector() == sel1 );
+            
+            SessionInfo* info2 = manager.createSession( cms::Session::DupsOkAcknowledge );
+            std::string sel2 = "mysel2";
+            StompTopic dest2( "dummy.topic.2" );
+            ConsumerInfo* cinfo2 = manager.createConsumer( &dest2, info2, sel2 );
+            CPPUNIT_ASSERT( cinfo2->getSessionInfo() == info2 );
+            CPPUNIT_ASSERT( cinfo2->getDestination().toString() == dest2.toString() );
+            CPPUNIT_ASSERT( cinfo2->getMessageSelector() == sel2 );
+            
+            SessionInfo* info3 = manager.createSession( cms::Session::ClientAcknowledge );
+            std::string sel3 = "mysel3";
+            StompQueue dest3( "dummy.queue.1" );
+            ConsumerInfo* cinfo3 = manager.createConsumer( &dest3, info3, sel3 );
+            CPPUNIT_ASSERT( cinfo3->getSessionInfo() == info3 );
+            CPPUNIT_ASSERT( cinfo3->getDestination().toString() == dest3.toString() );
+            CPPUNIT_ASSERT( cinfo3->getMessageSelector() == sel3 );
+            
+            SessionInfo* info4 = manager.createSession( cms::Session::Transactional );
+            std::string sel4 = "";
+            StompTopic dest4( "dummy.queue.2" );
+            ConsumerInfo* cinfo4 = manager.createConsumer( &dest4, info4, sel4 );
+            CPPUNIT_ASSERT( cinfo4->getSessionInfo() == info4 );
+            CPPUNIT_ASSERT( cinfo4->getDestination().toString() == dest4.toString() );
+            CPPUNIT_ASSERT( cinfo4->getMessageSelector() == sel4 );
+            
+            delete info1;
+            delete info2;
+            delete info3;
+            delete info4;
+            
+            delete cinfo1;
+            delete cinfo2;
+            delete cinfo3;
+            delete cinfo4;
+        }
+        
+        void testCommand()
+        {
+            std::string connectionId = "testConnectionId";
+            StompResponseBuilder responseBuilder("testSessionId");
+            transport::DummyTransport transport( &responseBuilder );
+            StompSessionManager manager( connectionId, &transport );
+            
+            StompTopic dest1( "dummy.topic" );
+            StompTopic dest2( "dummy.topic2" );
+            
+            SessionInfo* info1 = manager.createSession( cms::Session::AutoAcknowledge );
+            ConsumerInfo* cinfo1 = manager.createConsumer( &dest1, info1, "" );
+            
+            SessionInfo* info2 = manager.createSession( cms::Session::DupsOkAcknowledge );
+            ConsumerInfo* cinfo2 = manager.createConsumer( &dest1, info2, "" );
+            
+            SessionInfo* info3 = manager.createSession( cms::Session::ClientAcknowledge );
+            ConsumerInfo* cinfo3 = manager.createConsumer( &dest2, info3, "" );
+            
+            SessionInfo* info4 = manager.createSession( cms::Session::Transactional );
+            ConsumerInfo* cinfo4 = manager.createConsumer( &dest2, info4, "" );
+            
+            MyMessageListener listener;
+            manager.setConsumerMessageListener( &listener );
+            
+            commands::TextMessageCommand* msg = new commands::TextMessageCommand();
+            msg->setCMSDestination( dest1 );
+            msg->setText( "hello world" );                        
+            manager.onStompCommand( msg );
+            
+            CPPUNIT_ASSERT( listener.consumers.size() == 2 );
+            for( unsigned int ix=0; ix<listener.consumers.size(); ++ix ){
+                CPPUNIT_ASSERT( listener.consumers[ix] == cinfo1 || 
+                    listener.consumers[ix] == cinfo2 );
+            }
+            
+            // Clean up the consumers list
+            listener.consumers.clear();
+            
+            msg = new commands::TextMessageCommand();
+            msg->setCMSDestination( dest2 );
+            msg->setText( "hello world" );
+            manager.onStompCommand( msg );
+            
+            CPPUNIT_ASSERT( listener.consumers.size() == 2 );
+            for( unsigned int ix=0; ix<listener.consumers.size(); ++ix ){
+                CPPUNIT_ASSERT( listener.consumers[ix] == cinfo3 || 
+                    listener.consumers[ix] == cinfo4 );
+            }
+                        
+            delete info1;
+            delete info2;
+            delete info3;
+            delete info4;
+            
+            delete cinfo1;
+            delete cinfo2;
+            delete cinfo3;
+            delete cinfo4;
+        }
+        
+        void testSendingCommands(){
+            
+            
+            
+            std::string connectionId = "testConnectionId";
+            StompResponseBuilder responseBuilder("testSessionId");
+            transport::DummyTransport transport( &responseBuilder );
+            StompSessionManager manager( connectionId, &transport );
+            
+            StompTopic dest1( "dummy.topic.1" );
+            
+            MyCommandListener cmdListener;
+            transport.setOutgoingCommandListener( &cmdListener );
+            
+            SessionInfo* info1 = manager.createSession( cms::Session::AutoAcknowledge );
+            ConsumerInfo* cinfo1 = manager.createConsumer( &dest1, info1, "" );                    
+            CPPUNIT_ASSERT( cmdListener.cmd != NULL );
+            
+            cmdListener.cmd = NULL;
+            
+            SessionInfo* info2 = manager.createSession( cms::Session::DupsOkAcknowledge );
+            ConsumerInfo* cinfo2 = manager.createConsumer( &dest1, info2, "" );
+            CPPUNIT_ASSERT( cmdListener.cmd == NULL );
+            
+            cmdListener.cmd = NULL;
+            
+            manager.removeConsumer( cinfo1 );
+            CPPUNIT_ASSERT( cmdListener.cmd == NULL );
+            
+            cmdListener.cmd = NULL;
+            
+            manager.removeConsumer( cinfo2 );
+            CPPUNIT_ASSERT( cmdListener.cmd != NULL );
+            
+            delete info1;
+            delete info2;
+            
+            delete cinfo1;
+            delete cinfo2;                      
+        }
+      
+    };
+
+}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_STOMPSESSIONMANAGERTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/AbortCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/AbortCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/AbortCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/AbortCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,62 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ABORTCOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ABORTCOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/AbortCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class AbortCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( AbortCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+    	AbortCommandTest() {}
+    	virtual ~AbortCommandTest() {}
+
+        void test(void)
+        {
+            AbortCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::ABORT );
+            
+            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" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            AbortCommand 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() );
+            
+        }
+        
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ABORTCOMMANDTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/AckCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/AckCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/AckCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/AckCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,65 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ACKCOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ACKCOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/AckCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+            
+    class AckCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( AckCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+    	AckCommandTest() {}
+    	virtual ~AckCommandTest() {}
+
+        void test(void)
+        {
+            AckCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::ACK );
+            
+            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.getMessageId() == NULL );
+            cmd.setMessageId( "ID:123456789" );
+            CPPUNIT_ASSERT( std::string( cmd.getMessageId() ) == "ID:123456789" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            AckCommand 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.getMessageId()) == cmd1.getMessageId() );
+            CPPUNIT_ASSERT( std::string(cmd.getTransactionId()) == cmd1.getTransactionId() );
+            
+        }
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ACKCOMMANDTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/BeginCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/BeginCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/BeginCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/BeginCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,62 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_BEGINCOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_BEGINCOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/BeginCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class BeginCommandTest: public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( BeginCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+        
+    public:
+
+    	BeginCommandTest() {}
+    	virtual ~BeginCommandTest() {}
+
+        void test(void)
+        {
+            BeginCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::BEGIN );
+            
+            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" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            BeginCommand 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() );
+            
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_BEGINCOMMANDTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/BytesMessageCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/BytesMessageCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/BytesMessageCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/BytesMessageCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,188 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_BYTESMESSAGECOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_BYTESMESSAGECOMMANDTEST_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/BytesMessageCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class BytesMessageCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( BytesMessageCommandTest );
+        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:
+
+    	BytesMessageCommandTest() {}
+    	virtual ~BytesMessageCommandTest() {}
+
+        void test(void)
+        {
+            TestAckHandler ackHandler;
+            BytesMessageCommand 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 );
+            CPPUNIT_ASSERT( cmd.getCMSDestination().toString() == 
+                            "testTopic" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            BytesMessageCommand 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 );
+            cmd.setCMSDestination( topic );
+            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( "test" );
+            CPPUNIT_ASSERT( std::string( cmd.getCMSMessageType() ) == 
+                            "test" );
+            CPPUNIT_ASSERT( cmd.getRedeliveryCount() == 0 );
+            cmd.setRedeliveryCount( 123 );
+            CPPUNIT_ASSERT( cmd.getRedeliveryCount() == 123 );
+            
+            const char* bodyBytes = "TESTBODYBYTES\0";
+            CPPUNIT_ASSERT( cmd.getBodyLength() == 0 );
+            cmd.setBodyBytes( (const unsigned char*)bodyBytes, 
+                              strlen( bodyBytes ) + 1 );
+            CPPUNIT_ASSERT( cmd.getBodyLength() == 
+                            (unsigned int)strlen( bodyBytes ) + 1 );
+            CPPUNIT_ASSERT( std::string( (const char*)cmd.getBodyBytes() ) == 
+                            bodyBytes );
+
+            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() );
+
+            BytesMessageCommand* cmd5 = 
+                dynamic_cast< BytesMessageCommand* >( cmd2 );
+
+            CPPUNIT_ASSERT( cmd5 != NULL );
+            CPPUNIT_ASSERT( std::string( (const char*)cmd.getBodyBytes() ) == 
+                            (const char*)cmd5->getBodyBytes() );
+
+            delete cmd2;
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_BYTESMESSAGECOMMANDTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/CommandConstantsTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/CommandConstantsTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/CommandConstantsTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/CommandConstantsTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,81 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_COMMANDCONSTANTSTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_COMMANDCONSTANTSTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/CommandConstants.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class CommandConstantsTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( CommandConstantsTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+    	CommandConstantsTest() {}
+    	virtual ~CommandConstantsTest() {}
+
+        void test(void)
+        {
+            int index = 0;
+            
+            for(; index < CommandConstants::NUM_COMMANDS; ++index )
+            {
+                CommandConstants::CommandId cmdId = 
+                    (CommandConstants::CommandId)index;
+                std::string cmd = CommandConstants::toString( cmdId );
+    
+                CPPUNIT_ASSERT( cmd != "");            
+                CPPUNIT_ASSERT( 
+                    cmdId == CommandConstants::toCommandId( cmd ) );
+            }
+            
+            CPPUNIT_ASSERT( index != 0 );
+            
+            index = 0;
+                                        
+            for(; index < CommandConstants::NUM_STOMP_HEADERS; ++index )
+            {
+                CommandConstants::StompHeader hdrId = 
+                    (CommandConstants::StompHeader)index;
+                std::string hdr = CommandConstants::toString( hdrId );
+    
+                CPPUNIT_ASSERT( hdr != "");            
+                CPPUNIT_ASSERT( 
+                    hdrId == CommandConstants::toStompHeader( hdr ) );
+            }
+
+            CPPUNIT_ASSERT( index != 0 );
+            
+            index = 0;
+                                        
+            for(; index < CommandConstants::NUM_ACK_MODES; ++index )
+            {
+                CommandConstants::AckMode ackMode = 
+                    (CommandConstants::AckMode)index;
+                std::string ackStr = CommandConstants::toString( ackMode );
+    
+                CPPUNIT_ASSERT( ackStr != "");            
+                CPPUNIT_ASSERT( 
+                    ackMode == CommandConstants::toAckMode( ackStr ) );
+            }
+
+            CPPUNIT_ASSERT( index != 0 );
+
+            CPPUNIT_ASSERT( CommandConstants::queuePrefix != NULL );
+            CPPUNIT_ASSERT( CommandConstants::topicPrefix != NULL );
+
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_COMMANDCONSTANTSTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/CommitCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/CommitCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/CommitCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/CommitCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,62 @@
+#ifndef COMMITCOMMANDTEST_H_
+#define COMMITCOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/CommitCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class CommitCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( CommitCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+    	CommitCommandTest() {}
+    	virtual ~CommitCommandTest() {}
+
+        void test(void)
+        {
+            CommitCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::COMMIT );
+            
+            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" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            CommitCommand 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() );
+            
+        }
+
+    };
+
+}}}}
+
+#endif /*COMMITCOMMANDTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ConnectCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ConnectCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ConnectCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ConnectCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,62 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_CONNECTCOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_CONNECTCOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/ConnectCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class ConnectCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( ConnectCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+    	ConnectCommandTest() {}
+    	virtual ~ConnectCommandTest() {}
+
+        void test(void)
+        {
+            ConnectCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::CONNECT );
+            
+            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" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            ConnectCommand 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() );
+            
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_CONNECTCOMMANDTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ConnectedCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ConnectedCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ConnectedCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ConnectedCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,62 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_CONNECTEDCOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_CONNECTEDCOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/ConnectedCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class ConnectedCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( ConnectedCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+        
+    public:
+
+    	ConnectedCommandTest() {}
+    	virtual ~ConnectedCommandTest() {}
+
+        void test(void)
+        {
+            ConnectedCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::CONNECTED );
+            
+            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" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            ConnectedCommand 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() );
+            
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_CONNECTEDCOMMANDTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/DisconnectCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/DisconnectCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/DisconnectCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/DisconnectCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,62 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_DISCONNECTCOMMANDTEXT_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_DISCONNECTCOMMANDTEXT_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/DisconnectCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class DisconnectCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( DisconnectCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+        
+    public:
+
+    	DisconnectCommandTest() {}
+    	virtual ~DisconnectCommandTest() {}
+
+        void test(void)
+        {
+            DisconnectCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::DISCONNECT );
+            
+            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" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            DisconnectCommand 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() );
+            
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_DISCONNECTCOMMANDTEXT_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ErrorCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ErrorCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ErrorCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ErrorCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,70 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ERRORCOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ERRORCOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/ErrorCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class ErrorCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( ErrorCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+        
+    public:
+
+    	ErrorCommandTest() {}
+    	virtual ~ErrorCommandTest() {}
+
+        void test(void)
+        {
+            ErrorCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::ERROR_CMD );
+            
+            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.getErrorMessage() == NULL );
+            cmd.setErrorMessage( "Error" );
+            CPPUNIT_ASSERT( std::string( cmd.getErrorMessage() ) == "Error" );
+            CPPUNIT_ASSERT( cmd.getErrorDetails() == NULL );
+            cmd.setErrorDetails( "ErrorD" );
+            CPPUNIT_ASSERT( std::string( cmd.getErrorDetails() ) == "ErrorD" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            ErrorCommand 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.getErrorMessage()) == cmd1.getErrorMessage() );
+            CPPUNIT_ASSERT( std::string(cmd.getErrorDetails()) == cmd1.getErrorDetails() );
+            
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_ERRORCOMMANDTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/MessageCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/MessageCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/MessageCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/MessageCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,171 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_MESSAGECOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_MESSAGECOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/MessageCommand.h>
+#include <activemq/core/ActiveMQAckHandler.h>
+#include <activemq/connector/stomp/StompTopic.h>
+#include <cms/Message.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class MessageCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( MessageCommandTest );
+        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:
+
+    	MessageCommandTest() {}
+    	virtual ~MessageCommandTest() {}
+
+        void test(void)
+        {
+            TestAckHandler ackHandler;
+            MessageCommand 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 );
+            
+            MessageCommand cmd1( frame );
+            
+            CPPUNIT_ASSERT( cmd.getCommandId() == cmd1.getCommandId() );
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == CommandConstants::SEND );
+            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( "test" );
+            CPPUNIT_ASSERT( std::string( cmd.getCMSMessageType() ) == 
+                            "test" );
+            CPPUNIT_ASSERT( cmd.getRedeliveryCount() == 0 );
+            cmd.setRedeliveryCount( 123 );
+            CPPUNIT_ASSERT( cmd.getRedeliveryCount() == 123 );
+
+            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() );
+
+            delete cmd2;
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMANDS_MESSAGECOMMANDTEST_H_*/

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

Added: incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ReceiptCommandTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ReceiptCommandTest.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ReceiptCommandTest.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/test/activemq/connector/stomp/commands/ReceiptCommandTest.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,69 @@
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_COMMAND_RECEIPTCOMMANDTEST_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_COMMAND_RECEIPTCOMMANDTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <activemq/connector/stomp/commands/ReceiptCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+namespace commands{
+
+    class ReceiptCommandTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( ReceiptCommandTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+        
+    public:
+
+    	ReceiptCommandTest() {}
+    	virtual ~ReceiptCommandTest() {}
+
+        void test(void)
+        {
+            ReceiptCommand cmd;
+
+            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+                            CommandConstants::RECEIPT );
+            
+            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.getReceiptId() == NULL );
+            cmd.setReceiptId( "456987" );
+            CPPUNIT_ASSERT( std::string( cmd.getReceiptId() ) == 
+                            "456987" );
+            
+            StompFrame* frame = cmd.marshal().clone();
+            
+            CPPUNIT_ASSERT( frame != NULL );
+            
+            ReceiptCommand 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.getReceiptId() ) == 
+                            cmd1.getReceiptId() );
+            
+        }
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_COMMAND_RECEIPTCOMMANDTEST_H_*/

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



Mime
View raw message