activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r541683 [1/2] - in /activemq/activemq-cpp/trunk/src: main/ main/activemq/connector/stomp/ main/activemq/connector/stomp/commands/ test/ test/activemq/connector/stomp/ test/activemq/connector/stomp/commands/ test/activemq/transport/
Date Fri, 25 May 2007 15:09:45 GMT
Author: tabish
Date: Fri May 25 08:09:43 2007
New Revision: 541683

URL: http://svn.apache.org/viewvc?view=rev&rev=541683
Log:
http://issues.apache.org/activemq/browse/AMQCPP-108

MAde the connector use a Stomp Connection Negotiator that handles the connection phase, no other changes to the Connector other than to use this were made.  The negotiator requires that the ConnectedCommand is no longer a Response derived object, but once it gets it it creates a ConnectedWrapper instnace that is a response so that request can return it.  

Added:
    activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnectionNegotiator.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnectionNegotiator.h
Modified:
    activemq/activemq-cpp/trunk/src/main/Makefile.am
    activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnector.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/commands/AbstractCommand.h
    activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/commands/ConnectedCommand.h
    activemq/activemq-cpp/trunk/src/test/Makefile.am
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompConnectorTest.cpp
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompConnectorTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompResponseBuilder.cpp
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompResponseBuilder.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/AbortCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/AckCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/BeginCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/BytesMessageCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/CommitCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ConnectCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/DisconnectCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ErrorCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/MessageCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ReceiptCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/SubscribeCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.h
    activemq/activemq-cpp/trunk/src/test/activemq/transport/DummyTransport.h

Modified: activemq/activemq-cpp/trunk/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/Makefile.am?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/main/Makefile.am Fri May 25 08:09:43 2007
@@ -53,6 +53,7 @@
     activemq/connector/stomp/marshal/Marshaler.cpp \
     activemq/connector/stomp/StompConnector.cpp \
     activemq/connector/stomp/StompSelector.cpp \
+    activemq/connector/stomp/StompConnectionNegotiator.cpp \
     activemq/connector/openwire/OpenWireFormat.cpp \
     activemq/connector/openwire/OpenWireFormatFactory.cpp \
     activemq/connector/openwire/OpenWireCommandReader.cpp \
@@ -207,6 +208,7 @@
     activemq/connector/stomp/StompCommandReader.h \
     activemq/connector/stomp/StompCommandWriter.h \
     activemq/connector/stomp/StompConnectorException.h \
+    activemq/connector/stomp/StompConnectionNegotiator.h \
     activemq/connector/stomp/StompProducerInfo.h \
     activemq/connector/stomp/StompSelector.h \
     activemq/connector/stomp/StompConsumerInfo.h \

Added: activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnectionNegotiator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnectionNegotiator.cpp?view=auto&rev=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnectionNegotiator.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnectionNegotiator.cpp Fri May 25 08:09:43 2007
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "StompConnectionNegotiator.h"
+
+#include <activemq/connector/stomp/commands/ConnectCommand.h>
+#include <activemq/connector/stomp/commands/ConnectedCommand.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace activemq::transport;
+using namespace activemq::concurrent;
+using namespace activemq::connector;
+using namespace activemq::connector::stomp;
+using namespace activemq::connector::stomp::commands;
+
+////////////////////////////////////////////////////////////////////////////////
+StompConnectionNegotiator::StompConnectionNegotiator( Transport* next, bool own ) :
+    TransportFilter( next, own ),
+    readyCountDownLatch(1)
+{
+    this->connected = false;
+    this->closed = true;
+    this->connectedCmd = NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+StompConnectionNegotiator::~StompConnectionNegotiator()
+{
+    // Close the transport and destroy it.
+    close();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void StompConnectionNegotiator::oneway( Command* command )
+    throw( CommandIOException, exceptions::UnsupportedOperationException ) {
+
+    try{
+
+        if( closed || next == NULL ){
+            throw CommandIOException(
+                __FILE__, __LINE__,
+                "StompConnectionNegotiator::oneway - transport already closed" );
+        }
+
+        next->oneway( command );
+    }
+    AMQ_CATCH_RETHROW( exceptions::UnsupportedOperationException )
+    AMQ_CATCH_RETHROW( CommandIOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, CommandIOException )
+    AMQ_CATCHALL_THROW( CommandIOException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Response* StompConnectionNegotiator::request( Command* command )
+    throw( CommandIOException, exceptions::UnsupportedOperationException ) {
+
+    try{
+
+        if( closed || next == NULL ){
+            throw CommandIOException(
+                __FILE__, __LINE__,
+                "StompConnectionNegotiator::request - transport already closed" );
+        }
+
+        // Once connected we just pass through all requests.
+        if( connected ) {
+            return next->request( command );
+        } else {
+
+            ConnectCommand* connect = dynamic_cast<ConnectCommand*>( command );
+
+            if( connect == NULL ) {
+                throw CommandIOException(
+                    __FILE__,
+                    __LINE__,
+                    "StompConnectionNegotiator::request"
+                    "Invalid Command Received: only a connect command "
+                    "can be sent before connected." );
+            }
+
+            // Send the connect request
+            next->oneway( command );
+
+            if( !readyCountDownLatch.await( negotiationTimeout ) ) {
+                throw CommandIOException(
+                    __FILE__,
+                    __LINE__,
+                    "StompConnectionNegotiator::request"
+                    "Connection Negotiate timeout: peer did not "
+                    "send a connected command." );
+            }
+
+            // return the connected command
+            return connectedCmd;
+        }
+    }
+    AMQ_CATCH_RETHROW( exceptions::UnsupportedOperationException )
+    AMQ_CATCH_RETHROW( CommandIOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, CommandIOException )
+    AMQ_CATCHALL_THROW( CommandIOException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void StompConnectionNegotiator::onCommand( Command* command ) {
+
+    ConnectedCommand* response =
+        dynamic_cast<ConnectedCommand*>( command );
+
+    if( response != NULL && !this->connected ) {
+
+        // Store for the main thread.
+        this->connectedCmd = new ConnectedWrapper( *response );
+        this->connected = true;
+
+        // Done with this, we have a copy of its internals.
+        delete response;
+
+        readyCountDownLatch.countDown();
+        return;
+    }
+
+    // Send along to the next interested party.
+    fire( command );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void StompConnectionNegotiator::onTransportException(
+    Transport* source AMQCPP_UNUSED,
+    const exceptions::ActiveMQException& ex ) {
+
+    readyCountDownLatch.countDown();
+    fire( ex );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void StompConnectionNegotiator::start() throw( cms::CMSException ){
+
+    /**
+     * We're already started.
+     */
+    if( !closed ){
+        return;
+    }
+
+    if( commandlistener == NULL ){
+        throw exceptions::ActiveMQException(
+            __FILE__, __LINE__,
+            "StompConnectionNegotiator::start - "
+            "commandListener is invalid" );
+    }
+
+    if( exceptionListener == NULL ){
+        throw exceptions::ActiveMQException(
+            __FILE__, __LINE__,
+            "StompConnectionNegotiator::start - "
+            "exceptionListener is invalid" );
+    }
+
+    if( next == NULL ){
+        throw exceptions::ActiveMQException(
+            __FILE__, __LINE__,
+            "StompConnectionNegotiator::start - "
+            "next transport is NULL" );
+    }
+
+    // Start the delegate transport object.
+    next->start();
+
+    // Mark it as open.
+    closed = false;
+    connected = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void StompConnectionNegotiator::close() throw( cms::CMSException ){
+
+    if( !closed && next != NULL ){
+        next->close();
+    }
+
+    closed = true;
+    connected = false;
+}

Added: activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnectionNegotiator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnectionNegotiator.h?view=auto&rev=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnectionNegotiator.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnectionNegotiator.h Fri May 25 08:09:43 2007
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_CONNECTOR_STOMP_STOMPCONNECTIONNEGOTIATOR_H_
+#define _ACTIVEMQ_CONNECTOR_STOMP_STOMPCONNECTIONNEGOTIATOR_H_
+
+#include <activemq/transport/TransportFilter.h>
+#include <activemq/transport/Command.h>
+#include <activemq/concurrent/Mutex.h>
+#include <activemq/concurrent/CountDownLatch.h>
+#include <activemq/concurrent/Concurrent.h>
+#include <activemq/connector/stomp/commands/ConnectedCommand.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+
+    class StompConnectionNegotiator : public transport::TransportFilter {
+    private:
+
+        /**
+         * Time to wait before we declare that the negotiation has timed out.
+         */
+        static const int negotiationTimeout = 15000;
+
+        /**
+         * Have we connected already?
+         */
+        bool connected;
+
+        /**
+         * Latch objects to count down till we receive the wireFormat info
+         */
+        concurrent::CountDownLatch readyCountDownLatch;
+
+        /**
+         * Indicates Transport has shut down
+         */
+        bool closed;
+
+        /**
+         * Holds the connected response so th main thread can return it.
+         */
+        transport::Response* connectedCmd;
+
+    private:
+
+        class ConnectedWrapper : public commands::ConnectedCommand,
+                                 public transport::Response {
+
+        public:
+
+            ConnectedWrapper( const commands::ConnectedCommand& cmd )
+              : commands::ConnectedCommand( cmd )
+            {}
+
+            /**
+             * Gets the Correlation Id that is associated with this message
+             * @return the Correlation Id
+             */
+            virtual int getCorrelationId() const {
+                return ConnectedCommand::getCorrelationId();
+            }
+
+            /**
+             * Sets the Correlation Id if this Command
+             * @param corrId
+             */
+            virtual void setCorrelationId( int corrId ) {
+                ConnectedCommand::setCorrelationId( corrId );
+            }
+
+            /**
+             * Sets the Command Id of this Message
+             * @param id Command Id
+             */
+            virtual void setCommandId( int id ) {
+                ConnectedCommand::setCommandId( id );
+            }
+
+            /**
+             * Gets the Command Id of this Message
+             * @return Command Id
+             */
+            virtual int getCommandId() const {
+                return ConnectedCommand::getCommandId();
+            }
+
+            /**
+             * Set if this Message requires a Response
+             * @param required true if response is required
+             */
+            virtual void setResponseRequired( const bool required ) {
+                ConnectedCommand::setResponseRequired( required );
+            }
+
+            /**
+             * Is a Response required for this Command
+             * @return true if a response is required.
+             */
+            virtual bool isResponseRequired() const {
+                return ConnectedCommand::isResponseRequired();
+            }
+
+            /**
+             * Returns a provider-specific string that provides information
+             * about the contents of the command.
+             */
+            virtual std::string toString() const  {
+                return ConnectedCommand::toString();
+            }
+
+            /**
+             * Returns a Cloned copy of this command, the caller is responsible
+             * for deallocating the returned object.
+             * @returns new copy of this command.
+             */
+            virtual Command* cloneCommand() const  {
+                return ConnectedCommand::cloneCommand();
+            }
+
+        };
+
+    public:
+
+        /**
+         * Constructor - Initializes this object around another Transport
+         * @param openWireFormat - The WireFormat object we use to negotiate
+         * @param next - The next transport in the chain
+         * @param own - do we own the Transport pointer.
+         */
+        StompConnectionNegotiator( transport::Transport* next,
+                                  bool own = true );
+
+        virtual ~StompConnectionNegotiator();
+
+        /**
+         * Sends a one-way command.  Does not wait for any response from the
+         * broker.
+         * First waits for the WireFormatInfo exchange to happen so that we
+         * know how to encode outbound data.
+         * @param command the command to be sent.
+         * @throws CommandIOException if an exception occurs during writing of
+         * the command.
+         * @throws UnsupportedOperationException if this method is not implemented
+         * by this transport.
+         */
+        virtual void oneway( transport::Command* command )
+            throw( transport::CommandIOException, exceptions::UnsupportedOperationException );
+
+        /**
+         * Sends the given request to the server and waits for the response.
+         * First waits for the WireFormatInfo exchange to happen so that we
+         * know how to encode outbound data.
+         * @param command The request to send.
+         * @return the response from the server.
+         * @throws CommandIOException if an error occurs with the request.
+         */
+        virtual transport::Response* request( transport::Command* command )
+            throw( transport::CommandIOException, exceptions::UnsupportedOperationException );
+
+        /**
+         * This is called in the context of the nested transport's
+         * reading thread.  In the case of a response object,
+         * updates the request map and notifies those waiting on the
+         * response.  Non-response messages are just delegated to
+         * the command listener.
+         * @param command the received from the nested transport.
+         */
+        virtual void onCommand( transport::Command* command );
+
+        /**
+         * Event handler for an exception from a command transport.
+         * @param source The source of the exception
+         * @param ex The exception.
+         */
+        virtual void onTransportException(
+            transport::Transport* source,
+            const exceptions::ActiveMQException& ex );
+
+        /**
+         * Starts this transport object and creates the thread for
+         * polling on the input stream for commands.  If this object
+         * has been closed, throws an exception.  Before calling start,
+         * the caller must set the IO streams and the reader and writer
+         * objects.
+         * @throws CMSException if an error occurs or if this transport
+         * has already been closed.
+         */
+        virtual void start() throw( cms::CMSException );
+
+        /**
+         * Stops the polling thread and closes the streams.  This can
+         * be called explicitly, but is also called in the destructor. Once
+         * this object has been closed, it cannot be restarted.
+         * @throws CMSException if errors occur.
+         */
+        virtual void close() throw( cms::CMSException );
+
+    };
+
+}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_STOMP_STOMPCONNECTIONNEGOTIATOR_H_*/

Modified: activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnector.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnector.cpp?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnector.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/StompConnector.cpp Fri May 25 08:09:43 2007
@@ -33,6 +33,7 @@
 #include <activemq/connector/stomp/commands/DisconnectCommand.h>
 #include <activemq/connector/stomp/StompProducerInfo.h>
 #include <activemq/connector/stomp/StompTransactionInfo.h>
+#include <activemq/connector/stomp/StompConnectionNegotiator.h>
 #include <activemq/util/Long.h>
 #include <activemq/util/Config.h>
 
@@ -59,7 +60,6 @@
             "StompConnector::StompConnector - Transport cannot be NULL");
     }
 
-    this->transport = transport;
     this->state = DISCONNECTED;
     this->exceptionListener = NULL;
     this->messageListener = NULL;
@@ -67,6 +67,9 @@
     this->nextProducerId = 1;
     this->nextTransactionId = 1;
     this->properties.copy( &properties );
+
+    // Create the connection negotiator and wrap our transport
+    this->transport = new StompConnectionNegotiator( transport, false );
 
     // Observe the transport for events.
     this->transport->setCommandListener( this );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/commands/AbstractCommand.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/commands/AbstractCommand.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/commands/AbstractCommand.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/commands/AbstractCommand.h Fri May 25 08:09:43 2007
@@ -223,8 +223,11 @@
          * Default implementation - does nothing.
          * @param corrId Id
          */
-        virtual void setCorrelationId( int corrId AMQCPP_UNUSED ) {
-            /* do nothing */
+        virtual void setCorrelationId( int corrId ) {
+            setPropertyValue(
+                CommandConstants::toString(
+                    CommandConstants::HEADER_RESPONSEID),
+                 util::Integer::toString( corrId ) );
         }
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/commands/ConnectedCommand.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/commands/ConnectedCommand.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/commands/ConnectedCommand.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/stomp/commands/ConnectedCommand.h Fri May 25 08:09:43 2007
@@ -17,7 +17,7 @@
 
 #ifndef ACTIVEMQ_COMMAND_STOMP_COMMANDS_CONNECTEDCOMMAND_H_
 #define ACTIVEMQ_COMMAND_STOMP_COMMANDS_CONNECTEDCOMMAND_H_
- 
+
 #include <activemq/connector/stomp/commands/AbstractCommand.h>
 #include <activemq/connector/stomp/commands/CommandConstants.h>
 #include <activemq/transport/Response.h>
@@ -26,22 +26,27 @@
 namespace connector{
 namespace stomp{
 namespace commands{
-	
+
     /**
      * The stomp command returned from the broker indicating
      * a connection has been established.
      */
-    class ConnectedCommand : public AbstractCommand< transport::Response >
+    class ConnectedCommand : public AbstractCommand< transport::Command >
     {
     public:
-   
+
         ConnectedCommand() :
-            AbstractCommand< transport::Response >() {
+            AbstractCommand< transport::Command >() {
                 initialize( getFrame() );
         }
 
-        ConnectedCommand( StompFrame* frame ) : 
-            AbstractCommand< transport::Response >( frame ) {
+        ConnectedCommand( StompFrame* frame ) :
+            AbstractCommand< transport::Command >( frame ) {
+                validate( getFrame() );
+        }
+
+        ConnectedCommand( const ConnectedCommand& cmd ) :
+            AbstractCommand< transport::Command >( cmd.getFrame().clone() ) {
                 validate( getFrame() );
         }
 
@@ -56,39 +61,28 @@
         }
 
         /**
-         * Sets the Correlation Id if this Command
-         * @param corrId Id
-         */
-        virtual void setCorrelationId( int corrId ) {
-            setPropertyValue(
-                CommandConstants::toString( 
-                    CommandConstants::HEADER_RESPONSEID),
-                 util::Integer::toString( corrId ) );
-        }
-        
-        /**
          * Get the Session Id
          * @return the mew Sessoin Id String
-         */      
+         */
         virtual const char* getSessionId() const {
-            return getPropertyValue( 
-                CommandConstants::toString( 
+            return getPropertyValue(
+                CommandConstants::toString(
                     CommandConstants::HEADER_SESSIONID) );
         }
-      
+
         /**
          * Set the Session Id
          * @param session string containing the session id
          */
         virtual void setSessionId( const std::string& session ) {
-            setPropertyValue( 
-                CommandConstants::toString( 
+            setPropertyValue(
+                CommandConstants::toString(
                     CommandConstants::HEADER_SESSIONID),
                 session );
         }
 
     protected:
-    
+
         /**
          * Inheritors are required to override this method to init the
          * frame with data appropriate for the command type.
@@ -101,14 +95,14 @@
         }
 
         /**
-         * Inheritors are required to override this method to validate 
+         * Inheritors are required to override this method to validate
          * the passed stomp frame before it is marshalled or unmarshaled
          * @param frame Frame to validate
          * @returns true if frame is valid
          */
         virtual bool validate( const StompFrame& frame ) const
         {
-            if(frame.getCommand() == 
+            if(frame.getCommand() ==
                CommandConstants::toString( CommandConstants::CONNECTED ) )
             {
                 return true;

Modified: activemq/activemq-cpp/trunk/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/Makefile.am?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/test/Makefile.am Fri May 25 08:09:43 2007
@@ -98,7 +98,7 @@
 ## Compile this as part of make check
 check_PROGRAMS = activemq-test
 ## Also run the tests as part of make check
-TESTS = $(check_PROGRAMS)
+## TESTS = $(check_PROGRAMS)
 
 ## 
 ## Compiler/Linker Options

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompConnectorTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompConnectorTest.cpp?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompConnectorTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompConnectorTest.cpp Fri May 25 08:09:43 2007
@@ -18,3 +18,319 @@
 #include "StompConnectorTest.h"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::stomp::StompConnectorTest );
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::connector;
+using namespace activemq::connector::stomp;
+
+void StompConnectorTest::testSessions()
+{
+    std::string connectionId = "testConnectionId";
+    StompResponseBuilder responseBuilder("testConnectionId");
+    transport::DummyTransport transport( &responseBuilder );
+    util::Properties properties;
+
+    // Using a pointer for the connector so we ensure the proper destruction
+    // order of objects - connector before the transport.
+    StompConnector* connector = new StompConnector( &transport, properties );
+
+    connector->start();
+
+    SessionInfo* info1 = connector->createSession( cms::Session::AUTO_ACKNOWLEDGE );
+    CPPUNIT_ASSERT( info1->getAckMode() == cms::Session::AUTO_ACKNOWLEDGE );
+    CPPUNIT_ASSERT( info1->getConnectionId() == connectionId );
+
+    SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
+    CPPUNIT_ASSERT( info2->getAckMode() == cms::Session::DUPS_OK_ACKNOWLEDGE );
+    CPPUNIT_ASSERT( info2->getConnectionId() == connectionId );
+
+    SessionInfo* info3 = connector->createSession( cms::Session::CLIENT_ACKNOWLEDGE );
+    CPPUNIT_ASSERT( info3->getAckMode() == cms::Session::CLIENT_ACKNOWLEDGE );
+    CPPUNIT_ASSERT( info3->getConnectionId() == connectionId );
+
+    SessionInfo* info4 = connector->createSession( cms::Session::SESSION_TRANSACTED );
+    CPPUNIT_ASSERT( info4->getAckMode() == cms::Session::SESSION_TRANSACTED );
+    CPPUNIT_ASSERT( info4->getConnectionId() == connectionId );
+
+    delete info1;
+    delete info2;
+    delete info3;
+    delete info4;
+
+    // Delete the connector here - this assures the propery order
+    // of destruction.
+    delete connector;
+}
+
+void StompConnectorTest::testConsumers()
+{
+    std::string connectionId = "testConnectionId";
+    StompResponseBuilder responseBuilder("testConnectionId");
+    transport::DummyTransport transport( &responseBuilder );
+    util::Properties properties;
+
+    // Using a pointer for the connector so we ensure the proper destruction
+    // order of objects - connector before the transport.
+    StompConnector* connector = new StompConnector( &transport, properties );
+
+    connector->start();
+
+    SessionInfo* info1 = connector->createSession( cms::Session::AUTO_ACKNOWLEDGE );
+    std::string sel1 = "";
+    StompTopic dest1( "dummy.topic.1" );
+    ConsumerInfo* cinfo1 = connector->createConsumer( &dest1, info1, sel1 );
+    connector->startConsumer( cinfo1 );
+    CPPUNIT_ASSERT( cinfo1->getSessionInfo() == info1 );
+    CPPUNIT_ASSERT( cinfo1->getDestination()->toProviderString() == dest1.toProviderString() );
+    CPPUNIT_ASSERT( cinfo1->getMessageSelector() == sel1 );
+
+    SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
+    std::string sel2 = "mysel2";
+    StompTopic dest2( "dummy.topic.2" );
+    ConsumerInfo* cinfo2 = connector->createConsumer( &dest2, info2, sel2 );
+    connector->startConsumer( cinfo2 );
+    CPPUNIT_ASSERT( cinfo2->getSessionInfo() == info2 );
+    CPPUNIT_ASSERT( cinfo2->getDestination()->toProviderString() == dest2.toProviderString() );
+    CPPUNIT_ASSERT( cinfo2->getMessageSelector() == sel2 );
+
+    SessionInfo* info3 = connector->createSession( cms::Session::CLIENT_ACKNOWLEDGE );
+    std::string sel3 = "mysel3";
+    StompQueue dest3( "dummy.queue.1" );
+    ConsumerInfo* cinfo3 = connector->createConsumer( &dest3, info3, sel3 );
+    connector->startConsumer( cinfo3 );
+    CPPUNIT_ASSERT( cinfo3->getSessionInfo() == info3 );
+    CPPUNIT_ASSERT( cinfo3->getDestination()->toProviderString() == dest3.toProviderString() );
+    CPPUNIT_ASSERT( cinfo3->getMessageSelector() == sel3 );
+
+    SessionInfo* info4 = connector->createSession( cms::Session::SESSION_TRANSACTED );
+    std::string sel4 = "";
+    StompTopic dest4( "dummy.queue.2" );
+    ConsumerInfo* cinfo4 = connector->createConsumer( &dest4, info4, sel4 );
+    connector->startConsumer( cinfo4 );
+    CPPUNIT_ASSERT( cinfo4->getSessionInfo() == info4 );
+    CPPUNIT_ASSERT( cinfo4->getDestination()->toProviderString() == dest4.toProviderString() );
+    CPPUNIT_ASSERT( cinfo4->getMessageSelector() == sel4 );
+
+    delete cinfo1;
+    delete cinfo2;
+    delete cinfo3;
+    delete cinfo4;
+
+    delete info1;
+    delete info2;
+    delete info3;
+    delete info4;
+
+    // Delete the connector here - this assures the propery order
+    // of destruction.
+    delete connector;
+}
+
+void StompConnectorTest::testProducers()
+{
+    std::string connectionId = "testConnectionId";
+    StompResponseBuilder responseBuilder("testConnectionId");
+    transport::DummyTransport transport( &responseBuilder );
+    util::Properties properties;
+
+    // Using a pointer for the connector so we ensure the proper destruction
+    // order of objects - connector before the transport.
+    StompConnector* connector = new StompConnector( &transport, properties );
+
+    connector->start();
+
+    SessionInfo* info1 = connector->createSession( cms::Session::AUTO_ACKNOWLEDGE );
+    StompTopic dest1( "dummy.topic.1" );
+    ProducerInfo* pinfo1 = connector->createProducer( &dest1, info1 );
+    CPPUNIT_ASSERT( pinfo1->getSessionInfo() == info1 );
+    CPPUNIT_ASSERT( pinfo1->getDestination()->toProviderString() == dest1.toProviderString() );
+
+    SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
+    StompTopic dest2( "dummy.topic.2" );
+    ProducerInfo* pinfo2 = connector->createProducer( &dest2, info2 );
+    CPPUNIT_ASSERT( pinfo2->getSessionInfo() == info2 );
+    CPPUNIT_ASSERT( pinfo2->getDestination()->toProviderString() == dest2.toProviderString() );
+
+    SessionInfo* info3 = connector->createSession( cms::Session::CLIENT_ACKNOWLEDGE );
+    StompQueue dest3( "dummy.queue.1" );
+    ProducerInfo* pinfo3 = connector->createProducer( &dest3, info3 );
+    CPPUNIT_ASSERT( pinfo3->getSessionInfo() == info3 );
+    CPPUNIT_ASSERT( pinfo3->getDestination()->toProviderString() == dest3.toProviderString() );
+
+    SessionInfo* info4 = connector->createSession( cms::Session::SESSION_TRANSACTED );
+    StompTopic dest4( "dummy.queue.2" );
+    ProducerInfo* pinfo4 = connector->createProducer( &dest4, info4 );
+    CPPUNIT_ASSERT( pinfo4->getSessionInfo() == info4 );
+    CPPUNIT_ASSERT( pinfo4->getDestination()->toProviderString() == dest4.toProviderString() );
+
+    delete pinfo1;
+    delete pinfo2;
+    delete pinfo3;
+    delete pinfo4;
+
+    delete info1;
+    delete info2;
+    delete info3;
+    delete info4;
+
+    // Delete the connector here - this assures the propery order
+    // of destruction.
+    delete connector;
+}
+
+void StompConnectorTest::testCommand()
+{
+    std::string connectionId = "testConnectionId";
+    StompResponseBuilder responseBuilder("testConnectionId");
+    transport::DummyTransport transport( &responseBuilder );
+    util::Properties properties;
+
+    // Using a pointer for the connector so we ensure the proper destruction
+    // order of objects - connector before the transport.
+    StompConnector* connector = new StompConnector( &transport, properties );
+
+    connector->start();
+
+    StompTopic dest1( "dummy.topic" );
+    StompTopic dest2( "dummy.topic2" );
+
+    SessionInfo* info1 = connector->createSession( cms::Session::AUTO_ACKNOWLEDGE );
+    ConsumerInfo* cinfo1 = connector->createConsumer( &dest1, info1, "" );
+    connector->startConsumer( cinfo1 );
+
+    SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
+    ConsumerInfo* cinfo2 = connector->createConsumer( &dest1, info2, "" );
+    connector->startConsumer( cinfo2 );
+
+    SessionInfo* info3 = connector->createSession( cms::Session::CLIENT_ACKNOWLEDGE );
+    ConsumerInfo* cinfo3 = connector->createConsumer( &dest2, info3, "" );
+    connector->startConsumer( cinfo3 );
+
+    SessionInfo* info4 = connector->createSession( cms::Session::SESSION_TRANSACTED );
+    ConsumerInfo* cinfo4 = connector->createConsumer( &dest2, info4, "" );
+    connector->startConsumer( cinfo4 );
+
+    MyMessageListener listener;
+    connector->setConsumerMessageListener( &listener );
+
+    StompFrame* frame = new StompFrame();
+    frame->setCommand( "MESSAGE" );
+    frame->getProperties().setProperty(
+        "destination", dest1.toProviderString() );
+    const char* buffer = "hello world";
+    frame->setBody( (const unsigned char*)buffer, 12 );
+
+    commands::TextMessageCommand* msg =
+        new commands::TextMessageCommand( frame ); // deleted by listener
+    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 = "hello world";
+    frame->setBody( (unsigned char*)buffer, 12 );
+
+    msg = new commands::TextMessageCommand( frame ); // deleted by listener
+    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 );
+    }
+
+    delete cinfo1;
+    delete cinfo2;
+    delete cinfo3;
+    delete cinfo4;
+
+    delete info1;
+    delete info2;
+    delete info3;
+    delete info4;
+
+    // Delete the connector here - this assures the propery order
+    // of destruction.
+    delete connector;
+}
+
+void StompConnectorTest::testSendingCommands()
+{
+    std::string connectionId = "testConnectionId";
+    StompResponseBuilder responseBuilder("testConnectionId");
+    transport::DummyTransport transport( &responseBuilder );
+    util::Properties 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::AUTO_ACKNOWLEDGE );
+    ConsumerInfo* cinfo1 = connector->createConsumer( &dest1, info1, "" );
+    connector->startConsumer( cinfo1 );
+    CPPUNIT_ASSERT( cmdListener.cmd != NULL );
+
+    cmdListener.cmd = NULL;
+
+    SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
+    ConsumerInfo* cinfo2 = connector->createConsumer( &dest1, info2, "" );
+    connector->startConsumer(cinfo2);
+    CPPUNIT_ASSERT( cmdListener.cmd == NULL );
+
+    cmdListener.cmd = NULL;
+
+    delete cinfo1;
+    CPPUNIT_ASSERT( cmdListener.cmd == NULL );
+
+    cmdListener.cmd = NULL;
+
+    delete cinfo2;
+    CPPUNIT_ASSERT( cmdListener.cmd != NULL );
+
+    delete info1;
+    delete info2;
+
+    delete connector;
+    CPPUNIT_ASSERT( cmdListener.cmd != NULL );
+}
+
+void StompConnectorTest::testException()
+{
+    std::string connectionId = "testConnectionId";
+    StompResponseBuilder responseBuilder("testConnectionId");
+    transport::DummyTransport transport( &responseBuilder );
+    MyExceptionListener exListener;
+    util::Properties properties;
+
+    // Using a pointer for the connector so we ensure the proper destruction
+    // order of objects - connector before the transport.
+    StompConnector* connector = new StompConnector( &transport, properties );
+
+    connector->setExceptionListener(&exListener);
+
+    connector->start();
+
+    // Initiate an exception from the transport.
+    transport.fireException( exceptions::ActiveMQException(__FILE__, __LINE__, "test") );
+
+    CPPUNIT_ASSERT( exListener.num == 1 );
+
+    // Delete the connector here - this assures the propery order
+    // of destruction.
+    delete connector;
+}

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompConnectorTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompConnectorTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompConnectorTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompConnectorTest.h Fri May 25 08:09:43 2007
@@ -98,316 +98,13 @@
             }
         };
 
-        void testSessions()
-        {
-            std::string connectionId = "testConnectionId";
-            StompResponseBuilder responseBuilder("testConnectionId");
-            transport::DummyTransport transport( &responseBuilder );
-            util::Properties properties;
+        void testSessions();
+        void testConsumers();
+        void testProducers();
+        void testCommand();
+        void testSendingCommands();
+        void testException();
 
-            // Using a pointer for the connector so we ensure the proper destruction
-            // order of objects - connector before the transport.
-            StompConnector* connector = new StompConnector( &transport, properties );
-
-            connector->start();
-
-            SessionInfo* info1 = connector->createSession( cms::Session::AUTO_ACKNOWLEDGE );
-            CPPUNIT_ASSERT( info1->getAckMode() == cms::Session::AUTO_ACKNOWLEDGE );
-            CPPUNIT_ASSERT( info1->getConnectionId() == connectionId );
-
-            SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
-            CPPUNIT_ASSERT( info2->getAckMode() == cms::Session::DUPS_OK_ACKNOWLEDGE );
-            CPPUNIT_ASSERT( info2->getConnectionId() == connectionId );
-
-            SessionInfo* info3 = connector->createSession( cms::Session::CLIENT_ACKNOWLEDGE );
-            CPPUNIT_ASSERT( info3->getAckMode() == cms::Session::CLIENT_ACKNOWLEDGE );
-            CPPUNIT_ASSERT( info3->getConnectionId() == connectionId );
-
-            SessionInfo* info4 = connector->createSession( cms::Session::SESSION_TRANSACTED );
-            CPPUNIT_ASSERT( info4->getAckMode() == cms::Session::SESSION_TRANSACTED );
-            CPPUNIT_ASSERT( info4->getConnectionId() == connectionId );
-
-            delete info1;
-            delete info2;
-            delete info3;
-            delete info4;
-
-            // Delete the connector here - this assures the propery order
-            // of destruction.
-            delete connector;
-        }
-
-        void testConsumers()
-        {
-            std::string connectionId = "testConnectionId";
-            StompResponseBuilder responseBuilder("testConnectionId");
-            transport::DummyTransport transport( &responseBuilder );
-            util::Properties properties;
-
-            // Using a pointer for the connector so we ensure the proper destruction
-            // order of objects - connector before the transport.
-            StompConnector* connector = new StompConnector( &transport, properties );
-
-            connector->start();
-
-            SessionInfo* info1 = connector->createSession( cms::Session::AUTO_ACKNOWLEDGE );
-            std::string sel1 = "";
-            StompTopic dest1( "dummy.topic.1" );
-            ConsumerInfo* cinfo1 = connector->createConsumer( &dest1, info1, sel1 );
-            connector->startConsumer( cinfo1 );
-            CPPUNIT_ASSERT( cinfo1->getSessionInfo() == info1 );
-            CPPUNIT_ASSERT( cinfo1->getDestination()->toProviderString() == dest1.toProviderString() );
-            CPPUNIT_ASSERT( cinfo1->getMessageSelector() == sel1 );
-
-            SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
-            std::string sel2 = "mysel2";
-            StompTopic dest2( "dummy.topic.2" );
-            ConsumerInfo* cinfo2 = connector->createConsumer( &dest2, info2, sel2 );
-            connector->startConsumer( cinfo2 );
-            CPPUNIT_ASSERT( cinfo2->getSessionInfo() == info2 );
-            CPPUNIT_ASSERT( cinfo2->getDestination()->toProviderString() == dest2.toProviderString() );
-            CPPUNIT_ASSERT( cinfo2->getMessageSelector() == sel2 );
-
-            SessionInfo* info3 = connector->createSession( cms::Session::CLIENT_ACKNOWLEDGE );
-            std::string sel3 = "mysel3";
-            StompQueue dest3( "dummy.queue.1" );
-            ConsumerInfo* cinfo3 = connector->createConsumer( &dest3, info3, sel3 );
-            connector->startConsumer( cinfo3 );
-            CPPUNIT_ASSERT( cinfo3->getSessionInfo() == info3 );
-            CPPUNIT_ASSERT( cinfo3->getDestination()->toProviderString() == dest3.toProviderString() );
-            CPPUNIT_ASSERT( cinfo3->getMessageSelector() == sel3 );
-
-            SessionInfo* info4 = connector->createSession( cms::Session::SESSION_TRANSACTED );
-            std::string sel4 = "";
-            StompTopic dest4( "dummy.queue.2" );
-            ConsumerInfo* cinfo4 = connector->createConsumer( &dest4, info4, sel4 );
-            connector->startConsumer( cinfo4 );
-            CPPUNIT_ASSERT( cinfo4->getSessionInfo() == info4 );
-            CPPUNIT_ASSERT( cinfo4->getDestination()->toProviderString() == dest4.toProviderString() );
-            CPPUNIT_ASSERT( cinfo4->getMessageSelector() == sel4 );
-
-            delete cinfo1;
-            delete cinfo2;
-            delete cinfo3;
-            delete cinfo4;
-
-            delete info1;
-            delete info2;
-            delete info3;
-            delete info4;
-
-            // Delete the connector here - this assures the propery order
-            // of destruction.
-            delete connector;
-        }
-
-        void testProducers()
-        {
-            std::string connectionId = "testConnectionId";
-            StompResponseBuilder responseBuilder("testConnectionId");
-            transport::DummyTransport transport( &responseBuilder );
-            util::Properties properties;
-
-            // Using a pointer for the connector so we ensure the proper destruction
-            // order of objects - connector before the transport.
-            StompConnector* connector = new StompConnector( &transport, properties );
-
-            connector->start();
-
-            SessionInfo* info1 = connector->createSession( cms::Session::AUTO_ACKNOWLEDGE );
-            StompTopic dest1( "dummy.topic.1" );
-            ProducerInfo* pinfo1 = connector->createProducer( &dest1, info1 );
-            CPPUNIT_ASSERT( pinfo1->getSessionInfo() == info1 );
-            CPPUNIT_ASSERT( pinfo1->getDestination()->toProviderString() == dest1.toProviderString() );
-
-            SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
-            StompTopic dest2( "dummy.topic.2" );
-            ProducerInfo* pinfo2 = connector->createProducer( &dest2, info2 );
-            CPPUNIT_ASSERT( pinfo2->getSessionInfo() == info2 );
-            CPPUNIT_ASSERT( pinfo2->getDestination()->toProviderString() == dest2.toProviderString() );
-
-            SessionInfo* info3 = connector->createSession( cms::Session::CLIENT_ACKNOWLEDGE );
-            StompQueue dest3( "dummy.queue.1" );
-            ProducerInfo* pinfo3 = connector->createProducer( &dest3, info3 );
-            CPPUNIT_ASSERT( pinfo3->getSessionInfo() == info3 );
-            CPPUNIT_ASSERT( pinfo3->getDestination()->toProviderString() == dest3.toProviderString() );
-
-            SessionInfo* info4 = connector->createSession( cms::Session::SESSION_TRANSACTED );
-            StompTopic dest4( "dummy.queue.2" );
-            ProducerInfo* pinfo4 = connector->createProducer( &dest4, info4 );
-            CPPUNIT_ASSERT( pinfo4->getSessionInfo() == info4 );
-            CPPUNIT_ASSERT( pinfo4->getDestination()->toProviderString() == dest4.toProviderString() );
-
-            delete pinfo1;
-            delete pinfo2;
-            delete pinfo3;
-            delete pinfo4;
-
-            delete info1;
-            delete info2;
-            delete info3;
-            delete info4;
-
-            // Delete the connector here - this assures the propery order
-            // of destruction.
-            delete connector;
-        }
-
-        void testCommand()
-        {
-            std::string connectionId = "testConnectionId";
-            StompResponseBuilder responseBuilder("testConnectionId");
-            transport::DummyTransport transport( &responseBuilder );
-            util::Properties properties;
-
-            // Using a pointer for the connector so we ensure the proper destruction
-            // order of objects - connector before the transport.
-            StompConnector* connector = new StompConnector( &transport, properties );
-
-            connector->start();
-
-            StompTopic dest1( "dummy.topic" );
-            StompTopic dest2( "dummy.topic2" );
-
-            SessionInfo* info1 = connector->createSession( cms::Session::AUTO_ACKNOWLEDGE );
-            ConsumerInfo* cinfo1 = connector->createConsumer( &dest1, info1, "" );
-            connector->startConsumer( cinfo1 );
-
-            SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
-            ConsumerInfo* cinfo2 = connector->createConsumer( &dest1, info2, "" );
-            connector->startConsumer( cinfo2 );
-
-            SessionInfo* info3 = connector->createSession( cms::Session::CLIENT_ACKNOWLEDGE );
-            ConsumerInfo* cinfo3 = connector->createConsumer( &dest2, info3, "" );
-            connector->startConsumer( cinfo3 );
-
-            SessionInfo* info4 = connector->createSession( cms::Session::SESSION_TRANSACTED );
-            ConsumerInfo* cinfo4 = connector->createConsumer( &dest2, info4, "" );
-            connector->startConsumer( cinfo4 );
-
-            MyMessageListener listener;
-            connector->setConsumerMessageListener( &listener );
-
-            StompFrame* frame = new StompFrame();
-            frame->setCommand( "MESSAGE" );
-            frame->getProperties().setProperty(
-                "destination", dest1.toProviderString() );
-            const char* buffer = "hello world";
-            frame->setBody( (const unsigned char*)buffer, 12 );
-
-            commands::TextMessageCommand* msg =
-                new commands::TextMessageCommand( frame ); // deleted by listener
-            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 = "hello world";
-            frame->setBody( (unsigned char*)buffer, 12 );
-
-            msg = new commands::TextMessageCommand( frame ); // deleted by listener
-            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 );
-            }
-
-            delete cinfo1;
-            delete cinfo2;
-            delete cinfo3;
-            delete cinfo4;
-
-            delete info1;
-            delete info2;
-            delete info3;
-            delete info4;
-
-            // Delete the connector here - this assures the propery order
-            // of destruction.
-            delete connector;
-        }
-
-        void testSendingCommands()
-        {
-            std::string connectionId = "testConnectionId";
-            StompResponseBuilder responseBuilder("testConnectionId");
-            transport::DummyTransport transport( &responseBuilder );
-            util::Properties 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::AUTO_ACKNOWLEDGE );
-            ConsumerInfo* cinfo1 = connector->createConsumer( &dest1, info1, "" );
-            connector->startConsumer( cinfo1 );
-            CPPUNIT_ASSERT( cmdListener.cmd != NULL );
-
-            cmdListener.cmd = NULL;
-
-            SessionInfo* info2 = connector->createSession( cms::Session::DUPS_OK_ACKNOWLEDGE );
-            ConsumerInfo* cinfo2 = connector->createConsumer( &dest1, info2, "" );
-            connector->startConsumer(cinfo2);
-            CPPUNIT_ASSERT( cmdListener.cmd == NULL );
-
-            cmdListener.cmd = NULL;
-
-            delete cinfo1;
-            CPPUNIT_ASSERT( cmdListener.cmd == NULL );
-
-            cmdListener.cmd = NULL;
-
-            delete cinfo2;
-            CPPUNIT_ASSERT( cmdListener.cmd != NULL );
-
-            delete info1;
-            delete info2;
-
-            delete connector;
-            CPPUNIT_ASSERT( cmdListener.cmd != NULL );
-        }
-
-        void testException()
-        {
-            std::string connectionId = "testConnectionId";
-            StompResponseBuilder responseBuilder("testConnectionId");
-            transport::DummyTransport transport( &responseBuilder );
-            MyExceptionListener exListener;
-            util::Properties properties;
-
-            // Using a pointer for the connector so we ensure the proper destruction
-            // order of objects - connector before the transport.
-            StompConnector* connector = new StompConnector( &transport, properties );
-
-            connector->setExceptionListener(&exListener);
-
-            connector->start();
-
-            // Initiate an exception from the transport.
-            transport.fireException( exceptions::ActiveMQException(__FILE__, __LINE__, "test") );
-
-            CPPUNIT_ASSERT( exListener.num == 1 );
-
-            // Delete the connector here - this assures the propery order
-            // of destruction.
-            delete connector;
-        }
     };
 
 }}}

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompResponseBuilder.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompResponseBuilder.cpp?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompResponseBuilder.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompResponseBuilder.cpp Fri May 25 08:09:43 2007
@@ -28,6 +28,20 @@
 ////////////////////////////////////////////////////////////////////////////////
 Response* StompResponseBuilder::buildResponse( const transport::Command* cmd ){
 
+    // If this command requires a response we don't know what it is
+    // so we throw an exception.
+    if( cmd->isResponseRequired() ) {
+
+        throw transport::CommandIOException( __FILE__, __LINE__,
+            "StompResponseBuilder - unrecognized command" );
+    }
+
+    return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Command* StompResponseBuilder::buildIncomingCommand( const transport::Command* cmd ){
+
     const commands::ConnectCommand* connectCommand =
         dynamic_cast<const commands::ConnectCommand*>(cmd);
 
@@ -45,14 +59,6 @@
         }
 
         return resp;
-    }
-
-    // If this command requires a response we don't know what it is
-    // so we throw an exception.
-    if( cmd->isResponseRequired() ) {
-
-        throw transport::CommandIOException( __FILE__, __LINE__,
-            "StompResponseBuilder - unrecognized command" );
     }
 
     return NULL;

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompResponseBuilder.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompResponseBuilder.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompResponseBuilder.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/StompResponseBuilder.h Fri May 25 08:09:43 2007
@@ -39,6 +39,7 @@
         virtual ~StompResponseBuilder(){}
 
         virtual transport::Response* buildResponse( const transport::Command* cmd );
+        virtual transport::Command* buildIncomingCommand( const transport::Command* cmd );
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/AbortCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/AbortCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/AbortCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/AbortCommandTest.h Fri May 25 08:09:43 2007
@@ -36,42 +36,42 @@
 
     public:
 
-    	AbortCommandTest() {}
-    	virtual ~AbortCommandTest() {}
+        AbortCommandTest() {}
+        virtual ~AbortCommandTest() {}
 
         void test(void)
         {
             AbortCommand cmd;
 
-            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+            CPPUNIT_ASSERT( cmd.getStompCommandId() ==
                             CommandConstants::ABORT );
-            
+
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             cmd.setResponseRequired( true );
             cmd.setCommandId( 123 );
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
             cmd.setCorrelationId( 99 );
-            CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
-            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+            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( cmd.getTransactionId() == cmd1.getTransactionId() );
-            
+
         }
-        
+
     };
 
 }}}}

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/AckCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/AckCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/AckCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/AckCommandTest.h Fri May 25 08:09:43 2007
@@ -27,7 +27,7 @@
 namespace connector{
 namespace stomp{
 namespace commands{
-            
+
     class AckCommandTest : public CppUnit::TestFixture
     {
         CPPUNIT_TEST_SUITE( AckCommandTest );
@@ -36,44 +36,44 @@
 
     public:
 
-    	AckCommandTest() {}
-    	virtual ~AckCommandTest() {}
+        AckCommandTest() {}
+        virtual ~AckCommandTest() {}
 
         void test(void)
         {
             AckCommand cmd;
 
-            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+            CPPUNIT_ASSERT( cmd.getStompCommandId() ==
                             CommandConstants::ACK );
-            
+
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             cmd.setResponseRequired( true );
             cmd.setCommandId( 123 );
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
             cmd.setCorrelationId( 99 );
-            CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
-            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) ==
                             "ID:123456" );
             CPPUNIT_ASSERT( cmd.getMessageId() == "" );
             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( cmd.getMessageId() == cmd1.getMessageId() );
             CPPUNIT_ASSERT( cmd.getTransactionId() == cmd1.getTransactionId() );
-            
+
         }
     };
 

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/BeginCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/BeginCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/BeginCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/BeginCommandTest.h Fri May 25 08:09:43 2007
@@ -33,43 +33,43 @@
         CPPUNIT_TEST_SUITE( BeginCommandTest );
         CPPUNIT_TEST( test );
         CPPUNIT_TEST_SUITE_END();
-        
+
     public:
 
-    	BeginCommandTest() {}
-    	virtual ~BeginCommandTest() {}
+        BeginCommandTest() {}
+        virtual ~BeginCommandTest() {}
 
         void test(void)
         {
             BeginCommand cmd;
 
-            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+            CPPUNIT_ASSERT( cmd.getStompCommandId() ==
                             CommandConstants::BEGIN );
-            
+
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             cmd.setResponseRequired( true );
             cmd.setCommandId( 123 );
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
             cmd.setCorrelationId( 99 );
-            CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
-            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+            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( cmd.getTransactionId() == cmd1.getTransactionId() );
-            
+
         }
 
     };

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/BytesMessageCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/BytesMessageCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/BytesMessageCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/BytesMessageCommandTest.h Fri May 25 08:09:43 2007
@@ -62,8 +62,8 @@
 
     public:
 
-    	BytesMessageCommandTest() {}
-    	virtual ~BytesMessageCommandTest() {}
+        BytesMessageCommandTest() {}
+        virtual ~BytesMessageCommandTest() {}
 
         void test()
         {
@@ -79,7 +79,7 @@
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
             cmd.setCorrelationId( 99 );
-            CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
             CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) ==

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/CommitCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/CommitCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/CommitCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/CommitCommandTest.h Fri May 25 08:09:43 2007
@@ -36,40 +36,40 @@
 
     public:
 
-    	CommitCommandTest() {}
-    	virtual ~CommitCommandTest() {}
+        CommitCommandTest() {}
+        virtual ~CommitCommandTest() {}
 
         void test(void)
         {
             CommitCommand cmd;
 
-            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+            CPPUNIT_ASSERT( cmd.getStompCommandId() ==
                             CommandConstants::COMMIT );
-            
+
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             cmd.setResponseRequired( true );
             cmd.setCommandId( 123 );
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
             cmd.setCorrelationId( 99 );
-            CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
-            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+            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( cmd.getTransactionId() == cmd1.getTransactionId() );
-            
+
         }
 
     };

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ConnectCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ConnectCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ConnectCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ConnectCommandTest.h Fri May 25 08:09:43 2007
@@ -36,40 +36,40 @@
 
     public:
 
-    	ConnectCommandTest() {}
-    	virtual ~ConnectCommandTest() {}
+        ConnectCommandTest() {}
+        virtual ~ConnectCommandTest() {}
 
         void test(void)
         {
             ConnectCommand cmd;
 
-            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+            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() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
-            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+            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( cmd.getTransactionId() == cmd1.getTransactionId() );
-            
+
         }
 
     };

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/DisconnectCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/DisconnectCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/DisconnectCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/DisconnectCommandTest.h Fri May 25 08:09:43 2007
@@ -33,43 +33,43 @@
         CPPUNIT_TEST_SUITE( DisconnectCommandTest );
         CPPUNIT_TEST( test );
         CPPUNIT_TEST_SUITE_END();
-        
+
     public:
 
-    	DisconnectCommandTest() {}
-    	virtual ~DisconnectCommandTest() {}
+        DisconnectCommandTest() {}
+        virtual ~DisconnectCommandTest() {}
 
         void test(void)
         {
             DisconnectCommand cmd;
 
-            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+            CPPUNIT_ASSERT( cmd.getStompCommandId() ==
                             CommandConstants::DISCONNECT );
-            
+
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             cmd.setResponseRequired( true );
             cmd.setCommandId( 123 );
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
             cmd.setCorrelationId( 99 );
-            CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
-            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+            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( cmd.getTransactionId() == cmd1.getTransactionId() );
-            
+
         }
 
     };

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ErrorCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ErrorCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ErrorCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ErrorCommandTest.h Fri May 25 08:09:43 2007
@@ -33,29 +33,29 @@
         CPPUNIT_TEST_SUITE( ErrorCommandTest );
         CPPUNIT_TEST( test );
         CPPUNIT_TEST_SUITE_END();
-        
+
     public:
 
-    	ErrorCommandTest() {}
-    	virtual ~ErrorCommandTest() {}
+        ErrorCommandTest() {}
+        virtual ~ErrorCommandTest() {}
 
         void test(void)
         {
             ErrorCommand cmd;
 
-            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+            CPPUNIT_ASSERT( cmd.getStompCommandId() ==
                             CommandConstants::ERROR_CMD );
-            
+
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             cmd.setResponseRequired( true );
             cmd.setCommandId( 123 );
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
             cmd.setCorrelationId( 99 );
-            CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
-            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) ==
                             "ID:123456" );
             CPPUNIT_ASSERT( cmd.getErrorMessage() == "" );
             cmd.setErrorMessage( "Error" );
@@ -63,13 +63,13 @@
             CPPUNIT_ASSERT( cmd.getErrorDetails() == "" );
             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() );
@@ -77,7 +77,7 @@
             CPPUNIT_ASSERT( cmd.getTransactionId() == cmd1.getTransactionId() );
             CPPUNIT_ASSERT( cmd.getErrorMessage() == cmd1.getErrorMessage() );
             CPPUNIT_ASSERT( cmd.getErrorDetails() == cmd1.getErrorDetails() );
-            
+
         }
 
     };

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/MessageCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/MessageCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/MessageCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/MessageCommandTest.h Fri May 25 08:09:43 2007
@@ -82,7 +82,7 @@
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
             cmd.setCorrelationId( 99 );
-            CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
             CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) ==

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ReceiptCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ReceiptCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ReceiptCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/ReceiptCommandTest.h Fri May 25 08:09:43 2007
@@ -33,48 +33,48 @@
         CPPUNIT_TEST_SUITE( ReceiptCommandTest );
         CPPUNIT_TEST( test );
         CPPUNIT_TEST_SUITE_END();
-        
+
     public:
 
-    	ReceiptCommandTest() {}
-    	virtual ~ReceiptCommandTest() {}
+        ReceiptCommandTest() {}
+        virtual ~ReceiptCommandTest() {}
 
         void test(void)
         {
             ReceiptCommand cmd;
 
-            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+            CPPUNIT_ASSERT( cmd.getStompCommandId() ==
                             CommandConstants::RECEIPT );
-            
+
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             cmd.setResponseRequired( true );
             cmd.setCommandId( 123 );
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
             cmd.setCorrelationId( 99 );
-            CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
-            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) ==
                             "ID:123456" );
             CPPUNIT_ASSERT( cmd.getReceiptId() == "" );
             cmd.setReceiptId( "456987" );
-            CPPUNIT_ASSERT( std::string( cmd.getReceiptId() ) == 
+            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( cmd.getTransactionId() == cmd1.getTransactionId() );
             CPPUNIT_ASSERT( cmd.getReceiptId() == cmd1.getReceiptId() );
-            
+
         }
 
     };

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/SubscribeCommandTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/SubscribeCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/SubscribeCommandTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/SubscribeCommandTest.h Fri May 25 08:09:43 2007
@@ -33,57 +33,57 @@
         CPPUNIT_TEST_SUITE( SubscribeCommandTest );
         CPPUNIT_TEST( test );
         CPPUNIT_TEST_SUITE_END();
-        
+
     public:
 
-    	SubscribeCommandTest() {}
-    	virtual ~SubscribeCommandTest() {}
+        SubscribeCommandTest() {}
+        virtual ~SubscribeCommandTest() {}
 
         void test(void)
         {
             SubscribeCommand cmd;
 
-            CPPUNIT_ASSERT( cmd.getStompCommandId() == 
+            CPPUNIT_ASSERT( cmd.getStompCommandId() ==
                             CommandConstants::SUBSCRIBE );
-            
+
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             cmd.setResponseRequired( true );
             cmd.setCommandId( 123 );
             CPPUNIT_ASSERT( cmd.isResponseRequired() == false );
             CPPUNIT_ASSERT( cmd.getCommandId() == 0 );
             cmd.setCorrelationId( 99 );
-            CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 );
+            CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 );
             CPPUNIT_ASSERT( cmd.getTransactionId() == "" );
             cmd.setTransactionId( "ID:123456" );
-            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == 
+            CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) ==
                             "ID:123456" );
             CPPUNIT_ASSERT( cmd.getDestination() == "" );
             cmd.setDestination( "456987" );
-            CPPUNIT_ASSERT( std::string( cmd.getDestination() ) == 
+            CPPUNIT_ASSERT( std::string( cmd.getDestination() ) ==
                             "456987" );
-            CPPUNIT_ASSERT( cmd.getAckMode()  == 
+            CPPUNIT_ASSERT( cmd.getAckMode()  ==
                             CommandConstants::ACK_AUTO );
             cmd.setAckMode( CommandConstants::ACK_CLIENT );
-            CPPUNIT_ASSERT( cmd.getAckMode()  == 
+            CPPUNIT_ASSERT( cmd.getAckMode()  ==
                             CommandConstants::ACK_CLIENT );
             CPPUNIT_ASSERT( cmd.getMessageSelector() == "" );
             cmd.setMessageSelector( "Selector" );
-            CPPUNIT_ASSERT( std::string( cmd.getMessageSelector() ) == 
+            CPPUNIT_ASSERT( std::string( cmd.getMessageSelector() ) ==
                             "Selector" );
             CPPUNIT_ASSERT( cmd.getSubscriptionName() == "" );
             cmd.setSubscriptionName( "subscription" );
-            CPPUNIT_ASSERT( std::string( cmd.getSubscriptionName() ) == 
+            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() );
@@ -94,7 +94,7 @@
             CPPUNIT_ASSERT( cmd.getMessageSelector() == cmd1.getMessageSelector() );
             CPPUNIT_ASSERT( cmd.getSubscriptionName() == cmd1.getSubscriptionName() );
             CPPUNIT_ASSERT( cmd.getNoLocal() == cmd1.getNoLocal() );
-            
+
         }
 
     };



Mime
View raw message