Skip to content

Commit

Permalink
Rename readCgmesFiles into readCgmesResources to avoid confusions wit…
Browse files Browse the repository at this point in the history
…h potential reading from file system

Signed-off-by: Romain Courtier <[email protected]>
  • Loading branch information
rcourtier committed Oct 18, 2024
1 parent 8d9f05f commit c067041
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

/**
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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);

Expand Down

0 comments on commit c067041

Please sign in to comment.