Author: tabish Date: Tue Dec 5 12:36:43 2006 New Revision: 482767 URL: http://svn.apache.org/viewvc?view=rev&rev=482767 Log: Clean up output and add a debug flag to integration common so that the
output can be turned on or off. Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.h incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/expiration/ExpirationTest.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/simple/SimpleTester.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/transactional/TransactionTester.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp?view=diff&rev=482767&r1=482766&r2=482767 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/AbstractTester.cpp Tue Dec 5 12:36:43 2006 @@ -217,7 +217,9 @@ { std::string text = txtMsg->getText(); + if( IntegrationCommon::debug ) { printf("received text msg: %s\n", txtMsg->getText().c_str() ); + } numReceived++; @@ -240,12 +242,9 @@ string transcode( (const char*)bytes, bytesMsg->getBodyLength() ); - //printf("received bytes msg: " ); - //int numBytes = bytesMsg.getBodyLength(); - //for( int ix=0; ix<numBytes; ++ix ){ - // printf("[%d]", bytes[ix] ); - //} - //printf("\n"); + if( IntegrationCommon::debug ) { + printf("received bytes msg: %s\n", transcode.c_str() ); + } numReceived++; Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.cpp?view=diff&rev=482767&r1=482766&r2=482767 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.cpp Tue Dec 5 12:36:43 2006 @@ -23,3 +23,4 @@ const std::string IntegrationCommon::defaultURL = "tcp://127.0.0.1:61613"; const int IntegrationCommon::defaultDelay = 5; const unsigned int IntegrationCommon::defaultMsgCount = 1000; +bool IntegrationCommon::debug = false; Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.h?view=diff&rev=482767&r1=482766&r2=482767 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/common/IntegrationCommon.h Tue Dec 5 12:36:43 2006 @@ -33,6 +33,8 @@ static const int defaultDelay; static const unsigned int defaultMsgCount; + static bool debug; + }; }} Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp?view=diff&rev=482767&r1=482766&r2=482767 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/durable/DurableTester.cpp Tue Dec 5 12:36:43 2006 @@ -83,12 +83,14 @@ { try { - cout << "Starting activemqcms durable test (sending " - << IntegrationCommon::defaultMsgCount - << " messages per type and sleeping " - << IntegrationCommon::defaultDelay - << " milli-seconds) ...\n" - << endl; + if( IntegrationCommon::debug ) { + cout << "Starting activemqcms durable test (sending " + << IntegrationCommon::defaultMsgCount + << " messages per type and sleeping " + << IntegrationCommon::defaultDelay + << " milli-seconds) ...\n" + << endl; + } std::string subName = Guid().createGUID(); @@ -108,7 +110,10 @@ // Wait for all messages waitForMessages( sent ); - printf("received: %d\n", numReceived ); + if( IntegrationCommon::debug ) { + printf("received: %d\n", numReceived ); + } + CPPUNIT_ASSERT( numReceived == sent ); // Nuke the consumer @@ -126,10 +131,14 @@ // Wait for all remaining messages waitForMessages( sent ); - printf("received: %d\n", numReceived ); + if( IntegrationCommon::debug ) { + printf("received: %d\n", numReceived ); + } CPPUNIT_ASSERT( numReceived == sent ); - printf("Shutting Down\n" ); + if( IntegrationCommon::debug ) { + printf("Shutting Down\n" ); + } delete producer; delete consumer; } Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/expiration/ExpirationTest.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/expiration/ExpirationTest.cpp?view=diff&rev=482767&r1=482766&r2=482767 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/expiration/ExpirationTest.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/expiration/ExpirationTest.cpp Tue Dec 5 12:36:43 2006 @@ -242,7 +242,7 @@ // Create the destination (Topic or Queue) destination = session->createTopic( "mytopic?consumer.retroactive=true"); - consumer = session->createDurableConsumer( destination , user ,"",false); + consumer = session->createConsumer( destination ); consumer->setMessageListener( this ); Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/simple/SimpleTester.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/simple/SimpleTester.cpp?view=diff&rev=482767&r1=482766&r2=482767 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/simple/SimpleTester.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/simple/SimpleTester.cpp Tue Dec 5 12:36:43 2006 @@ -86,12 +86,14 @@ { try { - cout << "Starting activemqcms test (sending " - << IntegrationCommon::defaultMsgCount - << " messages per type and sleeping " - << IntegrationCommon::defaultDelay - << " milli-seconds) ...\n" - << endl; + if( IntegrationCommon::debug ) { + cout << "Starting activemqcms test (sending " + << IntegrationCommon::defaultMsgCount + << " messages per type and sleeping " + << IntegrationCommon::defaultDelay + << " milli-seconds) ...\n" + << endl; + } // Create CMS Object for Comms cms::Topic* topic = session->createTopic("mytopic"); @@ -112,11 +114,15 @@ // Wait for the messages to get here waitForMessages( IntegrationCommon::defaultMsgCount * 2 ); - printf("received: %d\n", numReceived ); + if( IntegrationCommon::debug ) { + printf("received: %d\n", numReceived ); + } CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount * 2 ); - printf("Shutting Down\n" ); + if( IntegrationCommon::debug ) { + printf("Shutting Down\n" ); + } delete producer; delete consumer; } Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/transactional/TransactionTester.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/transactional/TransactionTester.cpp?view=diff&rev=482767&r1=482766&r2=482767 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/transactional/TransactionTester.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/transactional/TransactionTester.cpp Tue Dec 5 12:36:43 2006 @@ -83,12 +83,14 @@ { try { - cout << "Starting activemqcms transactional test (sending " - << IntegrationCommon::defaultMsgCount - << " messages per type and sleeping " - << IntegrationCommon::defaultDelay - << " milli-seconds) ...\n" - << endl; + if( IntegrationCommon::debug ) { + cout << "Starting activemqcms transactional test (sending " + << IntegrationCommon::defaultMsgCount + << " messages per type and sleeping " + << IntegrationCommon::defaultDelay + << " milli-seconds) ...\n" + << endl; + } // Create CMS Object for Comms cms::Topic* topic = session->createTopic("mytopic"); @@ -113,7 +115,9 @@ // Wait till we get all the messages waitForMessages( IntegrationCommon::defaultMsgCount * 2 ); - printf("received: %d\n", numReceived ); + if( IntegrationCommon::debug ) { + printf("received: %d\n", numReceived ); + } CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount * 2 ); @@ -128,11 +132,15 @@ // Wait till we get all the messages waitForMessages( IntegrationCommon::defaultMsgCount ); - printf("received: %d\n", numReceived ); + if( IntegrationCommon::debug ) { + printf("received: %d\n", numReceived ); + } CPPUNIT_ASSERT( numReceived == IntegrationCommon::defaultMsgCount ); - printf("Shutting Down\n" ); + if( IntegrationCommon::debug ) { + printf("Shutting Down\n" ); + } delete producer; delete consumer; } Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp?view=diff&rev=482767&r1=482766&r2=482767 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/various/SimpleRollbackTest.cpp Tue Dec 5 12:36:43 2006 @@ -185,7 +185,9 @@ producer->send( textMsg ); delete textMsg; - printf( "Shutting Down\n" ); + if( IntegrationCommon::debug ) { + printf( "Shutting Down\n" ); + } delete producer; delete consumer; @@ -210,9 +212,9 @@ if( txtMsg != NULL ) { - std::string text = txtMsg->getText(); - - // printf("received text msg: %s\n", txtMsg.getText() ); + if( IntegrationCommon::debug ) { + printf("received text msg: %s\n", txtMsg->getText().c_str() ); + } numReceived++; @@ -234,13 +236,10 @@ const unsigned char* bytes = bytesMsg->getBodyBytes(); string transcode( (const char*)bytes, bytesMsg->getBodyLength() ); - - //printf("received bytes msg: " ); - //int numBytes = bytesMsg.getBodyLength(); - //for( int ix=0; ix<numBytes; ++ix ){ - // printf("[%d]", bytes[ix] ); - //} - //printf("\n"); + + if( IntegrationCommon::debug ) { + printf("Received Bytes Message: %s", transcode.c_str() ); + } numReceived++;