1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_testing_TestCondition_hpp
10 #define anna_testing_TestCondition_hpp
16 #include <anna/core/DataBlock.hpp>
31 struct Type { enum _v { Generic, Basic }; };
32 static const char* asText(const Type::_v type) throw();
34 TestCondition() : a_rcvFromEntity(true),
36 a_code(""), a_bitR(""), a_hopByHop(""), a_applicationId(""),
37 a_sessionId(""), a_resultCode(""),
38 a_msisdn(""), a_imsi(""), a_serviceContextId("") { a_type = Type::Basic; }
41 // Source of the received message
42 void setReceivedFromEntity(bool rfe) throw() { a_rcvFromEntity = rfe; }
43 bool receivedFromEntity() const throw() { return a_rcvFromEntity; }
46 void setRegexp(const std::string ®exp) throw() { a_regexp = regexp; }
48 void setCode(const std::string &value) throw() { a_code = value; }
49 void setBitR(const std::string &value) throw() { a_bitR = value; }
50 void setHopByHop(const std::string &value) throw() { a_hopByHop = value; }
51 void setApplicationId(const std::string &value) throw() { a_applicationId = value; }
52 void setSessionId(const std::string &value) throw() { a_sessionId = value; }
53 void setResultCode(const std::string &value) throw() { a_resultCode = value; }
54 void setMsisdn(const std::string &value) throw() { a_msisdn = value; }
55 void setImsi(const std::string &value) throw() { a_imsi = value; }
56 void setServiceContextId(const std::string &value) throw() { a_serviceContextId = value; }
58 bool exists() const throw();
59 friend bool operator==(const TestCondition &c1, const TestCondition &c2) throw() {
61 if (c1.getType() != c2.getType()) return false;
63 if (c1.getType() == TestCondition::Type::Generic) {
64 if (c1.getRegexp() != c2.getRegexp()) return false;
67 if (c1.getCode() != c2.getCode()) return false;
68 if (c1.getBitR() != c2.getBitR()) return false;
69 if (c1.getHopByHop() != c2.getHopByHop()) return false;
70 if (c1.getApplicationId() != c2.getApplicationId()) return false;
71 if (c1.getSessionId() != c2.getSessionId()) return false;
72 if (c1.getResultCode() != c2.getResultCode()) return false;
73 if (c1.getMsisdn() != c2.getMsisdn()) return false;
74 if (c1.getImsi() != c2.getImsi()) return false;
75 if (c1.getServiceContextId() != c2.getServiceContextId()) return false;
83 const Type::_v &getType() const throw() { return a_type; }
86 const std::string & getRegexp() const throw() { return a_regexp; }
88 const std::string & getCode() const throw() { return a_code; }
89 const std::string & getBitR() const throw() { return a_bitR; }
90 const std::string & getHopByHop() const throw() { return a_hopByHop; }
91 const std::string & getApplicationId() const throw() { return a_applicationId; }
92 const std::string & getSessionId() const throw() { return a_sessionId; }
93 const std::string & getResultCode() const throw() { return a_resultCode; }
94 const std::string & getMsisdn() const throw() { return a_msisdn; }
95 const std::string & getImsi() const throw() { return a_imsi; }
96 const std::string & getServiceContextId() const throw() { return a_serviceContextId; }
99 bool comply (const anna::DataBlock &message/*, bool matchSessionId*/) const throw();
102 anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
107 // Source of the received message
108 bool a_rcvFromEntity;
114 std::string a_regexp;
119 std::string a_hopByHop;
120 std::string a_applicationId;
121 std::string a_sessionId;
122 std::string a_resultCode;
123 std::string a_msisdn;
125 std::string a_serviceContextId;