Add nlohmann/json parser
[anna.git] / example / diameter / launcher / Launcher.cpp
index 420a498..07c2e1b 100644 (file)
 #include <anna/xml/xml.hpp>
 #include <anna/diameter.comm/OriginHost.hpp>
 #include <anna/diameter.comm/OriginHostManager.hpp>
-#include <Procedure.hpp>
 
 // Process
 #include <Launcher.hpp>
+#include <Procedure.hpp>
+#include <EventOperation.hpp>
 #include <MyDiameterEngine.hpp>
 #include <anna/testing/TestManager.hpp>
 #include <anna/testing/TestCase.hpp>
@@ -1834,7 +1835,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
 
 
   if(opType == "code") {
-    codecMsg.loadXML(param1);
+    codecMsg.loadXMLFile(param1);
     std::string hexString = anna::functions::asHexString(codecMsg.code());
     // write to outfile
     std::ofstream outfile(param2.c_str(), std::ifstream::out);
@@ -1894,7 +1895,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
     anna::diameter::comm::Message *msg;
 
     if(opType == "sendxml2e") {
-      codecMsg.loadXML(param1);
+      codecMsg.loadXMLFile(param1);
       updateOperatedOriginHostWithMessage(codecMsg);
       msg = getOperatedHost()->createCommMessage();
       msg->clearBody();
@@ -1944,7 +1945,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
     } else if(param1 == "load") {
       if(param2 == "") throw anna::RuntimeException("Missing xml path file for burst load operation", ANNA_FILE_LOCATION);
 
-      codecMsg.loadXML(param2);
+      codecMsg.loadXMLFile(param2);
       if(codecMsg.isAnswer()) throw anna::RuntimeException("Cannot load diameter answers for burst feature", ANNA_FILE_LOCATION);
       try { codecMsg.valid(); } catch(anna::RuntimeException &ex) { ex.trace(); }  // at least we need to see validation errors although it will continue loading (see validation mode configured in launcher)
 
@@ -2359,7 +2360,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
         if (numParams > 4)
           throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);
         if(param3 == "") throw anna::RuntimeException(anna::functions::asString("Missing xml file for '%s' command in test id operation", param2.c_str()), ANNA_FILE_LOCATION);
-        codecMsg.loadXML(param3);
+        codecMsg.loadXMLFile(param3);
         LOGWARNING(
           if (!codecMsg.isRequest() && (param4 == ""))
             anna::Logger::warning("Step number has not been provided. Take into account that this answer message will be sent 'as is' and sequence information could be wrong at the remote peer", ANNA_FILE_LOCATION);
@@ -2494,7 +2495,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
     anna::diameter::comm::Message *msg;
 
     if(opType == "sendxml2c") {
-      codecMsg.loadXML(param1);
+      codecMsg.loadXMLFile(param1);
       updateOperatedOriginHostWithMessage(codecMsg);
       msg = getOperatedHost()->createCommMessage();
       msg->clearBody();
@@ -2519,7 +2520,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
       getOperatedHost()->writeLogFile(codecMsg, (success ? "sent2c" : "send2cError"), detail);
     }
   } else if(opType == "loadxml") {
-    codecMsg.loadXML(param1);
+    codecMsg.loadXMLFile(param1);
     response_content = codecMsg.asXMLString();
     return true; // OK
   } else if(opType == "diameterServerSessions") {
@@ -2539,7 +2540,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
     } else if (param1 == "dump") {
       getOperatedServer()->getReactingAnswers()->dump("programmed_answer");
     } else {
-      codecMsg.loadXML(param1);
+      codecMsg.loadXMLFile(param1);
       updateOperatedOriginHostWithMessage(codecMsg);
       anna::diameter::codec::Message *message = getOperatedHost()->getCodecEngine()->createMessage(param1); // loads xml again, lesser of two evils
       LOGDEBUG(anna::Logger::debug(message->asXMLString(), ANNA_FILE_LOCATION));
@@ -2565,7 +2566,7 @@ bool Launcher::eventOperation(const std::string &operation, std::string &respons
     } else if (param1 == "dump") {
       getOperatedEntity()->getReactingAnswers()->dump("programmed_answer");
     } else {
-      codecMsg.loadXML(param1);
+      codecMsg.loadXMLFile(param1);
       updateOperatedOriginHostWithMessage(codecMsg);
       anna::diameter::codec::Message *message = getOperatedHost()->getCodecEngine()->createMessage(param1); // loads xml again, lesser of two evils
       LOGDEBUG(anna::Logger::debug(message->asXMLString(), ANNA_FILE_LOCATION));