Allow to clear an specific test case
[anna.git] / example / diameter / launcher / EventOperation.cpp
index 2b42486..8b45e61 100644 (file)
@@ -1105,12 +1105,23 @@ bool EventOperation::test__finished(std::string &response) {
   return true; // OK
 }
 
-bool EventOperation::test__clear(std::string &response) {
+bool EventOperation::test__clear(std::string &response, int id) {
 
   Launcher& my_app = static_cast <Launcher&>(anna::app::functions::getApp());
   anna::testing::TestManager &testManager = anna::testing::TestManager::instantiate();
 
-  return testManager.clearPool(response);
+  if (id == -1) {
+     return testManager.clearPool(response);
+  }
+
+  if (!testManager.findTestCase(id)) {
+      response += "cannot found test id (";
+      response += anna::functions::asString(id);
+      response += ")";
+      return false;
+  }
+
+  return testManager.clearTestCase(response, id);
 }
 
 bool EventOperation::test__junit(std::string &response, const std::string & targetFile) {