X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Ftesting%2FTestManager.cpp;h=6dfec1ecee2278d598a0b2486f688253f4117aa2;hb=a06169181968130467d2e54ac91676aecd14bcea;hp=c01b89edf831219c5b4c087873e8692bc67a017b;hpb=c7742e2134826a05ee9c6bf89eebaa726dae0d1b;p=anna.git diff --git a/example/diameter/launcher/testing/TestManager.cpp b/example/diameter/launcher/testing/TestManager.cpp index c01b89e..6dfec1e 100644 --- a/example/diameter/launcher/testing/TestManager.cpp +++ b/example/diameter/launcher/testing/TestManager.cpp @@ -24,6 +24,7 @@ #include #include #include +#include class TestTimer; @@ -220,8 +221,8 @@ bool TestManager::resetPool(bool hard) throw() { if (!tests()) return result; for (test_pool_nc_it it = a_testPool.begin(); it != a_testPool.end(); it++) { - it->second->reset(hard); - result = true; + if (it->second->reset(hard)) + result = true; } //a_sessionIdTestCaseMap.clear(); return result; @@ -311,7 +312,7 @@ TestCase *TestManager::getTestCaseFromSessionId(const anna::DataBlock &message, return NULL; } -void TestManager::receiveMessage(const anna::DataBlock &message, const anna::diameter::comm::ClientSession *clientSession) throw(anna::RuntimeException) { +void TestManager::receiveMessage(const anna::DataBlock &message, RealmNode *realm, const anna::diameter::comm::ClientSession *clientSession) throw(anna::RuntimeException) { // Testing disabled: if (!tests()) return; @@ -327,10 +328,15 @@ void TestManager::receiveMessage(const anna::DataBlock &message, const anna::dia std::string hint = "Uncovered condition for received message from entity over Session-Id '"; hint += sessionId; hint += "':"; try { - Launcher& my_app = static_cast (anna::app::functions::getApp()); - static anna::diameter::codec::Message codecMsg(my_app.getCodecEngine()); + static anna::diameter::codec::Message codecMsg; 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)); + // } } catch (anna::RuntimeException &ex) { ex.trace(); @@ -346,7 +352,7 @@ void TestManager::receiveMessage(const anna::DataBlock &message, const anna::dia } } -void TestManager::receiveMessage(const anna::DataBlock &message, const anna::diameter::comm::ServerSession *serverSession) throw(anna::RuntimeException) { +void TestManager::receiveMessage(const anna::DataBlock &message, RealmNode *realm, const anna::diameter::comm::ServerSession *serverSession) throw(anna::RuntimeException) { // Testing disabled: if (!tests()) return; @@ -362,10 +368,15 @@ void TestManager::receiveMessage(const anna::DataBlock &message, const anna::dia std::string hint = "Uncovered condition for received message from client over Session-Id '"; hint += sessionId; hint += "':"; try { - Launcher& my_app = static_cast (anna::app::functions::getApp()); - static anna::diameter::codec::Message codecMsg(my_app.getCodecEngine()); + static anna::diameter::codec::Message codecMsg; 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)); + // } } catch (anna::RuntimeException &ex) { ex.trace();