diff options
| author | Gordon Sim <gsim@apache.org> | 2013-07-13 09:15:49 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2013-07-13 09:15:49 +0000 |
| commit | 6213eb2304bb3d9209f29d2573514b9c11f3ab91 (patch) | |
| tree | d77d38a64bccaac2cb7e12796f2e30c8696599e5 /cpp/src/tests/MessagingSessionTests.cpp | |
| parent | bd0b54fbd4d007e3da6f9fc9284ce3fedd27d98b (diff) | |
| download | qpid-python-6213eb2304bb3d9209f29d2573514b9c11f3ab91.tar.gz | |
QPID-3247: add policy for self-struct subscription queue
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1502766 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/MessagingSessionTests.cpp')
| -rw-r--r-- | cpp/src/tests/MessagingSessionTests.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cpp/src/tests/MessagingSessionTests.cpp b/cpp/src/tests/MessagingSessionTests.cpp index b388f2c13a..9791cf9f38 100644 --- a/cpp/src/tests/MessagingSessionTests.cpp +++ b/cpp/src/tests/MessagingSessionTests.cpp @@ -1289,6 +1289,32 @@ QPID_AUTO_TEST_CASE(testSimpleRequestResponse) BOOST_CHECK_EQUAL(m.getSubject(), original.getSubject()); } +QPID_AUTO_TEST_CASE(testSelfDestructQueue) +{ + MessagingFixture fix; + //create receiver on temp queue for responses (using shorthand for temp queue) + Session other = fix.connection.createSession(); + Receiver r1 = other.createReceiver("amq.fanout; {link:{reliability:at-least-once, x-declare:{arguments:{qpid.max_count:10,qpid.policy_type:self-destruct}}}}"); + Receiver r2 = fix.session.createReceiver("amq.fanout"); + //send request + Sender s = fix.session.createSender("amq.fanout"); + for (uint i = 0; i < 20; ++i) { + s.send(Message((boost::format("MSG_%1%") % (i+1)).str())); + } + try { + ScopedSuppressLogging sl; + for (uint i = 0; i < 20; ++i) { + r1.fetch(Duration::SECOND); + } + BOOST_FAIL("Expected exception."); + } catch (const qpid::messaging::MessagingException&) { + } + + for (uint i = 0; i < 20; ++i) { + BOOST_CHECK_EQUAL(r2.fetch(Duration::SECOND).getContent(), (boost::format("MSG_%1%") % (i+1)).str()); + } +} + QPID_AUTO_TEST_SUITE_END() }} // namespace qpid::tests |
