summaryrefslogtreecommitdiff
path: root/cpp/src/tests/Cluster.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-07-26 15:47:23 +0000
committerAlan Conway <aconway@apache.org>2007-07-26 15:47:23 +0000
commit233cc9184c758702d8fa4a83d1bf8ec7dc0b3474 (patch)
tree6a73a6dfb117218e8fd94c8b447def68e0ab9de0 /cpp/src/tests/Cluster.cpp
parent89a8765ee2bac1d77be65f1011ffeeb2cbbabe2d (diff)
downloadqpid-python-233cc9184c758702d8fa4a83d1bf8ec7dc0b3474.tar.gz
* README: Instructions for openais install.
* configure.ac: Enable clustering if suitable openais is present. * src/tests/Cluster.cpp, .h, Cluster_child: Updated for 0-10 * src/qpid/sys/ConcurrentQueue.h: Added waitPop() * src/Makefile.am, src/qpid/sys/ThreadSafeQueue.h, ProducerConsumer.h: Removed unused code, ConcurrentQueue provides same functionality. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@559859 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/Cluster.cpp')
-rw-r--r--cpp/src/tests/Cluster.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/cpp/src/tests/Cluster.cpp b/cpp/src/tests/Cluster.cpp
index b22f312038..5ace48b736 100644
--- a/cpp/src/tests/Cluster.cpp
+++ b/cpp/src/tests/Cluster.cpp
@@ -19,8 +19,8 @@
#include "Cluster.h"
#include "test_tools.h"
-#include "qpid/framing/ChannelPingBody.h"
-#include "qpid/framing/ChannelOkBody.h"
+#include "qpid/framing/SessionPingBody.h"
+#include "qpid/framing/SessionPongBody.h"
#include "qpid/cluster/ClassifierHandler.h"
#define BOOST_AUTO_TEST_MAIN // Must come before #include<boost/test/*>
@@ -33,16 +33,16 @@ static const ProtocolVersion VER;
/** Verify membership in a cluster with one member. */
BOOST_AUTO_TEST_CASE(testClusterOne) {
TestCluster cluster("clusterOne", "amqp:one:1");
- AMQFrame frame(VER, 1, new ChannelPingBody(VER));
+ AMQFrame frame(VER, 1, new SessionPingBody(VER));
Uuid id(true);
SessionFrame send(id, frame, true);
cluster.handle(send);
- BOOST_REQUIRE(cluster.received.waitFor(1));
+ SessionFrame sf;
+ BOOST_REQUIRE(cluster.received.waitPop(sf));
- SessionFrame& sf=cluster.received[0];
BOOST_CHECK(sf.isIncoming);
BOOST_CHECK_EQUAL(id, sf.uuid);
- BOOST_CHECK_TYPEID_EQUAL(ChannelPingBody, *sf.frame.getBody());
+ BOOST_CHECK_TYPEID_EQUAL(SessionPingBody, *sf.frame.getBody());
BOOST_CHECK_EQUAL(1u, cluster.size());
Cluster::MemberList members = cluster.getMembers();
@@ -65,17 +65,18 @@ BOOST_AUTO_TEST_CASE(testClusterTwo) {
BOOST_REQUIRE(cluster.waitFor(2)); // Myself and child.
// Exchange frames with child.
- AMQFrame frame(VER, 1, new ChannelPingBody(VER));
+ AMQFrame frame(VER, 1, new SessionPingBody(VER));
Uuid id(true);
SessionFrame send(id, frame, true);
cluster.handle(send);
- BOOST_REQUIRE(cluster.received.waitFor(1));
- SessionFrame& sf=cluster.received[0];
+ SessionFrame sf;
+ BOOST_REQUIRE(cluster.received.waitPop(sf));
BOOST_CHECK_EQUAL(id, sf.uuid);
BOOST_CHECK(sf.isIncoming);
- BOOST_CHECK_TYPEID_EQUAL(ChannelPingBody, *sf.frame.getBody());
- BOOST_REQUIRE(cluster.received.waitFor(2));
- BOOST_CHECK_TYPEID_EQUAL(ChannelOkBody, *cluster.received[1].frame.getBody());
+ BOOST_CHECK_TYPEID_EQUAL(SessionPingBody, *sf.frame.getBody());
+
+ BOOST_REQUIRE(cluster.received.waitPop(sf));
+ BOOST_CHECK_TYPEID_EQUAL(SessionPongBody, *sf.frame.getBody());
if (!nofork) {
// Wait for child to exit.