X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FLauncher.cpp;h=30637bee3bd11c5d939e2ce911665723469292d4;hb=af9c86ffb0e28d35ad94d99c5f77e41578c972b4;hp=507bea304a8b70cadb01ad3c671a999ce56ce524;hpb=882e3764e48fdf93aeb078c1832b10a956288da3;p=anna.git diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 507bea3..30637be 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -189,7 +189,8 @@ void Launcher::servicesFromXML(const anna::xml::Node* servicesNode, bool bindRes // We will register a scope per stack id registered. The counters will be dynamically registered at count method. anna::diameter::comm::ApplicationMessageOamModule & appMsgOamModule = anna::diameter::comm::ApplicationMessageOamModule::instantiate(); appMsgOamModule.enableCounters(); // this special module is disabled by default (the only) - static int scope_id = 3; + static int scope_id = 3 + appMsgOamModule.scopes(); + unsigned int id_value; std::string codecEngineName; @@ -1200,7 +1201,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons if(getOperatedHost()->logEnabled()) { anna::diameter::comm::Server *usedServer = 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 getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2e" : "send2eError"), detail); } } else if((opType == "sendxml2c") || (opType == "sendhex2c")) { @@ -1229,7 +1230,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons // Detailed log: if(getOperatedHost()->logEnabled()) { anna::diameter::comm::ServerSession *usedServerSession = getOperatedServer()->getLastUsedResource(); - std::string detail = usedServerSession ? usedServerSession->asString() : ""; // shouldn't happen + std::string detail = usedServerSession ? usedServerSession->asString() : "[null server session]"; // shouldn't happen getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2c" : "send2cError"), detail); } } else if(opType == "answerxml2e") { @@ -1440,12 +1441,12 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons limit = atoi(param2.c_str()); testManager.setInProgressLimit(limit); opt_response = "new in-progress limit: "; - opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : ""; + opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : "[no limit]"; } else { opt_response = "in-progress limit amount: "; limit = testManager.getInProgressLimit(); - opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : ""; + opt_response += (limit != UINT_MAX) ? anna::functions::asString(limit) : "[no limit]"; opt_response += "; currently there are "; opt_response += anna::functions::asString(testManager.getInProgressCount()); opt_response += " test cases running"; @@ -1675,12 +1676,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons if (numParams > 1) throw anna::RuntimeException("Wrong body content format on HTTP Request. Check 'HELP.md' for more information.", ANNA_FILE_LOCATION); - if (testManager.clearPool()) { - opt_response = "all the programmed test cases have been dropped"; - } - else { - opt_response = "there are not programmed test cases to be removed"; - } + result = testManager.clearPool(opt_response); } else if(param1 == "junit") { response = testManager.junitAsXMLString(); @@ -1824,18 +1820,22 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons std::string::size_type pos, pos_1, pos_2; pos = regexp.find("end-to-end-id=", 0u); - pos = regexp.find("\"", pos); - pos_1 = pos; - pos = regexp.find("\"", pos+1); - pos_2 = pos; - regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+"); + if (pos != std::string::npos) { + pos = regexp.find("\"", pos); + pos_1 = pos; + pos = regexp.find("\"", pos+1); + pos_2 = pos; + regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+"); + } pos = regexp.find("hop-by-hop-id=", 0u); - pos = regexp.find("\"", pos); - pos_1 = pos; - pos = regexp.find("\"", pos+1); - pos_2 = pos; - regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+"); + if (pos != std::string::npos) { + pos = regexp.find("\"", pos); + pos_1 = pos; + pos = regexp.find("\"", pos+1); + pos_2 = pos; + regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+"); + } // For this representation: //pos = regexp.find("Origin-State-Id", 0u); @@ -1847,13 +1847,15 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons //regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+"); // But we have this one: pos = regexp.find("Origin-State-Id", 0u); - pos = regexp.rfind("\"", pos); - pos = regexp.rfind("\"", pos-1); - pos = regexp.rfind("\"", pos-1); - pos_1 = pos; - pos = regexp.find("\"", pos+1); - pos_2 = pos; - regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+"); + if (pos != std::string::npos) { + pos = regexp.rfind("\"", pos); + pos = regexp.rfind("\"", pos-1); + pos = regexp.rfind("\"", pos-1); + pos_1 = pos; + pos = regexp.find("\"", pos+1); + pos_2 = pos; + regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+"); + } //regexp.insert(0, "^"); //regexp += "$";