From ac669123004b6e78468cc4fcea3ffb4b9d7b7bd3 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 27 Jul 2007 19:27:43 +0000 Subject: Drop SessionFrame, UUID is not required and more efficient to transmit plain AMQFrames. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@560356 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/Cluster.cpp | 30 ++++++++++-------------------- cpp/src/tests/Cluster.h | 3 +-- cpp/src/tests/Cluster_child.cpp | 17 +++++++---------- cpp/src/tests/ais_check | 6 +++--- 4 files changed, 21 insertions(+), 35 deletions(-) (limited to 'cpp') diff --git a/cpp/src/tests/Cluster.cpp b/cpp/src/tests/Cluster.cpp index 5ace48b736..811fc0133e 100644 --- a/cpp/src/tests/Cluster.cpp +++ b/cpp/src/tests/Cluster.cpp @@ -33,17 +33,11 @@ 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 SessionPingBody(VER)); - Uuid id(true); - SessionFrame send(id, frame, true); + AMQFrame send(VER, 1, new SessionPingBody(VER)); cluster.handle(send); - SessionFrame sf; - BOOST_REQUIRE(cluster.received.waitPop(sf)); - - BOOST_CHECK(sf.isIncoming); - BOOST_CHECK_EQUAL(id, sf.uuid); - BOOST_CHECK_TYPEID_EQUAL(SessionPingBody, *sf.frame.getBody()); - + AMQFrame received; + BOOST_REQUIRE(cluster.received.waitPop(received)); + BOOST_CHECK_TYPEID_EQUAL(SessionPingBody, *received.getBody()); BOOST_CHECK_EQUAL(1u, cluster.size()); Cluster::MemberList members = cluster.getMembers(); BOOST_CHECK_EQUAL(1u, members.size()); @@ -65,18 +59,14 @@ BOOST_AUTO_TEST_CASE(testClusterTwo) { BOOST_REQUIRE(cluster.waitFor(2)); // Myself and child. // Exchange frames with child. - AMQFrame frame(VER, 1, new SessionPingBody(VER)); - Uuid id(true); - SessionFrame send(id, frame, true); + AMQFrame send(VER, 1, new SessionPingBody(VER)); cluster.handle(send); - SessionFrame sf; - BOOST_REQUIRE(cluster.received.waitPop(sf)); - BOOST_CHECK_EQUAL(id, sf.uuid); - BOOST_CHECK(sf.isIncoming); - BOOST_CHECK_TYPEID_EQUAL(SessionPingBody, *sf.frame.getBody()); + AMQFrame received; + BOOST_REQUIRE(cluster.received.waitPop(received)); + BOOST_CHECK_TYPEID_EQUAL(SessionPingBody, *received.getBody()); - BOOST_REQUIRE(cluster.received.waitPop(sf)); - BOOST_CHECK_TYPEID_EQUAL(SessionPongBody, *sf.frame.getBody()); + BOOST_REQUIRE(cluster.received.waitPop(received)); + BOOST_CHECK_TYPEID_EQUAL(SessionPongBody, *received.getBody()); if (!nofork) { // Wait for child to exit. diff --git a/cpp/src/tests/Cluster.h b/cpp/src/tests/Cluster.h index 02e642f641..510a788f7c 100644 --- a/cpp/src/tests/Cluster.h +++ b/cpp/src/tests/Cluster.h @@ -54,7 +54,6 @@ class TestHandler : public Handler, public ConcurrentQueue }; typedef TestHandler TestFrameHandler; -typedef TestHandler TestSessionFrameHandler; void nullDeleter(void*) {} @@ -70,7 +69,7 @@ struct TestCluster : public Cluster equal_to(), bind(&Cluster::size,this), n)); } - TestSessionFrameHandler received; + TestFrameHandler received; }; diff --git a/cpp/src/tests/Cluster_child.cpp b/cpp/src/tests/Cluster_child.cpp index fd4eb42e7b..7bea9d0490 100644 --- a/cpp/src/tests/Cluster_child.cpp +++ b/cpp/src/tests/Cluster_child.cpp @@ -35,18 +35,15 @@ static const ProtocolVersion VER; /** Chlid part of Cluster::clusterTwo test */ void clusterTwo() { TestCluster cluster("clusterTwo", "amqp:child:2"); - SessionFrame sf; - BOOST_REQUIRE(cluster.received.waitPop(sf)); // Frame from parent. - BOOST_CHECK(sf.isIncoming); - BOOST_CHECK_TYPEID_EQUAL(SessionPingBody, *sf.frame.getBody()); + AMQFrame frame; + BOOST_REQUIRE(cluster.received.waitPop(frame)); // Frame from parent. + BOOST_CHECK_TYPEID_EQUAL(SessionPingBody, *frame.getBody()); BOOST_CHECK_EQUAL(2u, cluster.size()); // Me and parent - AMQFrame frame(VER, 1, new SessionPongBody(VER)); - SessionFrame sendframe(sf.uuid, frame, false); - cluster.handle(sendframe); - BOOST_REQUIRE(cluster.received.waitPop(sf)); - BOOST_CHECK(!sf.isIncoming); - BOOST_CHECK_TYPEID_EQUAL(SessionPongBody, *sf.frame.getBody()); + AMQFrame send(VER, 1, new SessionPongBody(VER)); + cluster.handle(send); + BOOST_REQUIRE(cluster.received.waitPop(frame)); + BOOST_CHECK_TYPEID_EQUAL(SessionPongBody, *frame.getBody()); } int test_main(int, char**) { diff --git a/cpp/src/tests/ais_check b/cpp/src/tests/ais_check index 156a8b1ebe..69a0469a26 100755 --- a/cpp/src/tests/ais_check +++ b/cpp/src/tests/ais_check @@ -3,7 +3,7 @@ # test `id -ng` = "ais" || BADGROUP=yes -ps -u root | grep aisexec > /dev/null 2>&1 || NOAISEXEC=yes +{ ps -u root | grep aisexec >/dev/null; } || NOAISEXEC=yes if test -n "$BADGROUP" -o -n "$NOAISEXEC"; then cat <