X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=source%2Ftesting%2FTestStep.cpp;fp=source%2Ftesting%2FTestStep.cpp;h=a6d8185c16514a57a80ef3b0df01aa7ec9f24b3c;hp=84c577c77de1e7126bb6b8eab3bbf58997f0d357;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hpb=af9c86ffb0e28d35ad94d99c5f77e41578c972b4 diff --git a/source/testing/TestStep.cpp b/source/testing/TestStep.cpp index 84c577c..a6d8185 100644 --- a/source/testing/TestStep.cpp +++ b/source/testing/TestStep.cpp @@ -153,7 +153,7 @@ namespace { } */ - bool decodeMessage(const anna::DataBlock &message, anna::diameter::codec::Message &messageCodec) throw() { + bool decodeMessage(const anna::DataBlock &message, anna::diameter::codec::Message &messageCodec) { if (message.isEmpty()) return false; @@ -185,7 +185,7 @@ void TestStep::initialize(TestCase *testCase) { a_number = testCase->steps() + 1; // testCase is not NULL } -bool TestStep::decodeMessage(bool trust) throw() { +bool TestStep::decodeMessage(bool trust) { if (a_messageCodec) return true; a_messageCodec = new anna::diameter::codec::Message; if (::decodeMessage(a_message, *a_messageCodec)) return true; @@ -200,13 +200,13 @@ bool TestStep::decodeMessage(bool trust) throw() { } const char* TestStep::asText(const Type::_v type) -throw() { +{ static const char* text [] = { "Unconfigured", "Timeout", "SendDiameterXmlToEntity", "SendDiameterXmlToClient", "Delay", "Wait", "Command", "IpLimit" }; return text [type]; } anna::xml::Node* TestStep::asXML(anna::xml::Node* parent) -throw() { +{ anna::xml::Node* result = parent->createChild("TestStep"); result->createAttribute("Number", a_number); @@ -231,12 +231,12 @@ throw() { return result; } -std::string TestStep::asXMLString() throw() { +std::string TestStep::asXMLString() { anna::xml::Node root("root"); return anna::xml::Compiler().apply(asXML(&root)); } -bool TestStep::execute() throw() { +bool TestStep::execute() { int ia = a_testCase->interactiveAmount(); if (ia > -1) { @@ -262,7 +262,7 @@ bool TestStep::execute() throw() { return do_execute(); } -void TestStep::complete() throw() { +void TestStep::complete() { const char *literal = "Complete %s Test Step %d/%d (test case %llu)"; @@ -277,7 +277,7 @@ void TestStep::complete() throw() { do_complete(); } -void TestStep::reset() throw() { +void TestStep::reset() { const char *literal = "Reset %s Test Step %d/%d (test case %llu)"; @@ -295,7 +295,7 @@ void TestStep::reset() throw() { do_reset(); } -void TestStep::next() throw() { +void TestStep::next() { a_testCase->nextStep(); a_testCase->process(); } @@ -305,7 +305,7 @@ void TestStep::next() throw() { // TestStepTimeout //////////////////////////////////////////////////////////////////////////////////////////////////////// anna::xml::Node* TestStepTimeout::asXML(anna::xml::Node* parent) -throw() { +{ anna::xml::Node* result = TestStep::asXML(parent); // end timestamp will be 0 if test finished OK //parent->createChild("TestStepTimeout"); result->createAttribute("Timeout", a_timeout.asString()); @@ -313,7 +313,7 @@ throw() { return result; } -bool TestStepTimeout::do_execute() throw() { +bool TestStepTimeout::do_execute() { try { a_timer = TestManager::instantiate().createTimer((TestCaseStep*)this, a_timeout, TestTimer::Type::TimeLeft); } @@ -326,7 +326,7 @@ bool TestStepTimeout::do_execute() throw() { return true; // go next } -void TestStepTimeout::do_complete() throw() { +void TestStepTimeout::do_complete() { int stepNumber = getNumber(); if (stepNumber == a_testCase->steps()) { a_testCase->addDebugSummaryHint(anna::functions::asString("Timeout expired (step number %d) but it was the last test case step", stepNumber)); // before report (when set Failed state) @@ -346,7 +346,7 @@ void TestStepTimeout::do_complete() throw() { a_timer = NULL; } -void TestStepTimeout::cancelTimer() throw() { +void TestStepTimeout::cancelTimer() { if (!a_timer) return; try { TestManager::instantiate().cancelTimer(a_timer); @@ -358,7 +358,7 @@ void TestStepTimeout::cancelTimer() throw() { //a_timeout = 0; THIS IS CONFIGURATION INFO } -void TestStepTimeout::do_reset() throw() { +void TestStepTimeout::do_reset() { cancelTimer(); } @@ -366,7 +366,7 @@ void TestStepTimeout::do_reset() throw() { // TestStepSendDiameterXml //////////////////////////////////////////////////////////////////////////////////////////////////////// anna::xml::Node* TestStepSendDiameterXml::asXML(anna::xml::Node* parent) -throw() { +{ anna::xml::Node* result = TestStep::asXML(parent); //parent->createChild("TestStepSendDiameterXml"); std::string msg = "", xmlmsg = ""; @@ -399,7 +399,7 @@ throw() { return result; } -bool TestStepSendDiameterXml::do_execute() throw() { +bool TestStepSendDiameterXml::do_execute() { bool success = false; std::string failReason = "Error sending diameter message"; anna::diameter::comm::Entity *entity = a_originHost->getEntity(); // by default @@ -540,7 +540,7 @@ bool TestStepSendDiameterXml::do_execute() throw() { return success; // go next if sent was OK } -void TestStepSendDiameterXml::do_reset() throw() { +void TestStepSendDiameterXml::do_reset() { a_expired = false; //a_message.clear(); //a_messageAlreadyDecoded = false; @@ -550,7 +550,7 @@ void TestStepSendDiameterXml::do_reset() throw() { // TestStepDelay //////////////////////////////////////////////////////////////////////////////////////////////////////// anna::xml::Node* TestStepDelay::asXML(anna::xml::Node* parent) -throw() { +{ anna::xml::Node* result = TestStep::asXML(parent); //parent->createChild("TestStepDelay"); @@ -559,7 +559,7 @@ throw() { return result; } -bool TestStepDelay::do_execute() throw() { +bool TestStepDelay::do_execute() { if (a_delay == 0) { complete(); return true; } // special case try { a_timer = TestManager::instantiate().createTimer((TestCaseStep*)this, a_delay, TestTimer::Type::Delay); @@ -573,7 +573,7 @@ bool TestStepDelay::do_execute() throw() { return false; // don't go next (wait complete) } -void TestStepDelay::do_complete() throw() { +void TestStepDelay::do_complete() { if (a_delay == 0) return; // special case a_timer = NULL; if (TestManager::instantiate().getDumpStdout()) { @@ -583,7 +583,7 @@ void TestStepDelay::do_complete() throw() { // TODO, avoid this recursion } -void TestStepDelay::cancelTimer() throw() { +void TestStepDelay::cancelTimer() { if (!a_timer) return; if (a_delay == 0) return; // special case try { @@ -596,7 +596,7 @@ void TestStepDelay::cancelTimer() throw() { //a_delay = 0; THIS IS CONFIGURATION INFO } -void TestStepDelay::do_reset() throw() { +void TestStepDelay::do_reset() { cancelTimer(); } @@ -607,7 +607,7 @@ void TestStepDelay::do_reset() throw() { void TestStepWaitDiameter::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() { + const std::string &msisdn, const std::string &imsi, const std::string &serviceContextId) { a_condition.setReceivedFromEntity(fromEntity); a_condition.setCode(code); @@ -620,18 +620,18 @@ void TestStepWaitDiameter::setCondition(bool fromEntity, a_condition.setServiceContextId(serviceContextId); } -void TestStepWaitDiameter::setConditionRegexpHex(bool fromEntity, const std::string ®exp) throw() { +void TestStepWaitDiameter::setConditionRegexpHex(bool fromEntity, const std::string ®exp) { a_condition.setReceivedFromEntity(fromEntity); a_condition.setRegexpHex(regexp); } -void TestStepWaitDiameter::setConditionRegexpXml(bool fromEntity, const std::string ®exp) throw() { +void TestStepWaitDiameter::setConditionRegexpXml(bool fromEntity, const std::string ®exp) { a_condition.setReceivedFromEntity(fromEntity); a_condition.setRegexpXml(regexp); } anna::xml::Node* TestStepWaitDiameter::asXML(anna::xml::Node* parent) -throw() { +{ anna::xml::Node* result = TestStep::asXML(parent); //parent->createChild("TestStepWaitDiameter"); std::string msg = "", xmlmsg = ""; @@ -671,16 +671,16 @@ throw() { return result; } -bool TestStepWaitDiameter::do_execute() throw() { +bool TestStepWaitDiameter::do_execute() { return a_completed; } -void TestStepWaitDiameter::do_complete() throw() { +void TestStepWaitDiameter::do_complete() { //a_testCase->process(); // next() not invoked; we only want to reactivate the test case // avoid stack overflow: we will process the test case externally when incoming message is fulfilled (TestCase.cpp), and TestManager is noticed } -bool TestStepWaitDiameter::fulfilled(const anna::DataBlock &db/*, bool matchSessionId*/) throw() { +bool TestStepWaitDiameter::fulfilled(const anna::DataBlock &db/*, bool matchSessionId*/) { if (a_condition.comply(db/*, matchSessionId*/)) { a_message = db; // store matched complete(); @@ -699,7 +699,7 @@ bool TestStepWaitDiameter::fulfilled(const anna::DataBlock &db/*, bool matchSess return false; } -void TestStepWaitDiameter::do_reset() throw() { +void TestStepWaitDiameter::do_reset() { a_message.clear(); a_clientSession = NULL; a_serverSession = NULL; @@ -709,7 +709,7 @@ void TestStepWaitDiameter::do_reset() throw() { // TestStepCmd //////////////////////////////////////////////////////////////////////////////////////////////////////// anna::xml::Node* TestStepCmd::asXML(anna::xml::Node* parent) -throw() { +{ anna::xml::Node* result = TestStep::asXML(parent); //parent->createChild("TestStepCmd"); @@ -729,7 +729,7 @@ throw() { return result; } -bool TestStepCmd::do_execute() throw() { +bool TestStepCmd::do_execute() { if (!a_threadRunning /* || a_threadDeprecated DO NOT WANT TO OVERLAP ... */) { // Special tags to replace: std::string cmd = getScript(); @@ -751,7 +751,7 @@ bool TestStepCmd::do_execute() throw() { // We must implement a interrupt procedure for the thread on reset call... TODO ! } -void TestStepCmd::do_complete() throw() { +void TestStepCmd::do_complete() { if (TestManager::instantiate().getDumpStdout()) { std::cout << "Executed Command Test Step (" << a_script << ") [rc=" << a_resultCode << "]" << std::endl; @@ -773,7 +773,7 @@ void TestStepCmd::do_complete() throw() { // TODO, avoid this recursion } -void TestStepCmd::do_reset() throw() { +void TestStepCmd::do_reset() { if (a_threadRunning) { std::string s_warn = anna::functions::asString("Thread still in progress: deprecating step %d for Test Case %llu", getNumber(), a_testCase->getId()); @@ -793,7 +793,7 @@ void TestStepCmd::do_reset() throw() { } anna::xml::Node* TestStepIpLimit::asXML(anna::xml::Node* parent) -throw() { +{ anna::xml::Node* result = TestStep::asXML(parent); std::string limit = (a_ipLimit != UINT_MAX) ? anna::functions::asString(a_ipLimit) : "[no limit]"; result->createAttribute("IpLimit", limit); @@ -801,13 +801,13 @@ throw() { return result; } -bool TestStepIpLimit::do_execute() throw() { +bool TestStepIpLimit::do_execute() { TestManager::instantiate().setInProgressLimit(a_ipLimit); complete(); return true; // go next } -void TestStepIpLimit::do_complete() throw() { +void TestStepIpLimit::do_complete() { if (TestManager::instantiate().getDumpStdout()) { std::string limit = (a_ipLimit != UINT_MAX) ? anna::functions::asString(a_ipLimit) : "[no limit]"; std::cout << "Executed IpLimit Test Step (value = " << limit << ")" << std::endl;