X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Ftesting%2FTestManager.cpp;h=75955ce90ae182ea109eca6a6f86b2b1b7188ff1;hb=2dc559e7fbe3f250f5aff1a23614181fc0b2e7f1;hp=2c03b4dad4bcf3b0f58e1c9506bcc26a1d93cb23;hpb=daeeaacceeccefcac46838f460b19409cc5c4cb4;p=anna.git diff --git a/example/diameter/launcher/testing/TestManager.cpp b/example/diameter/launcher/testing/TestManager.cpp index 2c03b4d..75955ce 100644 --- a/example/diameter/launcher/testing/TestManager.cpp +++ b/example/diameter/launcher/testing/TestManager.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include class TestTimer; @@ -82,7 +82,12 @@ TestManager::TestManager() : anna::timex::TimeEventObserver("TestManager") { a_timeController = NULL; a_reportsDirectory = "./"; - a_dumpReports = false; + + a_dumpInProgressReports = false; + a_dumpInitializedReports = false; + a_dumpFailedReports = false; + a_dumpSuccessReports = false; + a_dumpHexMessages = false; a_synchronousAmount = 1; a_poolRepeats = 0; // repeat disabled by default @@ -90,6 +95,7 @@ TestManager::TestManager() : a_inProgressLimit = UINT_MAX; // no limit a_clock = NULL; //a_testPool.clear(); + //a_statSummary.clear(); a_currentTestIt = a_testPool.end(); } @@ -104,6 +110,7 @@ void TestManager::registerSessionId(const std::string &sessionId, const TestCase } else { a_sessionIdTestCaseMap[sessionId] = const_cast(testCase); + LOGDEBUG(anna::Logger::debug(anna::functions::asString("TestManager::registerSessionId for test case (id = %llu): %s)", testCase->getId(), sessionId.c_str()), ANNA_FILE_LOCATION)); } } @@ -262,6 +269,7 @@ bool TestManager::clearPool() throw() { a_currentTestIt = a_testPool.end(); a_poolCycle = 1; configureTTPS(0); // stop + a_statSummary.clear(); return true; } @@ -365,7 +373,7 @@ TestCase *TestManager::getTestCaseFromSessionId(const anna::DataBlock &message, return NULL; } -void TestManager::receiveMessage(const anna::DataBlock &message, RealmNode *realm, const anna::diameter::comm::ClientSession *clientSession) throw(anna::RuntimeException) { +void TestManager::receiveMessage(const anna::DataBlock &message, OriginHost *host, const anna::diameter::comm::ClientSession *clientSession) throw(anna::RuntimeException) { // Testing disabled: if (!tests()) return; @@ -385,10 +393,10 @@ void TestManager::receiveMessage(const anna::DataBlock &message, RealmNode *real codecMsg.decode(message); hint += "\n"; hint += codecMsg.asXMLString(); - // // Realm checking: - // std::string messageOR = message.getAvp(anna::diameter::helpers::base::AVPID__Origin_Realm)->getDiameterIdentity()->getValue(); - // if (messageOR != realm->getName()) { - // LOGWARNING(anna::Logger::warning(anna::functions::asString("Received message from realm '%s', with different Origin-Realm: %s", realm->getName().c_str(), messageOR.c_str()), ANNA_FILE_LOCATION)); + // // Host checking: + // std::string messageOH = message.getAvp(anna::diameter::helpers::base::AVPID__Origin_Host)->getDiameterIdentity()->getValue(); + // if (messageOH != host->getName()) { + // LOGWARNING(anna::Logger::warning(anna::functions::asString("Received message from host '%s', with different Origin-Host: %s", host->getName().c_str(), messageOH.c_str()), ANNA_FILE_LOCATION)); // } } catch (anna::RuntimeException &ex) { @@ -405,7 +413,7 @@ void TestManager::receiveMessage(const anna::DataBlock &message, RealmNode *real } } -void TestManager::receiveMessage(const anna::DataBlock &message, RealmNode *realm, const anna::diameter::comm::ServerSession *serverSession) throw(anna::RuntimeException) { +void TestManager::receiveMessage(const anna::DataBlock &message, OriginHost *host, const anna::diameter::comm::ServerSession *serverSession) throw(anna::RuntimeException) { // Testing disabled: if (!tests()) return; @@ -425,10 +433,10 @@ void TestManager::receiveMessage(const anna::DataBlock &message, RealmNode *real codecMsg.decode(message); hint += "\n"; hint += codecMsg.asXMLString(); - // // Realm checking: - // std::string messageOR = message.getAvp(anna::diameter::helpers::base::AVPID__Origin_Realm)->getDiameterIdentity()->getValue(); - // if (messageOR != realm->getName()) { - // LOGWARNING(anna::Logger::warning(anna::functions::asString("Received message from realm '%s', with different Origin-Realm: %s", realm->getName().c_str(), messageOR.c_str()), ANNA_FILE_LOCATION)); + // // Host checking: + // std::string messageOH = message.getAvp(anna::diameter::helpers::base::AVPID__Origin_Host)->getDiameterIdentity()->getValue(); + // if (messageOH != host->getName()) { + // LOGWARNING(anna::Logger::warning(anna::functions::asString("Received message from host '%s', with different Origin-Host: %s", host->getName().c_str(), messageOH.c_str()), ANNA_FILE_LOCATION)); // } } catch (anna::RuntimeException &ex) { @@ -459,7 +467,10 @@ throw() { result->createAttribute("InProgressLimit", ""); else result->createAttribute("InProgressLimit", a_inProgressLimit); - result->createAttribute("DumpReports", (a_dumpReports ? "yes":"no")); + result->createAttribute("DumpInitializedReports", (a_dumpInitializedReports ? "yes":"no")); + result->createAttribute("DumpInProgressReports", (a_dumpInProgressReports ? "yes":"no")); + result->createAttribute("DumpFailedReports", (a_dumpFailedReports ? "yes":"no")); + result->createAttribute("DumpSuccessReports", (a_dumpSuccessReports ? "yes":"no")); result->createAttribute("DumpHexMessages", (a_dumpHexMessages ? "yes":"no")); result->createAttribute("ReportsDirectory", a_reportsDirectory); if (a_clock) { @@ -470,9 +481,13 @@ throw() { if (a_currentTestIt != a_testPool.end()) { result->createAttribute("CurrentTestCaseId", (*a_currentTestIt).first); } - if (a_dumpReports && poolSize != 0) { + if (poolSize != 0) { anna::xml::Node* testCases = result->createChild("TestCases"); for (test_pool_it it = a_testPool.begin(); it != a_testPool.end(); it++) { + if (((*it).second->getState() == TestCase::State::Initialized) && (!getDumpInitializedReports())) continue; + if (((*it).second->getState() == TestCase::State::InProgress) && (!getDumpInProgressReports())) continue; + if (((*it).second->getState() == TestCase::State::Failed) && (!getDumpFailedReports())) continue; + if (((*it).second->getState() == TestCase::State::Success) && (!getDumpSuccessReports())) continue; (*it).second->asXML(testCases); } }