if (isFinished()) {
- if (!testManager.getDumpReports()) return;
+ if ((getState() == State::Failed) && (!testManager.getDumpFailedReports())) return;
+ if ((getState() == State::Success) && (!testManager.getDumpSuccessReports())) return;
// report file name: cycle-<cycle id>.testcase-<test case id>.xml
// FORMAT: We tabulate the cycle and test case in order to ease ordering of files by mean ls:
}
void TestCase::assertInitialized() const throw(anna::RuntimeException) {
- if (a_state != State::Initialized)
- throw anna::RuntimeException(anna::functions::asString("Cannot program anymore. The test case %llu was started. You must reset it to append new steps.", a_id), ANNA_FILE_LOCATION);
+ if (isFinished())
+ throw anna::RuntimeException(anna::functions::asString("Cannot program anymore. The test case %llu has finished. You must reset it to append new steps (or do it during execution, which is also allowed).", a_id), ANNA_FILE_LOCATION);
}
void TestCase::assertMessage(const anna::DataBlock &db, bool toEntity) throw(anna::RuntimeException) {
a_hopByHops[hbh] = NULL; // may be assigned to a wait condition
}
- if (registerSessionId) {
- try {
- std::string sid = anna::diameter::helpers::base::functions::getSessionId(db);
- TestManager::instantiate().registerSessionId(sid, this);
- }
- catch (anna::RuntimeException &ex) {
- //ex.trace();
- // if we don't have session-id ... don't worry
- }
- }
+ if (registerSessionId)
+ TestManager::instantiate().registerSessionId(anna::diameter::helpers::base::functions::getSessionId(db), this);
}
void TestCase::addTimeout(const anna::Millisecond &timeout) throw(anna::RuntimeException) {
addStep(step);
}
-void TestCase::addSendxml2e(const anna::DataBlock &db, RealmNode *realm, int stepNumber) throw(anna::RuntimeException) {
+void TestCase::addSendxml2e(const anna::DataBlock &db, OriginHost *host, int stepNumber) throw(anna::RuntimeException) {
assertInitialized();
assertMessage(db, true /* to entity */);
TestStepSendxml2e *step = new TestStepSendxml2e(this);
step->setMsgDataBlock(db);
- step->setRealmNode(realm);
+ step->setOriginHost(host);
step->setWaitForRequestStepNumber(stepNumber); // -1 means, no reference
addStep(step);
}
-void TestCase::addSendxml2c(const anna::DataBlock &db, RealmNode *realm, int stepNumber) throw(anna::RuntimeException) {
+void TestCase::addSendxml2c(const anna::DataBlock &db, OriginHost *host, int stepNumber) throw(anna::RuntimeException) {
assertInitialized();
assertMessage(db, false /* to client */);
TestStepSendxml2c *step = new TestStepSendxml2c(this);
step->setMsgDataBlock(db);
- step->setRealmNode(realm);
+ step->setOriginHost(host);
addStep(step);
}
if (!step) step = new TestStepWait(this);
step->setCondition(fromEntity, code, bitR, usedHopByHop, applicationId, sessionId, resultCode, msisdn, imsi, serviceContextId);
- LOGWARNING(
+ LOGINFORMATION(
if (hasSameCondition(step->getCondition()))
- anna::Logger::warning(anna::functions::asString("The same wait condition has already been programmed in this test case (%llu). Are you sure ?", a_id), ANNA_FILE_LOCATION);
+ anna::Logger::information(anna::functions::asString("The same wait condition has already been programmed in this test case (%llu). Are you sure ?", a_id), ANNA_FILE_LOCATION);
);
addStep(step);
TestStepWait *step = new TestStepWait(this);
step->setCondition(fromEntity, regexp);
- LOGWARNING(
+ LOGINFORMATION(
if (hasSameCondition(step->getCondition()))
- anna::Logger::warning(anna::functions::asString("The same wait condition has already been programmed in this test case (%llu). Are you sure ?", a_id), ANNA_FILE_LOCATION);
+ anna::Logger::information(anna::functions::asString("The same wait condition has already been programmed in this test case (%llu). Are you sure ?", a_id), ANNA_FILE_LOCATION);
);
addStep(step);