From 858b69ff7c0ad5bf938e3817497a1b7953bf76d5 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 13 Feb 2009 19:21:21 +0000 Subject: Ensure that the queue depth in bytes remains accurate for LVQ. This also ensures that there are no underflow exceptions from the policy that keeps this count. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@744222 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/ClientSessionTest.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'cpp/src/tests/ClientSessionTest.cpp') diff --git a/cpp/src/tests/ClientSessionTest.cpp b/cpp/src/tests/ClientSessionTest.cpp index e4c311d8a0..e156000f18 100644 --- a/cpp/src/tests/ClientSessionTest.cpp +++ b/cpp/src/tests/ClientSessionTest.cpp @@ -21,6 +21,7 @@ #include "unit_test.h" #include "test_tools.h" #include "BrokerFixture.h" +#include "qpid/client/QueueOptions.h" #include "qpid/client/SubscriptionManager.h" #include "qpid/sys/Monitor.h" #include "qpid/sys/Thread.h" @@ -526,6 +527,27 @@ QPID_AUTO_TEST_CASE(testSessionCloseOnInvalidSession) { session.close(); } +QPID_AUTO_TEST_CASE(testLVQVariedSize) { + ClientSessionFixture fix; + std::string queue("my-lvq"); + QueueOptions args; + args.setOrdering(LVQ_NO_BROWSE); + fix.session.queueDeclare(arg::queue=queue, arg::exclusive=true, arg::autoDelete=true, arg::arguments=args); + + std::string key; + args.getLVQKey(key); + + for (size_t i = 0; i < 10; i++) { + std::ostringstream data; + size_t size = 100 - ((i % 10) * 10); + data << std::string(size, 'x'); + + Message m(data.str(), queue); + m.getHeaders().setString(key, "abc"); + fix.session.messageTransfer(arg::content=m); + } +} + QPID_AUTO_TEST_SUITE_END() -- cgit v1.2.1