X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=include%2Fanna%2Ftesting%2FTestCase.hpp;fp=include%2Fanna%2Ftesting%2FTestCase.hpp;h=6eab8df655699dd650e33609d4815ca4b316f49d;hp=3ebd5354f9dffd3e5b19feac0651053b2c122547;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hpb=af9c86ffb0e28d35ad94d99c5f77e41578c972b4 diff --git a/include/anna/testing/TestCase.hpp b/include/anna/testing/TestCase.hpp index 3ebd535..6eab8df 100644 --- a/include/anna/testing/TestCase.hpp +++ b/include/anna/testing/TestCase.hpp @@ -41,8 +41,8 @@ namespace testing { class TestStepWaitDiameter; class TestCase { - void assertInitialized() const throw(anna::RuntimeException); - void assertMessage(const anna::DataBlock &db, bool toEntity) throw(anna::RuntimeException); + void assertInitialized() const noexcept(false); + void assertMessage(const anna::DataBlock &db, bool toEntity) noexcept(false); public: @@ -56,90 +56,90 @@ public: std::vector a_events; public: - void addHint(const std::string &hint) throw(); - void clear() throw(); - int events() const throw() { return a_events.size(); } - anna::xml::Node* asXML(anna::xml::Node* parent) const throw(); - std::string asString() const throw(); + void addHint(const std::string &hint) ; + void clear() ; + int events() const { return a_events.size(); } + anna::xml::Node* asXML(anna::xml::Node* parent) const ; + std::string asString() const ; }; TestCase(unsigned int id, const std::string &description = ""); ~TestCase(); struct State { enum _v { Initialized, InProgress, Failed, Success }; }; - static const char* asText(const State::_v state) throw(); - const State::_v &getState() const throw() { return a_state; } - const anna::Millisecond &getStartTimestamp() const throw() { return a_startTimestamp; } - const anna::Millisecond &getFinishTimestamp() const throw() { return a_finishTimestamp; } - anna::Millisecond getLapseMs() const throw(); - anna::Millisecond getProcessingTimeMs() const throw(); - void addDebugSummaryHint(const std::string &hint) throw() { a_debugSummary.addHint(hint); } - void setState(const State::_v &state) throw(); - bool isFinished() const throw() { return (getState() == State::Failed || getState() == State::Success); } - bool inProgress() const throw() { return (getState() == State::InProgress); } - bool isFailed() const throw() { return (getState() == State::Failed); } - bool isSuccess() const throw() { return (getState() == State::Success); } - bool hasSameCondition(const TestDiameterCondition &condition) const throw(); - const DebugSummary & getDebugSummary() const throw() { return a_debugSummary; } + static const char* asText(const State::_v state) ; + const State::_v &getState() const { return a_state; } + const anna::Millisecond &getStartTimestamp() const { return a_startTimestamp; } + const anna::Millisecond &getFinishTimestamp() const { return a_finishTimestamp; } + anna::Millisecond getLapseMs() const ; + anna::Millisecond getProcessingTimeMs() const ; + void addDebugSummaryHint(const std::string &hint) { a_debugSummary.addHint(hint); } + void setState(const State::_v &state) ; + bool isFinished() const { return (getState() == State::Failed || getState() == State::Success); } + bool inProgress() const { return (getState() == State::InProgress); } + bool isFailed() const { return (getState() == State::Failed); } + bool isSuccess() const { return (getState() == State::Success); } + bool hasSameCondition(const TestDiameterCondition &condition) const ; + const DebugSummary & getDebugSummary() const { return a_debugSummary; } // Interactivity: - void makeInteractive(bool yes = true) throw() { a_interactiveAmount = (yes ? 0:-1); } - void addInteractiveAmount(unsigned int amount) throw() { + void makeInteractive(bool yes = true) { a_interactiveAmount = (yes ? 0:-1); } + void addInteractiveAmount(unsigned int amount) { if (a_interactiveAmount == -1) makeInteractive(); if (amount == 0) return; a_interactiveAmount += amount; process(); } - int interactiveAmount() const throw() { return a_interactiveAmount; } - void interactiveExecution() throw() { a_interactiveAmount --; } + int interactiveAmount() const { return a_interactiveAmount; } + void interactiveExecution() { a_interactiveAmount --; } // Step type & information - void addTimeout(const anna::Millisecond &timeout) throw(anna::RuntimeException); - void addDelay(const anna::Millisecond &delay) throw(anna::RuntimeException); + void addTimeout(const anna::Millisecond &timeout) noexcept(false); + void addDelay(const anna::Millisecond &delay) noexcept(false); void addWaitDiameter(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(anna::RuntimeException); - void addCommand(const std::string &cmd) throw(anna::RuntimeException); - void addIpLimit(unsigned int ipLimit) throw(anna::RuntimeException); + const std::string &msisdn, const std::string &imsi, const std::string &serviceContextId) noexcept(false); + void addCommand(const std::string &cmd) noexcept(false); + void addIpLimit(unsigned int ipLimit) noexcept(false); // Diameter-specifc - void addSendDiameterXml2e(const anna::DataBlock &db, anna::diameter::comm::OriginHost *host, int stepNumber) throw(anna::RuntimeException); - void addSendDiameterXml2c(const anna::DataBlock &db, anna::diameter::comm::OriginHost *host, int stepNumber) throw(anna::RuntimeException); - void addWaitDiameterAnswer(bool fromEntity, int stepNumber) throw(anna::RuntimeException); - void addWaitDiameterRegexpHex(bool fromEntity, const std::string ®exp) throw(anna::RuntimeException); - void addWaitDiameterRegexpXml(bool fromEntity, const std::string ®exp) throw(anna::RuntimeException); + void addSendDiameterXml2e(const anna::DataBlock &db, anna::diameter::comm::OriginHost *host, int stepNumber) noexcept(false); + void addSendDiameterXml2c(const anna::DataBlock &db, anna::diameter::comm::OriginHost *host, int stepNumber) noexcept(false); + void addWaitDiameterAnswer(bool fromEntity, int stepNumber) noexcept(false); + void addWaitDiameterRegexpHex(bool fromEntity, const std::string ®exp) noexcept(false); + void addWaitDiameterRegexpXml(bool fromEntity, const std::string ®exp) noexcept(false); // Process: - void nextStep() throw() { a_stepsIt++; } - bool done() throw(); - bool process() throw(); // false to stop + void nextStep() { a_stepsIt++; } + bool done() ; + bool process() ; // false to stop // Reset test case and underlaying information (steps context) - bool reset(bool hard /* hard reset includes in-progress test cases */) throw(); + bool reset(bool hard /* hard reset includes in-progress test cases */) ; // Check for clear (destroy steps) bool safeToClear(); // false if something pending (running threads steps) // getters - const unsigned int &getId() const throw() { return a_id; } - const std::string &getDescription() const throw() { return a_description; } + const unsigned int &getId() const { return a_id; } + const std::string &getDescription() const { return a_description; } // setters - void setDescription(const std::string &description) throw() { a_description = description; } + void setDescription(const std::string &description) { a_description = description; } //helpers - int steps() const throw() { return a_steps.size(); } - void addStep(TestStep *step) throw() { a_steps.push_back(step); } + int steps() const { return a_steps.size(); } + void addStep(TestStep *step) { a_steps.push_back(step); } - TestStepWaitDiameter *searchNextWaitConditionFulfilled(const anna::DataBlock &message, bool waitFromEntity) throw(); + TestStepWaitDiameter *searchNextWaitConditionFulfilled(const anna::DataBlock &message, bool waitFromEntity) ; // When a message arrives, we identify the test case by mean the Session-Id. Then, from the current step iterator (included), // we search for a fulfilling condition for that message. The first found, is 'completed' and then breaks the search. - const TestStep *getStep(int stepNumber) const throw(); + const TestStep *getStep(int stepNumber) const ; - anna::xml::Node* asXML(anna::xml::Node* parent) const throw(); - std::string asXMLString() const throw(); + anna::xml::Node* asXML(anna::xml::Node* parent) const ; + std::string asXMLString() const ; private: