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/11/11 16:59:17 UTC
svn commit: r834930 -
/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/ExpirationTest.cpp
Author: tabish
Date: Wed Nov 11 15:59:16 2009
New Revision: 834930
URL: http://svn.apache.org/viewvc?rev=834930&view=rev
Log:
Fix the test case, it was using a retroactive topic without persistence which means with the 5.3 broker the messages were discarded, it should have been using a Queue in the first place.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/ExpirationTest.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/ExpirationTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/ExpirationTest.cpp?rev=834930&r1=834929&r2=834930&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/ExpirationTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/ExpirationTest.cpp Wed Nov 11 15:59:16 2009
@@ -47,10 +47,11 @@
public:
- Producer( const std::string& brokerURL, const std::string& topic,
+ Producer( const std::string& brokerURL, const std::string& destination,
int numMessages, long long timeToLive ) {
this->cmsProvider.reset( new CMSProvider( brokerURL ) );
- this->cmsProvider->setDestinationName( topic );
+ this->cmsProvider->setDestinationName( destination );
+ this->cmsProvider->setTopic( false );
this->numMessages = numMessages;
this->timeToLive = timeToLive;
this->disableTimeStamps = false;
@@ -74,7 +75,10 @@
cms::MessageProducer* producer = cmsProvider->getProducer();
producer->setDeliveryMode( DeliveryMode::NON_PERSISTENT );
producer->setDisableMessageTimeStamp( disableTimeStamps );
- producer->setTimeToLive( 1 );
+
+ if( !this->disableTimeStamps ) {
+ producer->setTimeToLive( timeToLive );
+ }
// Create the Thread Id String
string threadIdStr = Integer::toString( Thread::getId() );
@@ -103,9 +107,10 @@
public:
- Consumer( const std::string& brokerURL, const std::string& topic, long waitMillis ) {
+ Consumer( const std::string& brokerURL, const std::string& destination, long waitMillis ) {
this->cmsProvider.reset( new CMSProvider( brokerURL ) );
- this->cmsProvider->setDestinationName( topic + "?consumer.retroactive=true" );
+ this->cmsProvider->setTopic( false );
+ this->cmsProvider->setDestinationName( destination );
this->waitMillis = waitMillis;
this->numReceived = 0;
}
@@ -149,13 +154,13 @@
////////////////////////////////////////////////////////////////////////////////
void ExpirationTest::testExpired() {
- string topic = UUID::randomUUID().toString();
- Producer producer( this->getBrokerURL(), topic, 1, 1 );
+ string destination = UUID::randomUUID().toString();
+ Producer producer( this->getBrokerURL(), destination, 1, 1 );
Thread producerThread( &producer );
producerThread.start();
producerThread.join();
- Consumer consumer( this->getBrokerURL(), topic, 2000 );
+ Consumer consumer( this->getBrokerURL(), destination, 2000 );
Thread consumerThread( &consumer );
consumerThread.start();
consumerThread.join();
@@ -166,14 +171,14 @@
////////////////////////////////////////////////////////////////////////////////
void ExpirationTest::testNotExpired() {
- string topic = UUID::randomUUID().toString();
- Producer producer( this->getBrokerURL(), topic, 2, 2000 );
+ string destination = UUID::randomUUID().toString();
+ Producer producer( this->getBrokerURL(), destination, 2, 2000 );
producer.setDisableTimeStamps( true );
Thread producerThread( &producer );
producerThread.start();
producerThread.join();
- Consumer consumer( this->getBrokerURL(), topic, 3000 );
+ Consumer consumer( this->getBrokerURL(), destination, 3000 );
Thread consumerThread( &consumer );
consumerThread.start();
consumerThread.join();