diff options
Diffstat (limited to 'cpp/tests/LazyLoadedContentTest.cpp')
| -rw-r--r-- | cpp/tests/LazyLoadedContentTest.cpp | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/cpp/tests/LazyLoadedContentTest.cpp b/cpp/tests/LazyLoadedContentTest.cpp index 624d2be3ff..49e4ecc4ae 100644 --- a/cpp/tests/LazyLoadedContentTest.cpp +++ b/cpp/tests/LazyLoadedContentTest.cpp @@ -26,20 +26,13 @@ #include <list> #include <sstream> #include "AMQFrame.h" - +#include "DummyChannel.h" using std::list; using std::string; using boost::dynamic_pointer_cast; using namespace qpid::broker; using namespace qpid::framing; -struct DummyHandler : OutputHandler{ - std::vector<AMQFrame*> frames; - - virtual void send(AMQFrame* frame){ - frames.push_back(frame); - } -}; class LazyLoadedContentTest : public CppUnit::TestCase @@ -99,21 +92,16 @@ public: { TestMessageStore store(in); LazyLoadedContent content(&store, 0, in.size()); - DummyHandler handler; - u_int16_t channel = 3; - content.send(highestProtocolVersion, &handler, channel, framesize); - check(handler, channel, outCount, out); - } - - void check(DummyHandler& handler, u_int16_t channel, size_t expectedChunkCount, string* expectedChunks) - { - CPPUNIT_ASSERT_EQUAL(expectedChunkCount, handler.frames.size()); + DummyChannel channel(3); + content.send(channel, framesize); + CPPUNIT_ASSERT_EQUAL(outCount, channel.out.frames.size()); - for (unsigned int i = 0; i < expectedChunkCount; i++) { - AMQContentBody::shared_ptr chunk(dynamic_pointer_cast<AMQContentBody, AMQBody>(handler.frames[i]->getBody())); + for (unsigned int i = 0; i < outCount; i++) { + AMQContentBody::shared_ptr chunk(dynamic_pointer_cast<AMQContentBody, AMQBody>(channel.out.frames[i]->getBody())); CPPUNIT_ASSERT(chunk); - CPPUNIT_ASSERT_EQUAL(expectedChunks[i], chunk->getData()); - CPPUNIT_ASSERT_EQUAL(channel, handler.frames[i]->getChannel()); + CPPUNIT_ASSERT_EQUAL(out[i], chunk->getData()); + CPPUNIT_ASSERT_EQUAL( + ChannelId(3), channel.out.frames[i]->getChannel()); } } }; |
