X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Ftesting%2FTestCase.cpp;h=087e29bb0de31fed7d7fcb412f8d897c7ba7668e;hb=61f1340da3cae5159d2e3bc14fc47c6d4bf9453e;hp=8cbba4bab609d54710b0c1b6f78ea7e199cb1e57;hpb=fbe71916b6bcafa22a9f47f0bc2a2e30ee5a8d88;p=anna.git diff --git a/example/diameter/launcher/testing/TestCase.cpp b/example/diameter/launcher/testing/TestCase.cpp index 8cbba4b..087e29b 100644 --- a/example/diameter/launcher/testing/TestCase.cpp +++ b/example/diameter/launcher/testing/TestCase.cpp @@ -230,9 +230,11 @@ void TestCase::assertInitialized() const throw(anna::RuntimeException) { void TestCase::assertMessage(const anna::DataBlock &db, bool toEntity) throw(anna::RuntimeException) { bool isRequest = anna::diameter::codec::functions::isRequest(db); - bool registerSessionId = ((isRequest && toEntity) || (!isRequest && !toEntity) /* (*) */); - // (*) we register answers Session-Id assuming that we will know the Session-Id values created by the client (OCS) - // This is another solution for TODO(***) regarding diameter server testing. No tsure about the final implementation. + bool registerKeys = ((isRequest && toEntity) || (!isRequest && !toEntity) /* (*) */); + // (*) we register answers Session-Id "assuming" that we will know the Session-Id values created by the client. + // This is another solution regarding diameter server testing. No sure about the final implementation. + // We will help registering also subscriber data, because certain messages (i.e. SLR) coming from clients could + // have specific Session-Id value (unknown at test programming), and normally are identified by subscriber. // Check hop-by-hop: if (isRequest) { @@ -242,8 +244,18 @@ void TestCase::assertMessage(const anna::DataBlock &db, bool toEntity) throw(ann a_hopByHops[hbh] = NULL; // may be assigned to a wait condition } - if (registerSessionId) - TestManager::instantiate().registerSessionId(anna::diameter::helpers::base::functions::getSessionId(db), this); + if (registerKeys) { + TestManager &testManager = TestManager::instantiate(); + testManager.registerSessionId(anna::diameter::helpers::base::functions::getSessionId(db), this); + + + std::string subscriberId = anna::diameter::helpers::dcca::functions::getSubscriptionIdData(db, anna::diameter::helpers::dcca::AVPVALUES__Subscription_Id_Type::END_USER_E164); + if (subscriberId == "") // try with IMSI + subscriberId = anna::diameter::helpers::dcca::functions::getSubscriptionIdData(db, anna::diameter::helpers::dcca::AVPVALUES__Subscription_Id_Type::END_USER_IMSI); + + if (subscriberId != "") + testManager.registerSubscriberId(subscriberId, this); + } } void TestCase::addTimeout(const anna::Millisecond &timeout) throw(anna::RuntimeException) {