X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Ftesting%2FTestManager.hpp;h=4f3bed27db315d86a9f1be79eced868e3043af06;hb=1f560cfaaea555f037a99a6790eade56434eb119;hp=979941ffb00e087404e6c3858b7fe16bb0ba2b80;hpb=bfedf5aed2670ccd65405c0ff96539ccb88b8f23;p=anna.git diff --git a/include/anna/testing/TestManager.hpp b/include/anna/testing/TestManager.hpp index 979941f..4f3bed2 100644 --- a/include/anna/testing/TestManager.hpp +++ b/include/anna/testing/TestManager.hpp @@ -63,7 +63,13 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto StatSummary() { clear(); } void newTCState(const TestCase::State::_v beginState, const TestCase::State::_v endState) throw(); void clear() throw(); + unsigned int getInitializedCount() const throw() { return a_initializedTcs; } unsigned int getInProgressCount() const throw() { return a_inprogressTcs; } + unsigned int getFailedCount() const throw() { return a_failedTcs; } + unsigned int getSuccessCount() const throw() { return a_sucessTcs; } + unsigned int getFinishedCount() const throw() { return a_sucessTcs + a_failedTcs; } + unsigned int getTotal() const throw() { return (a_initializedTcs + a_inprogressTcs + a_failedTcs + a_sucessTcs); } + anna::xml::Node* asXML(anna::xml::Node* parent) const throw(); }; @@ -77,6 +83,7 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto std::string a_reportsDirectory; bool a_dumpInitializedReports, a_dumpInProgressReports, a_dumpFailedReports, a_dumpSuccessReports; bool a_dumpHexMessages; + bool a_dumpStdout; // Pool of test cases test_pool_t a_testPool; @@ -95,14 +102,12 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto // Test timers timer_container a_timers; - // Test case identifiers: - // Session-Id's - std::map 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 a_subscriberIdTestCaseMap; // stores used Subscriber-Id values within a test case. - + // Test case identifiers: key1 (strong); key2 (alternative) + std::map a_key1TestCaseMap; + std::map a_key2TestCaseMap; + // Diameter shall use: key1 -> sessionId, key2 -> subscriberId + // StatSummary a_statSummary; // general statistics @@ -118,8 +123,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; } @@ -130,6 +135,8 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto void setDumpHex(bool dh) throw() { a_dumpHexMessages = dh; } bool getDumpHex() const throw() { return a_dumpHexMessages; } + void setDumpStdout(bool ds) throw() { a_dumpStdout = ds; } + bool getDumpStdout() const throw() { return a_dumpStdout; } void setDumpInitializedReports(bool enable) throw() { a_dumpInitializedReports = enable; } void setDumpInProgressReports(bool enable) throw() { a_dumpInProgressReports = enable; } @@ -162,23 +169,34 @@ class TestManager : public anna::timex::TimeEventObserver, public anna::Singleto unsigned int getInProgressCount() const throw() { return a_statSummary.getInProgressCount(); } + unsigned int getInitializedCount() const throw() { return a_statSummary.getInitializedCount(); } + unsigned int getFinishedCount() const throw() { return a_statSummary.getFinishedCount(); } unsigned int getInProgressLimit() const throw() { return a_inProgressLimit; } - void setInProgressLimit(unsigned int limit) throw() { a_inProgressLimit = limit; } // 0 = UINT_MAX (no limit) + void setInProgressLimit(unsigned int limit) throw() { a_inProgressLimit = limit; } // -1 = UINT_MAX (no limit) bool gotoTestCase(unsigned int id) throw(); + bool runTestCase(unsigned int id) throw(); 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 + TestCase *getTestCase(unsigned int id, const std::string &description = "") throw(); // creates/reuses a test case + + // Diameter-specific + 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); - // 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); + // Non-trasactional (kafka) + // + // bool execTestCases(int sync_amount) throw(); anna::xml::Node* asXML(anna::xml::Node* parent) const throw(); + anna::xml::Node* junitAsXML(anna::xml::Node* parent) const throw(); std::string asXMLString() const throw(); + std::string junitAsXMLString() const throw(); + std::string summaryCounts() const throw(); + std::string summaryStates() const throw(); // stats void tcsStateStats(const TestCase::State::_v beginState, const TestCase::State::_v endState) throw() {