// Soft reset if finished:
if (!hard /* is soft reset */ && !isFinished()) return false;
+ // Dump as failed if still in progress (hard reset):
+ if (getState() == State::InProgress) {
+ addDebugSummaryHint("Testcase hard reset while in progress");
+ setState(State::Failed);
+ }
+
// Clean stage ////////////////////////////
// id is kept
std::vector<TestStep*>::iterator it;
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);
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);
}
}
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<const TestStepWait*>(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);
}