summaryrefslogtreecommitdiff
path: root/cpp/src/tests
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-07-19 21:52:24 +0000
committerAlan Conway <aconway@apache.org>2007-07-19 21:52:24 +0000
commitcb566519d58ded6704507fa5530bf901e620edf6 (patch)
treeab4b29ddd0ad2b5e9015647e379bede84163b13e /cpp/src/tests
parent3f900af77d5f781431dc25e307974e0fc27aa561 (diff)
downloadqpid-python-cb566519d58ded6704507fa5530bf901e620edf6.tar.gz
* Summary:
- Connect cluster handlers into broker handler chains. - Progress on wiring replication. * src/tests/cluster.mk: Temporarily disabled Cluster test. * src/tests/Cluster.h, cpp, Cluster_child.cpp: Updated to use UUIDs. * src/qpidd.cpp: - Load optional libs (cluster) - Include plugin config in options.parse. * src/qpid/cluster/SessionManager.h: - Create sessions, update handler chains (as HandlerUpdater) - Handle frames from cluster. * src/qpid/cluster/ClusterPlugin.h, .cpp: - renamed from ClusterPluginProvider - Create and connect Cluster and SessionManager. - Register SessionManager as HandlerUpdater. * src/qpid/cluster/Cluster.h, .cpp: Refactor as SessionFrameHandler. * src/qpid/broker/Connection.cpp: Apply HandlerUpdaters. * src/qpid/broker/Broker.h, .cpp: - Initialize plugins - Apply HandlerUpdaters * src/qpid/Plugin.h, .cpp: Simplified plugin framework. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@557788 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
-rw-r--r--cpp/src/tests/Cluster.cpp10
-rw-r--r--cpp/src/tests/Cluster.h10
-rw-r--r--cpp/src/tests/Cluster_child.cpp4
-rw-r--r--cpp/src/tests/Makefile.am2
-rw-r--r--cpp/src/tests/cluster.mk9
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