From eabcd5c760c8d3b3e8f6f45a29c19148560f91cd Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 26 Jun 2008 18:12:12 +0000 Subject: Consolidated cluster tests in cluster_test.cpp Improvements to BrokerFixture for testing. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@671969 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/Plugin.cpp | 17 +++++++++++------ cpp/src/qpid/Plugin.h | 3 +++ cpp/src/qpid/cluster/Cpg.cpp | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'cpp/src/qpid') diff --git a/cpp/src/qpid/Plugin.cpp b/cpp/src/qpid/Plugin.cpp index 77627c3742..733d134334 100644 --- a/cpp/src/qpid/Plugin.cpp +++ b/cpp/src/qpid/Plugin.cpp @@ -19,16 +19,16 @@ */ #include "Plugin.h" +#include "qpid/Options.h" namespace qpid { namespace { -// This is a single threaded singleton implementation so -// it is important to be sure that the first use of this -// singleton is when the program is still single threaded Plugin::Plugins& thePlugins() { + // This is a single threaded singleton implementation so + // it is important to be sure that the first use of this + // singleton is when the program is still single threaded static Plugin::Plugins plugins; - return plugins; } } @@ -42,8 +42,13 @@ Plugin::~Plugin() {} Options* Plugin::getOptions() { return 0; } -const Plugin::Plugins& Plugin::getPlugins() { - return thePlugins(); +const Plugin::Plugins& Plugin::getPlugins() { return thePlugins(); } + +void Plugin::addOptions(Options& opts) { + for (Plugins::const_iterator i = getPlugins().begin(); i != getPlugins().end(); ++i) { + if ((*i)->getOptions()) + opts.add(*(*i)->getOptions()); + } } } // namespace qpid diff --git a/cpp/src/qpid/Plugin.h b/cpp/src/qpid/Plugin.h index 7b01c83273..3ead770129 100644 --- a/cpp/src/qpid/Plugin.h +++ b/cpp/src/qpid/Plugin.h @@ -88,6 +88,9 @@ class Plugin : boost::noncopyable * Caller must not delete plugin pointers. */ static const Plugins& getPlugins(); + + /** For each registered plugin, add plugin.getOptions() to opts. */ + static void addOptions(Options& opts); }; } // namespace qpid diff --git a/cpp/src/qpid/cluster/Cpg.cpp b/cpp/src/qpid/cluster/Cpg.cpp index 01d97d2a17..ce8aa0dc33 100644 --- a/cpp/src/qpid/cluster/Cpg.cpp +++ b/cpp/src/qpid/cluster/Cpg.cpp @@ -92,7 +92,7 @@ Cpg::Cpg(Handler& h) : handler(h) { cpg_callbacks_t callbacks = { &globalDeliver, &globalConfigChange }; check(cpg_initialize(&handle, &callbacks), "Cannot initialize CPG"); handles.put(handle, &handler); - QPID_LOG(debug, "Initialize CPG handle " << handle); + QPID_LOG(debug, "Initialize CPG handle 0x" << std::hex << handle); } Cpg::~Cpg() { -- cgit v1.2.1