X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Ftesting%2FTestCondition.cpp;h=e82e52eea13ee7ceaeeb914a9e8e6224eb74a19d;hb=4275d46f5d3c3a150ced258ae20c985520f6477a;hp=fcb3c089651b017ae79af19d0ed2ff3a5229cb98;hpb=9fa68da11c56250017da9735e4a5dd3fd3b2021b;p=anna.git diff --git a/source/testing/TestCondition.cpp b/source/testing/TestCondition.cpp index fcb3c08..e82e52e 100644 --- a/source/testing/TestCondition.cpp +++ b/source/testing/TestCondition.cpp @@ -10,7 +10,7 @@ #include // Project -#include +#include #include #include @@ -28,34 +28,24 @@ using namespace anna::testing; -const char* TestCondition::asText(const Type::_v type) -throw() { +const char* TestDiameterCondition::asText(const Type::_v type) +{ static const char* text [] = { "RegexpXml", "RegexpHex", "Fields" }; return text [type]; } -bool TestCondition::exists() const throw() { +bool TestDiameterCondition::exists() const { if (a_type != Type::Fields) return (getRegexp() != ""); return (a_code != "" || a_bitR != "" || a_hopByHop != "" || a_applicationId != "" || a_sessionId != "" || a_resultCode != "" || a_msisdn != "" || a_imsi != "" || a_serviceContextId != ""); } -bool TestCondition::comply(const anna::DataBlock &message) const throw() { +bool TestDiameterCondition::comply(const anna::DataBlock &message) const { if (a_type == Type::RegexpXml) { anna::diameter::codec::Message codecMsg; try { codecMsg.decode(message); } catch (anna::RuntimeException &ex) { ex.trace(); } - - //return codecMsg.isLike(getRegexp()); - // We will remove LF from both sides to ease regexp management: - std::string regexp = getRegexp(); - regexp.erase(std::remove(regexp.begin(), regexp.end(), '\n'), regexp.end()); - anna::RegularExpression re(regexp); - - std::string msgString = codecMsg.asXMLString(); - msgString.erase(std::remove(msgString.begin(), msgString.end(), '\n'), msgString.end()); - - return re.isLike(msgString); + return codecMsg.isLike(getRegexp()); } else if (a_type == Type::RegexpHex) { anna::RegularExpression re(getRegexp()); @@ -147,9 +137,9 @@ bool TestCondition::comply(const anna::DataBlock &message) const throw() { return true; } -anna::xml::Node* TestCondition::asXML(anna::xml::Node* parent) const -throw() { - anna::xml::Node* result = parent->createChild("TestCondition"); +anna::xml::Node* TestDiameterCondition::asXML(anna::xml::Node* parent) const +{ + anna::xml::Node* result = parent->createChild("TestDiameterCondition"); if (!exists()) return result; if (a_type == Type::RegexpXml) {