diff options
| author | Gordon Sim <gsim@apache.org> | 2009-01-07 10:46:53 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2009-01-07 10:46:53 +0000 |
| commit | 5f49d66d97bc32669d4ad2a493f0afc5a57c7c27 (patch) | |
| tree | c6ea1907f9de517382aeb7ff5805fc68c26acd14 /qpid/cpp/src/tests | |
| parent | 0dbd3dee502a5e11ef25a6a8ff05a74ed4059c3d (diff) | |
| download | qpid-python-5f49d66d97bc32669d4ad2a493f0afc5a57c7c27.tar.gz | |
QPID-1560: add support for a qpid.exclusive-binding option on direct exchange that causes the binding specified to be the only one for the given key. I.e. if there is already a binding at this exchange with this key it will be atomically updated to bind the new queue.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@732297 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests')
| -rw-r--r-- | qpid/cpp/src/tests/ClientSessionTest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/ClientSessionTest.cpp b/qpid/cpp/src/tests/ClientSessionTest.cpp index 5d047dcd0e..454632dd39 100644 --- a/qpid/cpp/src/tests/ClientSessionTest.cpp +++ b/qpid/cpp/src/tests/ClientSessionTest.cpp @@ -447,6 +447,28 @@ QPID_AUTO_TEST_CASE(testExclusiveSubscribe) } +QPID_AUTO_TEST_CASE(testExclusiveBinding) { + FieldTable options; + options.setString("qpid.exclusive-binding", "anything"); + ClientSessionFixture fix; + fix.session.queueDeclare(arg::queue="queue-1", arg::exclusive=true, arg::autoDelete=true); + fix.session.queueDeclare(arg::queue="queue-2", arg::exclusive=true, arg::autoDelete=true); + fix.session.exchangeBind(arg::exchange="amq.direct", arg::queue="queue-1", arg::bindingKey="my-key", arg::arguments=options); + fix.session.messageTransfer(arg::destination="amq.direct", arg::content=Message("message1", "my-key")); + fix.session.exchangeBind(arg::exchange="amq.direct", arg::queue="queue-2", arg::bindingKey="my-key", arg::arguments=options); + fix.session.messageTransfer(arg::destination="amq.direct", arg::content=Message("message2", "my-key")); + + Message got; + BOOST_CHECK(fix.subs.get(got, "queue-1")); + BOOST_CHECK_EQUAL("message1", got.getData()); + BOOST_CHECK(!fix.subs.get(got, "queue-1")); + + BOOST_CHECK(fix.subs.get(got, "queue-2")); + BOOST_CHECK_EQUAL("message2", got.getData()); + BOOST_CHECK(!fix.subs.get(got, "queue-2")); +} + + QPID_AUTO_TEST_SUITE_END() |
