diff options
author | Ted Ross <tross@apache.org> | 2009-08-25 16:48:03 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2009-08-25 16:48:03 +0000 |
commit | 24a9ab133d6cc7d765c1bc1c6c9eaf83b2d3cdd2 (patch) | |
tree | d61979385e948db50b64beb729e817bd68c0af21 /cpp/src | |
parent | 41c5a4f995cf16505f92257a0aa08ae967c8d466 (diff) | |
download | qpid-python-24a9ab133d6cc7d765c1bc1c6c9eaf83b2d3cdd2.tar.gz |
Added management visibility into the alternate exchange and auto-delete attributes
of an exchange.
Note that auto-delete is not implemented for exchanges.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@807712 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/broker/Exchange.cpp | 19 | ||||
-rw-r--r-- | cpp/src/qpid/broker/Exchange.h | 2 | ||||
-rwxr-xr-x | cpp/src/tests/cli_tests.py | 22 |
3 files changed, 40 insertions, 3 deletions
diff --git a/cpp/src/qpid/broker/Exchange.cpp b/cpp/src/qpid/broker/Exchange.cpp index 17fc0e23ca..b1fc1295f3 100644 --- a/cpp/src/qpid/broker/Exchange.cpp +++ b/cpp/src/qpid/broker/Exchange.cpp @@ -91,7 +91,9 @@ Exchange::Exchange (const string& _name, Manageable* parent, Broker* b) : ManagementAgent* agent = broker->getManagementAgent(); if (agent != 0) { - mgmtExchange = new _qmf::Exchange (agent, this, parent, _name, durable); + mgmtExchange = new _qmf::Exchange (agent, this, parent, _name); + mgmtExchange->set_durable(durable); + mgmtExchange->set_autoDelete(false); agent->addObject (mgmtExchange); } } @@ -109,7 +111,9 @@ Exchange::Exchange(const string& _name, bool _durable, const qpid::framing::Fiel ManagementAgent* agent = broker->getManagementAgent(); if (agent != 0) { - mgmtExchange = new _qmf::Exchange (agent, this, parent, _name, durable); + mgmtExchange = new _qmf::Exchange (agent, this, parent, _name); + mgmtExchange->set_durable(durable); + mgmtExchange->set_autoDelete(false); mgmtExchange->set_arguments(args); if (!durable) { if (name.empty()) { @@ -139,6 +143,17 @@ Exchange::~Exchange () mgmtExchange->resourceDestroy (); } +void Exchange::setAlternate(Exchange::shared_ptr _alternate) +{ + alternate = _alternate; + if (mgmtExchange != 0) { + if (alternate.get() != 0) + mgmtExchange->set_altExchange(alternate->GetManagementObject()->getObjectId()); + else + mgmtExchange->clr_altExchange(); + } +} + void Exchange::setPersistenceId(uint64_t id) const { if (mgmtExchange != 0 && persistenceId == 0) diff --git a/cpp/src/qpid/broker/Exchange.h b/cpp/src/qpid/broker/Exchange.h index ca8525d55e..c1e878200f 100644 --- a/cpp/src/qpid/broker/Exchange.h +++ b/cpp/src/qpid/broker/Exchange.h @@ -132,7 +132,7 @@ public: qpid::framing::FieldTable& getArgs() { return args; } Exchange::shared_ptr getAlternate() { return alternate; } - void setAlternate(Exchange::shared_ptr _alternate) { alternate = _alternate; } + void setAlternate(Exchange::shared_ptr _alternate); void incAlternateUsers() { alternateUsers++; } void decAlternateUsers() { alternateUsers--; } bool inUseAsAlternate() { return alternateUsers > 0; } diff --git a/cpp/src/tests/cli_tests.py b/cpp/src/tests/cli_tests.py index 2af1a20a87..4309b66271 100755 --- a/cpp/src/tests/cli_tests.py +++ b/cpp/src/tests/cli_tests.py @@ -123,6 +123,28 @@ class CliTests(TestBase010): found = True self.assertEqual(found, False) + def test_qpid_config_altex(self): + self.startQmf(); + qmf = self.qmf + exName = "testalt" + altName = "amq.direct" + + ret = os.system(self.command(" add exchange topic %s --alternate-exchange=%s" % (exName, altName))) + self.assertEqual(ret, 0) + + exchanges = qmf.getObjects(_class="exchange") + found = False + for exchange in exchanges: + if exchange.name == altName: + self.assertEqual(exchange.altExchange, None) + + if exchange.name == exName: + found = True + if not exchange.altExchange: + self.fail("Alternate exchange not set") + self.assertEqual(exchange._altExchange_.name, altName) + self.assertEqual(found, True) + def test_qpid_route(self): self.startQmf(); qmf = self.qmf |