Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostContingencyResult status fix #405

Merged
merged 9 commits into from
Dec 12, 2024
Prev Previous commit
Next Next commit
Rename FailedCriterion message field to description
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
Lisrte authored and flo-dup committed Dec 12, 2024
commit 6546929d72e75104af8e53d723402f6ec2fc68a1
Original file line number Diff line number Diff line change
@@ -9,9 +9,9 @@

/**
* scenarioResults or loadIncreaseResults failed criterion
* @param message Failed criterion message
* @param description Failed criterion description
* @param time Failure time (in seconds)
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
*/
public record FailedCriterion(String message, double time) {
public record FailedCriterion(String description, double time) {
}
Original file line number Diff line number Diff line change
@@ -57,13 +57,13 @@ static Optional<ScenarioResult> createScenarioResult(String id, String status, L
return Optional.empty();
}

static Optional<FailedCriterion> createFailedCriterion(String message, String time) {
if (message == null || time == null) {
LOGGER.warn("Inconsistent failed criterion entry (message: '{}', time: '{}')", message, time);
static Optional<FailedCriterion> createFailedCriterion(String description, String time) {
if (description == null || time == null) {
LOGGER.warn("Inconsistent failed criterion entry (description: '{}', time: '{}')", description, time);
} else {
try {
double timeD = Double.parseDouble(time);
return Optional.of(new FailedCriterion(message, timeD));
return Optional.of(new FailedCriterion(description, timeD));
} catch (NumberFormatException e) {
logInconsistentEntry("time", time);
}
Original file line number Diff line number Diff line change
@@ -49,10 +49,10 @@ public static void readScenarioResult(String elementName, XMLStreamReader xmlRea
public static void readFailedCriterion(String elementName, XMLStreamReader xmlReader, Consumer<FailedCriterion> resultConsumer) {
try {
if (elementName.equals("criterionNonRespected")) {
String message = xmlReader.getAttributeValue(null, ID);
String description = xmlReader.getAttributeValue(null, ID);
String time = xmlReader.getAttributeValue(null, TIME);
XmlUtil.readEndElementOrThrow(xmlReader);
ResultsUtil.createFailedCriterion(message, time).ifPresent(resultConsumer);
ResultsUtil.createFailedCriterion(description, time).ifPresent(resultConsumer);
}
} catch (XMLStreamException e) {
throw new UncheckedXmlStreamException(e);