summaryrefslogtreecommitdiff
path: root/cpp/src/tests/ClientSessionTest.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2010-01-20 15:54:59 +0000
committerGordon Sim <gsim@apache.org>2010-01-20 15:54:59 +0000
commitb994b686b50801cf34f1833478c7736359c54b87 (patch)
tree2f86b10ca31732b061ce15354eaa5003f026050e /cpp/src/tests/ClientSessionTest.cpp
parent2a029cd38ae548cc3a1399f6e68959085546ffd6 (diff)
downloadqpid-python-b994b686b50801cf34f1833478c7736359c54b87.tar.gz
Provide access to a sessions connection.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@901247 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/ClientSessionTest.cpp')
-rw-r--r--cpp/src/tests/ClientSessionTest.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/cpp/src/tests/ClientSessionTest.cpp b/cpp/src/tests/ClientSessionTest.cpp
index 6ca0aa6d44..8ce5d85632 100644
--- a/cpp/src/tests/ClientSessionTest.cpp
+++ b/cpp/src/tests/ClientSessionTest.cpp
@@ -607,6 +607,28 @@ QPID_AUTO_TEST_CASE(testExpirationNotAltered) {
BOOST_CHECK_EQUAL(12345u, got.getDeliveryProperties().getExpiration());
}
+QPID_AUTO_TEST_CASE(testGetConnectionFromSession) {
+ ClientSessionFixture fix;
+ FieldTable options;
+ options.setInt("no-local", 1);
+ fix.session.queueDeclare(arg::queue="a", arg::exclusive=true, arg::autoDelete=true, arg::arguments=options);
+ fix.session.queueDeclare(arg::queue="b", arg::exclusive=true, arg::autoDelete=true);
+
+ Connection c = fix.session.getConnection();
+ Session s = c.newSession();
+ //If this new session was created as expected on the same connection as
+ //fix.session, then the no-local behaviour means that queue 'a'
+ //will not enqueue messages from this new session but queue 'b'
+ //will.
+ s.messageTransfer(arg::content=Message("a", "a"));
+ s.messageTransfer(arg::content=Message("b", "b"));
+
+ Message got;
+ BOOST_CHECK(fix.subs.get(got, "b"));
+ BOOST_CHECK_EQUAL("b", got.getData());
+ BOOST_CHECK(!fix.subs.get(got, "a"));
+}
+
QPID_AUTO_TEST_SUITE_END()
}} // namespace qpid::tests