Skip to content

Commit

Permalink
Ignore created time during CGMES files comparison
Browse files Browse the repository at this point in the history
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
  • Loading branch information
miovd committed Mar 24, 2022
1 parent 4587093 commit 0e74a70
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void compareCgmesAndIidmExports() throws IOException {
}

@Test
public void compare2Exports() throws IOException {
public void compare2Exports() throws IOException, InterruptedException {
String baseName = "nordic32";
ReadOnlyDataSource dataSource = new ResourceDataSource(baseName, new ResourceSet("/cim14", "nordic32.xiidm"));
Network network = new XMLImporter().importData(dataSource, NetworkFactory.findDefault(), null);
Expand All @@ -65,6 +65,7 @@ private void compareFiles(String export1, String export2) throws IOException {
}
DifferenceEvaluator knownDiffs = DifferenceEvaluators.chain(
DifferenceEvaluators.Default,
ExportXmlCompare::ignoringCreatedTime,
ExportXmlCompare::numericDifferenceEvaluator,
ExportXmlCompare::ignoringFullModelAbout,
ExportXmlCompare::ignoringCurrentLimitIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,17 @@ static ComparisonResult sameScenarioTime(Comparison comparison, ComparisonResult
return result;
}

static ComparisonResult ignoringCreatedTime(Comparison comparison, ComparisonResult result) {
if (result == ComparisonResult.DIFFERENT && comparison.getType() == ComparisonType.TEXT_VALUE) {
Node control = comparison.getControlDetails().getTarget();
Node test = comparison.getTestDetails().getTarget();
if (test != null && control != null && control.getParentNode().getLocalName().equals("Model.created")) {
return ComparisonResult.EQUAL;
}
}
return result;
}

static ComparisonResult ignoringStaticVarCompensatorDiffq(Comparison comparison, ComparisonResult result) {
if (result == ComparisonResult.DIFFERENT) {
Node control = comparison.getControlDetails().getTarget();
Expand Down

0 comments on commit 0e74a70

Please sign in to comment.