X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FLauncher.cpp;h=94d8f66f52e5c12e52c4c4f9d0694b0f3e8102ee;hb=5406b19bdbfe101b264f8c4d878392e2916b8f9d;hp=cd20991e481ff9ff342c998e8a622617c8989651;hpb=a4a2ff4e20ddc4c6de7f2d3efd3acfb16c0d91c1;p=anna.git diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index cd20991..94d8f66 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -596,7 +596,14 @@ throw(anna::RuntimeException) { // Counters record procedure: const char *varname = "cntRecordPeriod"; - anna::Millisecond cntRecordPeriod = (cl.exists(varname)) ? checkTimeMeasure(varname, cl.getValue(varname)) : (anna::Millisecond)300000; + anna::Millisecond cntRecordPeriod; + try { + cntRecordPeriod = (cl.exists(varname)) ? checkTimeMeasure(varname, cl.getValue(varname)) : (anna::Millisecond)300000; + } + catch(anna::RuntimeException &ex) { + if (cntRecordPeriod != 0) throw ex; + } + if(cntRecordPeriod != 0) { a_counterRecorderClock = new MyCounterRecorderClock("Counters record procedure clock", cntRecordPeriod); // clock std::string cntDir = "."; @@ -1457,6 +1464,10 @@ std::string Launcher::help() const throw() { result += "\n been done before. Test cases state & data will be reset (when achieved again), but general"; result += "\n statistics and counters will continue measuring until reset with 'collect' operation."; result += "\n"; + result += "\n test|auto-reset| When cycling, current test cases can be soft (default) or hard reset. If no timeout has"; + result += "\n been configured for the test case, hard reset could prevent stuck on the next cycle for"; + result += "\n those test cases still in progress."; + result += "\n"; result += "\n test|clear Clears all the programmed test cases and stop testing (if in progress)."; result += "\n"; result += "\n test|summary Test manager general report (number of test cases, counts by state, global configuration,"; @@ -1978,6 +1989,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons // test|look[|id] Show programmed test case for id provided, current when missing ... // test|interact|amount|id Makes interactive a specific test case id. The amount is the margin of execution steps ... // test|reset|<[soft]/hard>[|id] Reset the test case for id provided, all the tests when missing ... + // test|auto-reset| When cycling, current test cases can be soft (default) or hard reset ... // test|clear Clears all the programmed test cases. // test|summary Test manager general report (number of test cases, counts by state ... @@ -2162,7 +2174,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons anna::testing::TestCase *testCase = ((id != -1) ? testManager.findTestCase(id) : NULL); if (testCase) { - bool done = testCase->reset((param2 == "hard") ? true:false); + bool done = testCase->reset(param2 == "hard"); opt_response_content = "test "; opt_response_content += param2; opt_response_content += " reset for id "; @@ -2171,7 +2183,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons } else { if (id == -1) { - bool anyReset = testManager.resetPool((param2 == "hard") ? true:false); + bool anyReset = testManager.resetPool(param2 == "hard"); opt_response_content = param2; opt_response_content += " reset have been sent to all programmed tests: "; opt_response_content += anyReset ? "some/all have been reset" : "nothing was reset"; } else { @@ -2181,6 +2193,16 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons } } } + else if(param1 == "auto-reset") { + if (numParams != 2) + throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION); + + if (param2 != "soft" && param2 != "hard") + throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION); + + testManager.setAutoResetHard(param2 == "hard"); + opt_response_content += anna::functions::asString("Auto-reset configured to '%s'", param2.c_str()); + } else if(param1 == "clear") { if (numParams > 1) throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);