From c067041f779630632662f0381629962ddf408a36 Mon Sep 17 00:00:00 2001 From: Romain Courtier Date: Mon, 14 Oct 2024 16:20:41 +0200 Subject: [PATCH] Rename readCgmesFiles into readCgmesResources to avoid confusions with potential reading from file system Signed-off-by: Romain Courtier --- .../powsybl/cgmes/conversion/test/ConversionUtil.java | 6 +++--- .../conversion/test/NodeContainerMappingTest.java | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/ConversionUtil.java b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/ConversionUtil.java index 93706a76769..f25813fbbc8 100644 --- a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/ConversionUtil.java +++ b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/ConversionUtil.java @@ -86,11 +86,11 @@ public static boolean xmlContains(InputStream is, String clazz, String ns, Strin return false; } - public static Network readCgmesFiles(String dir, String... files) { - return readCgmesFiles(new Properties(), dir, files); + public static Network readCgmesResources(String dir, String... files) { + return readCgmesResources(new Properties(), dir, files); } - public static Network readCgmesFiles(Properties properties, String dir, String... files) { + public static Network readCgmesResources(Properties properties, String dir, String... files) { ReadOnlyDataSource ds = new ResourceDataSource("CGMES input file(s)", new ResourceSet(dir, files)); return Network.read(ds, properties); } diff --git a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/NodeContainerMappingTest.java b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/NodeContainerMappingTest.java index df9c3363964..b7f91df69a3 100644 --- a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/NodeContainerMappingTest.java +++ b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/NodeContainerMappingTest.java @@ -14,7 +14,7 @@ import java.util.Set; -import static com.powsybl.cgmes.conversion.test.ConversionUtil.readCgmesFiles; +import static com.powsybl.cgmes.conversion.test.ConversionUtil.readCgmesResources; import static org.junit.jupiter.api.Assertions.*; /** @@ -36,7 +36,7 @@ void nodeContainersConnectedBySwitchesTest() { // IIDM network: // Ends of switches must be in the same VoltageLevel. So none of the situation above is allowed. // In such cases, a representative Substation and VoltageLevel are determined and gather all the elements. - Network network = readCgmesFiles(DIR, "containers_connected_by_switches.xml"); + Network network = readCgmesResources(DIR, "containers_connected_by_switches.xml"); assertNotNull(network); // All Substations and VoltageLevels are adjacent. Only 1 of each is kept. @@ -65,7 +65,7 @@ void nodeOfTJunctionInLineContainerTest() { // IIDM network: // Nodes must be within a VoltageLevel. // If that is not the case and no real representative can be found, a fictitious one is created. - Network network = readCgmesFiles(DIR, "line_with_t-junction.xml"); + Network network = readCgmesResources(DIR, "line_with_t-junction.xml"); assertNotNull(network); // There is no real representative VoltageLevel for node CN_A, so a fictitious one has been created. @@ -86,7 +86,7 @@ void substationsConnectedByTransformerTest() { // IIDM network: // Ends of transformers need to be in the same Substation. So the situation above is not allowed. // In such a case, a representative Substation is determined and gathers all the elements. - Network network = readCgmesFiles(DIR, "substations_connected_by_transformer.xml"); + Network network = readCgmesResources(DIR, "substations_connected_by_transformer.xml"); assertNotNull(network); // All Substations are adjacent, only 1 is kept. @@ -106,7 +106,7 @@ void voltageLevelsConnectedByOpenSwitchTest() { // IIDM network: // Ends of switches must be in the same VoltageLevel regardless the switch status in SSH. - Network network = readCgmesFiles(DIR, + Network network = readCgmesResources(DIR, "voltage_levels_connected_by_open_switch_EQ.xml", "voltage_levels_connected_by_open_switch_SSH.xml"); assertNotNull(network);