System test feature
[anna.git] / example / diameter / launcher / testing / TestTimer.cpp
diff --git a/example/diameter/launcher/testing/TestTimer.cpp b/example/diameter/launcher/testing/TestTimer.cpp
new file mode 100644 (file)
index 0000000..abe8b4d
--- /dev/null
@@ -0,0 +1,73 @@
+// ANNA - Anna is Not Nothingness Anymore                                                         //
+//                                                                                                //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
+//                                                                                                //
+// See project site at http://redmine.teslayout.com/projects/anna-suite                           //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
+
+
+// Project
+#include <anna/core/tracing/Logger.hpp>
+
+// Process
+#include <TestTimer.hpp>
+#include <TestCase.hpp>
+
+// Standard
+#include <iostream>
+
+
+using namespace std;
+using namespace anna;
+
+
+void TestTimer::expire(anna::timex::Engine*)
+throw(anna::RuntimeException) {
+
+  TestStep *step = getTestCaseStep();
+
+  // action:
+  step->complete();
+
+  LOGDEBUG(
+    string msg("TestTimer::expire | Completed TestStep:\n\n");
+    msg += step->asXMLString();
+    anna::Logger::debug(msg, ANNA_FILE_LOCATION);
+  );
+}
+
+const char* TestTimer::asText(const Type::_v type)
+throw() {
+  static const char* text [] = { "TimeLeft", "Delay" };
+  return text [type];
+}
+
+
+string TestTimer::asString() const
+throw() {
+  string result("TestTimer { ");
+  result += anna::timex::Transaction::asString();
+  result += " Type: ";
+  result += asText(a_type);
+
+//  const TestStep *step = getTestCaseStep();
+//
+//  if(step != NULL) {
+//    result += " | ";
+//    result += step->asXMLString();
+//  } else
+//    result += " | step: <null>";
+//  }
+
+//  switch(getType()) {
+//    case Type::TimeLeft:
+//      //result += " | xxxxx: <null>";
+//      break;
+//    case Type::Delay:
+//      //result += " | xxxxx: <null>";
+//      break;
+//  }
+
+  return result += " }";
+}
+