summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/MessagingSessionTests.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2014-08-14 12:46:46 +0000
committerGordon Sim <gsim@apache.org>2014-08-14 12:46:46 +0000
commit3a7a19b755c5eade585956b61c75dfb29e7ac526 (patch)
tree19b0d6e1841c6a67b0c5e4676d9adfc482b34126 /qpid/cpp/src/tests/MessagingSessionTests.cpp
parent8c54245221f54558a8784d572f432521f7c89105 (diff)
downloadqpid-python-3a7a19b755c5eade585956b61c75dfb29e7ac526.tar.gz
QPID-5985: fixed regression introduced by previous commit (r1617256), ensuring that call does not block indefinitely
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1617924 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/MessagingSessionTests.cpp')
-rw-r--r--qpid/cpp/src/tests/MessagingSessionTests.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/MessagingSessionTests.cpp b/qpid/cpp/src/tests/MessagingSessionTests.cpp
index 0859bae619..d01dd69999 100644
--- a/qpid/cpp/src/tests/MessagingSessionTests.cpp
+++ b/qpid/cpp/src/tests/MessagingSessionTests.cpp
@@ -1465,6 +1465,7 @@ QPID_AUTO_TEST_CASE(testImmediateNextReceiver)
if (running > 5*qpid::sys::TIME_SEC) {
throw qpid::types::Exception("Timed out spinning on nextReceiver(IMMEDIATE)");
}
+ qpid::sys::usleep(1); // for valgrind
}
Message in;
BOOST_CHECK(next.fetch(in, qpid::messaging::Duration::IMMEDIATE));
@@ -1475,6 +1476,20 @@ QPID_AUTO_TEST_CASE(testImmediateNextReceiver)
}
}
+QPID_AUTO_TEST_CASE(testImmediateNextReceiverNoMessage)
+{
+ QueueFixture fix;
+ Receiver r = fix.session.createReceiver(fix.queue);
+ r.setCapacity(1);
+ Receiver next;
+ try {
+ BOOST_CHECK(!fix.session.nextReceiver(next, qpid::messaging::Duration::IMMEDIATE));
+ r.close();
+ } catch (const std::exception& e) {
+ BOOST_FAIL(e.what());
+ }
+}
+
QPID_AUTO_TEST_SUITE_END()
}} // namespace qpid::tests