X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Ftesting%2FTestCase.cpp;h=818093b4de0483242e627eee14c56674978fecc4;hb=303d3e2584497a05fc715fbf32b57dcf81805f38;hp=d048dfc2284d47334001f7e1d8154816d5850196;hpb=bfedf5aed2670ccd65405c0ff96539ccb88b8f23;p=anna.git diff --git a/source/testing/TestCase.cpp b/source/testing/TestCase.cpp index d048dfc..818093b 100644 --- a/source/testing/TestCase.cpp +++ b/source/testing/TestCase.cpp @@ -256,7 +256,7 @@ void TestCase::assertMessage(const anna::DataBlock &db, bool toEntity) throw(ann if (registerKeys) { TestManager &testManager = TestManager::instantiate(); - testManager.registerSessionId(anna::diameter::helpers::base::functions::getSessionId(db), this); + testManager.registerKey1(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); @@ -264,7 +264,7 @@ void TestCase::assertMessage(const anna::DataBlock &db, bool toEntity) throw(ann 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); + testManager.registerKey2(subscriberId, this); } } @@ -304,9 +304,24 @@ void TestCase::addSendxml2c(const anna::DataBlock &db, anna::diameter::comm::Ori assertInitialized(); assertMessage(db, false /* to client */); + if (stepNumber != -1) { + const TestStep *stepReferred = getStep(stepNumber); + if (!stepReferred) + throw anna::RuntimeException(anna::functions::asString("Step number (%d) do not exists (test case %llu)", stepNumber, a_id), ANNA_FILE_LOCATION); + + if (stepReferred->getType() != TestStep::Type::Wait) + throw anna::RuntimeException(anna::functions::asString("Step number (%d) must refer to a 'wait' step (test case %llu)", stepNumber, a_id), ANNA_FILE_LOCATION); + + const TestCondition &tc = (static_cast(stepReferred))->getCondition(); + if (tc.getCode() == "0") { // if regexp used, is not possible to detect this kind of errors + throw anna::RuntimeException(anna::functions::asString("Step number (%d) must refer to a 'wait for request' step (test case %llu)", stepNumber, a_id), ANNA_FILE_LOCATION); + } + } + TestStepSendxml2c *step = new TestStepSendxml2c(this); step->setMsgDataBlock(db); step->setOriginHost(host); + step->setWaitForRequestStepNumber(stepNumber); // -1 means, no reference addStep(step); }