diff options
Diffstat (limited to 'qpid/cpp/src/tests/ClusterFixture.h')
-rw-r--r-- | qpid/cpp/src/tests/ClusterFixture.h | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/qpid/cpp/src/tests/ClusterFixture.h b/qpid/cpp/src/tests/ClusterFixture.h index 1617ce5e5b..d1acfaa9cb 100644 --- a/qpid/cpp/src/tests/ClusterFixture.h +++ b/qpid/cpp/src/tests/ClusterFixture.h @@ -67,37 +67,32 @@ using qpid::cluster::Cluster; * process, all others are forked as children. */ class ClusterFixture : public vector<uint16_t> { - string name; - std::auto_ptr<BrokerFixture> localBroker; - int localIndex; - std::vector<shared_ptr<ForkedBroker> > forkedBrokers; - public: + typedef std::vector<std::string> 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<BrokerFixture> localBroker; + int localIndex; + std::vector<shared_ptr<ForkedBroker> > forkedBrokers; + Args userArgs; }; |