// Checking command line parameters
std::string sessionBasedModelsType;
- anna::diameter::comm::Entity::SessionBasedModelsType::_v sessionBasedModelsTypeEnum;
+ anna::diameter::comm::Entity::SessionBasedModelsType::_v sessionBasedModelsTypeEnum = anna::diameter::comm::Entity::SessionBasedModelsType::SessionIdLowPart;
if(sessionBasedModelsClientSocketSelection) {
sessionBasedModelsType = sessionBasedModelsClientSocketSelection->getValue();
if (sessionBasedModelsType == "RoundRobin") {
result += "\n Test cases reports are not dumped on process context (too many information in general).";
result += "\n The report contains context information in every moment: this operation acts as a snapshot.";
result += "\n";
+ result += "\n test|state[|id] Get test case state for id provided, current 'in-process' test case when missing.";
+ result += "\n";
result += "\n test|interact|amount[|id] Makes interactive a specific test case id. The amount is the margin of execution steps";
result += "\n to be done. Normally, we will execute 'test|interact|0[|<test case id>]', which means that";
result += "\n the test case is selected to be interactive, but no step is executed. Then you have to";
result += "\n";
result += "\nThe alternative using SIGUSR2 signal requires the creation of the task(s) file which will be read at";
result += "\n signal event:";
- result += "\n echo \"<<operation>\" > "; result += getSignalUSR2InputFile();
+ result += "\n echo \"<operation>\" > "; result += getSignalUSR2InputFile();
result += "\n then";
result += "\n kill -12 <pid>";
result += "\n or";
}
-void Launcher::eventOperation(const std::string &operation, std::string &response_content) throw(anna::RuntimeException) {
+bool Launcher::eventOperation(const std::string &operation, std::string &response_content) throw(anna::RuntimeException) {
+
+ bool result = true;
+
LOGMETHOD(anna::TraceMethod tm("Launcher", "eventOperation", ANNA_FILE_LOCATION));
- if (operation == "") return; // ignore
+ if (operation == "") return result; // ignore
LOGDEBUG(anna::Logger::debug(anna::functions::asString("Operation: %s", operation.c_str()), ANNA_FILE_LOCATION));
// Default response:
catch(anna::RuntimeException &ex) {
ex.trace();
response_content = ex.asString();
- return;
+ return false;
}
- return;
+ return true; // OK
}
// Help:
if(operation == "help") {
response_content = help();
- return;
+ return true; // OK
}
// Reset performance data:
resetCounters();
resetStatistics();
response_content = "All process counters & statistic information have been reset";
- return;
+ return true; // OK
}
// Counters dump on demand:
if(operation == "forceCountersRecord") {
forceCountersRecord();
response_content = "Current counters have been dump to disk";
- return;
+ return true; // OK
}
// OAM & statistics:
if(operation == "show-oam") {
anna::xml::Node root("root");
response_content = anna::xml::Compiler().apply(oamAsXML(&root));
- return;
+ return true; // OK
}
if(operation == "show-stats") {
anna::xml::Node root("root");
response_content = anna::xml::Compiler().apply(statsAsXML(&root));
- return;
+ return true; // OK
}
///////////////////////////////////////////////////////////////////
std::string contextFile = ((numParams == 1) ? param1 : anna::functions::asString("/var/tmp/anna.context.%05d", getPid()));
writeContext(contextFile);
response_content = anna::functions::asString("Context dumped on file '%s'", contextFile.c_str());
- return;
+ return true; // OK
}
if(opType == "log-statistics-samples") {
logStatisticsSamples(param1);
response_content = anna::functions::asString("Log statistics samples for '%s' concepts", param1.c_str());
- return;
+ return true; // OK
}
// Change execution directory:
if(opType == "change-dir") {
if (param1 == "") param1 = a_initialWorkingDirectory;
- if (chdir(param1.c_str()) == 0)
+ result = (chdir(param1.c_str()) == 0);
+
+ if (result)
response_content = "New execution directory configured: ";
else
response_content = "Cannot assign provided execution directory: ";
response_content += param1;
- return;
+ return result;
}
if(opType == "services") {
catch(anna::RuntimeException &ex) {
ex.trace();
response_content = anna::functions::asString("Loaded services from file '%s' with errors", servicesFile.c_str());
- return;
+ return false;
}
response_content = anna::functions::asString("Loaded services from file '%s'", servicesFile.c_str());
- return;
+ return true; // OK
}
// Host switch:
response_content = "Working node is automatic";
}
}
- return;
+ return true; // OK
}
if(opType == "node_auto") {
a_workingNode = NULL;
response_content = "Working node has been set to automatic";
- return;
+ return true; // OK
}
// Operated host from possible forced-working node:
if (testCase) {
response_content = testCase->asXMLString();
- return;
+ return true; // OK
+ }
+ else {
+ result = false;
+ if (id == -1) {
+ opt_response_content = "no current test case detected (testing started ?)";
+ }
+ else {
+ opt_response_content = "cannot found test id (";
+ opt_response_content += anna::functions::asString(id);
+ opt_response_content += ")";
+ }
+ }
+ }
+ else if(param1 == "state") {
+ if (numParams > 2)
+ throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);
+
+ int id = ((param2 != "") ? atoi(param2.c_str()) : -1);
+ anna::testing::TestCase *testCase = testManager.findTestCase(id);
+
+ if (testCase) {
+ response_content = anna::testing::TestCase::asText(testCase->getState());
+ return testCase->isSuccess();
}
else {
+ result = false;
if (id == -1) {
opt_response_content = "no current test case detected (testing started ?)";
}
opt_response_content += anna::functions::asString(id);
}
else {
+ result = false;
opt_response_content = "cannot found test id (";
opt_response_content += anna::functions::asString(id);
opt_response_content += ")";
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 {
+ result = false;
opt_response_content = "cannot found test id (";
opt_response_content += anna::functions::asString(id);
opt_response_content += ")";
}
else if(param1 == "junit") {
response_content = testManager.junitAsXMLString();
- return;
+ return true; // OK
}
else if(param1 == "summary-counts") {
response_content = testManager.summaryCounts();
- return;
+ return true; // OK
}
else if(param1 == "summary-states") {
response_content = testManager.summaryStates();
- return;
+ return true; // OK
}
else if(param1 == "summary") {
response_content = testManager.asXMLString();
- return;
+ return true; // OK
}
else {
int id = atoi(param1.c_str());
} else if(opType == "loadxml") {
codecMsg.loadXML(param1);
response_content = codecMsg.asXMLString();
- return;
+ return true; // OK
} else if(opType == "diameterServerSessions") {
int diameterServerSessions = atoi(param1.c_str());
getOperatedServer()->setMaxConnections(diameterServerSessions);
} else if(opType == "answerxml2c") {
if(param1 == "") { // programmed answers FIFO's to stdout
response_content = getOperatedServer()->getReactingAnswers()->asString("ANSWERS TO CLIENT");
- return;
+ return true; // OK
} else if (param1 == "rotate") {
getOperatedServer()->getReactingAnswers()->rotate(true);
} else if (param1 == "exhaust") {
if(param1 == "") { // programmed answers FIFO's to stdout
response_content = getOperatedEntity()->getReactingAnswers()->asString("ANSWERS TO ENTITY");
- return;
+ return true; // OK
} else if (param1 == "rotate") {
getOperatedEntity()->getReactingAnswers()->rotate(true);
} else if (param1 == "exhaust") {
response_content += " => ";
response_content += opt_response_content;
}
+
+ return result;
}
anna::xml::Node* Launcher::asXML(anna::xml::Node* parent) const