namespace testing {
-
+// TODO: fix types (code to int, etc.)
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 {
}
-
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; }
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();