Abstract testing a little more
[anna.git] / include / anna / testing / TestManager.hpp
index a1cf8ed..82fdf99 100644 (file)
@@ -84,6 +84,7 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto
   int a_poolRepeats; // repeat pool N times
   int a_poolCycle; // current cycle, from 1 to N
   unsigned int a_inProgressLimit; // limit load to have this value
+  bool a_autoResetHard; // automatic reset on next cycle (soft by default, false)
 
   // Test clock
   int a_synchronousAmount;
@@ -94,20 +95,19 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto
   // Test timers
   timer_container a_timers;
 
-  // Test case identifiers:
-  // Session-Id's
-  std::map<std::string /* session id's */, TestCase*> a_sessionIdTestCaseMap; // stores used Session-Id values within a test case.
-                                                                              // No other can use them, but a test case could use more than one.
-  // Subscriber's
-  std::map<std::string /* subscriber id's */, TestCase*> a_subscriberIdTestCaseMap; // stores used Subscriber-Id values within a test case.
-
+  // Test case identifiers: key1 (strong); key2 (alternative)
+  std::map<std::string /* key */, TestCase*> a_key1TestCaseMap;
+  std::map<std::string /* key */, TestCase*> a_key2TestCaseMap;
 
+  // Diameter shall use: key1 -> sessionId, key2 -> subscriberId
+  //
 
   StatSummary a_statSummary; // general statistics
 
 
   TestManager();
   TestManager(const TestManager&);
+  virtual ~TestManager() {;}
 
   TestTimer* createTimer(TestCaseStep*, const anna::Millisecond &, const TestTimer::Type::_v type) throw(anna::RuntimeException);
   void cancelTimer(TestTimer*) throw();
@@ -116,8 +116,8 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto
 
   public:
 
-    void registerSessionId(const std::string &sessionId, const TestCase *testCase) throw(anna::RuntimeException);
-    void registerSubscriberId(const std::string &subscriberId, const TestCase *testCase) throw(anna::RuntimeException);
+    void registerKey1(const std::string &key, const TestCase *testCase) throw(anna::RuntimeException);
+    void registerKey2(const std::string &key, const TestCase *testCase) throw(anna::RuntimeException);
 
     int tests() const throw() { return a_testPool.size(); }
     void setTimerController(anna::timex::Engine *engine) throw() {  a_timeController = engine; }
@@ -155,6 +155,10 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto
     int getPoolRepeats() const throw() { return a_poolRepeats; }
     int getPoolCycle() const throw() { return a_poolCycle; }
 
+    bool getAutoResetHard() const throw() { return a_autoResetHard; }
+    void setAutoResetHard(bool hard = true) throw() { a_autoResetHard = hard; }
+
+
     unsigned int getInProgressCount() const throw() { return a_statSummary.getInProgressCount(); }
     unsigned int getInProgressLimit() const throw() { return a_inProgressLimit; }
     void setInProgressLimit(unsigned int limit) throw() { a_inProgressLimit = limit; } // 0 = UINT_MAX (no limit)
@@ -163,11 +167,15 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto
     TestCase *findTestCase(unsigned int id) const throw(); // id = -1 provides current test case triggered
     TestCase *getTestCase(unsigned int id) throw(); // creates/reuses a test case
 
-    // Main logic
-    TestCase *getTestCaseFromSessionId(const anna::DataBlock &message, std::string &sessionId) throw();
-    TestCase *getTestCaseFromSubscriberId(const anna::DataBlock &message, std::string &subscriberId) throw();
-    void receiveMessage(const anna::DataBlock &message, const anna::diameter::comm::ClientSession *clientSession) throw(anna::RuntimeException);
-    void receiveMessage(const anna::DataBlock &message, const anna::diameter::comm::ServerSession *serverSession) throw(anna::RuntimeException);
+    // Diameter
+    TestCase *getDiameterTestCaseFromSessionId(const anna::DataBlock &message, std::string &sessionId) throw();
+    TestCase *getDiameterTestCaseFromSubscriberId(const anna::DataBlock &message, std::string &subscriberId) throw();
+    void receiveDiameterMessage(const anna::DataBlock &message, const anna::diameter::comm::ClientSession *clientSession) throw(anna::RuntimeException);
+    void receiveDiameterMessage(const anna::DataBlock &message, const anna::diameter::comm::ServerSession *serverSession) throw(anna::RuntimeException);
+
+    // Non-trasactional (kafka)
+    //
+    //
 
     bool execTestCases(int sync_amount) throw();