X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FMyHandler.cpp;h=d2433c83a082115a62994b49a07c1d07c016ee48;hp=7d312ef098e8be69d6526a2742112380c80dc811;hb=080dc0740d8b02011dee032f5d44eeb5f2ffe23f;hpb=c200ffa70e1d93f5cb3137f3542245c44c05b008 diff --git a/example/diameter/launcher/MyHandler.cpp b/example/diameter/launcher/MyHandler.cpp index 7d312ef..d2433c8 100644 --- a/example/diameter/launcher/MyHandler.cpp +++ b/example/diameter/launcher/MyHandler.cpp @@ -477,19 +477,16 @@ bool MyHandler::doPOST(const std::string &uri, const nlohmann::json &j, std::str } else if (opType == "/test-reset") { auto it = j.find("type"); - if (it != j.end() && it->is_string()) { + std::string type = (it != j.end() && it->is_string()) ? *it : "soft"; - auto itI = j.find("id"); - int id = (itI != j.end() && itI->is_number_integer()) ? itI->get() : -2; // default is: apply to all the tests + auto itI = j.find("id"); + int id = (itI != j.end() && itI->is_number_integer()) ? itI->get() : -1; // default is: apply to all the tests - if ((*it == "soft") || (*it == "hard")) { - result = eop.test__reset(response, (*it == "soft"), id); - } - else - response += "invalid 'type' string field (allowed: soft|hard)"; + if ((type == "soft") || (type == "hard")) { + result = eop.test__reset(response, (type == "soft"), id); } else - response += "missing 'type' string field"; + response += "invalid 'type' string field (allowed: [soft]|hard)"; } else if (opType == "/test-repeats") { auto it = j.find("amount"); @@ -522,10 +519,8 @@ bool MyHandler::doPOST(const std::string &uri, const nlohmann::json &j, std::str } else if (opType == "/test-junit") { auto it = j.find("targetFile"); - if (it != j.end() && it->is_string()) - result = eop.test__junit(response, *it); - else - response += "missing 'targetFile' string field"; + std::string targetFile = (it != j.end() && it->is_string()) ? *it : "/tmp/junit.xml"; + result = eop.test__junit(response, targetFile); } else if (opType == "/test-summary-counts") { result = eop.test__summary_counts(response); @@ -549,7 +544,7 @@ bool MyHandler::doPOST(const std::string &uri, const nlohmann::json &j, std::str else response += "invalid 'action' string field (allowed: enable|disable)"; } - else if ((opType == "/test-report-hex")||(opType == "/test-dump_stdout")) { + else if ((opType == "/test-report-hex")||(opType == "/test-dump-stdout")) { auto itA = j.find("action"); std::string action = (itA != j.end() && itA->is_string()) ? *itA : "enable"; // default is: enable