X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=include%2Fanna%2Ftesting%2FTestCondition.hpp;h=ad29dc31582ca8b974fee4b7db94e4d870c74caf;hp=25350c8a478bb17ccaacf9af1370f1b5b28bd126;hb=9fa68da11c56250017da9735e4a5dd3fd3b2021b;hpb=d30d9e082885e16f0098a699a3b79f53fb28910b diff --git a/include/anna/testing/TestCondition.hpp b/include/anna/testing/TestCondition.hpp index 25350c8..ad29dc3 100644 --- a/include/anna/testing/TestCondition.hpp +++ b/include/anna/testing/TestCondition.hpp @@ -28,39 +28,46 @@ class TestCondition { public: - struct Type { enum _v { Generic, Basic }; }; + // RegexpXml = Regexp against XML representation for incoming messages + // RegexpHex = Regexp against HEX representation for incoming messages + // Fields = Compare specific message fields + struct Type { enum _v { RegexpXml, RegexpHex, Fields }; }; static const char* asText(const Type::_v type) throw(); TestCondition() : a_rcvFromEntity(true), + a_regexp(""), + a_code(""), a_bitR(""), a_hopByHop(""), a_applicationId(""), a_sessionId(""), a_resultCode(""), - a_msisdn(""), a_imsi(""), a_serviceContextId("") { a_type = Type::Basic; } + a_msisdn(""), a_imsi(""), a_serviceContextId("") { a_type = Type::Fields; } // Source of the received message void setReceivedFromEntity(bool rfe) throw() { a_rcvFromEntity = rfe; } bool receivedFromEntity() const throw() { return a_rcvFromEntity; } - // Generic - void setRegexp(const std::string ®exp) throw() { a_regexp = regexp; } - // Basic - void setCode(const std::string &value) throw() { a_code = value; } - void setBitR(const std::string &value) throw() { a_bitR = value; } - void setHopByHop(const std::string &value) throw() { a_hopByHop = value; } - void setApplicationId(const std::string &value) throw() { a_applicationId = value; } - void setSessionId(const std::string &value) throw() { a_sessionId = value; } - void setResultCode(const std::string &value) throw() { a_resultCode = value; } - void setMsisdn(const std::string &value) throw() { a_msisdn = value; } - void setImsi(const std::string &value) throw() { a_imsi = value; } - void setServiceContextId(const std::string &value) throw() { a_serviceContextId = value; } + // Regexp + void setRegexpXml(const std::string ®exp) throw() { a_regexp = regexp; a_type = Type::RegexpXml; } + void setRegexpHex(const std::string ®exp) throw() { a_regexp = regexp; a_type = Type::RegexpHex; } + + // Fields + void setCode(const std::string &value) throw() { a_code = value; a_type = Type::Fields; } + void setBitR(const std::string &value) throw() { a_bitR = value; a_type = Type::Fields; } + void setHopByHop(const std::string &value) throw() { a_hopByHop = value; a_type = Type::Fields; } + void setApplicationId(const std::string &value) throw() { a_applicationId = value; a_type = Type::Fields; } + void setSessionId(const std::string &value) throw() { a_sessionId = value; a_type = Type::Fields; } + void setResultCode(const std::string &value) throw() { a_resultCode = value; a_type = Type::Fields; } + void setMsisdn(const std::string &value) throw() { a_msisdn = value; a_type = Type::Fields; } + void setImsi(const std::string &value) throw() { a_imsi = value; a_type = Type::Fields; } + void setServiceContextId(const std::string &value) throw() { a_serviceContextId = value; a_type = Type::Fields; } bool exists() const throw(); friend bool operator==(const TestCondition &c1, const TestCondition &c2) throw() { if (c1.getType() != c2.getType()) return false; - if (c1.getType() == TestCondition::Type::Generic) { + if (c1.getType() == TestCondition::Type::RegexpXml || c1.getType() == TestCondition::Type::RegexpHex) { if (c1.getRegexp() != c2.getRegexp()) return false; } else { @@ -79,10 +86,9 @@ class TestCondition { } - const Type::_v &getType() const throw() { return a_type; } - // Generic + // Regexp: const std::string & getRegexp() const throw() { return a_regexp; } // Basic const std::string & getCode() const throw() { return a_code; } @@ -96,8 +102,7 @@ class TestCondition { const std::string & getServiceContextId() const throw() { return a_serviceContextId; } - bool comply (const anna::DataBlock &message/*, bool matchSessionId*/) const throw(); - + bool comply (const anna::DataBlock &message) const throw(); anna::xml::Node* asXML(anna::xml::Node* parent) const throw();