diff options
author | Ted Ross <tross@apache.org> | 2012-06-08 20:39:30 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2012-06-08 20:39:30 +0000 |
commit | f07e81db3e310ccc39d5d49fe525b56857804a3c (patch) | |
tree | 80fc8b9e9de04b1678fbaabef5f468fac5206a42 /qpid/cpp/src/tests/TopicExchangeTest.cpp | |
parent | 0a79a0e69e94e5235d59f6764cf5976f4d8a8380 (diff) | |
download | qpid-python-f07e81db3e310ccc39d5d49fe525b56857804a3c.tar.gz |
QPID-4048 - Rafactor of TopicExchange to isolate the binding-key data structure.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1348233 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/TopicExchangeTest.cpp')
-rw-r--r-- | qpid/cpp/src/tests/TopicExchangeTest.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/qpid/cpp/src/tests/TopicExchangeTest.cpp b/qpid/cpp/src/tests/TopicExchangeTest.cpp index ff8931f9c9..d57951ea3f 100644 --- a/qpid/cpp/src/tests/TopicExchangeTest.cpp +++ b/qpid/cpp/src/tests/TopicExchangeTest.cpp @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +#include "qpid/broker/TopicKeyNode.h" #include "qpid/broker/TopicExchange.h" #include "unit_test.h" #include "test_tools.h" @@ -32,14 +33,15 @@ class TopicExchange::TopicExchangeTester { public: typedef std::vector<std::string> BindingVec; + typedef TopicKeyNode<TopicExchange::BindingKey> TestBindingNode; private: // binding node iterator that collects all routes that are bound - class TestFinder : public TopicExchange::BindingNode::TreeIterator { + class TestFinder : public TestBindingNode::TreeIterator { public: TestFinder(BindingVec& m) : bv(m) {}; ~TestFinder() {}; - bool visit(BindingNode& node) { + bool visit(TestBindingNode& node) { if (!node.bindings.bindingVector.empty()) bv.push_back(node.routePattern); return true; @@ -53,7 +55,7 @@ public: ~TopicExchangeTester() {}; bool addBindingKey(const std::string& bKey) { string routingPattern = normalize(bKey); - BindingKey *bk = bindingTree.addBindingKey(routingPattern); + BindingKey *bk = bindingTree.add(routingPattern); if (bk) { // push a dummy binding to mark this node as "non-leaf" bk->bindingVector.push_back(Binding::shared_ptr()); @@ -64,12 +66,12 @@ public: bool removeBindingKey(const std::string& bKey){ string routingPattern = normalize(bKey); - BindingKey *bk = bindingTree.getBindingKey(routingPattern); + BindingKey *bk = bindingTree.get(routingPattern); if (bk) { bk->bindingVector.pop_back(); if (bk->bindingVector.empty()) { // no more bindings - remove this node - bindingTree.removeBindingKey(routingPattern); + bindingTree.remove(routingPattern); } return true; } @@ -87,7 +89,7 @@ public: } private: - TopicExchange::BindingNode bindingTree; + TestBindingNode bindingTree; }; } // namespace broker |