From be7022f1724bae9ecb99d5e8e2077f2f140c3d79 Mon Sep 17 00:00:00 2001 From: Etienne LESOT Date: Fri, 28 Nov 2025 14:22:16 +0100 Subject: [PATCH 1/4] add detail attachment point for line attached to vl modification Signed-off-by: Etienne LESOT --- .../dto/LineAttachToVoltageLevelInfos.java | 3 + .../LineAttachToVoltageLevel.java | 44 ++++++++++++- .../modification/utils/PropertiesUtils.java | 6 +- .../LineAttachToNewVoltageLevelTest.java | 65 ++++++++++++++++++- 4 files changed, 112 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/gridsuite/modification/dto/LineAttachToVoltageLevelInfos.java b/src/main/java/org/gridsuite/modification/dto/LineAttachToVoltageLevelInfos.java index cd3a5f8e..99b03ff2 100644 --- a/src/main/java/org/gridsuite/modification/dto/LineAttachToVoltageLevelInfos.java +++ b/src/main/java/org/gridsuite/modification/dto/LineAttachToVoltageLevelInfos.java @@ -42,6 +42,9 @@ public class LineAttachToVoltageLevelInfos extends ModificationInfos { @Schema(description = "attachment point name") private String attachmentPointName; + @Schema(description = "details about attachment point, may be null") + private VoltageLevelCreationInfos attachmentPointDetailInformation; + @Schema(description = "possible new voltage level to create before inserting it, may be null") private VoltageLevelCreationInfos mayNewVoltageLevelInfos; diff --git a/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java b/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java index 0a6ef16d..878554e1 100644 --- a/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java +++ b/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java @@ -10,11 +10,14 @@ import com.powsybl.iidm.modification.topology.CreateLineOnLine; import com.powsybl.iidm.modification.topology.CreateLineOnLineBuilder; import com.powsybl.iidm.network.*; +import com.powsybl.iidm.network.extensions.IdentifiableShortCircuitAdder; import org.gridsuite.modification.NetworkModificationException; import org.gridsuite.modification.dto.LineAttachToVoltageLevelInfos; import org.gridsuite.modification.dto.LineCreationInfos; +import org.gridsuite.modification.dto.SubstationCreationInfos; import org.gridsuite.modification.dto.VoltageLevelCreationInfos; import org.gridsuite.modification.utils.ModificationUtils; +import org.gridsuite.modification.utils.PropertiesUtils; import static org.gridsuite.modification.NetworkModificationException.Type.*; @@ -58,6 +61,9 @@ public void apply(Network network, ReportNode subReportNode) { VoltageLevelCreationInfos mayNewVL = modificationInfos.getMayNewVoltageLevelInfos(); if (mayNewVL != null) { ModificationUtils.getInstance().createVoltageLevel(mayNewVL, subReportNode, network); + // properties + VoltageLevel voltageLevel = network.getVoltageLevel(mayNewVL.getEquipmentId()); + PropertiesUtils.applyProperties(voltageLevel, null, mayNewVL.getProperties(), null); } LineCreationInfos attachmentLineInfos = modificationInfos.getAttachmentLine(); @@ -70,14 +76,16 @@ public void apply(Network network, ReportNode subReportNode) { .setB1(ModificationUtils.getInstance().zeroIfNull(attachmentLineInfos.getB1())) .setG2(ModificationUtils.getInstance().zeroIfNull(attachmentLineInfos.getG2())) .setB2(ModificationUtils.getInstance().zeroIfNull(attachmentLineInfos.getB2())); - + String newSubstationId = modificationInfos.getAttachmentPointDetailInformation() != null ? + modificationInfos.getAttachmentPointDetailInformation().getSubstationCreation().getEquipmentId() : + modificationInfos.getAttachmentPointId() + "_substation"; CreateLineOnLine algo = new CreateLineOnLineBuilder() .withPositionPercent(modificationInfos.getPercent()) .withBusbarSectionOrBusId(modificationInfos.getBbsOrBusId()) .withFictitiousVoltageLevelId(modificationInfos.getAttachmentPointId()) .withFictitiousVoltageLevelName(modificationInfos.getAttachmentPointName()) .withCreateFictitiousSubstation(true) - .withFictitiousSubstationId(modificationInfos.getAttachmentPointId() + "_substation") + .withFictitiousSubstationId(newSubstationId) .withLine1Id(modificationInfos.getNewLine1Id()) .withLine1Name(modificationInfos.getNewLine1Name()) .withLine2Id(modificationInfos.getNewLine2Id()) @@ -87,6 +95,38 @@ public void apply(Network network, ReportNode subReportNode) { .build(); algo.apply(network, true, subReportNode); + // override attachment point + if (modificationInfos.getAttachmentPointDetailInformation() != null) { + // override voltage level + VoltageLevel voltageLevel = network.getVoltageLevel(modificationInfos.getAttachmentPointId()); + if (modificationInfos.getAttachmentPointDetailInformation().getHighVoltageLimit() != null) { + voltageLevel.setHighVoltageLimit(modificationInfos.getAttachmentPointDetailInformation().getHighVoltageLimit()); + } + if (modificationInfos.getAttachmentPointDetailInformation().getLowVoltageLimit() != null) { + voltageLevel.setLowVoltageLimit(modificationInfos.getAttachmentPointDetailInformation().getLowVoltageLimit()); + } + if (modificationInfos.getAttachmentPointDetailInformation().getIpMax() != null || modificationInfos.getAttachmentPointDetailInformation().getIpMin() != null) { + IdentifiableShortCircuitAdder adder = voltageLevel.newExtension(IdentifiableShortCircuitAdder.class); + if (modificationInfos.getAttachmentPointDetailInformation().getIpMax() != null) { + adder.withIpMax(modificationInfos.getAttachmentPointDetailInformation().getIpMax()); + } + if (modificationInfos.getAttachmentPointDetailInformation().getIpMin() != null) { + adder.withIpMin(modificationInfos.getAttachmentPointDetailInformation().getIpMin()); + } + adder.add(); + } + PropertiesUtils.applyProperties(voltageLevel, modificationInfos.getAttachmentPointDetailInformation().getProperties()); + // override substation + SubstationCreationInfos substationCreationInfos = modificationInfos.getAttachmentPointDetailInformation().getSubstationCreation(); + final Substation substation = network.getSubstation(substationCreationInfos.getEquipmentId()); + if (substationCreationInfos.getEquipmentName() != null) { + substation.setName(substationCreationInfos.getEquipmentName()); + } + if (substationCreationInfos.getCountry() != null) { + substation.setCountry(substationCreationInfos.getCountry()); + } + PropertiesUtils.applyProperties(substation, substationCreationInfos.getProperties()); + } } @Override diff --git a/src/main/java/org/gridsuite/modification/utils/PropertiesUtils.java b/src/main/java/org/gridsuite/modification/utils/PropertiesUtils.java index 497b1416..1ec78138 100644 --- a/src/main/java/org/gridsuite/modification/utils/PropertiesUtils.java +++ b/src/main/java/org/gridsuite/modification/utils/PropertiesUtils.java @@ -21,6 +21,10 @@ private PropertiesUtils() { // Should not be instantiated } + public static void applyProperties(Identifiable identifiable, @Nullable List properties) { + applyProperties(identifiable, null, properties, null); + } + public static void applyProperties(Identifiable identifiable, ReportNode subReportNode, @Nullable List properties, String propertiesLabelKey) { List reportNodes = new ArrayList<>(); Optional.ofNullable(properties).ifPresent(props -> @@ -29,7 +33,7 @@ public static void applyProperties(Identifiable identifiable, ReportNode subR .ifPresent(reportNodes::add) ) ); - if (!reportNodes.isEmpty()) { + if (subReportNode != null && !reportNodes.isEmpty()) { ModificationUtils.getInstance().reportModifications(subReportNode, reportNodes, propertiesLabelKey); } } diff --git a/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java b/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java index b4087dfe..09684c28 100644 --- a/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java +++ b/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java @@ -7,12 +7,13 @@ package org.gridsuite.modification.modifications; import com.fasterxml.jackson.core.type.TypeReference; -import com.powsybl.iidm.network.Network; -import com.powsybl.iidm.network.SwitchKind; +import com.powsybl.iidm.network.*; +import com.powsybl.iidm.network.extensions.IdentifiableShortCircuit; import org.gridsuite.modification.dto.*; import org.gridsuite.modification.utils.NetworkCreation; import java.util.Arrays; +import java.util.List; import java.util.Map; import java.util.UUID; @@ -32,6 +33,34 @@ private static LineCreationInfos getAttachmentLine() { .build(); } + private static VoltageLevelCreationInfos getAttachmentPoint() { + return VoltageLevelCreationInfos.builder() + .equipmentId("AttPointId") + .stashed(false) + .nominalV(0) + .substationCreation(SubstationCreationInfos.builder().stashed(false) + .equipmentId("attachmentPointSubstation") + .country(Country.FR) + .properties(List.of(FreePropertyInfos.builder() + .added(true) + .name("substationProp") + .value("valueSubstation") + .build())) + .build()) + .lowVoltageLimit(50.0) + .highVoltageLimit(100.0) + .ipMin(5.0) + .ipMax(20.0) + .busbarCount(1) + .sectionCount(1) + .properties(List.of(FreePropertyInfos.builder() + .added(true) + .name("voltageLevelProp") + .value("valueVoltageLevel") + .build())) + .build(); + } + private static VoltageLevelCreationInfos getNewVoltageLevel() { return VoltageLevelCreationInfos.builder() .stashed(false) @@ -47,6 +76,11 @@ private static VoltageLevelCreationInfos getNewVoltageLevel() { .sectionCount(2) .switchKinds(Arrays.asList(SwitchKind.BREAKER)) .couplingDevices(Arrays.asList(CouplingDeviceInfos.builder().busbarSectionId1("1A").busbarSectionId2("1B").build())) + .properties(List.of(FreePropertyInfos.builder() + .added(true) + .name("newVoltageLevelProp") + .value("newVoltageLevelValue") + .build())) .build(); } @@ -63,6 +97,7 @@ protected ModificationInfos buildModification() { .percent(20.0) .attachmentPointId("AttPointId") .attachmentPointName("attPointName") + .attachmentPointDetailInformation(getAttachmentPoint()) .mayNewVoltageLevelInfos(getNewVoltageLevel()) // create another new VL .existingVoltageLevelId(null) .bbsOrBusId("1.A") @@ -81,9 +116,33 @@ protected void assertAfterNetworkModificationApplication() { assertNotNull(getNetwork().getLine("nl1")); assertNotNull(getNetwork().getLine("nl2")); assertNotNull(getNetwork().getVoltageLevel("AttPointId")); - assertNotNull(getNetwork().getVoltageLevel("newVoltageLevel")); + + VoltageLevel newVoltageLevel = getNetwork().getVoltageLevel("newVoltageLevel"); + assertNotNull(newVoltageLevel); + assertEquals("newVoltageLevelValue", newVoltageLevel.getProperty("newVoltageLevelProp")); + // replaced line is gone assertNull(getNetwork().getLine("line3")); + + // attachment point substation + Substation attachmentPointSubstation = getNetwork().getSubstation("attachmentPointSubstation"); + assertNotNull(attachmentPointSubstation); + assertEquals("valueSubstation", attachmentPointSubstation.getProperty("substationProp")); + assertTrue(attachmentPointSubstation.getCountry().isPresent()); + assertEquals(Country.FR, attachmentPointSubstation.getCountry().get()); + + // attachment point voltage level + VoltageLevel attachmentPointVoltageLevel = getNetwork().getVoltageLevel("AttPointId"); + assertNotNull(attachmentPointVoltageLevel); + assertEquals("valueVoltageLevel", attachmentPointVoltageLevel.getProperty("voltageLevelProp")); + assertEquals(380.0, attachmentPointVoltageLevel.getNominalV(), 0.001); + assertEquals(50.0, attachmentPointVoltageLevel.getLowVoltageLimit(), 0.001); + assertEquals(100.0, attachmentPointVoltageLevel.getHighVoltageLimit(), 0.001); + + IdentifiableShortCircuit identifiableShortCircuit = attachmentPointVoltageLevel.getExtension(IdentifiableShortCircuit.class); + assertNotNull(identifiableShortCircuit); + assertEquals(5.0, identifiableShortCircuit.getIpMin(), 0.001); + assertEquals(20.0, identifiableShortCircuit.getIpMax(), 0.001); } @Override From 3b5d027a5a477d3b3021cd568be56afa1ac929f4 Mon Sep 17 00:00:00 2001 From: Etienne LESOT Date: Fri, 28 Nov 2025 14:33:53 +0100 Subject: [PATCH 2/4] add asserts Signed-off-by: Etienne LESOT --- .../modifications/LineAttachToNewVoltageLevelTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java b/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java index 09684c28..8625b05e 100644 --- a/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java +++ b/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java @@ -130,6 +130,7 @@ protected void assertAfterNetworkModificationApplication() { assertEquals("valueSubstation", attachmentPointSubstation.getProperty("substationProp")); assertTrue(attachmentPointSubstation.getCountry().isPresent()); assertEquals(Country.FR, attachmentPointSubstation.getCountry().get()); + assertTrue(attachmentPointSubstation.isFictitious()); // attachment point voltage level VoltageLevel attachmentPointVoltageLevel = getNetwork().getVoltageLevel("AttPointId"); @@ -138,6 +139,7 @@ protected void assertAfterNetworkModificationApplication() { assertEquals(380.0, attachmentPointVoltageLevel.getNominalV(), 0.001); assertEquals(50.0, attachmentPointVoltageLevel.getLowVoltageLimit(), 0.001); assertEquals(100.0, attachmentPointVoltageLevel.getHighVoltageLimit(), 0.001); + assertTrue(attachmentPointVoltageLevel.isFictitious()); IdentifiableShortCircuit identifiableShortCircuit = attachmentPointVoltageLevel.getExtension(IdentifiableShortCircuit.class); assertNotNull(identifiableShortCircuit); From 12b178a18728cbc018389053bf0cf4af0bf48ae2 Mon Sep 17 00:00:00 2001 From: Etienne LESOT Date: Fri, 28 Nov 2025 14:39:30 +0100 Subject: [PATCH 3/4] try to fix sonar Signed-off-by: Etienne LESOT --- .../modifications/LineAttachToVoltageLevel.java | 2 +- .../LineAttachToNewVoltageLevelTest.java | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java b/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java index 878554e1..6578291a 100644 --- a/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java +++ b/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java @@ -106,7 +106,7 @@ public void apply(Network network, ReportNode subReportNode) { voltageLevel.setLowVoltageLimit(modificationInfos.getAttachmentPointDetailInformation().getLowVoltageLimit()); } if (modificationInfos.getAttachmentPointDetailInformation().getIpMax() != null || modificationInfos.getAttachmentPointDetailInformation().getIpMin() != null) { - IdentifiableShortCircuitAdder adder = voltageLevel.newExtension(IdentifiableShortCircuitAdder.class); + IdentifiableShortCircuitAdder adder = voltageLevel.newExtension(IdentifiableShortCircuitAdder.class); if (modificationInfos.getAttachmentPointDetailInformation().getIpMax() != null) { adder.withIpMax(modificationInfos.getAttachmentPointDetailInformation().getIpMax()); } diff --git a/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java b/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java index 8625b05e..269834d4 100644 --- a/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java +++ b/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java @@ -12,10 +12,7 @@ import org.gridsuite.modification.dto.*; import org.gridsuite.modification.utils.NetworkCreation; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; import static org.junit.jupiter.api.Assertions.*; @@ -74,8 +71,8 @@ private static VoltageLevelCreationInfos getNewVoltageLevel() { .ipMax(10.0) .busbarCount(2) .sectionCount(2) - .switchKinds(Arrays.asList(SwitchKind.BREAKER)) - .couplingDevices(Arrays.asList(CouplingDeviceInfos.builder().busbarSectionId1("1A").busbarSectionId2("1B").build())) + .switchKinds(List.of(SwitchKind.BREAKER)) + .couplingDevices(Collections.singletonList(CouplingDeviceInfos.builder().busbarSectionId1("1A").busbarSectionId2("1B").build())) .properties(List.of(FreePropertyInfos.builder() .added(true) .name("newVoltageLevelProp") @@ -141,7 +138,7 @@ protected void assertAfterNetworkModificationApplication() { assertEquals(100.0, attachmentPointVoltageLevel.getHighVoltageLimit(), 0.001); assertTrue(attachmentPointVoltageLevel.isFictitious()); - IdentifiableShortCircuit identifiableShortCircuit = attachmentPointVoltageLevel.getExtension(IdentifiableShortCircuit.class); + IdentifiableShortCircuit identifiableShortCircuit = attachmentPointVoltageLevel.getExtension(IdentifiableShortCircuit.class); assertNotNull(identifiableShortCircuit); assertEquals(5.0, identifiableShortCircuit.getIpMin(), 0.001); assertEquals(20.0, identifiableShortCircuit.getIpMax(), 0.001); From 7908e8f6ebba0f67982078062199346adedead72 Mon Sep 17 00:00:00 2001 From: Etienne LESOT Date: Wed, 3 Dec 2025 10:17:30 +0100 Subject: [PATCH 4/4] review Signed-off-by: Etienne LESOT --- .../LineAttachToVoltageLevel.java | 61 +++++++++++-------- .../LineAttachToNewVoltageLevelTest.java | 3 + .../LineAttachToVoltageLevelTest.java | 9 ++- 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java b/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java index 6578291a..c8277b5e 100644 --- a/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java +++ b/src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java @@ -11,6 +11,7 @@ import com.powsybl.iidm.modification.topology.CreateLineOnLineBuilder; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.IdentifiableShortCircuitAdder; +import groovyjarjarantlr4.v4.runtime.misc.NotNull; import org.gridsuite.modification.NetworkModificationException; import org.gridsuite.modification.dto.LineAttachToVoltageLevelInfos; import org.gridsuite.modification.dto.LineCreationInfos; @@ -98,35 +99,43 @@ public void apply(Network network, ReportNode subReportNode) { // override attachment point if (modificationInfos.getAttachmentPointDetailInformation() != null) { // override voltage level - VoltageLevel voltageLevel = network.getVoltageLevel(modificationInfos.getAttachmentPointId()); - if (modificationInfos.getAttachmentPointDetailInformation().getHighVoltageLimit() != null) { - voltageLevel.setHighVoltageLimit(modificationInfos.getAttachmentPointDetailInformation().getHighVoltageLimit()); - } - if (modificationInfos.getAttachmentPointDetailInformation().getLowVoltageLimit() != null) { - voltageLevel.setLowVoltageLimit(modificationInfos.getAttachmentPointDetailInformation().getLowVoltageLimit()); - } - if (modificationInfos.getAttachmentPointDetailInformation().getIpMax() != null || modificationInfos.getAttachmentPointDetailInformation().getIpMin() != null) { - IdentifiableShortCircuitAdder adder = voltageLevel.newExtension(IdentifiableShortCircuitAdder.class); - if (modificationInfos.getAttachmentPointDetailInformation().getIpMax() != null) { - adder.withIpMax(modificationInfos.getAttachmentPointDetailInformation().getIpMax()); - } - if (modificationInfos.getAttachmentPointDetailInformation().getIpMin() != null) { - adder.withIpMin(modificationInfos.getAttachmentPointDetailInformation().getIpMin()); - } - adder.add(); - } - PropertiesUtils.applyProperties(voltageLevel, modificationInfos.getAttachmentPointDetailInformation().getProperties()); - // override substation - SubstationCreationInfos substationCreationInfos = modificationInfos.getAttachmentPointDetailInformation().getSubstationCreation(); - final Substation substation = network.getSubstation(substationCreationInfos.getEquipmentId()); - if (substationCreationInfos.getEquipmentName() != null) { - substation.setName(substationCreationInfos.getEquipmentName()); + updateAttachmentVoltageLevel(network, modificationInfos.getAttachmentPointDetailInformation()); + } + } + + private void updateAttachmentVoltageLevel(Network network, @NotNull VoltageLevelCreationInfos attachmentPointDetailInformation) { + VoltageLevel voltageLevel = network.getVoltageLevel(modificationInfos.getAttachmentPointId()); + if (attachmentPointDetailInformation.getHighVoltageLimit() != null) { + voltageLevel.setHighVoltageLimit(attachmentPointDetailInformation.getHighVoltageLimit()); + } + if (attachmentPointDetailInformation.getLowVoltageLimit() != null) { + voltageLevel.setLowVoltageLimit(attachmentPointDetailInformation.getLowVoltageLimit()); + } + if (attachmentPointDetailInformation.getIpMax() != null || attachmentPointDetailInformation.getIpMin() != null) { + IdentifiableShortCircuitAdder adder = voltageLevel.newExtension(IdentifiableShortCircuitAdder.class); + if (attachmentPointDetailInformation.getIpMax() != null) { + adder.withIpMax(attachmentPointDetailInformation.getIpMax()); } - if (substationCreationInfos.getCountry() != null) { - substation.setCountry(substationCreationInfos.getCountry()); + if (attachmentPointDetailInformation.getIpMin() != null) { + adder.withIpMin(attachmentPointDetailInformation.getIpMin()); } - PropertiesUtils.applyProperties(substation, substationCreationInfos.getProperties()); + adder.add(); + } + PropertiesUtils.applyProperties(voltageLevel, attachmentPointDetailInformation.getProperties()); + // override substation + SubstationCreationInfos substationCreationInfos = attachmentPointDetailInformation.getSubstationCreation(); + updateAttachmentSubstation(network, substationCreationInfos); + } + + private void updateAttachmentSubstation(Network network, @NotNull SubstationCreationInfos substationCreationInfos) { + final Substation substation = network.getSubstation(substationCreationInfos.getEquipmentId()); + if (substationCreationInfos.getEquipmentName() != null) { + substation.setName(substationCreationInfos.getEquipmentName()); + } + if (substationCreationInfos.getCountry() != null) { + substation.setCountry(substationCreationInfos.getCountry()); } + PropertiesUtils.applyProperties(substation, substationCreationInfos.getProperties()); } @Override diff --git a/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java b/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java index 269834d4..dbb07c3a 100644 --- a/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java +++ b/src/test/java/org/gridsuite/modification/modifications/LineAttachToNewVoltageLevelTest.java @@ -37,6 +37,7 @@ private static VoltageLevelCreationInfos getAttachmentPoint() { .nominalV(0) .substationCreation(SubstationCreationInfos.builder().stashed(false) .equipmentId("attachmentPointSubstation") + .equipmentName("attachmentPointSubstationName") .country(Country.FR) .properties(List.of(FreePropertyInfos.builder() .added(true) @@ -124,6 +125,8 @@ protected void assertAfterNetworkModificationApplication() { // attachment point substation Substation attachmentPointSubstation = getNetwork().getSubstation("attachmentPointSubstation"); assertNotNull(attachmentPointSubstation); + assertTrue(attachmentPointSubstation.getOptionalName().isPresent()); + assertEquals("attachmentPointSubstationName", attachmentPointSubstation.getOptionalName().get()); assertEquals("valueSubstation", attachmentPointSubstation.getProperty("substationProp")); assertTrue(attachmentPointSubstation.getCountry().isPresent()); assertEquals(Country.FR, attachmentPointSubstation.getCountry().get()); diff --git a/src/test/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevelTest.java b/src/test/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevelTest.java index 04be80f2..99da1239 100644 --- a/src/test/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevelTest.java +++ b/src/test/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevelTest.java @@ -13,9 +13,8 @@ import org.gridsuite.modification.dto.*; import org.gridsuite.modification.utils.NetworkCreation; import org.junit.jupiter.api.Test; -import java.util.Arrays; -import java.util.Map; -import java.util.UUID; + +import java.util.*; import static org.gridsuite.modification.NetworkModificationException.Type.*; import static org.junit.jupiter.api.Assertions.*; @@ -47,8 +46,8 @@ private static VoltageLevelCreationInfos getNewVoltageLevel() { .ipMax(10.0) .busbarCount(2) .sectionCount(2) - .switchKinds(Arrays.asList(SwitchKind.BREAKER)) - .couplingDevices(Arrays.asList(CouplingDeviceInfos.builder().busbarSectionId1("bbs.nw").busbarSectionId2("bbs.ne").build())) + .switchKinds(List.of(SwitchKind.BREAKER)) + .couplingDevices(Collections.singletonList(CouplingDeviceInfos.builder().busbarSectionId1("bbs.nw").busbarSectionId2("bbs.ne").build())) .build(); }