From f8903ef9bf3767041bb3a8437c8423ea984e5893 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 5 Jul 2007 16:08:29 +0000 Subject: * src/qpid/cluster/SessionFrame.cpp, .h: Wrap AMQFrame with session UUID and direction. * src/qpid/cluster/Cluster.cpp, .h: Use SessionFrame. * src/qpid/framing/AMQFrame.h, .cpp: Added setBody(), inline getBody() * src/qpid/framing/Uuid.h, .cpp: Clean up constructors, inline. * src/qpid/framing/Buffer.h: Put/get byte*, size_T. * src/qpid/cluster/SessionManager.cpp, .h: - Maintain the session map. - Handle frames from cluster, dispatch to proper channels. - Implement HandlerUpdater for new channels and maintains git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@553543 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/tests/Cluster.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'qpid/cpp/src/tests/Cluster.h') diff --git a/qpid/cpp/src/tests/Cluster.h b/qpid/cpp/src/tests/Cluster.h index f37c87a9ad..8fddd1d1f7 100644 --- a/qpid/cpp/src/tests/Cluster.h +++ b/qpid/cpp/src/tests/Cluster.h @@ -44,10 +44,10 @@ using namespace boost; void null_deleter(void*) {} -struct TestFrameHandler : - public FrameHandler, public vector, public Monitor +template +struct TestHandler : public Handler, public vector, public Monitor { - void handle(AMQFrame& frame) { + void handle(T& frame) { Mutex::ScopedLock l(*this); push_back(frame); notifyAll(); @@ -56,23 +56,22 @@ struct TestFrameHandler : bool waitFor(size_t n) { Mutex::ScopedLock l(*this); AbsTime deadline(now(), 5*TIME_SEC); - while (size() != n && wait(deadline)) + while (vector::size() != n && wait(deadline)) ; - return size() == n; + return vector::size() == n; } }; +typedef TestHandler TestFrameHandler; +typedef TestHandler TestSessionFrameHandler; + void nullDeleter(void*) {} struct TestCluster : public Cluster { TestCluster(string name, string url) : Cluster(name, url) { - setFromChains( - FrameHandler::Chains( - make_shared_ptr(&in, nullDeleter), - make_shared_ptr(&out, nullDeleter) - )); + setReceivedChain(make_shared_ptr(&received, nullDeleter)); } /** Wait for cluster to be of size n. */ @@ -80,7 +79,7 @@ struct TestCluster : public Cluster return wait(boost::bind(equal_to(), bind(&Cluster::size,this), n)); } - TestFrameHandler in, out; + TestSessionFrameHandler received; }; -- cgit v1.2.1