[prev in list] [next in list] [prev in thread] [next in thread]
List: activemq-commits
Subject: svn commit: r523835 - in
From: tabish () apache ! org
Date: 2007-03-29 20:46:13
Message-ID: 20070329204614.6469B1A9838 () eris ! apache ! org
[Download RAW message or body]
Author: tabish
Date: Thu Mar 29 13:46:10 2007
New Revision: 523835
URL: http://svn.apache.org/viewvc?view=rev&rev=523835
Log:
http://issues.apache.org/activemq/browse/AMQCPP-95
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/TestRegistry.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/connector/openwire/OpenwireSlowListenerTest.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/TestRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/TestRegistry.cpp?view=diff&rev=523835&r1=523834&r2=523835
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/TestRegistry.cpp \
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/TestRegistry.cpp \
Thu Mar 29 13:46:10 2007 @@ -21,7 +21,7 @@
CPPUNIT_TEST_SUITE_REGISTRATION( \
integration::connector::openwire::OpenwireSimpleTest ); \
CPPUNIT_TEST_SUITE_REGISTRATION( \
integration::connector::openwire::OpenwireSlowListenerTest ); \
CPPUNIT_TEST_SUITE_REGISTRATION( \
integration::connector::openwire::OpenwireTempDestinationTest );
-//CPPUNIT_TEST_SUITE_REGISTRATION( \
integration::connector::openwire::OpenwireTransactionTest ); \
+CPPUNIT_TEST_SUITE_REGISTRATION( \
integration::connector::openwire::OpenwireTransactionTest );
CPPUNIT_TEST_SUITE_REGISTRATION( integration::connector::stomp::AsyncSenderTest );
CPPUNIT_TEST_SUITE_REGISTRATION( integration::connector::stomp::DurableTest );
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/connector/openwire/OpenwireSlowListenerTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-in \
tegration/integration/connector/openwire/OpenwireSlowListenerTest.cpp?view=diff&rev=523835&r1=523834&r2=523835
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/connector/openwire/OpenwireSlowListenerTest.cpp \
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/integration/connector/openwire/OpenwireSlowListenerTest.cpp \
Thu Mar 29 13:46:10 2007 @@ -80,7 +80,7 @@
{
}
-void OpenwireSlowListenerTest::SlowListener::onMessage(const cms::Message* message) \
{ +void OpenwireSlowListenerTest::SlowListener::onMessage(const cms::Message* \
message) {
synchronized( &threadIds ) {
count++;
@@ -103,33 +103,34 @@
cms::Session* session = connection->createSession( \
cms::Session::AUTO_ACKNOWLEDGE );
cms::Destination* destination = \
session->createTopic(Guid::createGUIDString());
cms::MessageProducer* producer = session->createProducer( destination );
-
+
const unsigned int numConsumers = 5;
cms::MessageConsumer* consumers[numConsumers];
-
+
// Create several consumers for the same destination.
for (unsigned int i = 0; i < numConsumers; i++)
{
consumers[i] = session->createConsumer( destination );
consumers[i]->setMessageListener(&listener);
}
-
+
connection->start();
-
+
cms::BytesMessage* message = session->createBytesMessage();
-
+
unsigned int msgCount = 50;
for (unsigned int i = 0; i < msgCount; i++){
producer->send(message);
}
+ delete message;
// Wait no more than 10 seconds for all the messages to come in.
waitForMessages( msgCount * numConsumers, 10000, listener );
-
+
connection->close();
-
+
synchronized( &listener.threadIds ) {
-
+
// Make sure that the listenerwas always accessed by the same thread
// and that it received all the messages from all consumers.
CPPUNIT_ASSERT_EQUAL( 1, (int)listener.threadIds.size() );
@@ -139,7 +140,7 @@
{
delete consumers[i];
}
-
+
delete destination;
delete producer;
delete session;
@@ -151,24 +152,24 @@
}
}
-void OpenwireSlowListenerTest::waitForMessages( unsigned int count,
- long long maxWaitTime,
- OpenwireSlowListenerTest::SlowListener& l )
+void OpenwireSlowListenerTest::waitForMessages( unsigned int count,
+ long long maxWaitTime,
+ OpenwireSlowListenerTest::SlowListener& l )
{
long long startTime = Date::getCurrentTimeMilliseconds();
-
+
synchronized( &l.threadIds ) {
-
+
while( l.count < count ) {
-
+
long long curTime = Date::getCurrentTimeMilliseconds();
if( (curTime - startTime) >= maxWaitTime ) {
return;
}
-
+
l.threadIds.wait( 500 );
}
-
+
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic