Fork variant for TestStep command
[anna.git] / example / diameter / launcher / Launcher.hpp
index c8417fb..3ce4a20 100644 (file)
 #include <anna/core/core.hpp>
 #include <anna/comm/comm.hpp>
 #include <anna/time/Date.hpp>
+#include <anna/diameter/codec/Message.hpp>
 
 // Process
-#include "MyCommunicator.hpp"
-#include "MyCounterRecorder.hpp"
+#include <MyCommunicator.hpp>
+#include <MyCounterRecorder.hpp>
+#include <TestManager.hpp>
+
+
+#define SH_COMMAND_TAG_FOR_REPLACE__CYCLE_ID    "##cycleid##"
+#define SH_COMMAND_TAG_FOR_REPLACE__TESTCASE_ID "##testcaseid##"
+#define SH_COMMAND_TAG_FOR_REPLACE__TESTSTEP_ID "##teststepid##"
 
 
 namespace anna {
@@ -35,6 +42,12 @@ namespace anna {
   }
 }
 
+class TestManager;
+class RealmNode;
+class MyDiameterEntity;
+class MyLocalServer;
+class MyDiameterEngine;
+
 // RealmNode resources
 class RealmNode;
 typedef std::map<std::string, RealmNode*> realm_nodes_t;
@@ -49,37 +62,45 @@ class Launcher : public anna::comm::Application {
 
   // Core engines:
   MyCommunicator *a_communicator;
-  anna::diameter::codec::Engine *a_codecEngine;
   anna::timex::Engine* a_timeEngine;
   MyCounterRecorder *a_counterRecorder;
+  anna::Millisecond a_admlMinResolution;
   MyCounterRecorderClock *a_counterRecorderClock;
 
   // Nodes deployment:
   realm_nodes_t a_nodes;
   RealmNode *a_workingNode;
+  RealmNode *a_operatedRealm; // auxiliary for eventOperation
 
   // comm resources:
   anna::comm::ServerSocket* a_httpServerSocket; // HTTP
 
+  const anna::Millisecond &getADMLMinResolution() const throw() { return a_admlMinResolution; }
 
   void servicesFromXML(const anna::xml::Node* servicesNode, bool eventOperation) throw(anna::RuntimeException);
   anna::Millisecond checkTimeMeasure(const std::string &parameter, const std::string &value) throw(anna::RuntimeException);
   void initialize() throw(anna::RuntimeException); // HTTP
   void run() throw(anna::RuntimeException);
 
-
 public:
   Launcher();
+  //~Launcher(); TODO
 
   void loadServices(const std::string & xmlPathFile, bool eventOperation = false) throw(anna::RuntimeException);
   void startServices() throw(anna::RuntimeException);
 
-  anna::diameter::codec::Engine *getCodecEngine() const throw() { return a_codecEngine; }
-  RealmNode *getWorkingNode() const throw(anna::RuntimeException); // management operations working node
-  bool setWorkingNode(const std::string &name) throw(); // we could update ignoreFlagsOnValidation/integrationAndDebugging over the global codec engine
-                                                        //  but finally, that configuration issues will be global to the process.
+  bool setWorkingNode(const std::string &name) throw();
+  RealmNode *getRealmNode(const std::string &realmName) const throw(anna::RuntimeException);
+  RealmNode *getRealmNode(const anna::diameter::codec::Message &message) const throw(anna::RuntimeException);
+  bool uniqueRealm() const throw() { return (a_nodes.size() == 1); }
 
-  RealmNode *getRealmNode(const std::string &realmName) const throw();
+  // Operated realm for communication resources smart assignment ////////////////////////////////////////////////////////////
+  void updateOperatedRealmNodeWithMessage(const anna::diameter::codec::Message &message) throw(anna::RuntimeException);
+  RealmNode *getOperatedRealm() const throw(anna::RuntimeException);
+  MyDiameterEntity *getOperatedEntity() const throw(anna::RuntimeException);
+  MyLocalServer *getOperatedServer() const throw(anna::RuntimeException);
+  MyDiameterEngine *getOperatedEngine() const throw(anna::RuntimeException);
+  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
   MyCommunicator *getCommunicator() throw() { return a_communicator; }
@@ -94,6 +115,8 @@ public:
 
   // helpers
   bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw();
+
+  friend class TestManager;
 };
 
 #endif