From 271613450a1b10adf6e427f2369094c83a81f91d Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 12 Feb 2009 15:27:11 +0000 Subject: Allow passing extra argv arguments to ClusterFixture. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@743779 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/ClusterFixture.h | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'cpp/src/tests/ClusterFixture.h') diff --git a/cpp/src/tests/ClusterFixture.h b/cpp/src/tests/ClusterFixture.h index 1617ce5e5b..d1acfaa9cb 100644 --- a/cpp/src/tests/ClusterFixture.h +++ b/cpp/src/tests/ClusterFixture.h @@ -67,37 +67,32 @@ using qpid::cluster::Cluster; * process, all others are forked as children. */ class ClusterFixture : public vector { - string name; - std::auto_ptr localBroker; - int localIndex; - std::vector > forkedBrokers; - public: + typedef std::vector Args; /** @param localIndex can be -1 meaning don't automatically start a local broker. * A local broker can be started with addLocal(). */ - ClusterFixture(size_t n, int localIndex=0); + ClusterFixture(size_t n, int localIndex=0, const Args& args=Args()); void add(size_t n) { for (size_t i=0; i < n; ++i) add(); } void add(); // Add a broker. - void addLocal(); // Add a local broker. void setup(); - bool hasLocal() const { return localIndex >= 0 && size_t(localIndex) < size(); } + bool hasLocal() const; /** Kill a forked broker with sig, or shutdown localBroker if n==0. */ - void kill(size_t n, int sig=SIGINT) { - if (n == size_t(localIndex)) - localBroker->broker->shutdown(); - else - forkedBrokers[n]->kill(sig); - } + void kill(size_t n, int sig=SIGINT); /** Kill a broker and suppressing errors from closing connection c. */ - void killWithSilencer(size_t n, client::Connection& c, int sig=SIGINT) { - ScopedSuppressLogging sl; - kill(n,sig); - try { c.close(); } catch(...) {} - } + void killWithSilencer(size_t n, client::Connection& c, int sig=SIGINT); + + private: + void addLocal(); // Add a local broker. + Args makeArgs(const std::string& prefix); + string name; + std::auto_ptr localBroker; + int localIndex; + std::vector > forkedBrokers; + Args userArgs; }; -- cgit v1.2.1