From 5bde1ec851c9288c018a3e2742d4341c570be3e1 Mon Sep 17 00:00:00 2001 From: SAINTIER FRANCOIS Date: Mon, 14 Mar 2022 18:13:07 +0100 Subject: [PATCH 01/17] Update SCL initialisation method to allow the creation with a specific header.id Signed-off-by: SAINTIER FRANCOIS --- .../lfenergy/compas/sct/commons/scl/SclService.java | 6 +++--- .../compas/sct/commons/scl/SclServiceTest.java | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java index 6a8f93829..26f4be86e 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java @@ -47,9 +47,9 @@ public class SclService { private SclService(){ throw new IllegalStateException("SclService class"); } - public static SclRootAdapter initScl(String hVersion, String hRevision) throws ScdException { - UUID hId = UUID.randomUUID(); - return new SclRootAdapter(hId.toString(),hVersion,hRevision); + public static SclRootAdapter initScl(Optional hId, String hVersion, String hRevision) throws ScdException { + UUID headerId = hId.orElseGet(UUID::randomUUID); + return new SclRootAdapter(headerId.toString(), hVersion, hRevision); } public static SclRootAdapter addHistoryItem(SCL scd, String who, String what, String why){ diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java index 83a4cbbb5..1121c9f90 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java @@ -32,6 +32,7 @@ import org.lfenergy.compas.sct.commons.testhelpers.SclTestMarshaller; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.UUID; @@ -314,7 +315,15 @@ void testGetDAI() throws Exception { @Test void testInitScl(){ assertDoesNotThrow( - () -> SclService.initScl("hVersion","hRevision") + () -> SclService.initScl(Optional.empty(), "hVersion","hRevision") + ); + } + + @Test + void testInitScl_With_hId_shouldNotThrowError(){ + UUID hid = UUID.randomUUID(); + assertDoesNotThrow( + () -> SclService.initScl(Optional.of(hid),"hVersion","hRevision") ); } @@ -322,7 +331,7 @@ void testInitScl(){ void testUpdateHeader() { SclRootAdapter sclRootAdapter = assertDoesNotThrow( - () -> SclService.initScl("hVersion","hRevision") + () -> SclService.initScl(Optional.empty(),"hVersion","hRevision") ); UUID hId = UUID.fromString(sclRootAdapter.getHeaderAdapter().getHeaderId()); HeaderDTO headerDTO = DTO.createHeaderDTO(hId); From d3e2cd3b1848ddda3eec1391fa5756c6e5dbde74 Mon Sep 17 00:00:00 2001 From: Aliou DIAITE Date: Tue, 22 Mar 2022 17:17:46 +0100 Subject: [PATCH 02/17] [#57] : add Voltage Level and Bay adapters and tests Signed-off-by: Aliou DIAITE --- .../sct/commons/scl/sstation/BayAdapter.java | 29 ++++++++++ .../scl/sstation/SubstationAdapter.java | 10 ++++ .../scl/sstation/VoltageLevelAdapter.java | 40 ++++++++++++++ .../commons/scl/sstation/BayAdapterTest.java | 52 ++++++++++++++++++ .../scl/sstation/SubstationAdapterTest.java | 31 +++++++++-- .../scl/sstation/VoltageLevelAdapterTest.java | 53 +++++++++++++++++++ 6 files changed, 211 insertions(+), 4 deletions(-) create mode 100644 sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapter.java create mode 100644 sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapter.java create mode 100644 sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapterTest.java create mode 100644 sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapterTest.java diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapter.java new file mode 100644 index 000000000..d62968c83 --- /dev/null +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapter.java @@ -0,0 +1,29 @@ +package org.lfenergy.compas.sct.commons.scl.sstation; + +import org.lfenergy.compas.scl2007b4.model.TBay; +import org.lfenergy.compas.sct.commons.exception.ScdException; +import org.lfenergy.compas.sct.commons.scl.SclElementAdapter; + +public class BayAdapter extends SclElementAdapter { + + public BayAdapter(VoltageLevelAdapter parentAdapter){super(parentAdapter);} + + public BayAdapter(VoltageLevelAdapter parentAdapter, TBay currentElem){ + super (parentAdapter, currentElem); + } + + public BayAdapter(VoltageLevelAdapter parentAdapter, String bayName) throws ScdException { + super(parentAdapter); + TBay tBay = parentAdapter.getCurrentElem().getBay() + .stream() + .filter(bay -> bay.getName().equals(bayName)) + .findFirst() + .orElseThrow(() -> new ScdException("Unknown Bay name :" + bayName)); + setCurrentElem(tBay); + } + + @Override + protected boolean amChildElementRef() { + return parentAdapter.getCurrentElem().getBay().contains(currentElem); + } +} diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapter.java index b078e9583..0d8a7b3e4 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapter.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapter.java @@ -9,6 +9,8 @@ import org.lfenergy.compas.sct.commons.scl.SclElementAdapter; import org.lfenergy.compas.sct.commons.scl.SclRootAdapter; +import java.util.Optional; + public class SubstationAdapter extends SclElementAdapter { public SubstationAdapter(SclRootAdapter parentAdapter) { @@ -33,4 +35,12 @@ public SubstationAdapter(SclRootAdapter parentAdapter, String ssName) throws Scd protected boolean amChildElementRef() { return parentAdapter.getCurrentElem().getSubstation().contains(currentElem); } + + Optional getVoltageLevelAdapter(String vLevelName) { + return currentElem.getVoltageLevel() + .stream() + .filter(tVoltageLevel -> tVoltageLevel.getName().equals(vLevelName)) + .map(tVoltageLevel -> new VoltageLevelAdapter(this, tVoltageLevel)) + .findFirst(); + } } diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapter.java new file mode 100644 index 000000000..fa9525bbc --- /dev/null +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapter.java @@ -0,0 +1,40 @@ +package org.lfenergy.compas.sct.commons.scl.sstation; + +import org.lfenergy.compas.scl2007b4.model.TVoltageLevel; +import org.lfenergy.compas.sct.commons.exception.ScdException; +import org.lfenergy.compas.sct.commons.scl.SclElementAdapter; + +import java.util.Optional; + +public class VoltageLevelAdapter extends SclElementAdapter { + + public VoltageLevelAdapter(SubstationAdapter parentAdapter) {super(parentAdapter);} + + public VoltageLevelAdapter(SubstationAdapter substationAdapter, TVoltageLevel currentElem){ + super(substationAdapter, currentElem); + } + + public VoltageLevelAdapter(SubstationAdapter parentAdapter, String vLevelName) throws ScdException { + super(parentAdapter); + TVoltageLevel tVoltageLevel = parentAdapter.getCurrentElem().getVoltageLevel() + .stream() + .filter(vLevel -> vLevel.getName().equals(vLevelName)) + .findFirst() + .orElseThrow(() -> new ScdException("Unknown VoltageLevel name :" + vLevelName)); + setCurrentElem(tVoltageLevel); + } + + + @Override + protected boolean amChildElementRef() { + return parentAdapter.getCurrentElem().getVoltageLevel().contains(currentElem); + } + + Optional getBayAdapter(String bayName) { + return currentElem.getBay() + .stream() + .filter(tBay -> tBay.getName().equals(bayName)) + .map(tBay -> new BayAdapter(this, tBay)) + .findFirst(); + } +} diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapterTest.java new file mode 100644 index 000000000..6bbf67059 --- /dev/null +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapterTest.java @@ -0,0 +1,52 @@ +// SPDX-FileCopyrightText: 2021 RTE FRANCE +// +// SPDX-License-Identifier: Apache-2.0 + +package org.lfenergy.compas.sct.commons.scl.sstation; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.lfenergy.compas.scl2007b4.model.TBay; +import org.lfenergy.compas.scl2007b4.model.TSubstation; +import org.lfenergy.compas.scl2007b4.model.TVoltageLevel; +import org.lfenergy.compas.sct.commons.exception.ScdException; +import org.lfenergy.compas.sct.commons.scl.SclRootAdapter; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class BayAdapterTest { + + private BayAdapter bayAdapter; + + @BeforeEach + public void init() throws ScdException { + + SclRootAdapter sclRootAdapter = new SclRootAdapter("hID","hVersion","hRevision"); + TSubstation tSubstation = new TSubstation(); + tSubstation.setName("SUBSTATION"); + sclRootAdapter.getCurrentElem().getSubstation().add(tSubstation); + SubstationAdapter ssAdapter = sclRootAdapter.getSubstationAdapter("SUBSTATION"); + TVoltageLevel tVoltageLevel = new TVoltageLevel(); + tVoltageLevel.setName("VOLTAGE_LEVEL"); + ssAdapter.getCurrentElem().getVoltageLevel().add(tVoltageLevel); + VoltageLevelAdapter vLevelAdapter = ssAdapter.getVoltageLevelAdapter("VOLTAGE_LEVEL").get(); + TBay tBay = new TBay(); + tBay.setName("BAY"); + vLevelAdapter.getCurrentElem().getBay().add(tBay); + bayAdapter = vLevelAdapter.getBayAdapter("BAY").get(); + + } + + @Test + void testAmChildElementRef() { + assertTrue(bayAdapter.amChildElementRef()); + } + + @Test + void testSetCurrentElemInAdapter() { + TBay tBay1 = new TBay(); + assertThrows(IllegalArgumentException.class, + () ->bayAdapter.setCurrentElem(tBay1)); + } +} \ No newline at end of file diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java index 4b44cc29c..3c6187dac 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java @@ -4,8 +4,11 @@ package org.lfenergy.compas.sct.commons.scl.sstation; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.lfenergy.compas.scl2007b4.model.TBay; import org.lfenergy.compas.scl2007b4.model.TSubstation; +import org.lfenergy.compas.scl2007b4.model.TVoltageLevel; import org.lfenergy.compas.sct.commons.exception.ScdException; import org.lfenergy.compas.sct.commons.scl.SclRootAdapter; @@ -13,22 +16,42 @@ class SubstationAdapterTest { - @Test - void testAmChildElementRef() throws ScdException { - SclRootAdapter sclRootAdapter = new SclRootAdapter("hID","hVersion","hRevision"); + private SclRootAdapter sclRootAdapter; + private SubstationAdapter ssAdapter; + + @BeforeEach + public void init() throws ScdException { + sclRootAdapter = new SclRootAdapter("hID","hVersion","hRevision"); TSubstation tSubstation = new TSubstation(); tSubstation.setName("SUBSTATION"); sclRootAdapter.getCurrentElem().getSubstation().add(tSubstation); - SubstationAdapter ssAdapter = sclRootAdapter.getSubstationAdapter("SUBSTATION"); + ssAdapter = sclRootAdapter.getSubstationAdapter("SUBSTATION"); + } + + @Test + void testAmChildElementRef() { assertTrue(ssAdapter.amChildElementRef()); + } + @Test + void testSetCurrentElement() { SubstationAdapter ssfAdapter = new SubstationAdapter(sclRootAdapter); TSubstation tSubstation1 = new TSubstation(); assertThrows(IllegalArgumentException.class, () ->ssfAdapter.setCurrentElem(tSubstation1)); + } + @Test + void testGetSubstationAdapter() { assertThrows(ScdException.class, () -> sclRootAdapter.getSubstationAdapter("SUBSTATION1")); + } + @Test + void testGetVoltageLevelAdapter() { + TVoltageLevel tVoltageLevel = new TVoltageLevel(); + tVoltageLevel.setName("VOLTAGE_LEVEL"); + ssAdapter.getCurrentElem().getVoltageLevel().add(tVoltageLevel); + assertFalse(ssAdapter.getVoltageLevelAdapter("VOLTAGE_LEVEL1").isPresent()); } } \ No newline at end of file diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapterTest.java new file mode 100644 index 000000000..2640a3062 --- /dev/null +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapterTest.java @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2021 RTE FRANCE +// +// SPDX-License-Identifier: Apache-2.0 + +package org.lfenergy.compas.sct.commons.scl.sstation; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.lfenergy.compas.scl2007b4.model.TBay; +import org.lfenergy.compas.scl2007b4.model.TSubstation; +import org.lfenergy.compas.scl2007b4.model.TVoltageLevel; +import org.lfenergy.compas.sct.commons.exception.ScdException; +import org.lfenergy.compas.sct.commons.scl.SclRootAdapter; + +import static org.junit.jupiter.api.Assertions.*; + +class VoltageLevelAdapterTest { + + private VoltageLevelAdapter vLevelAdapter; + + @BeforeEach + public void init() throws ScdException { + SclRootAdapter sclRootAdapter = new SclRootAdapter("hID","hVersion","hRevision"); + TSubstation tSubstation = new TSubstation(); + tSubstation.setName("SUBSTATION"); + sclRootAdapter.getCurrentElem().getSubstation().add(tSubstation); + SubstationAdapter ssAdapter = sclRootAdapter.getSubstationAdapter("SUBSTATION"); + TVoltageLevel tVoltageLevel = new TVoltageLevel(); + tVoltageLevel.setName("VOLTAGE_LEVEL"); + ssAdapter.getCurrentElem().getVoltageLevel().add(tVoltageLevel); + vLevelAdapter = ssAdapter.getVoltageLevelAdapter("VOLTAGE_LEVEL").get(); + } + + @Test + void testAmChildElementRef() { + assertTrue(vLevelAdapter.amChildElementRef()); + } + + @Test + void testSetCurrentElemInAdapter() throws ScdException { + TVoltageLevel tVoltageLevel1 = new TVoltageLevel(); + assertThrows(IllegalArgumentException.class, + () ->vLevelAdapter.setCurrentElem(tVoltageLevel1)); + } + + @Test + void testGetBayAdapter() { + TBay tBay = new TBay(); + tBay.setName("BAY"); + vLevelAdapter.getCurrentElem().getBay().add(tBay); + assertFalse(vLevelAdapter.getBayAdapter("BAY1").isPresent()); + } +} \ No newline at end of file From 73725973911344cd4e532aa741081970c02bb2a2 Mon Sep 17 00:00:00 2001 From: Aliou DIAITE Date: Wed, 23 Mar 2022 20:10:15 +0100 Subject: [PATCH 03/17] [#57] : WIP services and tests add substation to scd Signed-off-by: Aliou DIAITE --- .../compas/sct/commons/scl/SclService.java | 56 ++++++++++- .../sct/commons/scl/sstation/BayAdapter.java | 3 + .../scl/sstation/SubstationAdapter.java | 2 +- .../scl/sstation/VoltageLevelAdapter.java | 5 +- .../sct/commons/scl/SclServiceTest.java | 49 +++++++--- .../scd_with_substation.xml | 44 +++++++++ .../scd-substation-import-ssd/ssd.xml | 95 +++++++++++++++++++ 7 files changed, 234 insertions(+), 20 deletions(-) create mode 100644 sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml create mode 100644 sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java index 6a8f93829..979a13b40 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java @@ -7,10 +7,7 @@ import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.tuple.Pair; -import org.lfenergy.compas.scl2007b4.model.SCL; -import org.lfenergy.compas.scl2007b4.model.TExtRef; -import org.lfenergy.compas.scl2007b4.model.TPredefinedBasicTypeEnum; -import org.lfenergy.compas.scl2007b4.model.TPredefinedCDCEnum; +import org.lfenergy.compas.scl2007b4.model.*; import org.lfenergy.compas.sct.commons.Utils; import org.lfenergy.compas.sct.commons.dto.ConnectedApDTO; import org.lfenergy.compas.sct.commons.dto.ControlBlock; @@ -31,6 +28,9 @@ import org.lfenergy.compas.sct.commons.scl.ied.DAITracker; import org.lfenergy.compas.sct.commons.scl.ied.IEDAdapter; import org.lfenergy.compas.sct.commons.scl.ied.LDeviceAdapter; +import org.lfenergy.compas.sct.commons.scl.sstation.BayAdapter; +import org.lfenergy.compas.sct.commons.scl.sstation.SubstationAdapter; +import org.lfenergy.compas.sct.commons.scl.sstation.VoltageLevelAdapter; import java.util.ArrayList; import java.util.List; @@ -336,4 +336,52 @@ public static Set> getEnumTypeElements(SCL scd, String idE .map(tEnumVal -> Pair.of(tEnumVal.getOrd(),tEnumVal.getValue())) .collect(Collectors.toSet()); } + + public static SclRootAdapter addSubstation(@NonNull SCL scd, @NonNull SCL ssd) throws ScdException { + SclRootAdapter scdRootAdapter = new SclRootAdapter(scd); + SclRootAdapter ssdRootAdapter = new SclRootAdapter(ssd); + if(scdRootAdapter.getCurrentElem().getSubstation().size() > 1 + || ssdRootAdapter.currentElem.getSubstation().size() != 1) { + throw new ScdException("SCD file must have one or zero Substation and " + + "SCD file must have one Substation. The files are rejected."); + } + TSubstation ssdTSubstation = ssdRootAdapter.currentElem.getSubstation().get(0); + SubstationAdapter ssdSubstationAdapter = new SubstationAdapter(ssdRootAdapter, ssdTSubstation); + + if(scdRootAdapter.getCurrentElem().getSubstation().isEmpty()) { + scdRootAdapter.getCurrentElem().getSubstation().add(ssdTSubstation); + return scdRootAdapter; + } else { + TSubstation scdTSubstation = scdRootAdapter.currentElem.getSubstation().get(0); + if(scdTSubstation.getName().equalsIgnoreCase(ssdTSubstation.getName())) { + SubstationAdapter scdSubstationAdapter = new SubstationAdapter(scdRootAdapter, scdTSubstation); + for(TVoltageLevel vl:ssdSubstationAdapter.getCurrentElem().getVoltageLevel()){ + updateVoltageLevel(ssdSubstationAdapter, scdSubstationAdapter, vl); + } + } else throw new ScdException("SCD file must have only one Substation and the Substation name from SSD file is" + + " different from the one in SCD file. The files are rejected."); + } + return scdRootAdapter; + } + + private static void updateVoltageLevel(SubstationAdapter ssdSubstationAdapter, SubstationAdapter scdSubstationAdapter, TVoltageLevel vl) { + VoltageLevelAdapter vlAdapter = new VoltageLevelAdapter(ssdSubstationAdapter, vl); + if(scdSubstationAdapter.getVoltageLevelAdapter(vlAdapter.getCurrentElem().getName()).isPresent()) { + VoltageLevelAdapter scdVoltageLevelAdapter = scdSubstationAdapter.getVoltageLevelAdapter(vl.getName()).get(); + for (TBay tbay: vlAdapter.getCurrentElem().getBay()) { + updateBay(vlAdapter, scdVoltageLevelAdapter, tbay); + } + } else { + scdSubstationAdapter.getCurrentElem().getVoltageLevel().add(vlAdapter.currentElem); + } + } + + private static void updateBay(VoltageLevelAdapter vlAdapter, VoltageLevelAdapter scdVoltageLevelAdapter, TBay tbay) { + BayAdapter bayAdapter = new BayAdapter(vlAdapter, tbay); + if(vlAdapter.getBayAdapter(bayAdapter.currentElem.getName()).isPresent()){ + vlAdapter.getBayAdapter(bayAdapter.currentElem.getName()); + } else { + scdVoltageLevelAdapter.getCurrentElem().getBay().add(tbay); + } + } } diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapter.java index d62968c83..9811d994b 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapter.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapter.java @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 RTE FRANCE +// +// SPDX-License-Identifier: Apache-2.0 package org.lfenergy.compas.sct.commons.scl.sstation; import org.lfenergy.compas.scl2007b4.model.TBay; diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapter.java index 0d8a7b3e4..26a50a5da 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapter.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapter.java @@ -36,7 +36,7 @@ protected boolean amChildElementRef() { return parentAdapter.getCurrentElem().getSubstation().contains(currentElem); } - Optional getVoltageLevelAdapter(String vLevelName) { + public Optional getVoltageLevelAdapter(String vLevelName) { return currentElem.getVoltageLevel() .stream() .filter(tVoltageLevel -> tVoltageLevel.getName().equals(vLevelName)) diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapter.java index fa9525bbc..88811691c 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapter.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapter.java @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 RTE FRANCE +// +// SPDX-License-Identifier: Apache-2.0 package org.lfenergy.compas.sct.commons.scl.sstation; import org.lfenergy.compas.scl2007b4.model.TVoltageLevel; @@ -30,7 +33,7 @@ protected boolean amChildElementRef() { return parentAdapter.getCurrentElem().getVoltageLevel().contains(currentElem); } - Optional getBayAdapter(String bayName) { + public Optional getBayAdapter(String bayName) { return currentElem.getBay() .stream() .filter(tBay -> tBay.getName().equals(bayName)) diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java index 83a4cbbb5..ac8eeb800 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java @@ -5,13 +5,7 @@ package org.lfenergy.compas.sct.commons.scl; import org.junit.jupiter.api.Test; -import org.lfenergy.compas.scl2007b4.model.SCL; -import org.lfenergy.compas.scl2007b4.model.TExtRef; -import org.lfenergy.compas.scl2007b4.model.THeader; -import org.lfenergy.compas.scl2007b4.model.THitem; -import org.lfenergy.compas.scl2007b4.model.TLLN0Enum; -import org.lfenergy.compas.scl2007b4.model.TServiceType; -import org.lfenergy.compas.scl2007b4.model.TVal; +import org.lfenergy.compas.scl2007b4.model.*; import org.lfenergy.compas.sct.commons.dto.DTO; import org.lfenergy.compas.sct.commons.dto.HeaderDTO; import org.lfenergy.compas.sct.commons.testhelpers.MarshallerWrapper; @@ -35,13 +29,7 @@ import java.util.Set; import java.util.UUID; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; class SclServiceTest { @@ -363,4 +351,37 @@ void testGetEnumTypeElements() throws Exception { ); assertFalse(enumList.isEmpty()); } + + + @Test + void testAddSubstation_Scd_Without_Substation() throws Exception { + SCL scd = SclTestMarshaller.getSCLFromFile("/scl-root-test-schema-conf/add_ied_test.xml"); + SclRootAdapter scdRootAdapter = new SclRootAdapter(scd); + + SCL ssd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd.xml"); + SclRootAdapter ssdRootAdapter = new SclRootAdapter(ssd); + + SclRootAdapter expectedScdAdapter = SclService.addSubstation(scd, ssd); + + assertNotEquals(scdRootAdapter, expectedScdAdapter); + assertEquals(expectedScdAdapter.getCurrentElem().getSubstation(), ssdRootAdapter.getCurrentElem().getSubstation()); + + } + + @Test + void testAddSubstation_Scd_With_Substation() throws Exception { + SCL scd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/scd_with_substation.xml"); + SclRootAdapter scdRootAdapter = new SclRootAdapter(scd); + + SCL ssd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd.xml"); + SclRootAdapter ssdRootAdapter = new SclRootAdapter(ssd); + + SclRootAdapter expectedScdAdapter = SclService.addSubstation(scd, ssd); + TSubstation tSubstation = expectedScdAdapter.getCurrentElem().getSubstation().get(0); + TSubstation expectedTSubstation = ssdRootAdapter.getCurrentElem().getSubstation().get(0); + + assertNotEquals(scdRootAdapter, expectedScdAdapter); + assertEquals(tSubstation.getName(), expectedTSubstation.getName()); + assertEquals(tSubstation.getVoltageLevel().size(), expectedTSubstation.getVoltageLevel().size()); + } } \ No newline at end of file diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml new file mode 100644 index 000000000..9c713f860 --- /dev/null +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml @@ -0,0 +1,44 @@ + + + + + +
+ + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml new file mode 100644 index 000000000..5c83812f5 --- /dev/null +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml @@ -0,0 +1,95 @@ + + + + + + + + +
+ + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 90 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
From a6683e721db22185806682a7358410ea888bf8ed Mon Sep 17 00:00:00 2001 From: Aliou DIAITE Date: Thu, 24 Mar 2022 17:08:23 +0100 Subject: [PATCH 04/17] [#57] : Done add substation from ssd to scd Signed-off-by: Aliou DIAITE --- .../compas/sct/commons/scl/SclService.java | 33 ++++++----- .../sct/commons/scl/SclServiceTest.java | 8 +-- .../scd_with_substation.xml | 38 ++++++------- .../scd-substation-import-ssd/ssd.xml | 57 ++++++------------- 4 files changed, 54 insertions(+), 82 deletions(-) diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java index 979a13b40..1b67b82fa 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java @@ -346,17 +346,15 @@ public static SclRootAdapter addSubstation(@NonNull SCL scd, @NonNull SCL ssd) t "SCD file must have one Substation. The files are rejected."); } TSubstation ssdTSubstation = ssdRootAdapter.currentElem.getSubstation().get(0); - SubstationAdapter ssdSubstationAdapter = new SubstationAdapter(ssdRootAdapter, ssdTSubstation); - if(scdRootAdapter.getCurrentElem().getSubstation().isEmpty()) { scdRootAdapter.getCurrentElem().getSubstation().add(ssdTSubstation); return scdRootAdapter; } else { TSubstation scdTSubstation = scdRootAdapter.currentElem.getSubstation().get(0); if(scdTSubstation.getName().equalsIgnoreCase(ssdTSubstation.getName())) { - SubstationAdapter scdSubstationAdapter = new SubstationAdapter(scdRootAdapter, scdTSubstation); - for(TVoltageLevel vl:ssdSubstationAdapter.getCurrentElem().getVoltageLevel()){ - updateVoltageLevel(ssdSubstationAdapter, scdSubstationAdapter, vl); + SubstationAdapter scdSubstationAdapter = scdRootAdapter.getSubstationAdapter(scdTSubstation.getName()); + for(TVoltageLevel tvl : ssdTSubstation.getVoltageLevel()){ + updateVoltageLevel(scdSubstationAdapter, tvl); } } else throw new ScdException("SCD file must have only one Substation and the Substation name from SSD file is" + " different from the one in SCD file. The files are rejected."); @@ -364,24 +362,25 @@ public static SclRootAdapter addSubstation(@NonNull SCL scd, @NonNull SCL ssd) t return scdRootAdapter; } - private static void updateVoltageLevel(SubstationAdapter ssdSubstationAdapter, SubstationAdapter scdSubstationAdapter, TVoltageLevel vl) { - VoltageLevelAdapter vlAdapter = new VoltageLevelAdapter(ssdSubstationAdapter, vl); - if(scdSubstationAdapter.getVoltageLevelAdapter(vlAdapter.getCurrentElem().getName()).isPresent()) { - VoltageLevelAdapter scdVoltageLevelAdapter = scdSubstationAdapter.getVoltageLevelAdapter(vl.getName()).get(); - for (TBay tbay: vlAdapter.getCurrentElem().getBay()) { - updateBay(vlAdapter, scdVoltageLevelAdapter, tbay); + private static void updateVoltageLevel(@NonNull SubstationAdapter scdSubstationAdapter, TVoltageLevel vl) throws ScdException { + if(scdSubstationAdapter.getVoltageLevelAdapter(vl.getName()).isPresent()) { + VoltageLevelAdapter scdVoltageLevelAdapter = scdSubstationAdapter.getVoltageLevelAdapter(vl.getName()) + .orElseThrow(() -> new ScdException("Unable to create VoltageLevelAdapter")); + for (TBay tbay: vl.getBay()) { + updateBay(scdVoltageLevelAdapter, tbay); } } else { - scdSubstationAdapter.getCurrentElem().getVoltageLevel().add(vlAdapter.currentElem); + scdSubstationAdapter.getCurrentElem().getVoltageLevel().add(vl); } } - private static void updateBay(VoltageLevelAdapter vlAdapter, VoltageLevelAdapter scdVoltageLevelAdapter, TBay tbay) { - BayAdapter bayAdapter = new BayAdapter(vlAdapter, tbay); - if(vlAdapter.getBayAdapter(bayAdapter.currentElem.getName()).isPresent()){ - vlAdapter.getBayAdapter(bayAdapter.currentElem.getName()); + private static void updateBay(@NonNull VoltageLevelAdapter scdVoltageLevelAdapter, TBay tBay) { + if(scdVoltageLevelAdapter.getBayAdapter(tBay.getName()).isPresent()){ + scdVoltageLevelAdapter.getCurrentElem().getBay() + .removeIf(t -> t.getName().equalsIgnoreCase(tBay.getName())); + scdVoltageLevelAdapter.getCurrentElem().getBay().add(tBay); } else { - scdVoltageLevelAdapter.getCurrentElem().getBay().add(tbay); + scdVoltageLevelAdapter.getCurrentElem().getBay().add(tBay); } } } diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java index ac8eeb800..209516328 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java @@ -377,11 +377,11 @@ void testAddSubstation_Scd_With_Substation() throws Exception { SclRootAdapter ssdRootAdapter = new SclRootAdapter(ssd); SclRootAdapter expectedScdAdapter = SclService.addSubstation(scd, ssd); - TSubstation tSubstation = expectedScdAdapter.getCurrentElem().getSubstation().get(0); - TSubstation expectedTSubstation = ssdRootAdapter.getCurrentElem().getSubstation().get(0); + TSubstation expectedTSubstation = expectedScdAdapter.getCurrentElem().getSubstation().get(0); + TSubstation tSubstation = ssdRootAdapter.getCurrentElem().getSubstation().get(0); assertNotEquals(scdRootAdapter, expectedScdAdapter); - assertEquals(tSubstation.getName(), expectedTSubstation.getName()); - assertEquals(tSubstation.getVoltageLevel().size(), expectedTSubstation.getVoltageLevel().size()); + assertEquals(expectedTSubstation.getName(), tSubstation.getName()); + assertEquals(expectedTSubstation.getVoltageLevel().size(), tSubstation.getVoltageLevel().size()); } } \ No newline at end of file diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml index 9c713f860..e6f6bf4c0 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml @@ -5,37 +5,33 @@
- - - - - - - - - - - - - - 0 - + + + 90 + - + - + - + - + - + - + + + + + + + + diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml index 5c83812f5..4a692d624 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml @@ -6,54 +6,31 @@ -
- - - - - - - - - - - - +
+ 0 - + - + - - - - + - - - - + - + - - - - - - - + - + @@ -61,9 +38,9 @@ 90 - + - + @@ -71,23 +48,23 @@ - + - + - + - + - + - + From b68d6f62c44e7e93c8f4401b394551926988a01b Mon Sep 17 00:00:00 2001 From: Aliou DIAITE Date: Fri, 25 Mar 2022 09:33:09 +0100 Subject: [PATCH 05/17] [#57] : Add tests Signed-off-by: Aliou DIAITE --- .../sct/commons/scl/SclServiceTest.java | 24 ++++++++++++++----- .../commons/scl/sstation/BayAdapterTest.java | 20 +++++++++++++--- .../scl/sstation/SubstationAdapterTest.java | 8 +++++++ .../scl/sstation/VoltageLevelAdapterTest.java | 22 ++++++++++++++--- .../scd_with_substation_name_different.xml | 16 +++++++++++++ .../ssd_with_2_substations.xml | 24 +++++++++++++++++++ 6 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation_name_different.xml create mode 100644 sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java index 209516328..146972514 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java @@ -352,30 +352,42 @@ void testGetEnumTypeElements() throws Exception { assertFalse(enumList.isEmpty()); } + @Test + void testAddSubstation_SSD_With_TWO_Substation() throws Exception { + SCL scd = SclTestMarshaller.getSCLFromFile("/scl-root-test-schema-conf/add_ied_test.xml"); + SCL ssd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd_with_2_substations.xml"); + + assertThrows(ScdException.class, + () ->SclService.addSubstation(scd, ssd)); + } @Test - void testAddSubstation_Scd_Without_Substation() throws Exception { + void testAddSubstation_SCD_Without_Substation() throws Exception { SCL scd = SclTestMarshaller.getSCLFromFile("/scl-root-test-schema-conf/add_ied_test.xml"); SclRootAdapter scdRootAdapter = new SclRootAdapter(scd); - SCL ssd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd.xml"); SclRootAdapter ssdRootAdapter = new SclRootAdapter(ssd); - SclRootAdapter expectedScdAdapter = SclService.addSubstation(scd, ssd); assertNotEquals(scdRootAdapter, expectedScdAdapter); assertEquals(expectedScdAdapter.getCurrentElem().getSubstation(), ssdRootAdapter.getCurrentElem().getSubstation()); + } + + @Test + void testAddSubstation_SCD_With_Different_Substation_Name() throws Exception { + SCL scd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/scd_with_substation_name_different.xml"); + SCL ssd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd.xml"); + assertThrows(ScdException.class, + () ->SclService.addSubstation(scd, ssd)); } @Test - void testAddSubstation_Scd_With_Substation() throws Exception { + void testAddSubstation_SCD_With_Substation() throws Exception { SCL scd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/scd_with_substation.xml"); SclRootAdapter scdRootAdapter = new SclRootAdapter(scd); - SCL ssd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd.xml"); SclRootAdapter ssdRootAdapter = new SclRootAdapter(ssd); - SclRootAdapter expectedScdAdapter = SclService.addSubstation(scd, ssd); TSubstation expectedTSubstation = expectedScdAdapter.getCurrentElem().getSubstation().get(0); TSubstation tSubstation = ssdRootAdapter.getCurrentElem().getSubstation().get(0); diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapterTest.java index 6bbf67059..c88f64402 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapterTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/BayAdapterTest.java @@ -12,12 +12,12 @@ import org.lfenergy.compas.sct.commons.exception.ScdException; import org.lfenergy.compas.sct.commons.scl.SclRootAdapter; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; class BayAdapterTest { private BayAdapter bayAdapter; + private VoltageLevelAdapter vLevelAdapter; @BeforeEach public void init() throws ScdException { @@ -30,7 +30,7 @@ public void init() throws ScdException { TVoltageLevel tVoltageLevel = new TVoltageLevel(); tVoltageLevel.setName("VOLTAGE_LEVEL"); ssAdapter.getCurrentElem().getVoltageLevel().add(tVoltageLevel); - VoltageLevelAdapter vLevelAdapter = ssAdapter.getVoltageLevelAdapter("VOLTAGE_LEVEL").get(); + vLevelAdapter = ssAdapter.getVoltageLevelAdapter("VOLTAGE_LEVEL").get(); TBay tBay = new TBay(); tBay.setName("BAY"); vLevelAdapter.getCurrentElem().getBay().add(tBay); @@ -43,6 +43,20 @@ void testAmChildElementRef() { assertTrue(bayAdapter.amChildElementRef()); } + @Test + void testController() { + BayAdapter expectedBayAdapter = new BayAdapter(vLevelAdapter); + assertNotNull(expectedBayAdapter.getParentAdapter()); + assertNull(expectedBayAdapter.getCurrentElem()); + assertFalse(expectedBayAdapter.amChildElementRef()); + } + + @Test + void testControllerWithVoltageLevelName() { + assertThrows(ScdException.class, + () -> new BayAdapter(vLevelAdapter, "BAY_1")); + } + @Test void testSetCurrentElemInAdapter() { TBay tBay1 = new TBay(); diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java index 3c6187dac..c722acc12 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java @@ -33,6 +33,14 @@ void testAmChildElementRef() { assertTrue(ssAdapter.amChildElementRef()); } + @Test + void testController() { + SubstationAdapter expectedSubstationAdapter = new SubstationAdapter(sclRootAdapter, sclRootAdapter.getCurrentElem().getSubstation().get(0)); + assertNotNull(expectedSubstationAdapter.getParentAdapter()); + assertNotNull(expectedSubstationAdapter.getCurrentElem()); + assertTrue(expectedSubstationAdapter.amChildElementRef()); + } + @Test void testSetCurrentElement() { SubstationAdapter ssfAdapter = new SubstationAdapter(sclRootAdapter); diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapterTest.java index 2640a3062..af8e6f9e3 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapterTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/VoltageLevelAdapterTest.java @@ -17,6 +17,7 @@ class VoltageLevelAdapterTest { private VoltageLevelAdapter vLevelAdapter; + private SubstationAdapter ssAdapter; @BeforeEach public void init() throws ScdException { @@ -24,11 +25,26 @@ public void init() throws ScdException { TSubstation tSubstation = new TSubstation(); tSubstation.setName("SUBSTATION"); sclRootAdapter.getCurrentElem().getSubstation().add(tSubstation); - SubstationAdapter ssAdapter = sclRootAdapter.getSubstationAdapter("SUBSTATION"); + ssAdapter = sclRootAdapter.getSubstationAdapter("SUBSTATION"); TVoltageLevel tVoltageLevel = new TVoltageLevel(); tVoltageLevel.setName("VOLTAGE_LEVEL"); ssAdapter.getCurrentElem().getVoltageLevel().add(tVoltageLevel); - vLevelAdapter = ssAdapter.getVoltageLevelAdapter("VOLTAGE_LEVEL").get(); + vLevelAdapter = ssAdapter.getVoltageLevelAdapter("VOLTAGE_LEVEL") + .orElse(new VoltageLevelAdapter(ssAdapter, "VOLTAGE_LEVEL")); + } + + @Test + void testController() { + VoltageLevelAdapter expectedTVoltageLevel = new VoltageLevelAdapter(ssAdapter); + assertNotNull(expectedTVoltageLevel.getParentAdapter()); + assertNull(expectedTVoltageLevel.getCurrentElem()); + assertFalse(expectedTVoltageLevel.amChildElementRef()); + } + + @Test + void testControllerWithVoltageLevelName(){ + assertThrows(ScdException.class, + () -> new VoltageLevelAdapter(ssAdapter, "VOLTAGE_LEVEL_1")); } @Test @@ -37,7 +53,7 @@ void testAmChildElementRef() { } @Test - void testSetCurrentElemInAdapter() throws ScdException { + void testSetCurrentElemInAdapter() { TVoltageLevel tVoltageLevel1 = new TVoltageLevel(); assertThrows(IllegalArgumentException.class, () ->vLevelAdapter.setCurrentElem(tVoltageLevel1)); diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation_name_different.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation_name_different.xml new file mode 100644 index 000000000..8dd5934d7 --- /dev/null +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation_name_different.xml @@ -0,0 +1,16 @@ + + + + + +
+ + + + 90 + + + + + + \ No newline at end of file diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml new file mode 100644 index 000000000..28097cfba --- /dev/null +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml @@ -0,0 +1,24 @@ + + + + + + + + +
+ + + 0 + + + + + + + 0 + + + + +
From 9eb334560b01c7148ae7557cde15253fd5696243 Mon Sep 17 00:00:00 2001 From: aDiaite <62600667+AliouDIAITE@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:33:02 +0200 Subject: [PATCH 06/17] Update sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com> Signed-off-by: Aliou DIAITE --- .../resources/scd-substation-import-ssd/scd_with_substation.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml index e6f6bf4c0..00944ccb5 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml @@ -10,7 +10,7 @@ 90 - + From 266c2d97a922c54d41a1e9e4b14508fe235df575 Mon Sep 17 00:00:00 2001 From: aDiaite <62600667+AliouDIAITE@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:33:11 +0200 Subject: [PATCH 07/17] Update sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com> Signed-off-by: Aliou DIAITE --- .../resources/scd-substation-import-ssd/scd_with_substation.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml index 00944ccb5..a6607280e 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml @@ -13,7 +13,7 @@ - + From f50f875e8e331a5d8aa3762104589198a30797ec Mon Sep 17 00:00:00 2001 From: aDiaite <62600667+AliouDIAITE@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:33:19 +0200 Subject: [PATCH 08/17] Update sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com> Signed-off-by: Aliou DIAITE --- .../resources/scd-substation-import-ssd/scd_with_substation.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml index a6607280e..43d1e5a0f 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml @@ -16,7 +16,7 @@ - + From cfcaeff05563e7bcab9020f90cb5e06dfc9a97cf Mon Sep 17 00:00:00 2001 From: aDiaite <62600667+AliouDIAITE@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:33:27 +0200 Subject: [PATCH 09/17] Update sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com> Signed-off-by: Aliou DIAITE --- .../resources/scd-substation-import-ssd/scd_with_substation.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml index 43d1e5a0f..2df1cc7a9 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml @@ -20,7 +20,7 @@ - + From 750971495cd0b7a3a1496374ca152833551dd2f3 Mon Sep 17 00:00:00 2001 From: aDiaite <62600667+AliouDIAITE@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:33:32 +0200 Subject: [PATCH 10/17] Update sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com> Signed-off-by: Aliou DIAITE --- .../resources/scd-substation-import-ssd/scd_with_substation.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml index 2df1cc7a9..f1fa62761 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml @@ -23,7 +23,7 @@ - + From 9c73c634e2f3792fe302751a2845d0e6b831455d Mon Sep 17 00:00:00 2001 From: aDiaite <62600667+AliouDIAITE@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:33:42 +0200 Subject: [PATCH 11/17] Update sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com> Signed-off-by: Aliou DIAITE --- .../src/test/resources/scd-substation-import-ssd/ssd.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml index 4a692d624..32403efec 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml @@ -64,7 +64,7 @@ - + From a9ed21829fd1a64c82cf5fd4bac5459d98f93373 Mon Sep 17 00:00:00 2001 From: aDiaite <62600667+AliouDIAITE@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:33:49 +0200 Subject: [PATCH 12/17] Update sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com> Signed-off-by: Aliou DIAITE --- .../scd-substation-import-ssd/ssd_with_2_substations.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml index 28097cfba..c50cf5e75 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml @@ -4,7 +4,7 @@ - + SSD
From 687952f3ae0ced28e51c98febb7eadf5c895d570 Mon Sep 17 00:00:00 2001 From: aDiaite <62600667+AliouDIAITE@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:33:54 +0200 Subject: [PATCH 13/17] Update sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com> Signed-off-by: Aliou DIAITE --- .../scd-substation-import-ssd/ssd_with_2_substations.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml index c50cf5e75..752b82fba 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml @@ -6,7 +6,7 @@ SSD -
+
0 From d27f5e51fa96fa32dd6a1c84d6ae048fc0e7d3f8 Mon Sep 17 00:00:00 2001 From: aDiaite <62600667+AliouDIAITE@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:34:06 +0200 Subject: [PATCH 14/17] Update sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com> Signed-off-by: Aliou DIAITE --- .../scd-substation-import-ssd/ssd_with_2_substations.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml index 752b82fba..0de304748 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml @@ -2,7 +2,7 @@ - + SSD From e6a68526c68b23ae474366a56f0ba8c8589e0ec1 Mon Sep 17 00:00:00 2001 From: aDiaite <62600667+AliouDIAITE@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:34:15 +0200 Subject: [PATCH 15/17] Update sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com> Signed-off-by: Aliou DIAITE --- .../src/test/resources/scd-substation-import-ssd/ssd.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml index 32403efec..d59c77113 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml @@ -2,7 +2,7 @@ - + From 7cef0563d78d7af94e55265a2df2a6ff2a78d394 Mon Sep 17 00:00:00 2001 From: Aliou DIAITE Date: Wed, 30 Mar 2022 11:24:07 +0200 Subject: [PATCH 16/17] [#57] : file correction && add new test Signed-off-by: Aliou DIAITE --- .../sct/commons/scl/SclServiceTest.java | 8 ++++++ .../scd_with_substation.xml | 14 +++++----- .../scd-substation-import-ssd/ssd.xml | 28 +++++++++---------- .../ssd_with_2_substations.xml | 4 +-- .../ssd_without_substations.xml | 11 ++++++++ 5 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 sct-commons/src/test/resources/scd-substation-import-ssd/ssd_without_substations.xml diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java index 146972514..e8e431552 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java @@ -351,6 +351,14 @@ void testGetEnumTypeElements() throws Exception { ); assertFalse(enumList.isEmpty()); } + @Test + void testAddSubstation_SSD_Without_Substation() throws Exception { + SCL scd = SclTestMarshaller.getSCLFromFile("/scl-root-test-schema-conf/add_ied_test.xml"); + SCL ssd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd_without_substations.xml"); + + assertThrows(ScdException.class, + () ->SclService.addSubstation(scd, ssd)); + } @Test void testAddSubstation_SSD_With_TWO_Substation() throws Exception { diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml index f1fa62761..332586e8b 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml @@ -2,7 +2,7 @@ - +
@@ -10,24 +10,24 @@ 90 - + - + - + - + - + - + diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml index d59c77113..7a38e3382 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd.xml @@ -2,35 +2,35 @@ - + - + SSD -
+
0 - + - + - + - + - + @@ -40,24 +40,24 @@ 90 - + - + - + - + - + - + diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml index 0de304748..c28020825 100644 --- a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml @@ -2,9 +2,9 @@ - + - SSD + SSD
diff --git a/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_without_substations.xml b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_without_substations.xml new file mode 100644 index 000000000..24cbad428 --- /dev/null +++ b/sct-commons/src/test/resources/scd-substation-import-ssd/ssd_without_substations.xml @@ -0,0 +1,11 @@ + + + + + + + SSD + +
+ + From b1ca3d4812fa9c5d4855680681c7ca60d7e84624 Mon Sep 17 00:00:00 2001 From: Aliou DIAITE Date: Wed, 30 Mar 2022 17:21:04 +0200 Subject: [PATCH 17/17] [#57] : replace tests by ParametrerizedTest , update pom and remove unused import Signed-off-by: Aliou DIAITE --- pom.xml | 10 ++++-- sct-commons/pom.xml | 5 +++ .../compas/sct/commons/scl/SclService.java | 17 ++-------- .../sct/commons/scl/SclServiceTest.java | 32 +++++-------------- .../scl/sstation/SubstationAdapterTest.java | 1 - 5 files changed, 23 insertions(+), 42 deletions(-) diff --git a/pom.xml b/pom.xml index 27733e33e..25fd45d5e 100644 --- a/pom.xml +++ b/pom.xml @@ -48,13 +48,19 @@ org.junit.jupiter junit-jupiter-api - 5.7.2 + 5.8.1 test org.junit.jupiter junit-jupiter-engine - 5.7.2 + 5.8.1 + test + + + org.junit.jupiter + junit-jupiter-params + 5.8.1 test diff --git a/sct-commons/pom.xml b/sct-commons/pom.xml index c617c6c0c..fa7153926 100644 --- a/sct-commons/pom.xml +++ b/sct-commons/pom.xml @@ -60,6 +60,11 @@ junit-jupiter-engine test + + org.junit.jupiter + junit-jupiter-params + test + org.hamcrest hamcrest diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java index 1b67b82fa..8b490d0ad 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java @@ -9,15 +9,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.lfenergy.compas.scl2007b4.model.*; import org.lfenergy.compas.sct.commons.Utils; -import org.lfenergy.compas.sct.commons.dto.ConnectedApDTO; -import org.lfenergy.compas.sct.commons.dto.ControlBlock; -import org.lfenergy.compas.sct.commons.dto.ExtRefBindingInfo; -import org.lfenergy.compas.sct.commons.dto.ExtRefInfo; -import org.lfenergy.compas.sct.commons.dto.ExtRefSignalInfo; -import org.lfenergy.compas.sct.commons.dto.ExtRefSourceInfo; -import org.lfenergy.compas.sct.commons.dto.HeaderDTO; -import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate; -import org.lfenergy.compas.sct.commons.dto.SubNetworkDTO; +import org.lfenergy.compas.sct.commons.dto.*; import org.lfenergy.compas.sct.commons.exception.ScdException; import org.lfenergy.compas.sct.commons.scl.com.CommunicationAdapter; import org.lfenergy.compas.sct.commons.scl.dtt.DataTypeTemplateAdapter; @@ -28,15 +20,10 @@ import org.lfenergy.compas.sct.commons.scl.ied.DAITracker; import org.lfenergy.compas.sct.commons.scl.ied.IEDAdapter; import org.lfenergy.compas.sct.commons.scl.ied.LDeviceAdapter; -import org.lfenergy.compas.sct.commons.scl.sstation.BayAdapter; import org.lfenergy.compas.sct.commons.scl.sstation.SubstationAdapter; import org.lfenergy.compas.sct.commons.scl.sstation.VoltageLevelAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.UUID; +import java.util.*; import java.util.stream.Collectors; @Slf4j diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java index e8e431552..3fce8f055 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java @@ -5,24 +5,15 @@ package org.lfenergy.compas.sct.commons.scl; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.lfenergy.compas.scl2007b4.model.*; -import org.lfenergy.compas.sct.commons.dto.DTO; -import org.lfenergy.compas.sct.commons.dto.HeaderDTO; -import org.lfenergy.compas.sct.commons.testhelpers.MarshallerWrapper; -import org.lfenergy.compas.sct.commons.dto.ConnectedApDTO; -import org.lfenergy.compas.sct.commons.dto.DaTypeName; -import org.lfenergy.compas.sct.commons.dto.DoTypeName; -import org.lfenergy.compas.sct.commons.dto.ExtRefBindingInfo; -import org.lfenergy.compas.sct.commons.dto.ExtRefInfo; -import org.lfenergy.compas.sct.commons.dto.ExtRefSignalInfo; -import org.lfenergy.compas.sct.commons.dto.ExtRefSourceInfo; -import org.lfenergy.compas.sct.commons.dto.LNodeDTO; -import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate; -import org.lfenergy.compas.sct.commons.dto.SubNetworkDTO; +import org.lfenergy.compas.sct.commons.dto.*; import org.lfenergy.compas.sct.commons.exception.ScdException; import org.lfenergy.compas.sct.commons.scl.ied.IEDAdapter; import org.lfenergy.compas.sct.commons.scl.ied.LDeviceAdapter; import org.lfenergy.compas.sct.commons.scl.ied.LN0Adapter; +import org.lfenergy.compas.sct.commons.testhelpers.MarshallerWrapper; import org.lfenergy.compas.sct.commons.testhelpers.SclTestMarshaller; import java.util.List; @@ -351,19 +342,12 @@ void testGetEnumTypeElements() throws Exception { ); assertFalse(enumList.isEmpty()); } - @Test - void testAddSubstation_SSD_Without_Substation() throws Exception { - SCL scd = SclTestMarshaller.getSCLFromFile("/scl-root-test-schema-conf/add_ied_test.xml"); - SCL ssd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd_without_substations.xml"); - assertThrows(ScdException.class, - () ->SclService.addSubstation(scd, ssd)); - } - - @Test - void testAddSubstation_SSD_With_TWO_Substation() throws Exception { + @ParameterizedTest + @ValueSource(strings = {"/scd-substation-import-ssd/ssd_with_2_substations.xml", "/scd-substation-import-ssd/ssd_without_substations.xml"}) + void testAddSubstation_Check_SSD_Validity(String ssdFileName) throws Exception { SCL scd = SclTestMarshaller.getSCLFromFile("/scl-root-test-schema-conf/add_ied_test.xml"); - SCL ssd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd_with_2_substations.xml"); + SCL ssd = SclTestMarshaller.getSCLFromFile(ssdFileName); assertThrows(ScdException.class, () ->SclService.addSubstation(scd, ssd)); diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java index c722acc12..d479bce8e 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/SubstationAdapterTest.java @@ -6,7 +6,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.lfenergy.compas.scl2007b4.model.TBay; import org.lfenergy.compas.scl2007b4.model.TSubstation; import org.lfenergy.compas.scl2007b4.model.TVoltageLevel; import org.lfenergy.compas.sct.commons.exception.ScdException;