X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=include%2Fanna%2Ftesting%2FTestStep.hpp;h=8f771cc93b5ff35f111b65ff94f73b7c88ac206b;hp=844b6bec797c5d81bf75f322dd580dc728dccd84;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hpb=af9c86ffb0e28d35ad94d99c5f77e41578c972b4 diff --git a/include/anna/testing/TestStep.hpp b/include/anna/testing/TestStep.hpp index 844b6be..8f771cc 100644 --- a/include/anna/testing/TestStep.hpp +++ b/include/anna/testing/TestStep.hpp @@ -50,32 +50,32 @@ class TestStep { anna::Millisecond a_endTimestamp; // unix time bool a_executed; // used for interactive mode in order to not repeat a execution step if before completing, the user add interactive amount - void setBeginTimestamp(const anna::Millisecond &t) throw() { a_beginTimestamp = t; } - const anna::Millisecond &getBeginTimestamp() const throw() { return a_beginTimestamp; } - void setEndTimestamp(const anna::Millisecond &t) throw() { a_endTimestamp = t; } - const anna::Millisecond &getEndTimestamp() const throw() { return a_endTimestamp; } + void setBeginTimestamp(const anna::Millisecond &t) { a_beginTimestamp = t; } + const anna::Millisecond &getBeginTimestamp() const { return a_beginTimestamp; } + void setEndTimestamp(const anna::Millisecond &t) { a_endTimestamp = t; } + const anna::Millisecond &getEndTimestamp() const { return a_endTimestamp; } void initialize(TestCase *testCase); public: struct Type { enum _v { Unconfigured, Timeout, Sendxml2e, Sendxml2c, Delay, Wait, Cmd, IpLimit }; }; - static const char* asText(const Type::_v type) throw(); + static const char* asText(const Type::_v type) ; TestStep(TestCase *testCase) : a_message(true), a_messageCodec(NULL), a_executed(false) { initialize(testCase); } virtual ~TestStep() {;} // setter & getters - const Type::_v &getType() const throw() { return a_type; } - const int &getNumber() const throw() { return a_number; } - bool isCompleted() const throw() { return a_completed; } - anna::Millisecond getLapseMs() const throw() { return a_endTimestamp - a_beginTimestamp; } - - bool execute() throw(); - void complete() throw(); - void reset() throw(); - void next() throw(); - virtual anna::xml::Node* asXML(anna::xml::Node* parent) throw(); - std::string asXMLString() throw(); + const Type::_v &getType() const { return a_type; } + const int &getNumber() const { return a_number; } + bool isCompleted() const { return a_completed; } + anna::Millisecond getLapseMs() const { return a_endTimestamp - a_beginTimestamp; } + + bool execute() ; + void complete() ; + void reset() ; + void next() ; + virtual anna::xml::Node* asXML(anna::xml::Node* parent) ; + std::string asXMLString() ; protected: TestCase *a_testCase; @@ -85,14 +85,14 @@ class TestStep { // Message (not for all step types) anna::DataBlock a_message; anna::diameter::codec::Message *a_messageCodec; // used as helper and for traffic logs - bool decodeMessage(bool trust = false) throw(); // If trust=true: decoding the previously encoded message (sendxml sentences). + bool decodeMessage(bool trust = false) ; // If trust=true: decoding the previously encoded message (sendxml sentences). // The only error would be validation ones, and we are going to ignore them here. - virtual bool do_execute() throw() = 0; // returns true if next step must be executed - virtual void do_complete() throw() = 0; // end of transaction (delay/timeout expired, wait condition fulfilled, sending done) + virtual bool do_execute() = 0; // returns true if next step must be executed + virtual void do_complete() = 0; // end of transaction (delay/timeout expired, wait condition fulfilled, sending done) // In all cases, the next step will be executed except 'timeout' which is asynchronous // and will move to the next step just after timer creation (no complete waited) - virtual void do_reset() throw() = 0; + virtual void do_reset() = 0; }; @@ -106,15 +106,15 @@ class TestStepTimeout : public TestStep { ~TestStepTimeout() { do_reset(); } // setter & getters - void setTimeout(const anna::Millisecond &t) throw() { a_timeout = t; } - const anna::Millisecond &getTimeout() const throw() { return a_timeout; } + void setTimeout(const anna::Millisecond &t) { a_timeout = t; } + const anna::Millisecond &getTimeout() const { return a_timeout; } // virtuals - bool do_execute() throw(); - void do_complete() throw(); // timeout reached, test case failed - void do_reset() throw(); - void cancelTimer() throw(); - anna::xml::Node* asXML(anna::xml::Node* parent) throw(); + bool do_execute() ; + void do_complete() ; // timeout reached, test case failed + void do_reset() ; + void cancelTimer() ; + anna::xml::Node* asXML(anna::xml::Node* parent) ; }; @@ -138,18 +138,18 @@ class TestStepSendDiameterXml : public TestStep { ~TestStepSendDiameterXml() { do_reset(); } // setter & getters - void setOriginHost(anna::diameter::comm::OriginHost *host) throw() { a_originHost = host; } - anna::diameter::comm::OriginHost *getOriginHost() const throw() { return a_originHost; } - void setWaitForRequestStepNumber(int stepNumber) throw() { a_waitForRequestStepNumber = stepNumber; } - int getWaitForRequestStepNumber() const throw() { return a_waitForRequestStepNumber; } - void setMsgDataBlock(const anna::DataBlock &db) throw() { a_message = db; } - const anna::DataBlock &getMsgDataBlock() const throw() { return a_message; } + void setOriginHost(anna::diameter::comm::OriginHost *host) { a_originHost = host; } + anna::diameter::comm::OriginHost *getOriginHost() const { return a_originHost; } + void setWaitForRequestStepNumber(int stepNumber) { a_waitForRequestStepNumber = stepNumber; } + int getWaitForRequestStepNumber() const { return a_waitForRequestStepNumber; } + void setMsgDataBlock(const anna::DataBlock &db) { a_message = db; } + const anna::DataBlock &getMsgDataBlock() const { return a_message; } // virtuals - bool do_execute() throw(); - void do_complete() throw() {;} - void do_reset() throw(); - anna::xml::Node* asXML(anna::xml::Node* parent) throw(); + bool do_execute() ; + void do_complete() {;} + void do_reset() ; + anna::xml::Node* asXML(anna::xml::Node* parent) ; }; class TestStepSendDiameterXml2e : public TestStepSendDiameterXml { @@ -172,15 +172,15 @@ class TestStepDelay : public TestStep { ~TestStepDelay() { do_reset(); } // setter & getters - void setDelay(const anna::Millisecond &d) throw() { a_delay = d; } - const anna::Millisecond &getDelay() const throw() { return a_delay; } + void setDelay(const anna::Millisecond &d) { a_delay = d; } + const anna::Millisecond &getDelay() const { return a_delay; } // virtuals - bool do_execute() throw(); - void do_complete() throw(); // delay reached - void do_reset() throw(); - void cancelTimer() throw(); - anna::xml::Node* asXML(anna::xml::Node* parent) throw(); + bool do_execute() ; + void do_complete() ; // delay reached + void do_reset() ; + void cancelTimer() ; + anna::xml::Node* asXML(anna::xml::Node* parent) ; }; @@ -202,26 +202,26 @@ class TestStepWaitDiameter : public TestStep { void setCondition(bool fromEntity, const std::string &code, const std::string &bitR, const std::string &hopByHop, const std::string &applicationId, const std::string &sessionId, const std::string &resultCode, - const std::string &msisdn, const std::string &imsi, const std::string &serviceContextId) throw(); - void setConditionRegexpXml(bool fromEntity, const std::string ®exp) throw(); - void setConditionRegexpHex(bool fromEntity, const std::string ®exp) throw(); + const std::string &msisdn, const std::string &imsi, const std::string &serviceContextId) ; + void setConditionRegexpXml(bool fromEntity, const std::string ®exp) ; + void setConditionRegexpHex(bool fromEntity, const std::string ®exp) ; - void setClientSession(anna::diameter::comm::ClientSession *cs) throw() { a_clientSession = cs; } - void setServerSession(anna::diameter::comm::ServerSession *ss) throw() { a_serverSession = ss; } - anna::diameter::comm::ClientSession *getClientSession() const throw() { return a_clientSession; } - anna::diameter::comm::ServerSession *getServerSession() const throw() { return a_serverSession; } + void setClientSession(anna::diameter::comm::ClientSession *cs) { a_clientSession = cs; } + void setServerSession(anna::diameter::comm::ServerSession *ss) { a_serverSession = ss; } + anna::diameter::comm::ClientSession *getClientSession() const { return a_clientSession; } + anna::diameter::comm::ServerSession *getServerSession() const { return a_serverSession; } - const TestDiameterCondition &getCondition() const throw() { return a_condition; } - //void setMsgDataBlock(const anna::DataBlock &db) throw() { a_message = db; } - bool fulfilled(const anna::DataBlock &db/*, bool matchSessionId = true*/) throw(); - const anna::DataBlock &getMsgDataBlock() const throw() { return a_message; } + const TestDiameterCondition &getCondition() const { return a_condition; } + //void setMsgDataBlock(const anna::DataBlock &db) { a_message = db; } + bool fulfilled(const anna::DataBlock &db/*, bool matchSessionId = true*/) ; + const anna::DataBlock &getMsgDataBlock() const { return a_message; } // virtuals - bool do_execute() throw(); // this will be executed when test case starts (at least we could measure the time until condition is fulfilled) - void do_complete() throw(); // condition fulfilled - void do_reset() throw(); - anna::xml::Node* asXML(anna::xml::Node* parent) throw(); + bool do_execute() ; // this will be executed when test case starts (at least we could measure the time until condition is fulfilled) + void do_complete() ; // condition fulfilled + void do_reset() ; + anna::xml::Node* asXML(anna::xml::Node* parent) ; }; @@ -242,28 +242,28 @@ class TestStepCmd : public TestStep { ~TestStepCmd() { do_reset(); } // setter & getters - void setThreadRunning() throw() { a_threadRunning = true; } - void setThreadNotRunning() throw() { a_threadRunning = false; } - bool threadRunning() const throw() { return a_threadRunning; } - bool threadNotRunning() const throw() { return !a_threadRunning; } - - void setResultCode(int rc) throw() { a_resultCode = rc; } - int getResultCode() const throw() { return a_resultCode; } - void setErrorMsg(const std::string &em) throw() { a_errorMsg = em; } - const std::string &getErrorMsg() const throw() { return a_errorMsg; } - //void appendOutput(const std::string &output) throw() { a_output += output; } - //const std::string &getOutput() const throw() { return a_output; } - void setChildPid(pid_t pid) throw() { a_childPid = pid; } - const pid_t &getChildPid() const throw() { return a_childPid; } - - void setScript(const std::string &script) throw() { a_script = script; } - const std::string &getScript() const throw() { return a_script; } + void setThreadRunning() { a_threadRunning = true; } + void setThreadNotRunning() { a_threadRunning = false; } + bool threadRunning() const { return a_threadRunning; } + bool threadNotRunning() const { return !a_threadRunning; } + + void setResultCode(int rc) { a_resultCode = rc; } + int getResultCode() const { return a_resultCode; } + void setErrorMsg(const std::string &em) { a_errorMsg = em; } + const std::string &getErrorMsg() const { return a_errorMsg; } + //void appendOutput(const std::string &output) { a_output += output; } + //const std::string &getOutput() const { return a_output; } + void setChildPid(pid_t pid) { a_childPid = pid; } + const pid_t &getChildPid() const { return a_childPid; } + + void setScript(const std::string &script) { a_script = script; } + const std::string &getScript() const { return a_script; } // virtuals - bool do_execute() throw(); - void do_complete() throw(); - void do_reset() throw(); - anna::xml::Node* asXML(anna::xml::Node* parent) throw(); + bool do_execute() ; + void do_complete() ; + void do_reset() ; + anna::xml::Node* asXML(anna::xml::Node* parent) ; }; @@ -276,14 +276,14 @@ class TestStepIpLimit : public TestStep { ~TestStepIpLimit() { do_reset(); } // setter & getters - void setIpLimit(unsigned int limit) throw() { a_ipLimit = limit; } - unsigned int getIpLimit() const throw() { return a_ipLimit; } + void setIpLimit(unsigned int limit) { a_ipLimit = limit; } + unsigned int getIpLimit() const { return a_ipLimit; } // virtuals - bool do_execute() throw(); - void do_complete() throw(); - void do_reset() throw() {;} - anna::xml::Node* asXML(anna::xml::Node* parent) throw(); + bool do_execute() ; + void do_complete() ; + void do_reset() {;} + anna::xml::Node* asXML(anna::xml::Node* parent) ; }; }