summaryrefslogtreecommitdiff
path: root/cpp/src/tests/QueueTest.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2014-05-13 13:03:08 +0000
committerGordon Sim <gsim@apache.org>2014-05-13 13:03:08 +0000
commit2eeedde27d38add61e4c60fff9e461df83058760 (patch)
tree9142f9164bd07a6bc343defbd8f53acb1fd6ba40 /cpp/src/tests/QueueTest.cpp
parenta41a0bc3f519500ce42802217f50fcfdce6c5e1a (diff)
downloadqpid-python-2eeedde27d38add61e4c60fff9e461df83058760.tar.gz
QPID-5758: Move purging of expired messages from timer thread to worker thread
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1594220 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/QueueTest.cpp')
-rw-r--r--cpp/src/tests/QueueTest.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpp/src/tests/QueueTest.cpp b/cpp/src/tests/QueueTest.cpp
index 0fd35a000b..c44483f8dd 100644
--- a/cpp/src/tests/QueueTest.cpp
+++ b/cpp/src/tests/QueueTest.cpp
@@ -40,6 +40,7 @@
#include "qpid/framing/reply_exceptions.h"
#include "qpid/broker/QueueFlowLimit.h"
#include "qpid/broker/QueueSettings.h"
+#include "qpid/sys/Thread.h"
#include "qpid/sys/Timer.h"
#include <iostream>
@@ -202,18 +203,22 @@ QPID_AUTO_TEST_CASE(testPurgeExpired) {
}
QPID_AUTO_TEST_CASE(testQueueCleaner) {
+ boost::shared_ptr<Poller> poller(new Poller);
+ Thread runner(poller.get());
Timer timer;
QueueRegistry queues;
Queue::shared_ptr queue = queues.declare("my-queue", QueueSettings()).first;
addMessagesToQueue(10, *queue, 200, 400);
BOOST_CHECK_EQUAL(queue->getMessageCount(), 10u);
- QueueCleaner cleaner(queues, &timer);
+ QueueCleaner cleaner(queues, poller, &timer);
cleaner.start(100 * qpid::sys::TIME_MSEC);
::usleep(300*1000);
BOOST_CHECK_EQUAL(queue->getMessageCount(), 5u);
::usleep(300*1000);
BOOST_CHECK_EQUAL(queue->getMessageCount(), 0u);
+ poller->shutdown();
+ runner.join();
}
namespace {
int getIntProperty(const Message& message, const std::string& key)