X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FEventOperation.cpp;h=4d80410f542953b23c02be25899777b16cf91a03;hb=e782294456d0877aa8fc05aa931291ac79808eb3;hp=8d8a97d14ef110eb47b2d21e5ca599ca1b6ce529;hpb=080dc0740d8b02011dee032f5d44eeb5f2ffe23f;p=anna.git diff --git a/example/diameter/launcher/EventOperation.cpp b/example/diameter/launcher/EventOperation.cpp index 8d8a97d..4d80410 100644 --- a/example/diameter/launcher/EventOperation.cpp +++ b/example/diameter/launcher/EventOperation.cpp @@ -12,48 +12,24 @@ // Process #include #include +#include +#include +#include +#include -// Project -#include - - -//// Standard -//#include // std::istringstream -//#include // std::cout +// Standard #include -//#include // ceil -//#include #include // chdir -//#include -// -//// Project + +// Project +#include #include #include -//#include -//#include -//#include -//#include -//#include -//#include -//#include #include #include #include -//#include -//#include #include -//#include -//#include #include -// -//// Process -//#include -//#include -//#include -#include -#include -#include -//#include ///////////////////// @@ -381,7 +357,7 @@ bool EventOperation::sendmsg_hex_2e(std::string &response, const std::string & d if(my_app.getOperatedHost()->logEnabled()) { anna::diameter::comm::Server *usedServer = my_app.getOperatedEntity()->getLastUsedResource(); anna::diameter::comm::ClientSession *usedClientSession = usedServer ? usedServer->getLastUsedResource() : NULL; - std::string detail = usedClientSession ? usedClientSession->asString() : ""; // shouldn't happen + std::string detail = usedClientSession ? usedClientSession->asString() : "[null client session]"; // shouldn't happen my_app.getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2e" : "send2eError"), detail); } @@ -446,7 +422,7 @@ bool EventOperation::sendmsg_hex_2c(std::string &response, const std::string & d // Detailed log: if(my_app.getOperatedHost()->logEnabled()) { anna::diameter::comm::ServerSession *usedServerSession = my_app.getOperatedServer()->getLastUsedResource(); - std::string detail = usedServerSession ? usedServerSession->asString() : ""; // shouldn't happen + std::string detail = usedServerSession ? usedServerSession->asString() : "[null server session]"; // shouldn't happen my_app.getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2c" : "send2cError"), detail); } @@ -901,12 +877,12 @@ bool EventOperation::test__ip_limit(std::string &response, int amount) { if (amount > -2) { testManager.setInProgressLimit(amount); response = "New in-progress limit: "; - response += (amount != -1) ? anna::functions::asString(amount) : ""; + response += (amount != -1) ? anna::functions::asString(amount) : "[no limit]"; } else { response = "In-progress limit amount: "; int limit = testManager.getInProgressLimit(); - response += (limit != -1) ? anna::functions::asString(limit) : ""; + response += (limit != -1) ? anna::functions::asString(limit) : "[no limit]"; response += "; currently there are "; response += anna::functions::asString(testManager.getInProgressCount()); response += " test cases running"; @@ -1236,3 +1212,21 @@ bool EventOperation::test__dump_stdout(std::string &response, bool enable) { return true; // OK } +bool EventOperation::test__dynamic(std::string &response, const nlohmann::json &arguments) { + + Launcher& my_app = static_cast (anna::app::functions::getApp()); + + Procedure p(&my_app); + try { + p.execute(arguments, response); + } + catch(anna::RuntimeException &ex) { + ex.trace(); + response += ex.asString(); + return false; + } + + return true; // OK +} + +