From 8540702068eda8d37c40992ce6d70e9ab4af3237 Mon Sep 17 00:00:00 2001 From: "Carl C. Trieloff" Date: Tue, 21 Aug 2007 19:11:07 +0000 Subject: - header correction for buffer - added tests for one msg to multiple queue in async mode - added counter for async multiple msg git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@568236 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/BrokerChannelTest.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'cpp/src/tests/BrokerChannelTest.cpp') diff --git a/cpp/src/tests/BrokerChannelTest.cpp b/cpp/src/tests/BrokerChannelTest.cpp index 6c9b910637..3253a3d27a 100644 --- a/cpp/src/tests/BrokerChannelTest.cpp +++ b/cpp/src/tests/BrokerChannelTest.cpp @@ -75,6 +75,7 @@ class BrokerChannelTest : public CppUnit::TestCase CPPUNIT_TEST(testStaging); CPPUNIT_TEST(testQueuePolicy); CPPUNIT_TEST(testFlow); + CPPUNIT_TEST(testAsyncMesgToMoreThanOneQueue); CPPUNIT_TEST_SUITE_END(); shared_ptr broker; @@ -307,6 +308,38 @@ class BrokerChannelTest : public CppUnit::TestCase store.check(); } + + //NOTE: message or queue test, + //but as it can usefully use the same utility classes as this + //class it is defined here for simpllicity + void testAsyncMesgToMoreThanOneQueue() + { + MockMessageStore store; + {//must ensure that store is last thing deleted + const string data1("abcd"); + Message::shared_ptr msg1(createMessage("e", "A", "MsgA", data1.size())); + addContent(msg1, data1); + + Queue::shared_ptr queue1(new Queue("my_queue1", false, &store, 0)); + Queue::shared_ptr queue2(new Queue("my_queue2", false, &store, 0)); + Queue::shared_ptr queue3(new Queue("my_queue3", false, &store, 0)); + queue1->deliver(msg1); + queue2->deliver(msg1); + queue3->deliver(msg1); + sleep(2); + + Message::shared_ptr next = queue1->dequeue(); + CPPUNIT_ASSERT_EQUAL(msg1, next); + next = queue2->dequeue(); + CPPUNIT_ASSERT_EQUAL(msg1, next); + next = queue3->dequeue(); + CPPUNIT_ASSERT_EQUAL(msg1, next); + + } + } + + + void testFlow(){ Channel channel(connection, recorder, 7); channel.open(); -- cgit v1.2.1