summaryrefslogtreecommitdiff
path: root/cpp/src/tests/MessagingSessionTests.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2009-11-17 10:52:33 +0000
committerGordon Sim <gsim@apache.org>2009-11-17 10:52:33 +0000
commitdfeb9089cd7702cb70e170fcf5f5d01cbbde080c (patch)
treea8965e1124fda146dedca255f912ed6e0a69a643 /cpp/src/tests/MessagingSessionTests.cpp
parent2b9be90fca9e4e47cc6b47d16dd97d6bfaf0931e (diff)
downloadqpid-python-dfeb9089cd7702cb70e170fcf5f5d01cbbde080c.tar.gz
QPID-664: Added getReceiver()/getSender() methods to session in new api.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@881236 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/MessagingSessionTests.cpp')
-rw-r--r--cpp/src/tests/MessagingSessionTests.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/cpp/src/tests/MessagingSessionTests.cpp b/cpp/src/tests/MessagingSessionTests.cpp
index ec0e174fc8..16455bc974 100644
--- a/cpp/src/tests/MessagingSessionTests.cpp
+++ b/cpp/src/tests/MessagingSessionTests.cpp
@@ -694,6 +694,35 @@ QPID_AUTO_TEST_CASE(testAssertPolicyQueue)
fix.admin.deleteQueue("q");
}
+QPID_AUTO_TEST_CASE(testGetSender)
+{
+ QueueFixture fix;
+ std::string name = fix.session.createSender(fix.queue).getName();
+ Sender sender = fix.session.getSender(name);
+ BOOST_CHECK_EQUAL(name, sender.getName());
+ Message out(Uuid(true).str());
+ sender.send(out);
+ Message in;
+ BOOST_CHECK(fix.session.createReceiver(fix.queue).fetch(in));
+ BOOST_CHECK_EQUAL(out.getContent(), in.getContent());
+ BOOST_CHECK_THROW(fix.session.getSender("UnknownSender"), qpid::messaging::KeyError);
+}
+
+
+QPID_AUTO_TEST_CASE(testGetReceiver)
+{
+ QueueFixture fix;
+ std::string name = fix.session.createReceiver(fix.queue).getName();
+ Receiver receiver = fix.session.getReceiver(name);
+ BOOST_CHECK_EQUAL(name, receiver.getName());
+ Message out(Uuid(true).str());
+ fix.session.createSender(fix.queue).send(out);
+ Message in;
+ BOOST_CHECK(receiver.fetch(in));
+ BOOST_CHECK_EQUAL(out.getContent(), in.getContent());
+ BOOST_CHECK_THROW(fix.session.getReceiver("UnknownReceiver"), qpid::messaging::KeyError);
+}
+
QPID_AUTO_TEST_SUITE_END()
}} // namespace qpid::tests