summaryrefslogtreecommitdiff
path: root/cpp/src/tests/Cluster.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-07-05 16:08:29 +0000
committerAlan Conway <aconway@apache.org>2007-07-05 16:08:29 +0000
commit0865408d7fa16f913391ed9391fb13268a74d8a1 (patch)
tree3107946aae1031a960bc68921a33c9708c8bea53 /cpp/src/tests/Cluster.h
parent4e60e87b604f8959907a329a36264f98debc9536 (diff)
downloadqpid-python-0865408d7fa16f913391ed9391fb13268a74d8a1.tar.gz
* 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/qpid@553543 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/Cluster.h')
-rw-r--r--cpp/src/tests/Cluster.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/cpp/src/tests/Cluster.h b/cpp/src/tests/Cluster.h
index f37c87a9ad..8fddd1d1f7 100644
--- a/cpp/src/tests/Cluster.h
+++ b/cpp/src/tests/Cluster.h
@@ -44,10 +44,10 @@ using namespace boost;
void null_deleter(void*) {}
-struct TestFrameHandler :
- public FrameHandler, public vector<AMQFrame>, public Monitor
+template <class T>
+struct TestHandler : public Handler<T&>, public vector<T>, 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<T>::size() != n && wait(deadline))
;
- return size() == n;
+ return vector<T>::size() == n;
}
};
+typedef TestHandler<AMQFrame> TestFrameHandler;
+typedef TestHandler<SessionFrame> 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<size_t>(), bind(&Cluster::size,this), n));
}
- TestFrameHandler in, out;
+ TestSessionFrameHandler received;
};