summaryrefslogtreecommitdiff
path: root/cpp/src/tests/QueueTest.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-10-23 18:57:38 +0000
committerGordon Sim <gsim@apache.org>2008-10-23 18:57:38 +0000
commit283b61527c3c0958d5a5af757077dae219f5d5fa (patch)
tree349cffb59a56f61ad49404efc23a1544bb4e6d74 /cpp/src/tests/QueueTest.cpp
parent99c1552947bea5118b09c5034f6788cc93e2feca (diff)
downloadqpid-python-283b61527c3c0958d5a5af757077dae219f5d5fa.tar.gz
Some fixes to the LVQ (primarily a patch from cctrieloff@redhat.com)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@707446 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/QueueTest.cpp')
-rw-r--r--cpp/src/tests/QueueTest.cpp43
1 files changed, 27 insertions, 16 deletions
diff --git a/cpp/src/tests/QueueTest.cpp b/cpp/src/tests/QueueTest.cpp
index ef8aa69dd6..ab9f146fd7 100644
--- a/cpp/src/tests/QueueTest.cpp
+++ b/cpp/src/tests/QueueTest.cpp
@@ -438,27 +438,38 @@ QPID_AUTO_TEST_CASE(testLVQAcquire){
}
+QPID_AUTO_TEST_CASE(testLVQMultiQueue){
-QPID_AUTO_TEST_CASE(testLVQSaftyCheck){
-
-// This test is to check std::deque memory copy does not change out under us
-// if this test fails, then lvq would no longer be safe.
+ client::QueueOptions args;
+ // set queue mode
+ args.setOrdering(client::LVQ);
- std::deque<string> deq;
+ Queue::shared_ptr queue1(new Queue("my-queue", true ));
+ Queue::shared_ptr queue2(new Queue("my-queue", true ));
+ intrusive_ptr<Message> received;
+ queue1->configure(args);
+ queue2->configure(args);
- string a;
- string b;
+ intrusive_ptr<Message> msg1 = message("e", "A");
+ intrusive_ptr<Message> msg2 = message("e", "A");
+
+ string key;
+ args.getLVQKey(key);
+ BOOST_CHECK_EQUAL(key, "qpid.LVQ_key");
+
+ msg1->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a");
+ msg2->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a");
- deq.push_back(a);
- deq.push_back(b);
- string* tmp = &deq.back();
- for (int a =0; a<=100000; a++){
- string z;
- deq.push_back(z);
- }
- deq.pop_front();
- BOOST_CHECK_EQUAL(&deq.front(),tmp);
+ queue1->deliver(msg1);
+ queue2->deliver(msg1);
+ queue1->deliver(msg2);
+
+ received = queue1->get().payload;
+ BOOST_CHECK_EQUAL(msg2.get(), received.get());
+ received = queue2->get().payload;
+ BOOST_CHECK_EQUAL(msg1.get(), received.get());
+
}
void addMessagesToQueue(uint count, Queue& queue, uint oddTtl = 200, uint evenTtl = 0)