From 89e0f01cc546f252fdcc680d5eaba2841f9d62a6 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 29 Mar 2007 23:08:08 +0000 Subject: * tests/BrokerChannelTest.cpp: fixed leak in test code. * tests/.vg-supp: Updated supressions git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@523869 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/tests/.vg-supp | 21 --------------------- cpp/tests/BrokerChannelTest.cpp | 35 ++++++++++++++++++----------------- 2 files changed, 18 insertions(+), 38 deletions(-) (limited to 'cpp') diff --git a/cpp/tests/.vg-supp b/cpp/tests/.vg-supp index 5ea6ed1223..b9737f3990 100644 --- a/cpp/tests/.vg-supp +++ b/cpp/tests/.vg-supp @@ -1,24 +1,3 @@ -{ - - Memcheck:Leak - fun:_Znwj - fun:_ZN4qpid7framing14ChannelAdapter4sendEN5boost10shared_ptrINS0_7AMQBodyEEE - fun:_ZN4qpid7framing14ChannelAdapter4sendEPNS0_7AMQBodyE - fun:_ZN4qpid7framing16AMQP_ClientProxy10Connection5startEhhRKNS0_10FieldTableERKSsS7_ - fun:_ZN4qpid6broker10Connection9initiatedERKNS_7framing18ProtocolInitiationE - fun:_ZN17BrokerChannelTestC1Ev - fun:_ZN7CppUnit25ConcretTestFixtureFactoryI17BrokerChannelTestE11makeFixtureEv - fun:_ZNK7CppUnit27TestSuiteBuilderContextBase15makeTestFixtureEv - fun:_ZNK7CppUnit23TestSuiteBuilderContextI17BrokerChannelTestE11makeFixtureEv - fun:_ZN17BrokerChannelTest15addTestsToSuiteERN7CppUnit27TestSuiteBuilderContextBaseE - fun:_ZN17BrokerChannelTest5suiteEv - fun:_ZN7CppUnit16TestSuiteFactoryI17BrokerChannelTestE8makeTestEv - fun:_ZN7CppUnit19TestFactoryRegistry14addTestToSuiteEPNS_9TestSuiteE - fun:_ZN7CppUnit19TestFactoryRegistry8makeTestEv - obj:/usr/bin/DllPlugInTester - obj:/usr/bin/DllPlugInTester - fun:(below main) -} { Memcheck:Leak diff --git a/cpp/tests/BrokerChannelTest.cpp b/cpp/tests/BrokerChannelTest.cpp index 8717be07b5..61135c898b 100644 --- a/cpp/tests/BrokerChannelTest.cpp +++ b/cpp/tests/BrokerChannelTest.cpp @@ -31,6 +31,7 @@ #include "MockChannel.h" #include "broker/Connection.h" #include "ProtocolInitiation.h" +#include using namespace boost; using namespace qpid::broker; @@ -40,7 +41,7 @@ using std::string; using std::queue; struct MockHandler : ConnectionOutputHandler{ - std::vector frames; + boost::ptr_vector frames; void send(AMQFrame* frame){ frames.push_back(frame); } @@ -190,18 +191,18 @@ class BrokerChannelTest : public CppUnit::TestCase queue->deliver(msg); CPPUNIT_ASSERT_EQUAL((size_t) 4, handler.frames.size()); - CPPUNIT_ASSERT_EQUAL(ChannelId(0), handler.frames[0]->getChannel()); - CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[1]->getChannel()); - CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[2]->getChannel()); - CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[3]->getChannel()); + CPPUNIT_ASSERT_EQUAL(ChannelId(0), handler.frames[0].getChannel()); + CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[1].getChannel()); + CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[2].getChannel()); + CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[3].getChannel()); CPPUNIT_ASSERT(dynamic_cast( - handler.frames[0]->getBody().get())); + handler.frames[0].getBody().get())); CPPUNIT_ASSERT(dynamic_cast( - handler.frames[1]->getBody().get())); + handler.frames[1].getBody().get())); CPPUNIT_ASSERT(dynamic_cast( - handler.frames[2]->getBody().get())); + handler.frames[2].getBody().get())); AMQContentBody* contentBody = dynamic_cast( - handler.frames[3]->getBody().get()); + handler.frames[3].getBody().get()); CPPUNIT_ASSERT(contentBody); CPPUNIT_ASSERT_EQUAL(data, contentBody->getData()); } @@ -221,18 +222,18 @@ class BrokerChannelTest : public CppUnit::TestCase queue->deliver(msg); CPPUNIT_ASSERT_EQUAL((size_t) 4, handler.frames.size()); - CPPUNIT_ASSERT_EQUAL(ChannelId(0), handler.frames[0]->getChannel()); - CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[1]->getChannel()); - CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[2]->getChannel()); - CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[3]->getChannel()); + CPPUNIT_ASSERT_EQUAL(ChannelId(0), handler.frames[0].getChannel()); + CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[1].getChannel()); + CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[2].getChannel()); + CPPUNIT_ASSERT_EQUAL(ChannelId(7), handler.frames[3].getChannel()); CPPUNIT_ASSERT(dynamic_cast( - handler.frames[0]->getBody().get())); + handler.frames[0].getBody().get())); CPPUNIT_ASSERT(dynamic_cast( - handler.frames[1]->getBody().get())); + handler.frames[1].getBody().get())); CPPUNIT_ASSERT(dynamic_cast( - handler.frames[2]->getBody().get())); + handler.frames[2].getBody().get())); AMQContentBody* contentBody = dynamic_cast( - handler.frames[3]->getBody().get()); + handler.frames[3].getBody().get()); CPPUNIT_ASSERT(contentBody); CPPUNIT_ASSERT_EQUAL(data, contentBody->getData()); } -- cgit v1.2.1