From 398d53cb90e9f25dc89a46396225eef981f0ab24 Mon Sep 17 00:00:00 2001 From: "Eduardo Ramos Testillano (eramedu)" Date: Sun, 9 Jun 2019 05:23:05 +0200 Subject: [PATCH] Miss logic for wait for request data reference When sending to client, the wait for request step information was being ignored. --- source/testing/TestCase.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/testing/TestCase.cpp b/source/testing/TestCase.cpp index d048dfc..455c61b 100644 --- a/source/testing/TestCase.cpp +++ b/source/testing/TestCase.cpp @@ -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); } -- 2.20.1