Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683 ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.h (original) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/TextMessageCommandTest.h Fri May 25 08:09:43 2007 @@ -35,98 +35,98 @@ { CPPUNIT_TEST_SUITE( TextMessageCommandTest ); CPPUNIT_TEST( test ); - CPPUNIT_TEST_SUITE_END(); + CPPUNIT_TEST_SUITE_END(); protected: class TestAckHandler : public core::ActiveMQAckHandler { public: - + TestAckHandler(void) { wasAcked = false; } virtual ~TestAckHandler(void) {} - + virtual void acknowledgeMessage( const core::ActiveMQMessage* message AMQCPP_UNUSED) - throw ( cms::CMSException ) + throw ( cms::CMSException ) { wasAcked = true; } - + public: - + bool wasAcked; }; public: - TextMessageCommandTest() {} - virtual ~TextMessageCommandTest() {} + TextMessageCommandTest() {} + virtual ~TextMessageCommandTest() {} void test(void) { TestAckHandler ackHandler; TextMessageCommand cmd; - CPPUNIT_ASSERT( cmd.getStompCommandId() == + CPPUNIT_ASSERT( cmd.getStompCommandId() == CommandConstants::SEND ); - + CPPUNIT_ASSERT( cmd.isResponseRequired() == false ); cmd.setResponseRequired( true ); cmd.setCommandId( 123 ); CPPUNIT_ASSERT( cmd.isResponseRequired() == false ); CPPUNIT_ASSERT( cmd.getCommandId() == 0 ); cmd.setCorrelationId( 99 ); - CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 ); + CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 ); CPPUNIT_ASSERT( cmd.getTransactionId() == "" ); cmd.setTransactionId( "ID:123456" ); - CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == + CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == "ID:123456" ); StompTopic topic("testTopic"); cmd.setCMSDestination( &topic ); - + StompFrame* frame = cmd.marshal().clone(); - + CPPUNIT_ASSERT( frame != NULL ); - + TextMessageCommand cmd1( frame ); - + CPPUNIT_ASSERT( cmd.getCommandId() == cmd1.getCommandId() ); CPPUNIT_ASSERT( cmd.getStompCommandId() == cmd1.getStompCommandId() ); CPPUNIT_ASSERT( cmd.isResponseRequired() == cmd1.isResponseRequired() ); CPPUNIT_ASSERT( cmd.getCorrelationId() == cmd1.getCorrelationId() ); CPPUNIT_ASSERT( std::string(cmd.getTransactionId()) == cmd1.getTransactionId() ); - + cmd.setAckHandler( &ackHandler ); cmd.acknowledge(); CPPUNIT_ASSERT( ackHandler.wasAcked == true ); - - CPPUNIT_ASSERT( + + CPPUNIT_ASSERT( cmd.getProperties().hasProperty( "test" ) == false ); cmd.getProperties().setProperty( "test", "value" ); - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( cmd.getProperties().hasProperty( "test" ) == true ); - CPPUNIT_ASSERT( + CPPUNIT_ASSERT( std::string( cmd.getProperties().getProperty( "test" ) ) == "value" ); - + CPPUNIT_ASSERT( cmd.getCMSCorrelationID() == "" ); cmd.setCMSCorrelationID( "ID:1234567" ); - CPPUNIT_ASSERT( std::string( cmd.getCMSCorrelationID() ) == + CPPUNIT_ASSERT( std::string( cmd.getCMSCorrelationID() ) == "ID:1234567" ); - CPPUNIT_ASSERT( cmd.getCMSDeliveryMode() == + CPPUNIT_ASSERT( cmd.getCMSDeliveryMode() == cms::DeliveryMode::PERSISTENT ); cmd.setCMSDeliveryMode( cms::DeliveryMode::NON_PERSISTENT ); - CPPUNIT_ASSERT( cmd.getCMSDeliveryMode() == + CPPUNIT_ASSERT( cmd.getCMSDeliveryMode() == cms::DeliveryMode::NON_PERSISTENT ); - CPPUNIT_ASSERT( cmd.getCMSDestination()->toProviderString() == + CPPUNIT_ASSERT( cmd.getCMSDestination()->toProviderString() == "/topic/testTopic" ); CPPUNIT_ASSERT( cmd.getCMSExpiration() == 0 ); cmd.setCMSExpiration( 123 ); CPPUNIT_ASSERT( cmd.getCMSExpiration() == 123 ); CPPUNIT_ASSERT( cmd.getCMSMessageID() == "" ); cmd.setCMSMessageID( "ID:1234567" ); - CPPUNIT_ASSERT( std::string( cmd.getCMSMessageID() ) == + CPPUNIT_ASSERT( std::string( cmd.getCMSMessageID() ) == "ID:1234567" ); CPPUNIT_ASSERT( cmd.getCMSPriority() == 0 ); cmd.setCMSPriority( 5 ); @@ -136,14 +136,14 @@ CPPUNIT_ASSERT( cmd.getCMSRedelivered() == true ); CPPUNIT_ASSERT( cmd.getCMSReplyTo() == NULL ); cmd.setCMSReplyTo( &topic ); - CPPUNIT_ASSERT( cmd.getCMSReplyTo()->toProviderString() == + CPPUNIT_ASSERT( cmd.getCMSReplyTo()->toProviderString() == "/topic/testTopic" ); CPPUNIT_ASSERT( cmd.getCMSTimestamp() == 0 ); cmd.setCMSTimestamp( 123 ); CPPUNIT_ASSERT( cmd.getCMSTimestamp() == 123 ); CPPUNIT_ASSERT( cmd.getCMSType() == "" ); cmd.setCMSType( "text" ); - CPPUNIT_ASSERT( std::string( cmd.getCMSType() ) == + CPPUNIT_ASSERT( std::string( cmd.getCMSType() ) == "text" ); CPPUNIT_ASSERT( cmd.getRedeliveryCount() == 0 ); cmd.setRedeliveryCount( 123 ); @@ -154,7 +154,7 @@ CPPUNIT_ASSERT( std::string( cmd.getText() ) == "TESTMESSAGE" ); cms::Message* cmd2 = cmd.clone(); - + CPPUNIT_ASSERT( cmd.getCMSPriority() == cmd2->getCMSPriority() ); CPPUNIT_ASSERT( cmd.getCMSTimestamp() == cmd2->getCMSTimestamp() ); CPPUNIT_ASSERT( cmd.getCMSExpiration() == cmd2->getCMSExpiration() ); @@ -164,14 +164,14 @@ CPPUNIT_ASSERT( std::string(cmd.getCMSType()) == cmd2->getCMSType() ); CPPUNIT_ASSERT( std::string(cmd.getCMSMessageID()) == cmd2->getCMSMessageID() ); - core::ActiveMQMessage* message = + core::ActiveMQMessage* message = dynamic_cast< core::ActiveMQMessage* >( cmd2 ); - + CPPUNIT_ASSERT( message != NULL ); - CPPUNIT_ASSERT( cmd.getRedeliveryCount() == + CPPUNIT_ASSERT( cmd.getRedeliveryCount() == message->getRedeliveryCount() ); - - StompCommand* cmd4 = + + StompCommand* cmd4 = dynamic_cast< StompCommand* >( cmd2 ); CPPUNIT_ASSERT( cmd4 != NULL ); @@ -179,15 +179,15 @@ CPPUNIT_ASSERT( cmd.getStompCommandId() == cmd4->getStompCommandId() ); CPPUNIT_ASSERT( cmd.isResponseRequired() == cmd4->isResponseRequired() ); CPPUNIT_ASSERT( cmd.getCorrelationId() == cmd4->getCorrelationId() ); - CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == + CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == cmd4->getTransactionId() ); - TextMessageCommand* cmd5 = + TextMessageCommand* cmd5 = dynamic_cast< TextMessageCommand* >(message); CPPUNIT_ASSERT( cmd5 != NULL ); CPPUNIT_ASSERT( std::string( cmd.getText() ) == cmd5->getText() ); - + delete cmd2; }
Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.h?view=diff&rev=541683&r1=541682&r2=541683 ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.h (original) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/stomp/commands/UnsubscribeCommandTest.h Fri May 25 08:09:43 2007 @@ -33,47 +33,47 @@ CPPUNIT_TEST_SUITE( UnsubscribeCommandTest ); CPPUNIT_TEST( test ); CPPUNIT_TEST_SUITE_END(); - + public: - UnsubscribeCommandTest() {} - virtual ~UnsubscribeCommandTest() {} + UnsubscribeCommandTest() {} + virtual ~UnsubscribeCommandTest() {} void test(void) { UnsubscribeCommand cmd; - CPPUNIT_ASSERT( cmd.getStompCommandId() == + CPPUNIT_ASSERT( cmd.getStompCommandId() == CommandConstants::UNSUBSCRIBE ); - + CPPUNIT_ASSERT( cmd.isResponseRequired() == false ); cmd.setResponseRequired( true ); cmd.setCommandId( 123 ); CPPUNIT_ASSERT( cmd.isResponseRequired() == false ); CPPUNIT_ASSERT( cmd.getCommandId() == 0 ); cmd.setCorrelationId( 99 ); - CPPUNIT_ASSERT( cmd.getCorrelationId() == 0 ); + CPPUNIT_ASSERT( cmd.getCorrelationId() == 99 ); CPPUNIT_ASSERT( cmd.getTransactionId() == "" ); cmd.setTransactionId( "ID:123456" ); - CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == + CPPUNIT_ASSERT( std::string( cmd.getTransactionId() ) == "ID:123456" ); CPPUNIT_ASSERT( cmd.getDestination() == "" ); cmd.setDestination( "456987" ); - CPPUNIT_ASSERT( std::string( cmd.getDestination() ) == + CPPUNIT_ASSERT( std::string( cmd.getDestination() ) == "456987" ); - + StompFrame* frame = cmd.marshal().clone(); - + CPPUNIT_ASSERT( frame != NULL ); - + UnsubscribeCommand cmd1( frame ); - + CPPUNIT_ASSERT( cmd.getCommandId() == cmd1.getCommandId() ); CPPUNIT_ASSERT( cmd.getStompCommandId() == cmd1.getStompCommandId() ); CPPUNIT_ASSERT( cmd.isResponseRequired() == cmd1.isResponseRequired() ); CPPUNIT_ASSERT( cmd.getCorrelationId() == cmd1.getCorrelationId() ); CPPUNIT_ASSERT( cmd.getTransactionId() == cmd1.getTransactionId() ); CPPUNIT_ASSERT( cmd.getDestination() == cmd1.getDestination() ); - + } }; Modified: activemq/activemq-cpp/trunk/src/test/activemq/transport/DummyTransport.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/transport/DummyTransport.h?view=diff&rev=541683&r1=541682&r2=541683 ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/transport/DummyTransport.h (original) +++ activemq/activemq-cpp/trunk/src/test/activemq/transport/DummyTransport.h Fri May 25 08:09:43 2007 @@ -41,6 +41,7 @@ virtual ~ResponseBuilder(){} virtual Response* buildResponse( const Command* cmd ) = 0; + virtual Command* buildIncomingCommand( const Command* cmd ) = 0; }; class InternalCommandListener : @@ -53,7 +54,7 @@ ResponseBuilder* responseBuilder; concurrent::Mutex mutex; Command* command; - Response* response; + Command* response; bool done; concurrent::CountDownLatch startedLatch; @@ -96,8 +97,8 @@ this->command = command; // Create a response now before the caller has a // chance to destroy the command. - this->response = - responseBuilder->buildResponse( command ); + this->response = + responseBuilder->buildIncomingCommand( command ); mutex.notifyAll(); } @@ -154,7 +155,7 @@ DummyTransport( ResponseBuilder* responseBuilder , bool own = false, - bool useDefOutgoing = false ); + bool useDefOutgoing = true ); virtual ~DummyTransport();
