X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Ftesting%2FTestCondition.cpp;h=e82e52eea13ee7ceaeeb914a9e8e6224eb74a19d;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hp=6f0bba0d899882916e5bfd1b82ae91abe8ce4b70;hpb=2e2f6d4e2ffe1c8b86c812807f0e501ab78f56f9;p=anna.git diff --git a/source/testing/TestCondition.cpp b/source/testing/TestCondition.cpp index 6f0bba0..e82e52e 100644 --- a/source/testing/TestCondition.cpp +++ b/source/testing/TestCondition.cpp @@ -29,33 +29,23 @@ using namespace anna::testing; const char* TestDiameterCondition::asText(const Type::_v type) -throw() { +{ static const char* text [] = { "RegexpXml", "RegexpHex", "Fields" }; return text [type]; } -bool TestDiameterCondition::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 TestDiameterCondition::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()); @@ -148,7 +138,7 @@ bool TestDiameterCondition::comply(const anna::DataBlock &message) const throw() } anna::xml::Node* TestDiameterCondition::asXML(anna::xml::Node* parent) const -throw() { +{ anna::xml::Node* result = parent->createChild("TestDiameterCondition"); if (!exists()) return result;