diff options
| author | Alan Conway <aconway@apache.org> | 2009-02-12 15:27:11 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2009-02-12 15:27:11 +0000 |
| commit | 271613450a1b10adf6e427f2369094c83a81f91d (patch) | |
| tree | 0903040315c246be9264134962a315b5d1846752 /cpp/src/tests/ClusterFixture.h | |
| parent | 463bd9c4276c74b68a84e4620a4bb2c29473273c (diff) | |
| download | qpid-python-271613450a1b10adf6e427f2369094c83a81f91d.tar.gz | |
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
Diffstat (limited to 'cpp/src/tests/ClusterFixture.h')
| -rw-r--r-- | cpp/src/tests/ClusterFixture.h | 33 |
1 files changed, 14 insertions, 19 deletions
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<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; }; |
