From 847ee577e23fbdd2175709a08a7160e8b2c1f464 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 27 Mar 2007 15:36:39 +0000 Subject: Refactored client::Message to be independent of all Basic class concepts and client::IncomingMessage to handle 0-9 style references and appends. * cpp/lib/client/ClientMessage.cpp: Made independent of Basic class. * cpp/lib/client/IncomingMessage.cpp: Refactored to handle references/appends. * cpp/lib/client/BasicMessageChannel.cpp: Refactored to use new IncomingMessage Thread safety fixes: * cpp/lib/client/ResponseHandler.h: Remove stateful functions. * cpp/lib/client/ClientChannel.cpp: use new ResponseHandler interface. Minor cleanup: * cpp/lib/common/framing/BasicHeaderProperties.cpp: use DeliveryMode enum. * cpp/tests/HeaderTest.cpp: use DeliveryMode enum. * cpp/tests/MessageTest.cpp: use DeliveryMode enum. * cpp/lib/common/shared_ptr.h: #include for convenience. * cpp/lib/common/sys/ThreadSafeQueue.h: Changed "stop" "shutdown" * cpp/lib/common/sys/ProducerConsumer.h: Changed "stop" "shutdown" * cpp/tests/ClientChannelTest.cpp (TestCase): Removed debug couts. * cpp/tests/setup: valgrind --demangle=yes by default. * cpp/tests/topictest: sleep to hack around startup race. * cpp/lib/broker/BrokerQueue.cpp (configure): Fixed memory leak. Removed/updated FIXME comments in: * cpp/lib/broker/BrokerMessage.cpp: * cpp/lib/broker/BrokerMessageBase.h: * cpp/lib/broker/InMemoryContent.cpp: * cpp/lib/common/framing/MethodContext.h: git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@522956 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/tests/ProducerConsumerTest.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'cpp/tests/ProducerConsumerTest.cpp') diff --git a/cpp/tests/ProducerConsumerTest.cpp b/cpp/tests/ProducerConsumerTest.cpp index 1f2aeffbc5..ee94a56c55 100644 --- a/cpp/tests/ProducerConsumerTest.cpp +++ b/cpp/tests/ProducerConsumerTest.cpp @@ -95,7 +95,7 @@ class ProducerConsumerTest : public CppUnit::TestCase CPPUNIT_TEST_SUITE(ProducerConsumerTest); CPPUNIT_TEST(testProduceConsume); CPPUNIT_TEST(testTimeout); - CPPUNIT_TEST(testStop); + CPPUNIT_TEST(testShutdown); CPPUNIT_TEST(testCancel); CPPUNIT_TEST_SUITE_END(); @@ -103,7 +103,7 @@ class ProducerConsumerTest : public CppUnit::TestCase client::InProcessBrokerClient client; ProducerConsumer pc; - WatchedCounter stopped; + WatchedCounter shutdown; WatchedCounter timeout; WatchedCounter consumed; WatchedCounter produced; @@ -124,8 +124,8 @@ class ProducerConsumerTest : public CppUnit::TestCase void consumeInternal(ProducerConsumer::ConsumerLock& consumer) { - if (pc.isStopped()) { - ++stopped; + if (pc.isShutdown()) { + ++shutdown; return; } if (consumer.isTimedOut()) { @@ -189,7 +189,7 @@ public: produce(); CPPUNIT_ASSERT(consumed.waitFor(5)); join(threads); - CPPUNIT_ASSERT_EQUAL(0, int(stopped)); + CPPUNIT_ASSERT_EQUAL(0, int(shutdown)); } void testTimeout() { @@ -219,30 +219,30 @@ public: } - void testStop() { + void testShutdown() { ConsumeRunnable runMe(*this); vector threads = startThreads(2, runMe); while (pc.consumers() != 2) Thread::yield(); - pc.stop(); - CPPUNIT_ASSERT(stopped.waitFor(2)); + pc.shutdown(); + CPPUNIT_ASSERT(shutdown.waitFor(2)); join(threads); - threads = startThreads(1, runMe); // Should stop immediately. - CPPUNIT_ASSERT(stopped.waitFor(3)); + threads = startThreads(1, runMe); // Should shutdown immediately. + CPPUNIT_ASSERT(shutdown.waitFor(3)); join(threads); - // Produce/consume while stopped should return isStopped and + // Produce/consume while shutdown should return isShutdown and // throw on confirm. try { ProducerConsumer::ProducerLock p(pc); - CPPUNIT_ASSERT(pc.isStopped()); + CPPUNIT_ASSERT(pc.isShutdown()); CPPUNIT_FAIL("Expected exception"); } catch (...) {} // Expected try { ProducerConsumer::ConsumerLock c(pc); - CPPUNIT_ASSERT(pc.isStopped()); + CPPUNIT_ASSERT(pc.isShutdown()); CPPUNIT_FAIL("Expected exception"); } catch (...) {} // Expected -- cgit v1.2.1