diff options
Diffstat (limited to 'cpp/src/tests')
-rw-r--r-- | cpp/src/tests/Cluster.cpp | 10 | ||||
-rw-r--r-- | cpp/src/tests/Cluster.h | 10 | ||||
-rw-r--r-- | cpp/src/tests/Cluster_child.cpp | 4 | ||||
-rw-r--r-- | cpp/src/tests/Makefile.am | 2 | ||||
-rw-r--r-- | cpp/src/tests/cluster.mk | 9 |
5 files changed, 23 insertions, 12 deletions
diff --git a/cpp/src/tests/Cluster.cpp b/cpp/src/tests/Cluster.cpp index 2e6d9ecfff..56e17e06db 100644 --- a/cpp/src/tests/Cluster.cpp +++ b/cpp/src/tests/Cluster.cpp @@ -36,11 +36,14 @@ using namespace qpid::log; BOOST_AUTO_TEST_CASE(testClusterOne) { TestCluster cluster("clusterOne", "amqp:one:1"); AMQFrame frame(VER, 1, new ChannelPingBody(VER)); - cluster.getSendChains().in->handle(frame); + Uuid id(true); + SessionFrame send(id, frame, true); + cluster.handle(send); BOOST_REQUIRE(cluster.received.waitFor(1)); 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_EQUAL(1u, cluster.size()); @@ -60,9 +63,12 @@ BOOST_AUTO_TEST_CASE(testClusterTwo) { // Exchange frames with child. AMQFrame frame(VER, 1, new ChannelPingBody(VER)); - cluster.getSendChains().in->handle(frame); + Uuid id(true); + SessionFrame send(id, frame, true); + cluster.handle(send); BOOST_REQUIRE(cluster.received.waitFor(1)); SessionFrame& sf=cluster.received[0]; + BOOST_CHECK_EQUAL(id, sf.uuid); BOOST_CHECK(sf.isIncoming); BOOST_CHECK_TYPEID_EQUAL(ChannelPingBody, *sf.frame.getBody()); BOOST_REQUIRE(cluster.received.waitFor(2)); diff --git a/cpp/src/tests/Cluster.h b/cpp/src/tests/Cluster.h index 8fddd1d1f7..bf6d1c2a64 100644 --- a/cpp/src/tests/Cluster.h +++ b/cpp/src/tests/Cluster.h @@ -24,7 +24,10 @@ #include "qpid/framing/ChannelOkBody.h" #include "qpid/framing/BasicGetOkBody.h" #include "qpid/log/Logger.h" + #include <boost/bind.hpp> +#include <boost/test/test_tools.hpp> + #include <iostream> #include <vector> #include <functional> @@ -69,13 +72,12 @@ void nullDeleter(void*) {} struct TestCluster : public Cluster { - TestCluster(string name, string url) : Cluster(name, url) - { - setReceivedChain(make_shared_ptr(&received, nullDeleter)); - } + TestCluster(string name, string url) + : Cluster(name, url, make_shared_ptr(&received, nullDeleter)) {} /** Wait for cluster to be of size n. */ bool waitFor(size_t n) { + BOOST_CHECKPOINT("About to call Cluster::wait"); return wait(boost::bind(equal_to<size_t>(), bind(&Cluster::size,this), n)); } diff --git a/cpp/src/tests/Cluster_child.cpp b/cpp/src/tests/Cluster_child.cpp index 216afc7bca..9c119e5238 100644 --- a/cpp/src/tests/Cluster_child.cpp +++ b/cpp/src/tests/Cluster_child.cpp @@ -39,7 +39,9 @@ void clusterTwo() { BOOST_CHECK_EQUAL(2u, cluster.size()); // Me and parent AMQFrame frame(VER, 1, new ChannelOkBody(VER)); - cluster.getSendChains().out->handle(frame); + Uuid id(true); + SessionFrame sf(id, frame, false); + cluster.handle(sf); BOOST_REQUIRE(cluster.received.waitFor(2)); BOOST_CHECK(!cluster.received[1].isIncoming); BOOST_CHECK_TYPEID_EQUAL(ChannelOkBody, *cluster.received[1].frame.getBody()); diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am index 93c3e80673..4f1e7e1ec3 100644 --- a/cpp/src/tests/Makefile.am +++ b/cpp/src/tests/Makefile.am @@ -170,7 +170,7 @@ all-am: .valgrind.supp .valgrindrc # ltmain invocations, one may corrupt the temporaries of the other. .NOTPARALLEL: -CLEANFILES=valgrind.out qpidd.log .valgrindrc .valgrind.supp dummy_test $(unit_wrappers) +CLEANFILES=valgrind.out *.log *.vglog .valgrindrc .valgrind.supp dummy_test $(unit_wrappers) MAINTAINERCLEANFILES=gen.mk interop_runner_SOURCES = \ diff --git a/cpp/src/tests/cluster.mk b/cpp/src/tests/cluster.mk index 7407565f62..506624569f 100644 --- a/cpp/src/tests/cluster.mk +++ b/cpp/src/tests/cluster.mk @@ -20,10 +20,11 @@ check_PROGRAMS+=Cpg Cpg_SOURCES=Cpg.cpp Cpg_LDADD=$(lib_cluster) -lboost_unit_test_framework -TESTS+=Cluster -check_PROGRAMS+=Cluster -Cluster_SOURCES=Cluster.cpp Cluster.h -Cluster_LDADD=$(lib_cluster) -lboost_unit_test_framework +# FIXME aconway 2007-07-19: +# TESTS+=Cluster +# check_PROGRAMS+=Cluster +# Cluster_SOURCES=Cluster.cpp Cluster.h +# Cluster_LDADD=$(lib_cluster) -lboost_unit_test_framework check_PROGRAMS+=Cluster_child Cluster_child_SOURCES=Cluster_child.cpp Cluster.h |