activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r419365 [25/25] - in /incubator/activemq/trunk: activemq-core/src/main/java/org/apache/activemq/thread/ activemq-core/src/test/java/org/apache/activemq/openwire/v1/ activemq-cpp/src/main/activemq/concurrent/ activemq-cpp/src/main/activemq/c...
Date Wed, 05 Jul 2006 22:27:47 GMT
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/Connection.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/Connection.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/Connection.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/Connection.cpp Wed Jul  5 15:27:34 2006
@@ -1,411 +1,411 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "activemq/Connection.hpp"
-#include "activemq/Session.hpp"
-
-using namespace apache::activemq;
-
-
-// --- Constructors -------------------------------------------------
-
-/*
- *
- */
-Connection::Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo)
-{
-    this->transport               = transport ;
-    this->connectionInfo          = connectionInfo ;
-    this->acknowledgementMode     = AutoAckMode ;
-    this->connected               = false ;
-    this->closed                  = false ;
-    this->brokerInfo              = NULL ;
-    this->brokerWireFormat        = NULL ;
-    this->sessionCounter          = 0 ;
-    this->tempDestinationCounter  = 0 ;
-    this->localTransactionCounter = 0 ;
-
-    // Hook up as a command listener and start dispatching
-    transport->setCommandListener(smartify(this)) ;
-    transport->start() ;
-}
-
-/*
- *
- */
-Connection::~Connection()
-{
-    // Make sure connection is closed
-    close() ;
-}
-
-
-// --- Attribute methods --------------------------------------------
-
-/*
- *
- */
-void Connection::setExceptionListener(p<IExceptionListener> listener)
-{
-    this->listener = listener ;
-}
-
-/*
- *
- */
-p<IExceptionListener> Connection::getExceptionListener()
-{
-    return listener ;
-}
-
-/*
- *
- */
-p<ITransport> Connection::getTransport()
-{
-    return transport ;
-}
-
-/*
- *
- */
-void Connection::setTransport(p<ITransport> transport)
-{
-    this->transport = transport ;
-}
-
-/*
- *
- */
-p<string> Connection::getClientId()
-{
-    return connectionInfo->getClientId() ;
-}
-
-/*
- *
- */
-void Connection::setClientId(const char* value) throw (CmsException)
-{
-    if( connected )
-        throw CmsException("You cannot change the client id once a connection is established") ; 
-
-    p<string> clientId = new string(value) ;
-    connectionInfo->setClientId( clientId ) ;
-}
-
-
-/*
- *
- */
-p<BrokerInfo> Connection::getBrokerInfo()
-{
-    return brokerInfo ;
-}
-
-/*
- *
- */
-p<WireFormatInfo> Connection::getBrokerWireFormat()
-{
-    return brokerWireFormat ;
-}
-
-/*
- *
- */
-AcknowledgementMode Connection::getAcknowledgementMode()
-{
-    return acknowledgementMode ;
-}
-
-/*
- *
- */
-void Connection::setAcknowledgementMode(AcknowledgementMode ackMode)
-{
-    acknowledgementMode = ackMode ;
-}
-
-/*
- *
- */
-p<ConnectionId> Connection::getConnectionId()
-{
-    return connectionInfo->getConnectionId() ;
-}
-
-
-// --- Operation methods --------------------------------------------
-
-/*
- *
- */
-void Connection::close()
-{
-    if( !closed )
-    {
-        list< p<ISession> >::iterator sessionIter ;
-
-        // Iterate through all sessions and close them down
-        for( sessionIter = sessions.begin() ;
-             sessionIter != sessions.end() ;
-             sessionIter++ )
-        {
-            (*sessionIter)->close() ;
-        }
-        // Empty session list
-        sessions.clear() ;
-
-        // Remove connection from broker
-        disposeOf( getConnectionId() ) ;
-
-        // Finally, transmit a shutdown command to broker
-        transport->oneway( new ShutdownInfo() ) ;
-        closed = true ;
-    }
-}
-
-/*
- *
- */
-p<ISession> Connection::createSession() throw(CmsException)
-{
-    return createSession(acknowledgementMode) ;
-}
-
-/*
- *
- */
-p<ISession> Connection::createSession(AcknowledgementMode ackMode) throw(CmsException)
-{
-    p<SessionInfo> sessionInfo = createSessionInfo( ackMode ) ;
-
-    // Send session info to broker
-    syncRequest(sessionInfo) ;
-
-    p<ISession> session = new Session(smartify(this), sessionInfo, ackMode) ;
-    sessions.push_back(session) ;
-
-    return session ;
-}
-
-/*
- * Performs a synchronous request-response with the broker.
- */
-p<Response> Connection::syncRequest(p<BaseCommand> command) throw(CmsException) 
-{
-    checkConnected() ;
-    
-    p<Response> response = transport->request(command) ;
-
-    if( response->getDataStructureType() == ExceptionResponse::TYPE )
-    {
-        p<ExceptionResponse> exceptionResponse = p_cast<ExceptionResponse> (response) ;
-        p<BrokerError>       brokerError = exceptionResponse->getException() ;
-        string               message ;
-
-        // Build error message
-        message.assign("Request failed: ") ;
-        message.append( brokerError->getExceptionClass()->c_str() ) ;
-        message.append(", ") ;
-        message.append( brokerError->getStackTrace()->c_str() ) ;
-
-        // TODO: Change to CMSException()
-        throw CmsException( message.c_str() ) ; 
-    }
-    return response ;
-}
-
-/*
- *
- */
-void Connection::oneway(p<BaseCommand> command) throw(CmsException)
-{
-    checkConnected() ;
-    transport->oneway(command) ;
-}
-
-/*
- *
- */
-void Connection::disposeOf(p<IDataStructure> dataStructure) throw(CmsException)
-{
-    p<RemoveInfo> command = new RemoveInfo() ;
-    command->setObjectId( dataStructure ) ;
-    syncRequest(command) ;
-
-    //
-    // Delete session from internal list if a session id was supplied
-    // Note! Dispose of sessions should only be invoked from Session.close()
-    //
-    if( dataStructure->getDataStructureType() == SessionId::TYPE )
-    {
-        list< p<ISession> >::iterator tempIter ;
-        p<SessionId>                  sessionId ;
-
-        // Convert data structure to a session id
-        sessionId = p_cast<SessionId> (dataStructure) ;
-
-        // Iterate through all sessions and check for a match on the session id
-        for( tempIter = sessions.begin() ;
-             tempIter != sessions.end() ;
-             tempIter++ )
-        {
-            p<Session> session = p_cast<Session> (*tempIter) ;
-
-            // Do we have a session id match?
-            if( session->getSessionId()->getValue() == sessionId->getValue() )
-            {
-                // Remove session
-                sessions.remove(session) ;
-                break ;
-            }
-        }
-    }
-}
-
-/*
- * Creates a new temporary destination name.
- */
-p<string> Connection::createTemporaryDestinationName()
-{
-    p<string> name = new string() ;
-    char*     buffer = new char[15] ;
-
-    {
-        LOCKED_SCOPE( mutex );
-
-        name->assign( connectionInfo->getConnectionId()->getValue()->c_str() ) ;
-        name->append( ":" ) ;
-#ifdef unix
-        sprintf(buffer, "%lld", ++tempDestinationCounter) ;
-#else
-        sprintf(buffer, "%I64d", ++tempDestinationCounter) ;
-#endif
-        name->append( buffer ) ;
-    }
-
-    return name ;
-}
-
-/*
- * Creates a new local transaction ID.
- */
-p<LocalTransactionId> Connection::createLocalTransactionId()
-{
-    p<LocalTransactionId> id = new LocalTransactionId() ;
-
-    id->setConnectionId( getConnectionId() ) ;
-
-    {
-        LOCKED_SCOPE (mutex);
-        id->setValue( ++localTransactionCounter ) ;
-    }
-
-    return id ;
-}
-
-
-// --- Implementation methods ---------------------------------------
-
-/*
- *
- */
-p<SessionInfo> Connection::createSessionInfo(AcknowledgementMode ackMode)
-{
-    p<SessionInfo> sessionInfo = new SessionInfo() ;
-    p<SessionId>   sessionId   = new SessionId() ;
-    
-    sessionId->setConnectionId ( connectionInfo->getConnectionId()->getValue() ) ;
-
-    {
-        LOCKED_SCOPE( mutex );
-        sessionId->setValue( ++sessionCounter ) ; 
-    }
-
-    sessionInfo->setSessionId( sessionId ) ;
-    return sessionInfo ; 
-}
-
-/*
- *
- */
-void Connection::checkConnected() throw(CmsException) 
-{
-    if( closed )
-        throw ConnectionClosedException("Oops! Connection already closed.") ;
-
-    if( !connected )
-    {
-        connected = true ;
-
-        // Send the connection info and see if we get an ack/nak
-        syncRequest( connectionInfo ) ;
-    } 
-}
-
-/*
- * Handle incoming commands.
- */
-void Connection::onCommand(p<ITransport> transport, p<BaseCommand> command)
-{
-    if( command->getDataStructureType() == MessageDispatch::TYPE )
-    {
-        p<MessageDispatch> dispatch = p_cast<MessageDispatch> (command) ;
-        p<ConsumerId> consumerId = dispatch->getConsumerId() ;
-        p<MessageConsumer> consumer = NULL ;
-        list< p<ISession> >::const_iterator tempIter ;
-
-        // Iterate through all sessions and check if one has the consumer
-        for( tempIter = sessions.begin() ;
-             tempIter != sessions.end() ;
-             tempIter++ )
-        {
-            consumer = p_cast<Session> (*tempIter)->getConsumer(consumerId) ;
-
-            // Found a match?
-            if( consumer != NULL )
-                break ;
-        }
-        if( consumer == NULL )
-            cout << "ERROR: No such consumer active: " << consumerId->getValue() << endl ;
-        else
-        {
-            p<ActiveMQMessage> message = p_cast<ActiveMQMessage> (dispatch->getMessage()) ;
-            consumer->dispatch(message) ;
-        }
-    }
-    else if( command->getDataStructureType() == WireFormatInfo::TYPE )
-        this->brokerWireFormat = p_cast<WireFormatInfo> (command) ;
-
-    else if( command->getDataStructureType() == BrokerInfo::TYPE )
-        this->brokerInfo = p_cast<BrokerInfo> (command) ;
-
-    else
-        cout << "ERROR: Unknown command: " << command->getDataStructureType() << endl ;
-}
-
-/*
- * Handle incoming broker errors.
- */
-void Connection::onError(p<ITransport> transport, exception& error)
-{
-    if( listener != NULL )
-        this->listener->onException(error) ;
-    else
-        cout << "ERROR: Received a broker exception: " << error.what() << endl ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "activemq/Connection.hpp"
+#include "activemq/Session.hpp"
+
+using namespace apache::activemq;
+
+
+// --- Constructors -------------------------------------------------
+
+/*
+ *
+ */
+Connection::Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo)
+{
+    this->transport               = transport ;
+    this->connectionInfo          = connectionInfo ;
+    this->acknowledgementMode     = AutoAckMode ;
+    this->connected               = false ;
+    this->closed                  = false ;
+    this->brokerInfo              = NULL ;
+    this->brokerWireFormat        = NULL ;
+    this->sessionCounter          = 0 ;
+    this->tempDestinationCounter  = 0 ;
+    this->localTransactionCounter = 0 ;
+
+    // Hook up as a command listener and start dispatching
+    transport->setCommandListener(smartify(this)) ;
+    transport->start() ;
+}
+
+/*
+ *
+ */
+Connection::~Connection()
+{
+    // Make sure connection is closed
+    close() ;
+}
+
+
+// --- Attribute methods --------------------------------------------
+
+/*
+ *
+ */
+void Connection::setExceptionListener(p<IExceptionListener> listener)
+{
+    this->listener = listener ;
+}
+
+/*
+ *
+ */
+p<IExceptionListener> Connection::getExceptionListener()
+{
+    return listener ;
+}
+
+/*
+ *
+ */
+p<ITransport> Connection::getTransport()
+{
+    return transport ;
+}
+
+/*
+ *
+ */
+void Connection::setTransport(p<ITransport> transport)
+{
+    this->transport = transport ;
+}
+
+/*
+ *
+ */
+p<string> Connection::getClientId()
+{
+    return connectionInfo->getClientId() ;
+}
+
+/*
+ *
+ */
+void Connection::setClientId(const char* value) throw (CmsException)
+{
+    if( connected )
+        throw CmsException("You cannot change the client id once a connection is established") ; 
+
+    p<string> clientId = new string(value) ;
+    connectionInfo->setClientId( clientId ) ;
+}
+
+
+/*
+ *
+ */
+p<BrokerInfo> Connection::getBrokerInfo()
+{
+    return brokerInfo ;
+}
+
+/*
+ *
+ */
+p<WireFormatInfo> Connection::getBrokerWireFormat()
+{
+    return brokerWireFormat ;
+}
+
+/*
+ *
+ */
+AcknowledgementMode Connection::getAcknowledgementMode()
+{
+    return acknowledgementMode ;
+}
+
+/*
+ *
+ */
+void Connection::setAcknowledgementMode(AcknowledgementMode ackMode)
+{
+    acknowledgementMode = ackMode ;
+}
+
+/*
+ *
+ */
+p<ConnectionId> Connection::getConnectionId()
+{
+    return connectionInfo->getConnectionId() ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ *
+ */
+void Connection::close()
+{
+    if( !closed )
+    {
+        list< p<ISession> >::iterator sessionIter ;
+
+        // Iterate through all sessions and close them down
+        for( sessionIter = sessions.begin() ;
+             sessionIter != sessions.end() ;
+             sessionIter++ )
+        {
+            (*sessionIter)->close() ;
+        }
+        // Empty session list
+        sessions.clear() ;
+
+        // Remove connection from broker
+        disposeOf( getConnectionId() ) ;
+
+        // Finally, transmit a shutdown command to broker
+        transport->oneway( new ShutdownInfo() ) ;
+        closed = true ;
+    }
+}
+
+/*
+ *
+ */
+p<ISession> Connection::createSession() throw(CmsException)
+{
+    return createSession(acknowledgementMode) ;
+}
+
+/*
+ *
+ */
+p<ISession> Connection::createSession(AcknowledgementMode ackMode) throw(CmsException)
+{
+    p<SessionInfo> sessionInfo = createSessionInfo( ackMode ) ;
+
+    // Send session info to broker
+    syncRequest(sessionInfo) ;
+
+    p<ISession> session = new Session(smartify(this), sessionInfo, ackMode) ;
+    sessions.push_back(session) ;
+
+    return session ;
+}
+
+/*
+ * Performs a synchronous request-response with the broker.
+ */
+p<Response> Connection::syncRequest(p<BaseCommand> command) throw(CmsException) 
+{
+    checkConnected() ;
+    
+    p<Response> response = transport->request(command) ;
+
+    if( response->getDataStructureType() == ExceptionResponse::TYPE )
+    {
+        p<ExceptionResponse> exceptionResponse = p_cast<ExceptionResponse> (response) ;
+        p<BrokerError>       brokerError = exceptionResponse->getException() ;
+        string               message ;
+
+        // Build error message
+        message.assign("Request failed: ") ;
+        message.append( brokerError->getExceptionClass()->c_str() ) ;
+        message.append(", ") ;
+        message.append( brokerError->getStackTrace()->c_str() ) ;
+
+        // TODO: Change to CMSException()
+        throw CmsException( message.c_str() ) ; 
+    }
+    return response ;
+}
+
+/*
+ *
+ */
+void Connection::oneway(p<BaseCommand> command) throw(CmsException)
+{
+    checkConnected() ;
+    transport->oneway(command) ;
+}
+
+/*
+ *
+ */
+void Connection::disposeOf(p<IDataStructure> dataStructure) throw(CmsException)
+{
+    p<RemoveInfo> command = new RemoveInfo() ;
+    command->setObjectId( dataStructure ) ;
+    syncRequest(command) ;
+
+    //
+    // Delete session from internal list if a session id was supplied
+    // Note! Dispose of sessions should only be invoked from Session.close()
+    //
+    if( dataStructure->getDataStructureType() == SessionId::TYPE )
+    {
+        list< p<ISession> >::iterator tempIter ;
+        p<SessionId>                  sessionId ;
+
+        // Convert data structure to a session id
+        sessionId = p_cast<SessionId> (dataStructure) ;
+
+        // Iterate through all sessions and check for a match on the session id
+        for( tempIter = sessions.begin() ;
+             tempIter != sessions.end() ;
+             tempIter++ )
+        {
+            p<Session> session = p_cast<Session> (*tempIter) ;
+
+            // Do we have a session id match?
+            if( session->getSessionId()->getValue() == sessionId->getValue() )
+            {
+                // Remove session
+                sessions.remove(session) ;
+                break ;
+            }
+        }
+    }
+}
+
+/*
+ * Creates a new temporary destination name.
+ */
+p<string> Connection::createTemporaryDestinationName()
+{
+    p<string> name = new string() ;
+    char*     buffer = new char[15] ;
+
+    {
+        LOCKED_SCOPE( mutex );
+
+        name->assign( connectionInfo->getConnectionId()->getValue()->c_str() ) ;
+        name->append( ":" ) ;
+#ifdef unix
+        sprintf(buffer, "%lld", ++tempDestinationCounter) ;
+#else
+        sprintf(buffer, "%I64d", ++tempDestinationCounter) ;
+#endif
+        name->append( buffer ) ;
+    }
+
+    return name ;
+}
+
+/*
+ * Creates a new local transaction ID.
+ */
+p<LocalTransactionId> Connection::createLocalTransactionId()
+{
+    p<LocalTransactionId> id = new LocalTransactionId() ;
+
+    id->setConnectionId( getConnectionId() ) ;
+
+    {
+        LOCKED_SCOPE (mutex);
+        id->setValue( ++localTransactionCounter ) ;
+    }
+
+    return id ;
+}
+
+
+// --- Implementation methods ---------------------------------------
+
+/*
+ *
+ */
+p<SessionInfo> Connection::createSessionInfo(AcknowledgementMode ackMode)
+{
+    p<SessionInfo> sessionInfo = new SessionInfo() ;
+    p<SessionId>   sessionId   = new SessionId() ;
+    
+    sessionId->setConnectionId ( connectionInfo->getConnectionId()->getValue() ) ;
+
+    {
+        LOCKED_SCOPE( mutex );
+        sessionId->setValue( ++sessionCounter ) ; 
+    }
+
+    sessionInfo->setSessionId( sessionId ) ;
+    return sessionInfo ; 
+}
+
+/*
+ *
+ */
+void Connection::checkConnected() throw(CmsException) 
+{
+    if( closed )
+        throw ConnectionClosedException("Oops! Connection already closed.") ;
+
+    if( !connected )
+    {
+        connected = true ;
+
+        // Send the connection info and see if we get an ack/nak
+        syncRequest( connectionInfo ) ;
+    } 
+}
+
+/*
+ * Handle incoming commands.
+ */
+void Connection::onCommand(p<ITransport> transport, p<BaseCommand> command)
+{
+    if( command->getDataStructureType() == MessageDispatch::TYPE )
+    {
+        p<MessageDispatch> dispatch = p_cast<MessageDispatch> (command) ;
+        p<ConsumerId> consumerId = dispatch->getConsumerId() ;
+        p<MessageConsumer> consumer = NULL ;
+        list< p<ISession> >::const_iterator tempIter ;
+
+        // Iterate through all sessions and check if one has the consumer
+        for( tempIter = sessions.begin() ;
+             tempIter != sessions.end() ;
+             tempIter++ )
+        {
+            consumer = p_cast<Session> (*tempIter)->getConsumer(consumerId) ;
+
+            // Found a match?
+            if( consumer != NULL )
+                break ;
+        }
+        if( consumer == NULL )
+            cout << "ERROR: No such consumer active: " << consumerId->getValue() << endl ;
+        else
+        {
+            p<ActiveMQMessage> message = p_cast<ActiveMQMessage> (dispatch->getMessage()) ;
+            consumer->dispatch(message) ;
+        }
+    }
+    else if( command->getDataStructureType() == WireFormatInfo::TYPE )
+        this->brokerWireFormat = p_cast<WireFormatInfo> (command) ;
+
+    else if( command->getDataStructureType() == BrokerInfo::TYPE )
+        this->brokerInfo = p_cast<BrokerInfo> (command) ;
+
+    else
+        cout << "ERROR: Unknown command: " << command->getDataStructureType() << endl ;
+}
+
+/*
+ * Handle incoming broker errors.
+ */
+void Connection::onError(p<ITransport> transport, exception& error)
+{
+    if( listener != NULL )
+        this->listener->onException(error) ;
+    else
+        cout << "ERROR: Received a broker exception: " << error.what() << endl ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/Connection.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/IUnitTest.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/IUnitTest.hpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/IUnitTest.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/IUnitTest.hpp Wed Jul  5 15:27:34 2006
@@ -1,39 +1,39 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef IUnitTest_hpp_
-#define IUnitTest_hpp_
-
-// Turn off warning message for ignored exception specification
-#ifdef _MSC_VER
-#pragma warning( disable : 4290 )
-#endif
-
-#include <exception>
-#include "ppr/util/ifr/p"
-
-using namespace ifr;
-using namespace std;
-
-struct IUnitTest : Interface
-{
-    virtual void setUp() throw (exception)  = 0 ;
-    virtual void execute() throw (exception)  = 0 ;
-    virtual void tearDown() throw (exception)  = 0 ;
-    virtual p<string> toString() = 0 ;
-};
-
-#endif /*IUnitTest_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef IUnitTest_hpp_
+#define IUnitTest_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <exception>
+#include "ppr/util/ifr/p"
+
+using namespace ifr;
+using namespace std;
+
+struct IUnitTest : Interface
+{
+    virtual void setUp() throw (exception)  = 0 ;
+    virtual void execute() throw (exception)  = 0 ;
+    virtual void tearDown() throw (exception)  = 0 ;
+    virtual p<string> toString() = 0 ;
+};
+
+#endif /*IUnitTest_hpp_*/

Propchange: incubator/activemq/trunk/openwire-cpp/src/test/cpp/IUnitTest.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchQueue.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchQueue.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchQueue.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchQueue.cpp Wed Jul  5 15:27:34 2006
@@ -1,121 +1,121 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "TestAsynchQueue.hpp"
-
-/*
- * 
- */
-TestAsynchQueue::TestAsynchQueue(p<IConnection> connection)
-{
-    this->connection = connection ;
-    this->error      = NULL ;
-}
-
-/*
- * 
- */
-TestAsynchQueue::~TestAsynchQueue()
-{
-    // no-op
-}
-
-/*
- * 
- */
-void TestAsynchQueue::setUp() throw (exception)
-{
-    // Create a session
-    session = connection->createSession() ;
-}
-
-/*
- * 
- */
-void TestAsynchQueue::execute() throw (exception)
-{
-    p<IQueue>             queue ;
-    p<IMessageConsumer>   consumer ;
-    p<IMessageProducer>   producer ;
-    p<IBytesMessage>      message ;
-
-    // Connect to a queue
-    queue = session->getQueue("FOO.BAR") ;
-
-    // Create producer and a asycnhrounous consumer
-    producer = session->createProducer(queue) ;
-    consumer = session->createConsumer(queue) ;
-    consumer->setMessageListener( smartify(this) ) ;
-
-    // Create binary message
-    message = session->createBytesMessage() ;
-    message->writeBoolean(true) ;
-    message->writeInt(3677490) ;
-    message->writeString("Hello Binary World!") ;
-
-    // Send message
-    producer->send(message) ;
-
-    // Wait for asynchronous message for 5s
-    semaphore.wait(5) ;
-
-    // Check if any error was registered by the message handler
-    if( error != NULL )
-        throw TraceException( error ) ;
-}
-
-/*
- * 
- */
-void TestAsynchQueue::tearDown() throw (exception)
-{
-    // Clean up
-    session->close() ;
-    session = NULL ;
-}
-
-p<string> TestAsynchQueue::toString()
-{
-    p<string> str = new string("Send/receive a byte message to 1 queue listener asynchronously") ;
-    return str ;
-}
-
-void TestAsynchQueue::onMessage(p<IMessage> message)
-{
-    if( message == NULL )
-    {
-        error = "Received a null message" ;
-        semaphore.notify() ;
-        return ;
-    }
-
-    p<IBytesMessage> msg = p_dyncast<IBytesMessage> (message) ;
-    if( msg == NULL )
-    {
-        error = "Received wrong type of message" ;
-        semaphore.notify() ;
-        return ;
-    }
-
-    // Verify message content
-    if( msg->readBoolean() != true ||
-        msg->readInt()     != 3677490 ||
-        msg->readString()->compare("Hello Binary World!") != 0 ) 
-    {
-        error = "Message content has been corrupted" ;
-    }
-    semaphore.notify() ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "TestAsynchQueue.hpp"
+
+/*
+ * 
+ */
+TestAsynchQueue::TestAsynchQueue(p<IConnection> connection)
+{
+    this->connection = connection ;
+    this->error      = NULL ;
+}
+
+/*
+ * 
+ */
+TestAsynchQueue::~TestAsynchQueue()
+{
+    // no-op
+}
+
+/*
+ * 
+ */
+void TestAsynchQueue::setUp() throw (exception)
+{
+    // Create a session
+    session = connection->createSession() ;
+}
+
+/*
+ * 
+ */
+void TestAsynchQueue::execute() throw (exception)
+{
+    p<IQueue>             queue ;
+    p<IMessageConsumer>   consumer ;
+    p<IMessageProducer>   producer ;
+    p<IBytesMessage>      message ;
+
+    // Connect to a queue
+    queue = session->getQueue("FOO.BAR") ;
+
+    // Create producer and a asycnhrounous consumer
+    producer = session->createProducer(queue) ;
+    consumer = session->createConsumer(queue) ;
+    consumer->setMessageListener( smartify(this) ) ;
+
+    // Create binary message
+    message = session->createBytesMessage() ;
+    message->writeBoolean(true) ;
+    message->writeInt(3677490) ;
+    message->writeString("Hello Binary World!") ;
+
+    // Send message
+    producer->send(message) ;
+
+    // Wait for asynchronous message for 5s
+    semaphore.wait(5) ;
+
+    // Check if any error was registered by the message handler
+    if( error != NULL )
+        throw TraceException( error ) ;
+}
+
+/*
+ * 
+ */
+void TestAsynchQueue::tearDown() throw (exception)
+{
+    // Clean up
+    session->close() ;
+    session = NULL ;
+}
+
+p<string> TestAsynchQueue::toString()
+{
+    p<string> str = new string("Send/receive a byte message to 1 queue listener asynchronously") ;
+    return str ;
+}
+
+void TestAsynchQueue::onMessage(p<IMessage> message)
+{
+    if( message == NULL )
+    {
+        error = "Received a null message" ;
+        semaphore.notify() ;
+        return ;
+    }
+
+    p<IBytesMessage> msg = p_dyncast<IBytesMessage> (message) ;
+    if( msg == NULL )
+    {
+        error = "Received wrong type of message" ;
+        semaphore.notify() ;
+        return ;
+    }
+
+    // Verify message content
+    if( msg->readBoolean() != true ||
+        msg->readInt()     != 3677490 ||
+        msg->readString()->compare("Hello Binary World!") != 0 ) 
+    {
+        error = "Message content has been corrupted" ;
+    }
+    semaphore.notify() ;
+}

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

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchQueue.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchQueue.hpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchQueue.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchQueue.hpp Wed Jul  5 15:27:34 2006
@@ -1,59 +1,59 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef TestAsynchQueue_hpp_
-#define TestAsynchQueue_hpp_
-
-#include <exception>
-#include <string>
-
-#include "cms/IConnection.hpp"
-#include "ppr/thread/Semaphore.hpp"
-#include "ppr/TraceException.hpp"
-#include "ppr/util/ifr/p"
-
-#include "IUnitTest.hpp"
-
-using namespace apache::cms;
-using namespace apache::ppr;
-using namespace apache::ppr::thread;
-using namespace ifr;
-using namespace std;
-
-/*
- * Tests sending/receiving a message to an asynchronous listener.
- */
-class TestAsynchQueue : public IUnitTest, public IMessageListener
-{
-private:
-    p<IConnection> connection ;
-    p<ISession>    session ;
-    Semaphore      semaphore ; 
-    char*          error ;
-
-public:
-    TestAsynchQueue(p<IConnection> connection) ;
-    virtual ~TestAsynchQueue() ;
-
-    virtual void setUp() throw (exception) ;
-    virtual void execute() throw (exception) ;
-    virtual void tearDown() throw (exception) ;
-    virtual p<string> toString() ;
-
-    virtual void onMessage(p<IMessage> message) ;
-} ;
-
-#endif /*TestAsynchQueue_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef TestAsynchQueue_hpp_
+#define TestAsynchQueue_hpp_
+
+#include <exception>
+#include <string>
+
+#include "cms/IConnection.hpp"
+#include "ppr/thread/Semaphore.hpp"
+#include "ppr/TraceException.hpp"
+#include "ppr/util/ifr/p"
+
+#include "IUnitTest.hpp"
+
+using namespace apache::cms;
+using namespace apache::ppr;
+using namespace apache::ppr::thread;
+using namespace ifr;
+using namespace std;
+
+/*
+ * Tests sending/receiving a message to an asynchronous listener.
+ */
+class TestAsynchQueue : public IUnitTest, public IMessageListener
+{
+private:
+    p<IConnection> connection ;
+    p<ISession>    session ;
+    Semaphore      semaphore ; 
+    char*          error ;
+
+public:
+    TestAsynchQueue(p<IConnection> connection) ;
+    virtual ~TestAsynchQueue() ;
+
+    virtual void setUp() throw (exception) ;
+    virtual void execute() throw (exception) ;
+    virtual void tearDown() throw (exception) ;
+    virtual p<string> toString() ;
+
+    virtual void onMessage(p<IMessage> message) ;
+} ;
+
+#endif /*TestAsynchQueue_hpp_*/

Propchange: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchQueue.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchTopic.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchTopic.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchTopic.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchTopic.cpp Wed Jul  5 15:27:34 2006
@@ -1,125 +1,125 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "TestAsynchTopic.hpp"
-
-/*
- * 
- */
-TestAsynchTopic::TestAsynchTopic(p<IConnection> connection)
-{
-    this->connection = connection ;
-    this->error      = NULL ;
-}
-
-/*
- * 
- */
-TestAsynchTopic::~TestAsynchTopic()
-{
-    // no-op
-}
-
-/*
- * 
- */
-void TestAsynchTopic::setUp() throw (exception)
-{
-    // Create a session
-    session = connection->createSession() ;
-}
-
-/*
- * 
- */
-void TestAsynchTopic::execute() throw (exception)
-{
-    p<ITopic>           topic ;
-    p<IMessageConsumer> consumer1,
-                        consumer2 ;
-    p<IMessageProducer> producer ;
-    p<IMapMessage>      message ;
-
-    // Connect to a topic
-    topic = session->getTopic("TEST.TOPIC") ;
-
-    // Create producer and two asynchrounous consumers
-    producer = session->createProducer(topic) ;
-    consumer1 = session->createConsumer(topic) ;
-    consumer1->setMessageListener( smartify(this) ) ;
-    consumer2 = session->createConsumer(topic) ;
-    consumer2->setMessageListener( smartify(this) ) ;
-
-    // Create binary message
-    message = session->createMapMessage() ;
-    message->setBoolean("key1", false) ;
-    message->setInt("key2", 8494845) ;
-    message->setString("key3", "Hello Map World!") ;
-
-    // Send message
-    producer->send(message) ;
-
-    // Wait for asynchronous messages for 5s each
-    semaphore.wait(5) ;
-    semaphore.wait(5) ;
-
-    // Check if any error was registered by the message handlers
-    if( error != NULL )
-        throw TraceException( error ) ;
-}
-
-/*
- * 
- */
-void TestAsynchTopic::tearDown() throw (exception)
-{
-    // Clean up
-    session->close() ;
-    session = NULL ;
-}
-
-p<string> TestAsynchTopic::toString()
-{
-    p<string> str = new string("Send/receive a map message to 2 topic listener asynchronously") ;
-    return str ;
-}
-
-void TestAsynchTopic::onMessage(p<IMessage> message)
-{
-    if( message == NULL )
-    {
-        error = "Received a null message" ;
-        semaphore.notify() ;
-        return ;
-    }
-
-    p<IMapMessage> msg = p_dyncast<IMapMessage> (message) ;
-    if( msg == NULL )
-    {
-        error = "Received wrong type of message" ;
-        semaphore.notify() ;
-        return ;
-    }
-
-    // Verify message content
-    if( msg->getBoolean("key1") != false ||
-        msg->getInt("key2")     != 8494845 ||
-        msg->getString("key3")->compare("Hello Map World!") != 0 ) 
-    {
-        error = "Message content has been corrupted" ;
-    }
-    semaphore.notify() ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "TestAsynchTopic.hpp"
+
+/*
+ * 
+ */
+TestAsynchTopic::TestAsynchTopic(p<IConnection> connection)
+{
+    this->connection = connection ;
+    this->error      = NULL ;
+}
+
+/*
+ * 
+ */
+TestAsynchTopic::~TestAsynchTopic()
+{
+    // no-op
+}
+
+/*
+ * 
+ */
+void TestAsynchTopic::setUp() throw (exception)
+{
+    // Create a session
+    session = connection->createSession() ;
+}
+
+/*
+ * 
+ */
+void TestAsynchTopic::execute() throw (exception)
+{
+    p<ITopic>           topic ;
+    p<IMessageConsumer> consumer1,
+                        consumer2 ;
+    p<IMessageProducer> producer ;
+    p<IMapMessage>      message ;
+
+    // Connect to a topic
+    topic = session->getTopic("TEST.TOPIC") ;
+
+    // Create producer and two asynchrounous consumers
+    producer = session->createProducer(topic) ;
+    consumer1 = session->createConsumer(topic) ;
+    consumer1->setMessageListener( smartify(this) ) ;
+    consumer2 = session->createConsumer(topic) ;
+    consumer2->setMessageListener( smartify(this) ) ;
+
+    // Create binary message
+    message = session->createMapMessage() ;
+    message->setBoolean("key1", false) ;
+    message->setInt("key2", 8494845) ;
+    message->setString("key3", "Hello Map World!") ;
+
+    // Send message
+    producer->send(message) ;
+
+    // Wait for asynchronous messages for 5s each
+    semaphore.wait(5) ;
+    semaphore.wait(5) ;
+
+    // Check if any error was registered by the message handlers
+    if( error != NULL )
+        throw TraceException( error ) ;
+}
+
+/*
+ * 
+ */
+void TestAsynchTopic::tearDown() throw (exception)
+{
+    // Clean up
+    session->close() ;
+    session = NULL ;
+}
+
+p<string> TestAsynchTopic::toString()
+{
+    p<string> str = new string("Send/receive a map message to 2 topic listener asynchronously") ;
+    return str ;
+}
+
+void TestAsynchTopic::onMessage(p<IMessage> message)
+{
+    if( message == NULL )
+    {
+        error = "Received a null message" ;
+        semaphore.notify() ;
+        return ;
+    }
+
+    p<IMapMessage> msg = p_dyncast<IMapMessage> (message) ;
+    if( msg == NULL )
+    {
+        error = "Received wrong type of message" ;
+        semaphore.notify() ;
+        return ;
+    }
+
+    // Verify message content
+    if( msg->getBoolean("key1") != false ||
+        msg->getInt("key2")     != 8494845 ||
+        msg->getString("key3")->compare("Hello Map World!") != 0 ) 
+    {
+        error = "Message content has been corrupted" ;
+    }
+    semaphore.notify() ;
+}

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

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchTopic.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchTopic.hpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchTopic.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchTopic.hpp Wed Jul  5 15:27:34 2006
@@ -1,59 +1,59 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef TestAsynchTopic_hpp_
-#define TestAsynchTopic_hpp_
-
-#include <exception>
-#include <string>
-
-#include "cms/IConnection.hpp"
-#include "ppr/thread/Semaphore.hpp"
-#include "ppr/util/ifr/p"
-
-#include "ppr/TraceException.hpp"
-#include "IUnitTest.hpp"
-
-using namespace apache::cms;
-using namespace apache::ppr;
-using namespace apache::ppr::thread;
-using namespace ifr;
-using namespace std;
-
-/*
- * Tests sending/receiving a message to two asynchronous listeners.
- */
-class TestAsynchTopic : public IUnitTest, public IMessageListener
-{
-private:
-    p<IConnection> connection ;
-    p<ISession>    session ;
-    Semaphore      semaphore ; 
-    char*          error ;
-
-public:
-    TestAsynchTopic(p<IConnection> connection) ;
-    virtual ~TestAsynchTopic() ;
-
-    virtual void setUp() throw (exception) ;
-    virtual void execute() throw (exception) ;
-    virtual void tearDown() throw (exception) ;
-    virtual p<string> toString() ;
-
-    virtual void onMessage(p<IMessage> message) ;
-} ;
-
-#endif /*TestAsynchTopic_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef TestAsynchTopic_hpp_
+#define TestAsynchTopic_hpp_
+
+#include <exception>
+#include <string>
+
+#include "cms/IConnection.hpp"
+#include "ppr/thread/Semaphore.hpp"
+#include "ppr/util/ifr/p"
+
+#include "ppr/TraceException.hpp"
+#include "IUnitTest.hpp"
+
+using namespace apache::cms;
+using namespace apache::ppr;
+using namespace apache::ppr::thread;
+using namespace ifr;
+using namespace std;
+
+/*
+ * Tests sending/receiving a message to two asynchronous listeners.
+ */
+class TestAsynchTopic : public IUnitTest, public IMessageListener
+{
+private:
+    p<IConnection> connection ;
+    p<ISession>    session ;
+    Semaphore      semaphore ; 
+    char*          error ;
+
+public:
+    TestAsynchTopic(p<IConnection> connection) ;
+    virtual ~TestAsynchTopic() ;
+
+    virtual void setUp() throw (exception) ;
+    virtual void execute() throw (exception) ;
+    virtual void tearDown() throw (exception) ;
+    virtual p<string> toString() ;
+
+    virtual void onMessage(p<IMessage> message) ;
+} ;
+
+#endif /*TestAsynchTopic_hpp_*/

Propchange: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestAsynchTopic.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestLocalTXCommit.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestLocalTXCommit.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestLocalTXCommit.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestLocalTXCommit.cpp Wed Jul  5 15:27:34 2006
@@ -1,153 +1,153 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "TestLocalTXCommit.hpp"
-
-/*
- * 
- */
-TestLocalTXCommit::TestLocalTXCommit(p<IConnection> connection)
-{
-    this->connection  = connection ;
-    this->error       = NULL ;
-    this->transmitted = false ;
-    this->matchCount  = 0 ;
-}
-
-/*
- * 
- */
-TestLocalTXCommit::~TestLocalTXCommit()
-{
-    // no-op
-}
-
-/*
- * 
- */
-void TestLocalTXCommit::setUp() throw (exception)
-{
-    // Create a session
-    session = connection->createSession( TransactionalAckMode ) ;
-}
-
-/*
- * 
- */
-void TestLocalTXCommit::execute() throw (exception)
-{
-    p<IQueue>             queue ;
-    p<IMessageConsumer>   consumer ;
-    p<IMessageProducer>   producer ;
-    p<ITextMessage>       message1, message2;
-
-    // Connect to a queue
-    queue = session->getQueue("FOO.BAR") ;
-
-    // Create producer and a asycnhrounous consumer
-    producer = session->createProducer(queue) ;
-    consumer = session->createConsumer(queue) ;
-    consumer->setMessageListener( smartify(this) ) ;
-
-    // Create text messages
-    message1 = session->createTextMessage("LocalTX 1") ;
-    message2 = session->createTextMessage("LocalTX 2") ;
-
-    // Send messages
-    producer->send(message1) ;
-    producer->send(message2) ;
-
-    // Commit transaction
-    transmitted = true ;
-    session->commit() ;
-
-    // Wait for asynchronous receive for 5s
-    semaphore.wait(5) ;
-
-    // Check if any error was registered by the message handler
-    if( error != NULL )
-        throw TraceException( error ) ;
-}
-
-/*
- * 
- */
-void TestLocalTXCommit::tearDown() throw (exception)
-{
-    // Clean up
-    session->close() ;
-    session = NULL ;
-}
-
-p<string> TestLocalTXCommit::toString()
-{
-    p<string> str = new string("Sends multiple messages to a queue guarded by a local transaction") ;
-    return str ;
-}
-
-void TestLocalTXCommit::onMessage(p<IMessage> message)
-{
-    if( !transmitted )
-    {
-        error = "Received a message before transaction was committed" ;
-        session->rollback() ;
-        semaphore.notify() ;
-        return ;
-    }
-
-    if( message == NULL )
-    {
-        error = "Received a null message" ;
-        session->rollback() ;
-        semaphore.notify() ;
-        return ;
-    }
-
-    p<ITextMessage> msg = p_dyncast<ITextMessage> (message) ;
-    if( msg == NULL )
-    {
-        error = "Received wrong type of message" ;
-        semaphore.notify() ;
-        return ;
-    }
-
-    // Verify message content
-    if( msg->getText()->compare("LocalTX 1") != 0 ||
-        msg->getText()->compare("LocalTX 2") != 0 ) 
-    {
-        matchCount++ ;
-    }
-    else
-    {
-        error = "Message content has been corrupted" ;
-
-        // Rollback receive
-        session->rollback() ;
-
-        // Wakeup main thread
-        semaphore.notify() ;
-    }
-
-    // Did we receive both messages?
-    if( matchCount == 2 )
-    {
-        // Commit receive
-        session->commit() ;
-
-        // Wakeup main thread
-        semaphore.notify() ;
-    }
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "TestLocalTXCommit.hpp"
+
+/*
+ * 
+ */
+TestLocalTXCommit::TestLocalTXCommit(p<IConnection> connection)
+{
+    this->connection  = connection ;
+    this->error       = NULL ;
+    this->transmitted = false ;
+    this->matchCount  = 0 ;
+}
+
+/*
+ * 
+ */
+TestLocalTXCommit::~TestLocalTXCommit()
+{
+    // no-op
+}
+
+/*
+ * 
+ */
+void TestLocalTXCommit::setUp() throw (exception)
+{
+    // Create a session
+    session = connection->createSession( TransactionalAckMode ) ;
+}
+
+/*
+ * 
+ */
+void TestLocalTXCommit::execute() throw (exception)
+{
+    p<IQueue>             queue ;
+    p<IMessageConsumer>   consumer ;
+    p<IMessageProducer>   producer ;
+    p<ITextMessage>       message1, message2;
+
+    // Connect to a queue
+    queue = session->getQueue("FOO.BAR") ;
+
+    // Create producer and a asycnhrounous consumer
+    producer = session->createProducer(queue) ;
+    consumer = session->createConsumer(queue) ;
+    consumer->setMessageListener( smartify(this) ) ;
+
+    // Create text messages
+    message1 = session->createTextMessage("LocalTX 1") ;
+    message2 = session->createTextMessage("LocalTX 2") ;
+
+    // Send messages
+    producer->send(message1) ;
+    producer->send(message2) ;
+
+    // Commit transaction
+    transmitted = true ;
+    session->commit() ;
+
+    // Wait for asynchronous receive for 5s
+    semaphore.wait(5) ;
+
+    // Check if any error was registered by the message handler
+    if( error != NULL )
+        throw TraceException( error ) ;
+}
+
+/*
+ * 
+ */
+void TestLocalTXCommit::tearDown() throw (exception)
+{
+    // Clean up
+    session->close() ;
+    session = NULL ;
+}
+
+p<string> TestLocalTXCommit::toString()
+{
+    p<string> str = new string("Sends multiple messages to a queue guarded by a local transaction") ;
+    return str ;
+}
+
+void TestLocalTXCommit::onMessage(p<IMessage> message)
+{
+    if( !transmitted )
+    {
+        error = "Received a message before transaction was committed" ;
+        session->rollback() ;
+        semaphore.notify() ;
+        return ;
+    }
+
+    if( message == NULL )
+    {
+        error = "Received a null message" ;
+        session->rollback() ;
+        semaphore.notify() ;
+        return ;
+    }
+
+    p<ITextMessage> msg = p_dyncast<ITextMessage> (message) ;
+    if( msg == NULL )
+    {
+        error = "Received wrong type of message" ;
+        semaphore.notify() ;
+        return ;
+    }
+
+    // Verify message content
+    if( msg->getText()->compare("LocalTX 1") != 0 ||
+        msg->getText()->compare("LocalTX 2") != 0 ) 
+    {
+        matchCount++ ;
+    }
+    else
+    {
+        error = "Message content has been corrupted" ;
+
+        // Rollback receive
+        session->rollback() ;
+
+        // Wakeup main thread
+        semaphore.notify() ;
+    }
+
+    // Did we receive both messages?
+    if( matchCount == 2 )
+    {
+        // Commit receive
+        session->commit() ;
+
+        // Wakeup main thread
+        semaphore.notify() ;
+    }
+}

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

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestLocalTXCommit.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestLocalTXCommit.hpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestLocalTXCommit.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestLocalTXCommit.hpp Wed Jul  5 15:27:34 2006
@@ -1,63 +1,63 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef TestLocalTXCommit_hpp_
-#define TestLocalTXCommit_hpp_
-
-#include <exception>
-#include <string>
-
-#include "cms/IConnection.hpp"
-#include "activemq/AcknowledgementMode.hpp"
-#include "ppr/thread/Semaphore.hpp"
-#include "ppr/TraceException.hpp"
-#include "ppr/util/ifr/p"
-
-#include "IUnitTest.hpp"
-
-using namespace apache;
-using namespace apache::cms;
-using namespace apache::ppr;
-using namespace apache::ppr::thread;
-using namespace ifr;
-using namespace std;
-
-/*
- * Tests sending multiple messages to a queue guarded by a local transaction.
- */
-class TestLocalTXCommit : public IUnitTest, public IMessageListener
-{
-private:
-    p<IConnection> connection ;
-    p<ISession>    session ;
-    Semaphore      semaphore ; 
-    char*          error ;
-    bool           transmitted ;
-    int            matchCount ;
-
-public:
-    TestLocalTXCommit(p<IConnection> connection) ;
-    virtual ~TestLocalTXCommit() ;
-
-    virtual void setUp() throw (exception) ;
-    virtual void execute() throw (exception) ;
-    virtual void tearDown() throw (exception) ;
-    virtual p<string> toString() ;
-
-    virtual void onMessage(p<IMessage> message) ;
-} ;
-
-#endif /*TestLocalTXCommit_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef TestLocalTXCommit_hpp_
+#define TestLocalTXCommit_hpp_
+
+#include <exception>
+#include <string>
+
+#include "cms/IConnection.hpp"
+#include "activemq/AcknowledgementMode.hpp"
+#include "ppr/thread/Semaphore.hpp"
+#include "ppr/TraceException.hpp"
+#include "ppr/util/ifr/p"
+
+#include "IUnitTest.hpp"
+
+using namespace apache;
+using namespace apache::cms;
+using namespace apache::ppr;
+using namespace apache::ppr::thread;
+using namespace ifr;
+using namespace std;
+
+/*
+ * Tests sending multiple messages to a queue guarded by a local transaction.
+ */
+class TestLocalTXCommit : public IUnitTest, public IMessageListener
+{
+private:
+    p<IConnection> connection ;
+    p<ISession>    session ;
+    Semaphore      semaphore ; 
+    char*          error ;
+    bool           transmitted ;
+    int            matchCount ;
+
+public:
+    TestLocalTXCommit(p<IConnection> connection) ;
+    virtual ~TestLocalTXCommit() ;
+
+    virtual void setUp() throw (exception) ;
+    virtual void execute() throw (exception) ;
+    virtual void tearDown() throw (exception) ;
+    virtual p<string> toString() ;
+
+    virtual void onMessage(p<IMessage> message) ;
+} ;
+
+#endif /*TestLocalTXCommit_hpp_*/

Propchange: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestLocalTXCommit.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSuite.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSuite.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSuite.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSuite.cpp Wed Jul  5 15:27:34 2006
@@ -1,238 +1,238 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "TestSuite.hpp"
-
-#include "TestSynchQueue.hpp"
-#include "TestAsynchQueue.hpp"
-#include "TestAsynchTopic.hpp"
-#include "TestLocalTXCommit.hpp"
-
-/*
- *
- */
-TestSuite::TestSuite()
-{
-    this->name       = NULL ;
-    this->trace      = false ;
-    this->connection = NULL ;
-}
-
-/*
- *
- */
-TestSuite::~TestSuite()
-{
-    // no-op
-}
-
-/*
- *
- */
-void TestSuite::setURI(const char* uri)
-{
-    this->uri = new Uri(uri) ;
-}
-
-/*
- *
- */
-void TestSuite::setSingle(const char* name)
-{
-    this->name = name ;
-}
-
-/*
- *
- */
-void TestSuite::setUp() throw (TraceException)
-{
-    p<IConnectionFactory> factory ;
-
-    cout << "Connecting to ActiveMQ broker..." << endl ;
-    factory = new ConnectionFactory( this->uri ) ;
-    connection = factory->createConnection() ;
-
-    this->unitTests["SynchQueue"]    = new TestSynchQueue( connection ) ;
-    this->unitTests["AsynchQueue"]   = new TestAsynchQueue( connection ) ;
-    this->unitTests["AsynchTopic"]   = new TestAsynchTopic( connection ) ;
-    this->unitTests["LocalTXCommit"] = new TestLocalTXCommit( connection ) ;
-}
-
-/*
- *
- */
-void TestSuite::execute() throw (TraceException)
-{
-
-    try
-    {
-        // Set up test suite
-        setUp() ;
-    }
-    catch( TraceException& e )
-    {
-        cout << "Failed to set up test suite. " << e.what() << endl ;
-        exit(-1) ;
-    }
-
-    if( name != NULL )
-        runSingle( name ) ;
-    else
-        runAll() ;
-
-    try
-    {
-        // Tear down test suite
-        tearDown() ;
-    }
-    catch( TraceException& e )
-    {
-        cout << "Failed to tear down test suite. " << e.what() << endl ;
-        exit(-1) ;
-    }
-}
-
-/*
- *
- */
-void TestSuite::tearDown() throw (TraceException)
-{
-    if( connection != NULL )
-        connection->close() ;
-}
-
-/*
- *
- */
-p<string> TestSuite::toString()
-{
-    p<string> str = new string("ActiveMQ C++ Client Test Suite") ;
-    return str ;
-}
-
-/*
- *
- */
-void TestSuite::runSingle(const char* name) throw (TraceException)
-{
-    // Find unit test
-    map< string, p<IUnitTest> >::iterator tempIter ;
-    string key = string(name) ;
-
-    try
-    {
-        // Locate given unit test
-        tempIter = unitTests.find(key) ;
-        if( tempIter == unitTests.end() )
-        {
-            cout << "No unit test named [" << name << "] found." << endl ;
-            exit(-1) ;
-        }
-        string info ;
-
-        info.assign( tempIter->second->toString()->c_str() ) ;
-
-        // Pad with spaces up to 71 chars
-        for( int i = (int)info.length() ; i < 71 ; i++ )
-            info.append(" ") ;
-
-        cout << info.c_str() ;
-
-        tempIter->second->setUp() ;
-        tempIter->second->execute() ;
-        tempIter->second->tearDown() ;
-
-        cout << "[  OK  ]" << endl ;
-    }
-    catch( TraceException& e )
-    {
-        cout << "[FAILED]" << endl ;
-        cout << "  " << e.what() << endl ;
-    }
-}
-
-/*
- *
- */
-void TestSuite::runAll() throw (TraceException)
-{
-    map< string, p<IUnitTest> >::iterator tempIter ;
-
-    // Loop through and execute all unit tests
-    for( tempIter = unitTests.begin() ;
-         tempIter != unitTests.end() ;
-         tempIter++ )
-    {
-        string info ;
-
-        info.assign( tempIter->second->toString()->c_str() ) ;
-
-        // Pad with spaces up to 71 chars
-        for( int i = (int)info.length() ; i < 71 ; i++ )
-            info.append(" ") ;
-
-        cout << info.c_str() ;
-
-        try
-        {
-            tempIter->second->setUp() ;
-            tempIter->second->execute() ;
-            tempIter->second->tearDown() ;
-
-            cout << "[  OK  ]" << endl ;
-        }
-        catch( TraceException& e )
-        {
-            cout << "[FAILED]" << endl ;
-            cout << "  " << e.what() << endl ;
-        }
-    }
-}
-
-/*
- * Main entry point.
- */
-int main(int argc, char *argv[])
-{
-    TestSuite suite ;
-
-    // Print usage if no arguments was supplied
-    if( argc <= 1 )
-    {
-        cout << "usage: test \"uri\" [name]" << endl ;
-        cout << "  uri    The URI to the ActiveMQ broker, surrounded with quotation marks" << endl ;
-        cout << "  name   The name of a single unit test to execute" << endl ;
-        exit(-1) ;
-    }
-
-    // Check cmdline args for URI
-    // Sample URI: "tcp://192.168.64.142:61616?trace=false&protocol=openwire&encoding=none"
-    for( int i = 0 ; i < argc ; i++ )
-    {
-        // Skip program name
-        if( i == 0 )
-            continue ;
-
-        // Assume URI
-        if( i == 1 )
-            suite.setURI( argv[i] ) ;
-        // Assume unit test name
-        if( i == 2 )
-            suite.setSingle( argv[i] ) ;
-    }
-    suite.execute() ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "TestSuite.hpp"
+
+#include "TestSynchQueue.hpp"
+#include "TestAsynchQueue.hpp"
+#include "TestAsynchTopic.hpp"
+#include "TestLocalTXCommit.hpp"
+
+/*
+ *
+ */
+TestSuite::TestSuite()
+{
+    this->name       = NULL ;
+    this->trace      = false ;
+    this->connection = NULL ;
+}
+
+/*
+ *
+ */
+TestSuite::~TestSuite()
+{
+    // no-op
+}
+
+/*
+ *
+ */
+void TestSuite::setURI(const char* uri)
+{
+    this->uri = new Uri(uri) ;
+}
+
+/*
+ *
+ */
+void TestSuite::setSingle(const char* name)
+{
+    this->name = name ;
+}
+
+/*
+ *
+ */
+void TestSuite::setUp() throw (TraceException)
+{
+    p<IConnectionFactory> factory ;
+
+    cout << "Connecting to ActiveMQ broker..." << endl ;
+    factory = new ConnectionFactory( this->uri ) ;
+    connection = factory->createConnection() ;
+
+    this->unitTests["SynchQueue"]    = new TestSynchQueue( connection ) ;
+    this->unitTests["AsynchQueue"]   = new TestAsynchQueue( connection ) ;
+    this->unitTests["AsynchTopic"]   = new TestAsynchTopic( connection ) ;
+    this->unitTests["LocalTXCommit"] = new TestLocalTXCommit( connection ) ;
+}
+
+/*
+ *
+ */
+void TestSuite::execute() throw (TraceException)
+{
+
+    try
+    {
+        // Set up test suite
+        setUp() ;
+    }
+    catch( TraceException& e )
+    {
+        cout << "Failed to set up test suite. " << e.what() << endl ;
+        exit(-1) ;
+    }
+
+    if( name != NULL )
+        runSingle( name ) ;
+    else
+        runAll() ;
+
+    try
+    {
+        // Tear down test suite
+        tearDown() ;
+    }
+    catch( TraceException& e )
+    {
+        cout << "Failed to tear down test suite. " << e.what() << endl ;
+        exit(-1) ;
+    }
+}
+
+/*
+ *
+ */
+void TestSuite::tearDown() throw (TraceException)
+{
+    if( connection != NULL )
+        connection->close() ;
+}
+
+/*
+ *
+ */
+p<string> TestSuite::toString()
+{
+    p<string> str = new string("ActiveMQ C++ Client Test Suite") ;
+    return str ;
+}
+
+/*
+ *
+ */
+void TestSuite::runSingle(const char* name) throw (TraceException)
+{
+    // Find unit test
+    map< string, p<IUnitTest> >::iterator tempIter ;
+    string key = string(name) ;
+
+    try
+    {
+        // Locate given unit test
+        tempIter = unitTests.find(key) ;
+        if( tempIter == unitTests.end() )
+        {
+            cout << "No unit test named [" << name << "] found." << endl ;
+            exit(-1) ;
+        }
+        string info ;
+
+        info.assign( tempIter->second->toString()->c_str() ) ;
+
+        // Pad with spaces up to 71 chars
+        for( int i = (int)info.length() ; i < 71 ; i++ )
+            info.append(" ") ;
+
+        cout << info.c_str() ;
+
+        tempIter->second->setUp() ;
+        tempIter->second->execute() ;
+        tempIter->second->tearDown() ;
+
+        cout << "[  OK  ]" << endl ;
+    }
+    catch( TraceException& e )
+    {
+        cout << "[FAILED]" << endl ;
+        cout << "  " << e.what() << endl ;
+    }
+}
+
+/*
+ *
+ */
+void TestSuite::runAll() throw (TraceException)
+{
+    map< string, p<IUnitTest> >::iterator tempIter ;
+
+    // Loop through and execute all unit tests
+    for( tempIter = unitTests.begin() ;
+         tempIter != unitTests.end() ;
+         tempIter++ )
+    {
+        string info ;
+
+        info.assign( tempIter->second->toString()->c_str() ) ;
+
+        // Pad with spaces up to 71 chars
+        for( int i = (int)info.length() ; i < 71 ; i++ )
+            info.append(" ") ;
+
+        cout << info.c_str() ;
+
+        try
+        {
+            tempIter->second->setUp() ;
+            tempIter->second->execute() ;
+            tempIter->second->tearDown() ;
+
+            cout << "[  OK  ]" << endl ;
+        }
+        catch( TraceException& e )
+        {
+            cout << "[FAILED]" << endl ;
+            cout << "  " << e.what() << endl ;
+        }
+    }
+}
+
+/*
+ * Main entry point.
+ */
+int main(int argc, char *argv[])
+{
+    TestSuite suite ;
+
+    // Print usage if no arguments was supplied
+    if( argc <= 1 )
+    {
+        cout << "usage: test \"uri\" [name]" << endl ;
+        cout << "  uri    The URI to the ActiveMQ broker, surrounded with quotation marks" << endl ;
+        cout << "  name   The name of a single unit test to execute" << endl ;
+        exit(-1) ;
+    }
+
+    // Check cmdline args for URI
+    // Sample URI: "tcp://192.168.64.142:61616?trace=false&protocol=openwire&encoding=none"
+    for( int i = 0 ; i < argc ; i++ )
+    {
+        // Skip program name
+        if( i == 0 )
+            continue ;
+
+        // Assume URI
+        if( i == 1 )
+            suite.setURI( argv[i] ) ;
+        // Assume unit test name
+        if( i == 2 )
+            suite.setSingle( argv[i] ) ;
+    }
+    suite.execute() ;
+}

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

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSuite.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSuite.hpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSuite.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSuite.hpp Wed Jul  5 15:27:34 2006
@@ -1,68 +1,68 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef TestSuite_hpp_
-#define TestSuite_hpp_
-
-#include <exception>
-#include <iostream>
-#include <map>
-#include <string>
-
-#include "cms/IConnection.hpp"
-#include "cms/IConnectionFactory.hpp"
-#include "activemq/ConnectionFactory.hpp"
-#include "activemq/Connection.hpp"
-#include "ppr/TraceException.hpp"
-#include "ppr/net/Uri.hpp"
-#include "ppr/util/ifr/p"
-
-#include "IUnitTest.hpp"
-
-using namespace apache::activemq;
-using namespace apache::cms;
-using namespace apache::ppr;
-using namespace apache::ppr::net;
-using namespace ifr;
-using namespace std;
-
-class TestSuite : public IUnitTest
-{
-private:
-    p<IConnection>              connection ;
-    p<Uri>                      uri ;
-    map< string, p<IUnitTest> > unitTests ;
-    const char*                 name ;
-    bool                        trace ;
-
-public:
-    TestSuite() ;
-    virtual ~TestSuite() ;
-
-    virtual void setURI(const char* uri) ;
-    virtual void setSingle(const char* name) ;
-
-    virtual void setUp() throw (TraceException) ;
-    virtual void execute() throw (TraceException) ;
-    virtual void tearDown() throw (TraceException) ;
-    virtual p<string> toString() ;
-
-protected:
-    void runSingle(const char* name) throw (TraceException) ;
-    void runAll() throw (TraceException) ;
-} ;
-
-#endif /*TestSuite_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef TestSuite_hpp_
+#define TestSuite_hpp_
+
+#include <exception>
+#include <iostream>
+#include <map>
+#include <string>
+
+#include "cms/IConnection.hpp"
+#include "cms/IConnectionFactory.hpp"
+#include "activemq/ConnectionFactory.hpp"
+#include "activemq/Connection.hpp"
+#include "ppr/TraceException.hpp"
+#include "ppr/net/Uri.hpp"
+#include "ppr/util/ifr/p"
+
+#include "IUnitTest.hpp"
+
+using namespace apache::activemq;
+using namespace apache::cms;
+using namespace apache::ppr;
+using namespace apache::ppr::net;
+using namespace ifr;
+using namespace std;
+
+class TestSuite : public IUnitTest
+{
+private:
+    p<IConnection>              connection ;
+    p<Uri>                      uri ;
+    map< string, p<IUnitTest> > unitTests ;
+    const char*                 name ;
+    bool                        trace ;
+
+public:
+    TestSuite() ;
+    virtual ~TestSuite() ;
+
+    virtual void setURI(const char* uri) ;
+    virtual void setSingle(const char* name) ;
+
+    virtual void setUp() throw (TraceException) ;
+    virtual void execute() throw (TraceException) ;
+    virtual void tearDown() throw (TraceException) ;
+    virtual p<string> toString() ;
+
+protected:
+    void runSingle(const char* name) throw (TraceException) ;
+    void runAll() throw (TraceException) ;
+} ;
+
+#endif /*TestSuite_hpp_*/

Propchange: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSuite.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.cpp Wed Jul  5 15:27:34 2006
@@ -1,118 +1,118 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "TestSynchQueue.hpp"
-
-/*
- * 
- */
-TestSynchQueue::TestSynchQueue(p<IConnection> connection)
-{
-    this->connection = connection ;
-}
-
-/*
- * 
- */
-TestSynchQueue::~TestSynchQueue()
-{
-    // no-op
-}
-
-/*
- * 
- */
-void TestSynchQueue::setUp() throw (exception)
-{
-    // Create a session
-    session = connection->createSession() ;
-}
-
-/*
- * 
- */
-void TestSynchQueue::execute() throw (exception)
-{
-    p<IQueue>             queue ;
-    p<IMessageConsumer>   consumer ;
-    p<IMessageProducer>   producer ;
-    p<ITextMessage>       reqMessage,
-                          rspMessage ;
-    p<PropertyMap>        props ;
-    MapItemHolder         item ;
-
-    // Connect to queue
-    queue = session->getQueue("FOO.BAR") ;
-    
-    // Create a consumer and producer
-    consumer = session->createConsumer(queue) ;
-    producer = session->createProducer(queue) ;
-
-    // Create a message
-    reqMessage = session->createTextMessage("Hello World!") ;
-    reqMessage->setJMSCorrelationID("abc") ;
-    reqMessage->setJMSXGroupID("cheese") ;
-    props = reqMessage->getProperties() ;
-    (*props)["someHeader"] = MapItemHolder( "James" ) ;
-
-    // Send message
-    producer->send(reqMessage) ;
-
-    // Receive and wait for a message
-    rspMessage = p_dyncast<ITextMessage> (consumer->receive()) ;
-    if( rspMessage == NULL )
-        throw TraceException("Received a null message") ;
-    else
-    {
-        p<string> str ;
-
-        props = rspMessage->getProperties() ;
-        item  = (*props)["someHeader"] ;
-
-        // Verify message
-        str = rspMessage->getJMSCorrelationID() ;
-        if( str == NULL || str->compare("abc") != 0 )
-            throw TraceException("Returned message has invalid correlation ID") ;
-
-        str = rspMessage->getJMSXGroupID() ;
-        if( str == NULL || str->compare("cheese") != 0 )
-            throw TraceException("Returned message has invalid group ID") ;
-
-        str = rspMessage->getText() ;
-        if( str == NULL || str->compare("Hello World!") != 0 )
-            throw TraceException("Returned message has altered body text") ;
-
-        str = item.getString() ;
-        if( str == NULL || str->compare("James") != 0 )
-            throw TraceException("Returned message has invalid properties") ;
-    }
-}
-
-/*
- * 
- */
-void TestSynchQueue::tearDown() throw (exception)
-{
-    // Clean up
-    session->close() ;
-    session = NULL ;
-}
-
-p<string> TestSynchQueue::toString()
-{
-    p<string> str = new string("Send/receive a text message to a queue synchronously") ;
-    return str ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "TestSynchQueue.hpp"
+
+/*
+ * 
+ */
+TestSynchQueue::TestSynchQueue(p<IConnection> connection)
+{
+    this->connection = connection ;
+}
+
+/*
+ * 
+ */
+TestSynchQueue::~TestSynchQueue()
+{
+    // no-op
+}
+
+/*
+ * 
+ */
+void TestSynchQueue::setUp() throw (exception)
+{
+    // Create a session
+    session = connection->createSession() ;
+}
+
+/*
+ * 
+ */
+void TestSynchQueue::execute() throw (exception)
+{
+    p<IQueue>             queue ;
+    p<IMessageConsumer>   consumer ;
+    p<IMessageProducer>   producer ;
+    p<ITextMessage>       reqMessage,
+                          rspMessage ;
+    p<PropertyMap>        props ;
+    MapItemHolder         item ;
+
+    // Connect to queue
+    queue = session->getQueue("FOO.BAR") ;
+    
+    // Create a consumer and producer
+    consumer = session->createConsumer(queue) ;
+    producer = session->createProducer(queue) ;
+
+    // Create a message
+    reqMessage = session->createTextMessage("Hello World!") ;
+    reqMessage->setJMSCorrelationID("abc") ;
+    reqMessage->setJMSXGroupID("cheese") ;
+    props = reqMessage->getProperties() ;
+    (*props)["someHeader"] = MapItemHolder( "James" ) ;
+
+    // Send message
+    producer->send(reqMessage) ;
+
+    // Receive and wait for a message
+    rspMessage = p_dyncast<ITextMessage> (consumer->receive()) ;
+    if( rspMessage == NULL )
+        throw TraceException("Received a null message") ;
+    else
+    {
+        p<string> str ;
+
+        props = rspMessage->getProperties() ;
+        item  = (*props)["someHeader"] ;
+
+        // Verify message
+        str = rspMessage->getJMSCorrelationID() ;
+        if( str == NULL || str->compare("abc") != 0 )
+            throw TraceException("Returned message has invalid correlation ID") ;
+
+        str = rspMessage->getJMSXGroupID() ;
+        if( str == NULL || str->compare("cheese") != 0 )
+            throw TraceException("Returned message has invalid group ID") ;
+
+        str = rspMessage->getText() ;
+        if( str == NULL || str->compare("Hello World!") != 0 )
+            throw TraceException("Returned message has altered body text") ;
+
+        str = item.getString() ;
+        if( str == NULL || str->compare("James") != 0 )
+            throw TraceException("Returned message has invalid properties") ;
+    }
+}
+
+/*
+ * 
+ */
+void TestSynchQueue::tearDown() throw (exception)
+{
+    // Clean up
+    session->close() ;
+    session = NULL ;
+}
+
+p<string> TestSynchQueue::toString()
+{
+    p<string> str = new string("Send/receive a text message to a queue synchronously") ;
+    return str ;
+}

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

Modified: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.hpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.hpp Wed Jul  5 15:27:34 2006
@@ -1,50 +1,50 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef TestSynchQueue_hpp_
-#define TestSynchQueue_hpp_
-
-#include <exception>
-#include <string>
-
-#include "cms/IConnection.hpp"
-#include "ppr/TraceException.hpp"
-#include "ppr/util/ifr/p"
-
-#include "IUnitTest.hpp"
-
-using namespace apache::cms;
-using namespace apache::ppr;
-using namespace ifr;
-using namespace std;
-
-class TestSynchQueue : public IUnitTest
-{
-private:
-    p<IConnection> connection ;
-    p<ISession>    session ;
-
-public:
-    TestSynchQueue(p<IConnection> connection) ;
-    virtual ~TestSynchQueue() ;
-
-    virtual void setUp() throw (exception) ;
-    virtual void execute() throw (exception) ;
-    virtual void tearDown() throw (exception) ;
-    virtual p<string> toString() ;
-} ;
-
-#endif /*TestSynchQueue_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef TestSynchQueue_hpp_
+#define TestSynchQueue_hpp_
+
+#include <exception>
+#include <string>
+
+#include "cms/IConnection.hpp"
+#include "ppr/TraceException.hpp"
+#include "ppr/util/ifr/p"
+
+#include "IUnitTest.hpp"
+
+using namespace apache::cms;
+using namespace apache::ppr;
+using namespace ifr;
+using namespace std;
+
+class TestSynchQueue : public IUnitTest
+{
+private:
+    p<IConnection> connection ;
+    p<ISession>    session ;
+
+public:
+    TestSynchQueue(p<IConnection> connection) ;
+    virtual ~TestSynchQueue() ;
+
+    virtual void setUp() throw (exception) ;
+    virtual void execute() throw (exception) ;
+    virtual void tearDown() throw (exception) ;
+    virtual p<string> toString() ;
+} ;
+
+#endif /*TestSynchQueue_hpp_*/

Propchange: incubator/activemq/trunk/openwire-cpp/src/test/cpp/TestSynchQueue.hpp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message