Add new operation 'run' to test a specific test case
[anna.git] / example / diameter / launcher / Launcher.cpp
index 0c4a5bd..bb28699 100644 (file)
@@ -1487,6 +1487,21 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
       opt_response_content += anna::functions::asString(id);
       opt_response_content += ")";
     }
+    else if(param1 == "run") {
+      if (numParams > 2)
+        throw anna::RuntimeException("Wrong body content format on HTTP Request. Check 'HELP.md' for more information.", ANNA_FILE_LOCATION);
+
+      if(param2 == "") throw anna::RuntimeException("Missing id for test run operation", ANNA_FILE_LOCATION);
+      int id = atoi(param2.c_str());
+      if (testManager.runTestCase(id)) {
+        opt_response_content = "test executed for id provided (";
+      }
+      else {
+        opt_response_content = "cannot found test id (";
+      }
+      opt_response_content += anna::functions::asString(id);
+      opt_response_content += ")";
+    }
     else if(param1 == "look") {
       if (numParams > 2)
         throw anna::RuntimeException("Wrong body content format on HTTP Request. Check 'HELP.md' for more information.", ANNA_FILE_LOCATION);