Skip to content

Commit

Permalink
Rework existing tests: moved cgmes input file into a specific subfold…
Browse files Browse the repository at this point in the history
…er and read the files using the static method in ConversionUtil

Signed-off-by: Romain Courtier <[email protected]>
  • Loading branch information
rcourtier committed Oct 16, 2024
1 parent ab05f38 commit 8c06662
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.*;
import java.util.regex.Pattern;

import static com.powsybl.cgmes.conversion.test.ConversionUtil.getUniqueMatches;
import static com.powsybl.cgmes.conversion.test.ConversionUtil.*;
import static org.junit.jupiter.api.Assertions.*;

/**
Expand All @@ -32,10 +32,12 @@ class OperationalLimitsGroupTest extends AbstractSerDeTest {
private static final Pattern ACTIVE_POWER_LIMIT = Pattern.compile("<cim:ActivePowerLimit rdf:ID=\"(.*?)\">");
private static final Pattern CURRENT_LIMIT = Pattern.compile("<cim:CurrentLimit rdf:ID=\"(.*?)\">");

private static final String DIR = "/issues/operational-limits/";

@Test
void importMultipleLimitsGroupsOnSameLineEndTest() {
// Retrieve line
Network network = Network.read("OperationalLimits.xml", getClass().getResourceAsStream("/OperationalLimits.xml"));
Network network = readCgmesResources(DIR, "multiple_limitsets_on_same_terminal.xml");
Line line = network.getLine("Line");

// There is 1 set on side 1, 2 sets on side 2
Expand All @@ -56,7 +58,7 @@ void importMultipleLimitsGroupsOnSameLineEndTest() {
@Test
void exportSelectedLimitsGroupTest() throws IOException {
// Import and export CGMES limits
Network network = Network.read("OperationalLimits.xml", getClass().getResourceAsStream("/OperationalLimits.xml"));
Network network = readCgmesResources(DIR, "multiple_limitsets_on_same_terminal.xml");

Properties exportParams = new Properties();
exportParams.put(CgmesExport.EXPORT_ALL_LIMITS_GROUP, false);
Expand Down Expand Up @@ -86,7 +88,7 @@ void exportSelectedLimitsGroupTest() throws IOException {
@Test
void exportAllLimitsGroupTest() throws IOException {
// Import and export CGMES limits
Network network = Network.read("OperationalLimits.xml", getClass().getResourceAsStream("/OperationalLimits.xml"));
Network network = readCgmesResources(DIR, "multiple_limitsets_on_same_terminal.xml");

Properties exportParams = new Properties();
exportParams.put(CgmesExport.EXPORT_ALL_LIMITS_GROUP, true);
Expand Down

0 comments on commit 8c06662

Please sign in to comment.