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 | ce70d9dec7f82513d3d421f97c0a446987fd8107 (patch) | |
| tree | 79046ee5de7b0fd1558cd3c8c5337436bcea9d9b /qpid/cpp/src/tests/MessagingSessionTests.cpp | |
| parent | 03349fee0dc9473750f465b92e37729299133902 (diff) | |
| download | qpid-python-ce70d9dec7f82513d3d421f97c0a446987fd8107.tar.gz | |
QPID-3247: add policy for self-struct subscription queue
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1502766 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/MessagingSessionTests.cpp')
| -rw-r--r-- | qpid/cpp/src/tests/MessagingSessionTests.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/MessagingSessionTests.cpp b/qpid/cpp/src/tests/MessagingSessionTests.cpp index b388f2c13a..9791cf9f38 100644 --- a/qpid/cpp/src/tests/MessagingSessionTests.cpp +++ b/qpid/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 |
