You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/03/14 00:52:21 UTC
svn commit: r753475 - in /activemq/activemq-cpp/trunk/src: main/
main/activemq/core/ main/activemq/transport/
main/activemq/transport/correlator/ main/activemq/transport/failover/
main/activemq/transport/logging/ main/activemq/transport/mock/ main/acti...
Author: tabish
Date: Fri Mar 13 23:52:20 2009
New Revision: 753475
URL: http://svn.apache.org/viewvc?rev=753475&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-100
Add a couple more test cases. Remove the CommandIOException class and just use the IOException in its place. Clean up a couple things in the FailoverTransport
Removed:
activemq/activemq-cpp/trunk/src/main/activemq/transport/CommandIOException.h
Modified:
activemq/activemq-cpp/trunk/src/main/Makefile.am
activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp
activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp
activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h
activemq/activemq-cpp/trunk/src/main/activemq/transport/Transport.h
activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportFilter.h
activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.cpp
activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.h
activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp
activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h
activemq/activemq-cpp/trunk/src/main/activemq/transport/logging/LoggingTransport.cpp
activemq/activemq-cpp/trunk/src/main/activemq/transport/logging/LoggingTransport.h
activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/InternalCommandListener.cpp
activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.cpp
activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h
activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp
activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h
activemq/activemq-cpp/trunk/src/test/activemq/transport/IOTransportTest.cpp
activemq/activemq-cpp/trunk/src/test/activemq/transport/correlator/ResponseCorrelatorTest.cpp
activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.cpp
activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.h
Modified: activemq/activemq-cpp/trunk/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/Makefile.am?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/main/Makefile.am Fri Mar 13 23:52:20 2009
@@ -202,7 +202,6 @@
activemq/state/TransactionState.h \
activemq/state/Tracked.h \
activemq/transport/AbstractTransportFactory.h \
- activemq/transport/CommandIOException.h \
activemq/transport/DefaultTransportListener.h \
activemq/transport/IOTransport.h \
activemq/transport/Transport.h \
Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp Fri Mar 13 23:52:20 2009
@@ -56,6 +56,7 @@
using namespace activemq::commands;
using namespace activemq::exceptions;
using namespace decaf;
+using namespace decaf::io;
using namespace decaf::util;
using namespace decaf::lang;
using namespace decaf::lang::exceptions;
@@ -545,7 +546,7 @@
enforceConnected();
this->getTransport().oneway( command );
}
- AMQ_CATCH_EXCEPTION_CONVERT( transport::CommandIOException, ActiveMQException )
+ AMQ_CATCH_EXCEPTION_CONVERT( IOException, ActiveMQException )
AMQ_CATCH_EXCEPTION_CONVERT( UnsupportedOperationException, ActiveMQException )
AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
AMQ_CATCHALL_THROW( ActiveMQException )
@@ -582,7 +583,7 @@
}
}
AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( transport::CommandIOException, ActiveMQException )
+ AMQ_CATCH_EXCEPTION_CONVERT( IOException, ActiveMQException )
AMQ_CATCH_EXCEPTION_CONVERT( UnsupportedOperationException, ActiveMQException )
AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
AMQ_CATCHALL_THROW( ActiveMQException )
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.cpp Fri Mar 13 23:52:20 2009
@@ -29,6 +29,8 @@
using namespace activemq::exceptions;
using namespace activemq::commands;
using namespace activemq::wireformat;
+using namespace decaf;
+using namespace decaf::io;
using namespace decaf::lang;
using namespace decaf::util::concurrent;
@@ -95,32 +97,32 @@
////////////////////////////////////////////////////////////////////////////////
void IOTransport::oneway( const Pointer<Command>& command )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException ) {
+ throw( IOException, decaf::lang::exceptions::UnsupportedOperationException ) {
try{
if( closed ){
- throw CommandIOException( __FILE__, __LINE__,
+ throw IOException( __FILE__, __LINE__,
"IOTransport::oneway() - transport is closed!" );
}
// Make sure the thread has been started.
if( thread == NULL ){
- throw CommandIOException(
+ throw IOException(
__FILE__, __LINE__,
"IOTransport::oneway() - transport is not started" );
}
// Make sure the command object is valid.
if( command == NULL ){
- throw CommandIOException(
+ throw IOException(
__FILE__, __LINE__,
"IOTransport::oneway() - attempting to write NULL command" );
}
// Make sure we have an output stream to write to.
if( outputStream == NULL ){
- throw CommandIOException(
+ throw IOException(
__FILE__, __LINE__,
"IOTransport::oneway() - invalid output stream" );
}
@@ -131,9 +133,9 @@
this->outputStream->flush();
}
}
- AMQ_CATCH_RETHROW( CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
@@ -250,7 +252,7 @@
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> IOTransport::request( const Pointer<Command>& command AMQCPP_UNUSED )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException ){
+ throw( IOException, decaf::lang::exceptions::UnsupportedOperationException ){
throw decaf::lang::exceptions::UnsupportedOperationException(
__FILE__, __LINE__,
@@ -259,7 +261,7 @@
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> IOTransport::request( const Pointer<Command>& command AMQCPP_UNUSED, unsigned int timeout AMQCPP_UNUSED )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException ){
+ throw( IOException, decaf::lang::exceptions::UnsupportedOperationException ){
throw decaf::lang::exceptions::UnsupportedOperationException(
__FILE__, __LINE__,
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/IOTransport.h Fri Mar 13 23:52:20 2009
@@ -124,13 +124,13 @@
* Sends a one-way command. Does not wait for any response from the
* broker.
* @param command the command to be sent.
- * @throws CommandIOException if an exception occurs during writing of
+ * @throws IOException if an exception occurs during writing of
* the command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual void oneway( const Pointer<Command>& command )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException );
+ throw( decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException );
/**
* Not supported by this class - throws an exception.
@@ -139,7 +139,7 @@
* @throws UnsupportedOperationException.
*/
virtual Pointer<Response> request( const Pointer<Command>& command )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException );
+ throw( decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException );
/**
* Not supported by this class - throws an exception.
@@ -149,7 +149,7 @@
* @throws UnsupportedOperationException.
*/
virtual Pointer<Response> request( const Pointer<Command>& command, unsigned int timeout )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException );
+ throw( decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException );
/**
* Sets the WireFormat instance to use.
@@ -264,7 +264,7 @@
* @param uri
* @throws IOException on failure of if not supported
*/
- virtual void reconnect( const decaf::net::URI& uri )
+ virtual void reconnect( const decaf::net::URI& uri AMQCPP_UNUSED )
throw( decaf::io::IOException ) {}
};
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/Transport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/Transport.h?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/Transport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/Transport.h Fri Mar 13 23:52:20 2009
@@ -20,11 +20,11 @@
#include <decaf/io/InputStream.h>
#include <decaf/io/OutputStream.h>
+#include <decaf/io/IOException.h>
#include <decaf/net/URI.h>
#include <decaf/lang/Pointer.h>
#include <decaf/lang/exceptions/UnsupportedOperationException.h>
#include <activemq/util/Config.h>
-#include <activemq/transport/CommandIOException.h>
#include <activemq/commands/Command.h>
#include <activemq/commands/Response.h>
#include <cms/Startable.h>
@@ -64,41 +64,41 @@
* Sends a one-way command. Does not wait for any response from the
* broker.
* @param command the command to be sent.
- * @throws CommandIOException if an exception occurs during writing of
+ * @throws IOException if an exception occurs during writing of
* the command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual void oneway( const Pointer<Command>& command )
- throw( CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException ) = 0;
/**
* Sends the given command to the broker and then waits for the response.
* @param command the command to be sent.
* @return the response from the broker.
- * @throws CommandIOException if an exception occurs during the read of the
+ * @throws IOException if an exception occurs during the read of the
* command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual Pointer<Response> request( const Pointer<Command>& command )
- throw( CommandIOException,
- decaf::lang::exceptions::UnsupportedOperationException ) = 0;
+ throw( decaf::io::IOException,
+ decaf::lang::exceptions::UnsupportedOperationException ) = 0;
/**
* Sends the given command to the broker and then waits for the response.
* @param command - The command to be sent.
* @param timeout - The time to wait for this response.
* @return the response from the broker.
- * @throws CommandIOException if an exception occurs during the read of the
+ * @throws IOException if an exception occurs during the read of the
* command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual Pointer<Response> request( const Pointer<Command>&, unsigned int timeout )
- throw( CommandIOException,
- decaf::lang::exceptions::UnsupportedOperationException ) = 0;
+ throw( decaf::io::IOException,
+ decaf::lang::exceptions::UnsupportedOperationException ) = 0;
/**
* Sets the WireFormat instance to use.
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportFilter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportFilter.h?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportFilter.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportFilter.h Fri Mar 13 23:52:20 2009
@@ -119,13 +119,13 @@
* Sends a one-way command. Does not wait for any response from the
* broker.
* @param command the command to be sent.
- * @throws CommandIOException if an exception occurs during writing of
+ * @throws IOException if an exception occurs during writing of
* the command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual void oneway( const Pointer<Command>& command )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException ){
+ throw( decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException ){
next->oneway( command );
}
@@ -133,11 +133,11 @@
/**
* Not supported by this class - throws an exception.
* @param command the command that is sent as a request
- * @throws CommandIOException
+ * @throws IOException
* @throws UnsupportedOperationException.
*/
virtual Pointer<Response> request( const Pointer<Command>& command )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException ){
+ throw( decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException ){
return next->request( command );
}
@@ -146,11 +146,11 @@
* Not supported by this class - throws an exception.
* @param command - The command that is sent as a request
* @param timeout - The the time to wait for a response.
- * @throws CommandIOException
+ * @throws IOException
* @throws UnsupportedOperationException.
*/
virtual Pointer<Response> request( const Pointer<Command>& command, unsigned int timeout )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException ){
+ throw( decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException ){
return next->request( command, timeout );
}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.cpp Fri Mar 13 23:52:20 2009
@@ -24,6 +24,7 @@
using namespace activemq::transport::correlator;
using namespace activemq::exceptions;
using namespace decaf;
+using namespace decaf::io;
using namespace decaf::lang;
using namespace decaf::lang::exceptions;
@@ -43,29 +44,29 @@
////////////////////////////////////////////////////////////////////////////////
void ResponseCorrelator::oneway( const Pointer<Command>& command )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException ) {
+ throw( IOException, decaf::lang::exceptions::UnsupportedOperationException ) {
try{
command->setCommandId( nextCommandId.getAndIncrement() );
command->setResponseRequired( false );
if( closed || next == NULL ){
- throw CommandIOException( __FILE__, __LINE__,
+ throw IOException( __FILE__, __LINE__,
"transport already closed" );
}
next->oneway( command );
}
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_RETHROW( CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> ResponseCorrelator::request( const Pointer<Command>& command )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException ) {
+ throw( IOException, decaf::lang::exceptions::UnsupportedOperationException ) {
try{
@@ -100,7 +101,7 @@
if( response == NULL ){
- throw CommandIOException( __FILE__, __LINE__,
+ throw IOException( __FILE__, __LINE__,
"No valid response received for command: %s, check broker.",
command->toString().c_str() );
}
@@ -108,15 +109,15 @@
return response;
}
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_RETHROW( CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> ResponseCorrelator::request( const Pointer<Command>& command, unsigned int timeout )
- throw( CommandIOException, decaf::lang::exceptions::UnsupportedOperationException ) {
+ throw( IOException, decaf::lang::exceptions::UnsupportedOperationException ) {
try{
command->setCommandId( nextCommandId.getAndIncrement() );
@@ -150,7 +151,7 @@
if( response == NULL ){
- throw CommandIOException( __FILE__, __LINE__,
+ throw IOException( __FILE__, __LINE__,
"No valid response received for command: %s, check broker.",
command->toString().c_str() );
}
@@ -158,10 +159,10 @@
return response;
}
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_RETHROW( CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.h?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.h Fri Mar 13 23:52:20 2009
@@ -80,23 +80,23 @@
* Sends a one-way command. Does not wait for any response from the
* broker.
* @param command the command to be sent.
- * @throws CommandIOException if an exception occurs during writing of
+ * @throws IOException if an exception occurs during writing of
* the command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual void oneway( const Pointer<Command>& command )
- throw( CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException );
/**
* Sends the given request to the server and waits for the response.
* @param command The request to send.
* @return the response from the server.
- * @throws CommandIOException if an error occurs with the request.
+ * @throws IOException if an error occurs with the request.
*/
virtual Pointer<Response> request( const Pointer<Command>& command )
- throw( CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException );
/**
@@ -104,10 +104,10 @@
* @param command The request to send.
* @param timeout The time to wait for a response.
* @return the response from the server.
- * @throws CommandIOException if an error occurs with the request.
+ * @throws IOException if an error occurs with the request.
*/
virtual Pointer<Response> request( const Pointer<Command>& command, unsigned int timeout )
- throw( CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException );
/**
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp Fri Mar 13 23:52:20 2009
@@ -203,7 +203,7 @@
////////////////////////////////////////////////////////////////////////////////
void FailoverTransport::oneway( const Pointer<Command>& command )
- throw( CommandIOException,
+ throw( IOException,
decaf::lang::exceptions::UnsupportedOperationException ) {
Pointer<Exception> error;
@@ -321,7 +321,7 @@
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> FailoverTransport::request( const Pointer<Command>& command AMQCPP_UNUSED )
- throw( CommandIOException,
+ throw( IOException,
decaf::lang::exceptions::UnsupportedOperationException ) {
throw decaf::lang::exceptions::UnsupportedOperationException(
@@ -331,7 +331,7 @@
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> FailoverTransport::request( const Pointer<Command>& command AMQCPP_UNUSED,
unsigned int timeout AMQCPP_UNUSED )
- throw( CommandIOException,
+ throw( IOException,
decaf::lang::exceptions::UnsupportedOperationException ) {
throw decaf::lang::exceptions::UnsupportedOperationException(
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h Fri Mar 13 23:52:20 2009
@@ -159,47 +159,47 @@
* Sends a one-way command. Does not wait for any response from the
* broker.
* @param command the command to be sent.
- * @throws CommandIOException if an exception occurs during writing of
+ * @throws IOException if an exception occurs during writing of
* the command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual void oneway( const Pointer<Command>& command )
- throw( CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException );
/**
* Sends the given command to the broker and then waits for the response.
* @param command the command to be sent.
* @return the response from the broker.
- * @throws CommandIOException if an exception occurs during the read of the
+ * @throws IOException if an exception occurs during the read of the
* command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual Pointer<Response> request( const Pointer<Command>& command )
- throw( CommandIOException,
- decaf::lang::exceptions::UnsupportedOperationException );
+ throw( decaf::io::IOException,
+ decaf::lang::exceptions::UnsupportedOperationException );
/**
* Sends the given command to the broker and then waits for the response.
* @param command - The command to be sent.
* @param timeout - The time to wait for this response.
* @return the response from the broker.
- * @throws CommandIOException if an exception occurs during the read of the
+ * @throws IOException if an exception occurs during the read of the
* command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual Pointer<Response> request( const Pointer<Command>& command, unsigned int timeout )
- throw( CommandIOException,
- decaf::lang::exceptions::UnsupportedOperationException );
+ throw( decaf::io::IOException,
+ decaf::lang::exceptions::UnsupportedOperationException );
/**
* Sets the WireFormat instance to use.
* @param WireFormat the object used to encode / decode commands.
*/
- virtual void setWireFormat( const Pointer<wireformat::WireFormat>& wireFormat ) {
+ virtual void setWireFormat( const Pointer<wireformat::WireFormat>& wireFormat AMQCPP_UNUSED ) {
}
/**
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/logging/LoggingTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/logging/LoggingTransport.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/logging/LoggingTransport.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/logging/LoggingTransport.cpp Fri Mar 13 23:52:20 2009
@@ -22,6 +22,7 @@
using namespace activemq::exceptions;
using namespace activemq::transport;
using namespace activemq::transport::logging;
+using namespace decaf::io;
using namespace decaf::lang;
using namespace decaf::lang::exceptions;
@@ -49,7 +50,7 @@
////////////////////////////////////////////////////////////////////////////////
void LoggingTransport::oneway( const Pointer<Command>& command )
- throw(CommandIOException, decaf::lang::exceptions::UnsupportedOperationException) {
+ throw(IOException, decaf::lang::exceptions::UnsupportedOperationException) {
try {
@@ -63,15 +64,15 @@
// Delegate to the base class.
TransportFilter::oneway( command );
}
- AMQ_CATCH_RETHROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> LoggingTransport::request( const Pointer<Command>& command )
- throw(CommandIOException, decaf::lang::exceptions::UnsupportedOperationException) {
+ throw(IOException, decaf::lang::exceptions::UnsupportedOperationException) {
try {
@@ -88,15 +89,15 @@
return response;
}
- AMQ_CATCH_RETHROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> LoggingTransport::request( const Pointer<Command>& command, unsigned int timeout )
- throw(CommandIOException, decaf::lang::exceptions::UnsupportedOperationException) {
+ throw(IOException, decaf::lang::exceptions::UnsupportedOperationException) {
try {
@@ -113,8 +114,8 @@
return response;
}
- AMQ_CATCH_RETHROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/logging/LoggingTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/logging/LoggingTransport.h?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/logging/LoggingTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/logging/LoggingTransport.h Fri Mar 13 23:52:20 2009
@@ -57,13 +57,13 @@
* Sends a one-way command. Does not wait for any response from the
* broker.
* @param command the command to be sent.
- * @throws CommandIOException if an exception occurs during writing of
+ * @throws IOException if an exception occurs during writing of
* the command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual void oneway( const Pointer<Command>& command )
- throw( CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException );
/**
@@ -72,7 +72,7 @@
* @throws UnsupportedOperationException.
*/
virtual Pointer<Response> request( const Pointer<Command>& command )
- throw( CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException );
/**
@@ -82,7 +82,7 @@
* @throws UnsupportedOperationException.
*/
virtual Pointer<Response> request( const Pointer<Command>& command, unsigned int timeout )
- throw( CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException );
};
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/InternalCommandListener.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/InternalCommandListener.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/InternalCommandListener.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/InternalCommandListener.cpp Fri Mar 13 23:52:20 2009
@@ -24,6 +24,7 @@
using namespace activemq::transport::mock;
using namespace activemq::exceptions;
using namespace activemq::wireformat;
+using namespace decaf::io;
using namespace decaf::lang;
using namespace decaf::lang::exceptions;
@@ -87,7 +88,7 @@
if( transport->getNumReceivedMessages() > transport->getNumReceivedMessageBeforeFail() ) {
transport->fireException(
- CommandIOException( __FILE__, __LINE__, "Failed to Send Message.") );;
+ IOException( __FILE__, __LINE__, "Failed to Send Message.") );;
}
}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.cpp Fri Mar 13 23:52:20 2009
@@ -23,6 +23,7 @@
using namespace activemq::transport::mock;
using namespace activemq::exceptions;
using namespace activemq::wireformat;
+using namespace decaf::io;
using namespace decaf::lang;
using namespace decaf::lang::exceptions;
@@ -55,7 +56,7 @@
////////////////////////////////////////////////////////////////////////////////
void MockTransport::oneway( const Pointer<Command>& command )
- throw( CommandIOException,
+ throw( IOException,
decaf::lang::exceptions::UnsupportedOperationException) {
try{
@@ -64,7 +65,7 @@
this->numSentMessages++;
if( this->numSentMessages > this->numSentMessageBeforeFail ) {
- throw CommandIOException(
+ throw IOException(
__FILE__, __LINE__, "Failed to Send Message.");
}
}
@@ -78,16 +79,16 @@
return;
}
}
- AMQ_CATCH_RETHROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> MockTransport::request( const Pointer<Command>& command )
- throw( CommandIOException,
+ throw( IOException,
decaf::lang::exceptions::UnsupportedOperationException)
{
try{
@@ -98,7 +99,7 @@
this->numSentMessages++;
if( this->numSentMessages > this->numSentMessageBeforeFail ) {
- throw CommandIOException(
+ throw IOException(
__FILE__, __LINE__, "Failed to Send Message.");
}
}
@@ -113,29 +114,29 @@
return responseBuilder->buildResponse( command );
}
- throw CommandIOException(
+ throw IOException(
__FILE__, __LINE__,
"MockTransport::request - no response builder available" );
}
- AMQ_CATCH_RETHROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> MockTransport::request( const Pointer<Command>& command,
unsigned int timeout AMQCPP_UNUSED )
- throw( CommandIOException,
+ throw( IOException,
decaf::lang::exceptions::UnsupportedOperationException)
{
try{
return this->request( command );
}
- AMQ_CATCH_RETHROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h Fri Mar 13 23:52:20 2009
@@ -23,7 +23,6 @@
#include <activemq/transport/Transport.h>
#include <activemq/transport/TransportListener.h>
#include <activemq/transport/DefaultTransportListener.h>
-#include <activemq/transport/CommandIOException.h>
#include <activemq/transport/mock/ResponseBuilder.h>
#include <activemq/transport/mock/InternalCommandListener.h>
#include <activemq/wireformat/WireFormat.h>
@@ -100,15 +99,15 @@
}
virtual void oneway( const Pointer<Command>& command )
- throw(CommandIOException, decaf::lang::exceptions::UnsupportedOperationException);
+ throw( decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException);
virtual Pointer<Response> request( const Pointer<Command>& command )
- throw( CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException);
virtual Pointer<Response> request( const Pointer<Command>&, unsigned int timeout )
- throw( CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException);
/**
Modified: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp Fri Mar 13 23:52:20 2009
@@ -30,6 +30,7 @@
using namespace activemq::transport;
using namespace activemq::commands;
using namespace decaf::util::concurrent;
+using namespace decaf::io;
using namespace decaf::lang::exceptions;
////////////////////////////////////////////////////////////////////////////////
@@ -53,18 +54,18 @@
////////////////////////////////////////////////////////////////////////////////
void OpenWireFormatNegotiator::oneway( const Pointer<Command>& command )
- throw( CommandIOException, UnsupportedOperationException ) {
+ throw( IOException, UnsupportedOperationException ) {
try{
if( closed || next == NULL ){
- throw CommandIOException(
+ throw IOException(
__FILE__, __LINE__,
"OpenWireFormatNegotiator::oneway - transport already closed" );
}
if( !readyCountDownLatch.await( negotiationTimeout ) ) {
- throw CommandIOException(
+ throw IOException(
__FILE__,
__LINE__,
"OpenWireFormatNegotiator::oneway"
@@ -75,25 +76,25 @@
next->oneway( command );
}
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_RETHROW( CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> OpenWireFormatNegotiator::request( const Pointer<Command>& command )
- throw( CommandIOException, UnsupportedOperationException ) {
+ throw( IOException, UnsupportedOperationException ) {
try{
if( closed || next == NULL ){
- throw CommandIOException(
+ throw IOException(
__FILE__, __LINE__,
"OpenWireFormatNegotiator::request - transport already closed" );
}
if( !readyCountDownLatch.await( negotiationTimeout ) ) {
- throw CommandIOException(
+ throw IOException(
__FILE__,
__LINE__,
"OpenWireFormatNegotiator::request"
@@ -104,26 +105,26 @@
return next->request( command );
}
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_RETHROW( CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
Pointer<Response> OpenWireFormatNegotiator::request(
const Pointer<Command>& command, unsigned int timeout )
- throw( CommandIOException, UnsupportedOperationException ) {
+ throw( IOException, UnsupportedOperationException ) {
try{
if( closed || next == NULL ){
- throw CommandIOException(
+ throw IOException(
__FILE__, __LINE__,
"OpenWireFormatNegotiator::request - transport already closed" );
}
if( !readyCountDownLatch.await( negotiationTimeout ) ) {
- throw CommandIOException(
+ throw IOException(
__FILE__,
__LINE__,
"OpenWireFormatNegotiator::request"
@@ -134,9 +135,9 @@
return next->request( command, timeout );
}
AMQ_CATCH_RETHROW( UnsupportedOperationException )
- AMQ_CATCH_RETHROW( CommandIOException )
- AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, CommandIOException )
- AMQ_CATCHALL_THROW( CommandIOException )
+ AMQ_CATCH_RETHROW( IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, IOException )
+ AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
@@ -149,7 +150,7 @@
try {
if( !info->isValid() ) {
- throw CommandIOException(
+ throw IOException(
__FILE__,
__LINE__,
"OpenWireFormatNegotiator::onCommand"
Modified: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h Fri Mar 13 23:52:20 2009
@@ -82,13 +82,13 @@
* 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
+ * @throws IOException if an exception occurs during writing of
* the command.
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
virtual void oneway( const Pointer<commands::Command>& command )
- throw( transport::CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException );
/**
@@ -97,10 +97,10 @@
* 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.
+ * @throws IOException if an error occurs with the request.
*/
virtual Pointer<commands::Response> request( const Pointer<commands::Command>& command )
- throw( transport::CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException );
/**
@@ -110,11 +110,11 @@
* @param command The request to send.
* @param timeout The time to wait for the response.
* @return the response from the server.
- * @throws CommandIOException if an error occurs with the request.
+ * @throws IOException if an error occurs with the request.
*/
virtual Pointer<commands::Response> request(
const Pointer<commands::Command>& command, unsigned int timeout )
- throw( transport::CommandIOException,
+ throw( decaf::io::IOException,
decaf::lang::exceptions::UnsupportedOperationException );
/**
Modified: activemq/activemq-cpp/trunk/src/test/activemq/transport/IOTransportTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/transport/IOTransportTest.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/transport/IOTransportTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/transport/IOTransportTest.cpp Fri Mar 13 23:52:20 2009
@@ -36,6 +36,7 @@
using namespace activemq;
using namespace activemq::transport;
using namespace activemq::exceptions;
+using namespace decaf::io;
using namespace decaf::lang::exceptions;
////////////////////////////////////////////////////////////////////////////////
@@ -82,11 +83,11 @@
}
virtual Pointer<commands::Command> unmarshal( decaf::io::DataInputStream* inputStream )
- throw ( CommandIOException ){
+ throw ( IOException ){
try{
if( throwException ){
- throw CommandIOException();
+ throw IOException();
}
if( inputStream == NULL ) {
@@ -109,9 +110,9 @@
} catch( decaf::lang::Exception& ex ){
ex.setMark( __FILE__, __LINE__ );
- throw CommandIOException();
+ throw IOException();
} catch( ... ) {
- throw CommandIOException( __FILE__, __LINE__, "Catch all" );
+ throw IOException( __FILE__, __LINE__, "Catch all" );
}
return command;
@@ -121,12 +122,12 @@
return Pointer<Command>();
}catch( decaf::lang::Exception& ex ){
- CommandIOException cx;
+ IOException cx;
cx.setMark( __FILE__, __LINE__ );
throw cx;
}
catch( ... ){
- CommandIOException cx;
+ IOException cx;
cx.setMark( __FILE__, __LINE__ );
throw cx;
}
@@ -134,7 +135,7 @@
virtual void marshal( const Pointer<commands::Command>& command,
decaf::io::DataOutputStream* outputStream )
- throw (CommandIOException)
+ throw (IOException)
{
try{
@@ -147,10 +148,10 @@
}catch( decaf::lang::Exception& ex ){
ex.setMark( __FILE__, __LINE__ );
- throw CommandIOException( ex );
+ throw IOException( ex );
}
catch(...){
- throw CommandIOException( __FILE__, __LINE__, "writeCommand");
+ throw IOException( __FILE__, __LINE__, "writeCommand");
}
}
};
Modified: activemq/activemq-cpp/trunk/src/test/activemq/transport/correlator/ResponseCorrelatorTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/transport/correlator/ResponseCorrelatorTest.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/transport/correlator/ResponseCorrelatorTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/transport/correlator/ResponseCorrelatorTest.cpp Fri Mar 13 23:52:20 2009
@@ -29,6 +29,7 @@
using namespace activemq;
using namespace activemq::transport;
using namespace activemq::transport::correlator;
+using namespace decaf::io;
////////////////////////////////////////////////////////////////////////////////
namespace activemq{
@@ -81,7 +82,7 @@
}
virtual void oneway( const Pointer<Command>& command )
- throw(CommandIOException, decaf::lang::exceptions::UnsupportedOperationException)
+ throw(IOException, decaf::lang::exceptions::UnsupportedOperationException)
{
synchronized( &mutex ){
requests.push( command );
@@ -90,7 +91,7 @@
}
virtual Pointer<Response> request( const Pointer<Command>& command AMQCPP_UNUSED )
- throw(CommandIOException, decaf::lang::exceptions::UnsupportedOperationException)
+ throw(IOException, decaf::lang::exceptions::UnsupportedOperationException)
{
throw decaf::lang::exceptions::UnsupportedOperationException(
__FILE__, __LINE__, "stuff" );
@@ -98,7 +99,7 @@
virtual Pointer<Response> request( const Pointer<Command>& command AMQCPP_UNUSED,
unsigned int timeout AMQCPP_UNUSED )
- throw(CommandIOException, decaf::lang::exceptions::UnsupportedOperationException)
+ throw(IOException, decaf::lang::exceptions::UnsupportedOperationException)
{
throw decaf::lang::exceptions::UnsupportedOperationException(
__FILE__, __LINE__, "stuff" );
@@ -405,7 +406,7 @@
try{
correlator.request( cmd, 500 );
CPPUNIT_ASSERT(false);
- }catch( CommandIOException& ex ){
+ }catch( IOException& ex ){
// Expected.
}
Modified: activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.cpp?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.cpp Fri Mar 13 23:52:20 2009
@@ -31,6 +31,7 @@
using namespace activemq::transport::failover;
using namespace activemq::transport::mock;
using namespace activemq::exceptions;
+using namespace decaf::io;
using namespace decaf::lang;
using namespace decaf::util;
@@ -106,7 +107,7 @@
void FailoverTransportTest::testTransportCreateFailOnCreate() {
std::string uri =
- "failover://(mock://localhost:61616?failOnCreate=true)?maxReconnectAttempts=2";
+ "failover://(mock://localhost:61616?failOnCreate=true)?useExponentialBackOff=false&maxReconnectAttempts=3&initialReconnectDelay=100";
FailToConnectListener listener;
FailoverTransportFactory factory;
@@ -119,7 +120,7 @@
transport->narrow( typeid( FailoverTransport ) ) );
CPPUNIT_ASSERT( failover != NULL );
- CPPUNIT_ASSERT( failover->getMaxReconnectAttempts() == 2 );
+ CPPUNIT_ASSERT( failover->getMaxReconnectAttempts() == 3 );
transport->start();
@@ -131,6 +132,39 @@
}
////////////////////////////////////////////////////////////////////////////////
+void FailoverTransportTest::testTransportCreateFailOnCreateSendMessage() {
+
+ std::string uri =
+ "failover://(mock://localhost:61616?failOnCreate=true)?useExponentialBackOff=false&maxReconnectAttempts=3&initialReconnectDelay=100";
+
+ Pointer<ActiveMQMessage> message( new ActiveMQMessage() );
+
+ FailToConnectListener listener;
+ FailoverTransportFactory factory;
+
+ Pointer<Transport> transport( factory.create( uri ) );
+ CPPUNIT_ASSERT( transport != NULL );
+ transport->setTransportListener( &listener );
+
+ FailoverTransport* failover = dynamic_cast<FailoverTransport*>(
+ transport->narrow( typeid( FailoverTransport ) ) );
+
+ CPPUNIT_ASSERT( failover != NULL );
+ CPPUNIT_ASSERT( failover->getMaxReconnectAttempts() == 3 );
+
+ transport->start();
+
+ CPPUNIT_ASSERT_THROW_MESSAGE(
+ "Should Throw a IOException",
+ transport->oneway( message ),
+ IOException );
+
+ CPPUNIT_ASSERT( listener.caughtException == true );
+
+ transport->close();
+}
+
+////////////////////////////////////////////////////////////////////////////////
void FailoverTransportTest::testFailingBackupCreation() {
std::string uri =
@@ -211,6 +245,46 @@
}
////////////////////////////////////////////////////////////////////////////////
+void FailoverTransportTest::testSendRequestMessage() {
+
+ std::string uri = "failover://(mock://localhost:61616)?randomize=false";
+
+ Pointer<ActiveMQMessage> message( new ActiveMQMessage() );
+
+ MessageCountingListener messageCounter;
+ DefaultTransportListener listener;
+ FailoverTransportFactory factory;
+
+ Pointer<Transport> transport( factory.create( uri ) );
+ CPPUNIT_ASSERT( transport != NULL );
+ transport->setTransportListener( &listener );
+
+ FailoverTransport* failover = dynamic_cast<FailoverTransport*>(
+ transport->narrow( typeid( FailoverTransport ) ) );
+
+ CPPUNIT_ASSERT( failover != NULL );
+ CPPUNIT_ASSERT( failover->isRandomize() == false );
+
+ transport->start();
+
+ MockTransport* mock = NULL;
+ while( mock == NULL ) {
+ mock = dynamic_cast<MockTransport*>( transport->narrow( typeid( MockTransport ) ) );
+ }
+ mock->setOutgoingListener( &messageCounter );
+
+ transport->request( message );
+ transport->request( message );
+ transport->request( message );
+ transport->request( message );
+ Thread::sleep( 1000 );
+
+ CPPUNIT_ASSERT( messageCounter.numMessages = 4 );
+
+ transport->close();
+}
+
+////////////////////////////////////////////////////////////////////////////////
void FailoverTransportTest::testSendOnewayMessageFail() {
std::string uri =
@@ -251,3 +325,45 @@
transport->close();
}
+
+////////////////////////////////////////////////////////////////////////////////
+void FailoverTransportTest::testSendRequestMessageFail() {
+
+ std::string uri =
+ "failover://(mock://localhost:61616?failOnSendMessage=true,"
+ "mock://localhost:61618)?randomize=false";
+
+ Pointer<ActiveMQMessage> message( new ActiveMQMessage() );
+
+ MessageCountingListener messageCounter;
+ DefaultTransportListener listener;
+ FailoverTransportFactory factory;
+
+ Pointer<Transport> transport( factory.create( uri ) );
+ CPPUNIT_ASSERT( transport != NULL );
+ transport->setTransportListener( &listener );
+
+ FailoverTransport* failover = dynamic_cast<FailoverTransport*>(
+ transport->narrow( typeid( FailoverTransport ) ) );
+
+ CPPUNIT_ASSERT( failover != NULL );
+ CPPUNIT_ASSERT( failover->isRandomize() == false );
+
+ transport->start();
+
+ MockTransport* mock = NULL;
+ while( mock == NULL ) {
+ mock = dynamic_cast<MockTransport*>( transport->narrow( typeid( MockTransport ) ) );
+ }
+ mock->setOutgoingListener( &messageCounter );
+
+ transport->request( message );
+ transport->request( message );
+ transport->request( message );
+ transport->request( message );
+ Thread::sleep( 1000 );
+
+ CPPUNIT_ASSERT( messageCounter.numMessages = 4 );
+
+ transport->close();
+}
Modified: activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.h?rev=753475&r1=753474&r2=753475&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/transport/failover/FailoverTransportTest.h Fri Mar 13 23:52:20 2009
@@ -32,9 +32,12 @@
CPPUNIT_TEST( testTransportCreate );
CPPUNIT_TEST( testTransportCreateWithBackups );
CPPUNIT_TEST( testTransportCreateFailOnCreate );
+ CPPUNIT_TEST( testTransportCreateFailOnCreateSendMessage );
CPPUNIT_TEST( testFailingBackupCreation );
CPPUNIT_TEST( testSendOnewayMessage );
+ CPPUNIT_TEST( testSendRequestMessage );
CPPUNIT_TEST( testSendOnewayMessageFail );
+ CPPUNIT_TEST( testSendRequestMessageFail );
CPPUNIT_TEST_SUITE_END();
public:
@@ -54,16 +57,23 @@
// reached at which point it calls its listeners onException method.
void testTransportCreateFailOnCreate();
+ // Same as above but attempt to send a Message which should result in an Exception
+ // being thrown from the oneway method when the max connection attempts have been
+ // made.
+ void testTransportCreateFailOnCreateSendMessage();
+
// Tests that a Transport with a Connected Primary Transport but failing backup
// transports won't segfault and can be started, and stopped without error.
void testFailingBackupCreation();
- // Test that messages sent via the Oneway method are received.
+ // Test that messages sent via the Oneway or Request methods are received.
void testSendOnewayMessage();
+ void testSendRequestMessage();
- // Test that messages sent via the Oneway method are received after the first
- // transport faults on the send and transport 2 is created.
+ // Test that messages sent via the Oneway or Request methods are received after
+ // the first transport faults on the send and transport 2 is created.
void testSendOnewayMessageFail();
+ void testSendRequestMessageFail();
};