summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/ClientSessionTest.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-06-25 20:51:30 +0000
committerAlan Conway <aconway@apache.org>2008-06-25 20:51:30 +0000
commit23b153214d057627be9d00f8cc14280cd89eb95b (patch)
tree150a06aa11744b1187ed51bd3154c8e9b9eb19ac /qpid/cpp/src/tests/ClientSessionTest.cpp
parent4f72761ff1c309fca15956d1860b165530d3d353 (diff)
downloadqpid-python-23b153214d057627be9d00f8cc14280cd89eb95b.tar.gz
Additions to the client API:
- SubscriptionManager::get(queue) to get a single message from a queue. - Set FlowControl per-subscription. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@671655 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/ClientSessionTest.cpp')
-rw-r--r--qpid/cpp/src/tests/ClientSessionTest.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/qpid/cpp/src/tests/ClientSessionTest.cpp b/qpid/cpp/src/tests/ClientSessionTest.cpp
index 83c3317094..0475350d6a 100644
--- a/qpid/cpp/src/tests/ClientSessionTest.cpp
+++ b/qpid/cpp/src/tests/ClientSessionTest.cpp
@@ -203,7 +203,7 @@ QPID_AUTO_TEST_CASE(testSendToSelf) {
ClientSessionFixture fix;
SimpleListener mylistener;
fix.session.queueDeclare(queue="myq", exclusive=true, autoDelete=true);
- fix.subs.subscribe(mylistener, "myq", "myq");
+ fix.subs.subscribe(mylistener, "myq");
sys::Thread runner(fix.subs);//start dispatcher thread
string data("msg");
Message msg(data, "myq");
@@ -222,5 +222,30 @@ QPID_AUTO_TEST_CASE(testSendToSelf) {
}
}
+QPID_AUTO_TEST_CASE(testLocalQueue) {
+ ClientSessionFixture fix;
+ fix.session.queueDeclare(queue="lq", exclusive=true, autoDelete=true);
+ LocalQueue lq;
+ fix.subs.subscribe(lq, "lq", FlowControl(2, FlowControl::UNLIMITED, false));
+ fix.session.messageTransfer(content=Message("foo0", "lq"));
+ fix.session.messageTransfer(content=Message("foo1", "lq"));
+ fix.session.messageTransfer(content=Message("foo2", "lq"));
+ BOOST_CHECK_EQUAL("foo0", lq.pop().getData());
+ BOOST_CHECK_EQUAL("foo1", lq.pop().getData());
+ BOOST_CHECK(lq.empty()); // Credit exhausted.
+ fix.subs.setFlowControl("lq", FlowControl::unlimited());
+ BOOST_CHECK_EQUAL("foo2", lq.pop().getData());
+}
+
+QPID_AUTO_TEST_CASE(testGet) {
+ ClientSessionFixture fix;
+ fix.session.queueDeclare(queue="getq", exclusive=true, autoDelete=true);
+ fix.session.messageTransfer(content=Message("foo0", "getq"));
+ fix.session.messageTransfer(content=Message("foo1", "getq"));
+ BOOST_CHECK_EQUAL("foo0", fix.subs.get("getq").getData());
+ BOOST_CHECK_EQUAL("foo1", fix.subs.get("getq").getData());
+}
+
QPID_AUTO_TEST_SUITE_END()
+