diff options
| author | Charles E. Rolke <chug@apache.org> | 2013-04-29 20:20:23 +0000 |
|---|---|---|
| committer | Charles E. Rolke <chug@apache.org> | 2013-04-29 20:20:23 +0000 |
| commit | c150b7c6ff4f9bf0cad4110ef1d3075c02ac8dfe (patch) | |
| tree | b6552a1dda15d48bbf2a57bd8bd0c60b14c3a5be /cpp/src/qpid | |
| parent | 9ebd425c617b2433f54cbb088426dccad4764310 (diff) | |
| download | qpid-python-c150b7c6ff4f9bf0cad4110ef1d3075c02ac8dfe.tar.gz | |
QPID-4720: C++ Broker headers exchange tests not using run-time comaprisons.
Main code modified only slighty so that tests can hook into actual logic.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1477317 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/broker/HeadersExchange.cpp | 42 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/HeadersExchange.h | 2 |
2 files changed, 6 insertions, 38 deletions
diff --git a/cpp/src/qpid/broker/HeadersExchange.cpp b/cpp/src/qpid/broker/HeadersExchange.cpp index 2d7c33abed..7acdffce4d 100644 --- a/cpp/src/qpid/broker/HeadersExchange.cpp +++ b/cpp/src/qpid/broker/HeadersExchange.cpp @@ -286,9 +286,7 @@ void HeadersExchange::route(Deliverable& msg) Bindings::ConstPtr p = bindings.snapshot(); if (p.get()) { for (std::vector<BoundKey>::const_iterator i = p->begin(); i != p->end(); ++i) { - Matcher matcher(i->args); - msg.getMessage().processProperties(matcher); - if (matcher.matches()) { + if (match(i->args, msg.getMessage())) { b->push_back(i->binding); } } @@ -340,40 +338,10 @@ namespace } - -bool HeadersExchange::match(const FieldTable& bind, const FieldTable& msg) { - typedef FieldTable::ValueMap Map; - std::string what = getMatch(&bind); - if (what == all) { - for (Map::const_iterator i = bind.begin(); - i != bind.end(); - ++i) - { - if (i->first != x_match) - { - Map::const_iterator j = msg.find(i->first); - if (j == msg.end()) return false; - if (!match_values(*(i->second), *(j->second))) return false; - } - } - return true; - } else if (what == any) { - for (Map::const_iterator i = bind.begin(); - i != bind.end(); - ++i) - { - if (i->first != x_match) - { - Map::const_iterator j = msg.find(i->first); - if (j != msg.end()) { - if (match_values(*(i->second), *(j->second))) return true; - } - } - } - return false; - } else { - return false; - } +bool HeadersExchange::match(const FieldTable& bindArgs, const Message& msg) { + Matcher matcher(bindArgs); + msg.processProperties(matcher); + return matcher.matches(); } bool HeadersExchange::equal(const FieldTable& a, const FieldTable& b) { diff --git a/cpp/src/qpid/broker/HeadersExchange.h b/cpp/src/qpid/broker/HeadersExchange.h index 67ba793ba8..c96c5bc790 100644 --- a/cpp/src/qpid/broker/HeadersExchange.h +++ b/cpp/src/qpid/broker/HeadersExchange.h @@ -106,7 +106,7 @@ class HeadersExchange : public virtual Exchange { virtual bool supportsDynamicBinding() { return true; } - static QPID_BROKER_EXTERN bool match(const qpid::framing::FieldTable& bindArgs, const qpid::framing::FieldTable& msgArgs); + static QPID_BROKER_EXTERN bool match(const qpid::framing::FieldTable& bindArgs, const qpid::broker::Message& msg); static bool equal(const qpid::framing::FieldTable& bindArgs, const qpid::framing::FieldTable& msgArgs); }; |
