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 | bb0bd254b0df35a1890ffb3f59e159945ccdf0bb (patch) | |
tree | ce0cd6a64409473e3c3c156bc825d02f5cbc1fb7 /cpp/src/tests/ClientSessionTest.cpp | |
parent | e76832c5d237446129ad90232ea8ef5c61fe18db (diff) | |
download | qpid-python-bb0bd254b0df35a1890ffb3f59e159945ccdf0bb.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/qpid@732297 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/ClientSessionTest.cpp')
-rw-r--r-- | cpp/src/tests/ClientSessionTest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cpp/src/tests/ClientSessionTest.cpp b/cpp/src/tests/ClientSessionTest.cpp index 5d047dcd0e..454632dd39 100644 --- a/cpp/src/tests/ClientSessionTest.cpp +++ b/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() |