From ad2fed21351ba36bf3ce93d6f6c001fbd9879dc5 Mon Sep 17 00:00:00 2001 From: JAFFRE Guillaume Date: Tue, 2 Jul 2024 11:30:45 +0200 Subject: [PATCH 1/3] feat(400-rsr-1034): Add a private LNodeStatus to the SSD file - create Utils for new String Private creation Signed-off-by: JAFFRE Guillaume --- .../compas/sct/commons/util/PrivateUtils.java | 13 +++++++++++++ .../compas/sct/commons/util/PrivateUtilsTest.java | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/PrivateUtils.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/PrivateUtils.java index 94fde9822..ed0f095b9 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/PrivateUtils.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/PrivateUtils.java @@ -168,6 +168,19 @@ public static TPrivate createPrivate(List compasTopos) { return tPrivate; } + /** + * Create private of a given type containing a simple string as value + * @param privateType type attribute of private element to create + * @param privateValue value of private to create + * @return the complete private + */ + public static TPrivate createStringPrivate(String privateType, String privateValue) { + TPrivate tPrivate = new TPrivate(); + tPrivate.setType(privateType); + tPrivate.getContent().add(privateValue); + return tPrivate; + } + /** * Create Private of given type as parameter * @param jaxbElement content of Private to create diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/PrivateUtilsTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/PrivateUtilsTest.java index 4a36049fd..5a9b20954 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/PrivateUtilsTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/PrivateUtilsTest.java @@ -211,6 +211,18 @@ public static Stream createPrivateTestSources() { new TCompasSystemVersion()); } + @Test + void createStringPrivate_should_return_new_private() { + //GIVEN + String privateType = "COMPAS-LNodeStatus"; + String compasLNodeStatus = "on"; + //WHEN + TPrivate result = PrivateUtils.createStringPrivate(privateType, compasLNodeStatus); + //THEN + assertThat(result.getType()).contains(privateType); + assertThat(result.getContent()).containsExactly(compasLNodeStatus); + } + @Test void removePrivates_should_remove_privates() { // Given : setUp From 25e13a2ac440553e70f0f171fdb8975b28f21e7e Mon Sep 17 00:00:00 2001 From: JAFFRE Guillaume Date: Wed, 26 Jun 2024 16:34:40 +0200 Subject: [PATCH 2/3] feat(404 - rsr-1004): Add constraints to update compas flow bindings - modification of ExtRefEditorService and add a test - modification of ExtRefEditor interface to return List with updateIedNameBasedOnLnode() Signed-off-by: JAFFRE Guillaume --- .../sct/commons/ExtRefEditorService.java | 37 ++++- .../compas/sct/commons/api/ExtRefEditor.java | 4 +- .../sct/commons/ExtRefEditorServiceTest.java | 35 ++++- ..._lnode_several_ied_matching_compasFlow.xml | 131 ++++++++++++++++++ ..._extref_iedname_based_on_lnode_success.xml | 10 +- ...tref_iedname_fails_no_Compas_ICDHeader.xml | 95 +++++++++++++ 6 files changed, 298 insertions(+), 14 deletions(-) create mode 100644 sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_several_ied_matching_compasFlow.xml create mode 100644 sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_fails_no_Compas_ICDHeader.xml diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/ExtRefEditorService.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/ExtRefEditorService.java index b5ada60ed..7d6aeb621 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/ExtRefEditorService.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/ExtRefEditorService.java @@ -5,7 +5,6 @@ package org.lfenergy.compas.sct.commons; import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; import org.lfenergy.compas.scl2007b4.model.*; import org.lfenergy.compas.sct.commons.api.ExtRefEditor; import org.lfenergy.compas.sct.commons.dto.*; @@ -27,6 +26,7 @@ import java.math.BigInteger; import java.util.*; +import java.util.function.BinaryOperator; import java.util.function.Function; import java.util.stream.Collectors; @@ -90,7 +90,7 @@ private static List getIedSources(SclRootAdapter sclRootAdapter, TCompasBa */ private List getExtRefWithBayReferenceInLDEPF(TDataTypeTemplates dataTypeTemplates, TIED tied, final TLDevice tlDevice, final List sclReportItems) { List extRefBayReferenceList = new ArrayList<>(); - String lDevicePath = "SCL/IED[@name=\""+ tied.getName() + "\"]/AccessPoint/Server/LDevice[@inst=\"" + tlDevice.getInst() + "\"]"; + String lDevicePath = "SCL/IED[@name=\"" + tied.getName() + "\"]/AccessPoint/Server/LDevice[@inst=\"" + tlDevice.getInst() + "\"]"; Optional tCompasBay = PrivateUtils.extractCompasPrivate(tied, TCompasBay.class); if (tCompasBay.isEmpty()) { sclReportItems.add(SclReportItem.error(lDevicePath, "The IED has no Private Bay")); @@ -405,8 +405,7 @@ private List updateLDEPFDos(LDeviceAdapter lDeviceAdapter, TExtRe private Optional updateVal(AbstractLNAdapter lnAdapter, String doName, String daName, TExtRef extRef, TChannel setting) { String value = switch (daName) { case DU_DA_NAME -> setting.getChannelShortLabel(); - case SETVAL_DA_NAME -> - LN_PREFIX_B.equals(lnAdapter.getPrefix()) || LN_PREFIX_A.equals(lnAdapter.getPrefix()) ? setting.getChannelLevModQ().value() : setting.getChannelLevMod().value(); + case SETVAL_DA_NAME -> LN_PREFIX_B.equals(lnAdapter.getPrefix()) || LN_PREFIX_A.equals(lnAdapter.getPrefix()) ? setting.getChannelLevModQ().value() : setting.getChannelLevMod().value(); case STVAL_DA_NAME -> ActiveStatus.ON.getValue(); case SETSRCREF_DA_NAME -> computeDaiValue(lnAdapter, extRef, setting.getDAName()); default -> null; @@ -464,7 +463,7 @@ public void debindCompasFlowsAndExtRefsBasedOnVoltageLevel(SCL scd) { @Override - public void updateIedNameBasedOnLnode(SCL scl) { + public List updateIedNameBasedOnLnode(SCL scl) { Map bayByTopoKey = scl.getSubstation().stream() .flatMap(tSubstation -> tSubstation.getVoltageLevel().stream()) .flatMap(tVoltageLevel -> tVoltageLevel.getBay().stream()) @@ -475,6 +474,7 @@ public void updateIedNameBasedOnLnode(SCL scl) { .flatMap(Optional::stream) .collect(Collectors.toMap(BayTopoKey::topoKey, BayTopoKey::bay)); + List sclReportItems = new ArrayList<>(); scl.getIED().stream() .flatMap(ldeviceService::getLdevices) .forEach(tlDevice -> @@ -488,9 +488,21 @@ public void updateIedNameBasedOnLnode(SCL scl) { && Objects.equals(tlNode.getLnInst(), tCompasFlow.getExtReflnInst()) && Utils.lnClassEquals(tlNode.getLnClass(), tCompasFlow.getExtReflnClass()) && Objects.equals(tlNode.getPrefix(), tCompasFlow.getExtRefprefix())) + .filter(tlNode -> { + Optional tCompasICDHeader = PrivateUtils.extractCompasPrivate(tlNode, TCompasICDHeader.class); + if (tCompasICDHeader.isPresent()) { + return Objects.equals(tCompasFlow.getFlowSourceIEDType(), tCompasICDHeader.get().getIEDType()) + && Objects.equals(tCompasFlow.getFlowIEDSystemVersioninstance(), tCompasICDHeader.get().getIEDSystemVersioninstance()) + && Objects.equals(tCompasFlow.getFlowSourceIEDredundancy(), tCompasICDHeader.get().getIEDredundancy()); + } else { + sclReportItems.add(SclReportItem.error("", ("The substation LNode with following attributes : IedName:%s / LdInst:%s / LnClass:%s / LnInst:%s " + + "does not contain the needed (COMPAS - ICDHeader) private") + .formatted(tlNode.getIedName(), tlNode.getLdInst(), tlNode.getLnClass().getFirst(), tlNode.getLnInst()))); + return false; + } + }) .map(TLNode::getIedName) - .filter(StringUtils::isNotBlank) - .findFirst() + .reduce(checkOnlyOneIed(tCompasFlow, tBay, sclReportItems)) ) .ifPresentOrElse(iedName -> { extRefService.getMatchingExtRefs(tlDevice, tCompasFlow).forEach(tExtRef -> tExtRef.setIedName(iedName)); @@ -503,6 +515,17 @@ public void updateIedNameBasedOnLnode(SCL scl) { ) ) ); + return sclReportItems; + } + + private static BinaryOperator checkOnlyOneIed(TCompasFlow tCompasFlow, TBay tBay, List sclReportItems) { + return (iedName1, iedName2) -> { + sclReportItems.add(SclReportItem.error("", + ("Several LNode@IedName ('%s', '%s') are found in the bay '%s' for the following compas-flow attributes :" + + " @FlowSourceIEDType '%s' @FlowSourceIEDredundancy '%s' @FlowIEDSystemVersioninstance '%s'"). + formatted(iedName1, iedName2, tBay.getName(), tCompasFlow.getFlowSourceIEDType(), tCompasFlow.getFlowSourceIEDredundancy(), tCompasFlow.getFlowIEDSystemVersioninstance()))); + return iedName1; + }; } record TopoKey(String FlowNode, BigInteger FlowNodeOrder) { diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/ExtRefEditor.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/ExtRefEditor.java index 6c2da6d7c..f083a5a34 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/ExtRefEditor.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/ExtRefEditor.java @@ -72,7 +72,9 @@ public interface ExtRefEditor { /** * Update compas:Flow.ExtRefiedName and ExtRef.iedName, based on Substation LNode iedName + * @param scd SCL + * @return list of encoutered errors */ - void updateIedNameBasedOnLnode(SCL scd); + List updateIedNameBasedOnLnode(SCL scd); } diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/ExtRefEditorServiceTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/ExtRefEditorServiceTest.java index b576e3ad9..66f997e98 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/ExtRefEditorServiceTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/ExtRefEditorServiceTest.java @@ -595,7 +595,7 @@ void manageBindingForLDEPF_when_DO_Mod_and_DA_stVal_NotFoundInDataTypeTemplate_s .extracting(SclReportItem::message, SclReportItem::xpath) .containsExactly( Tuple.tuple("DO@name=Mod/DA@name=stVal not found in DataTypeTemplate", - "SCL/IED[@name=\"IED_NAME1\"]/AccessPoint/Server/LDevice[@inst=\"LDEPF\"]"), + "SCL/IED[@name=\"IED_NAME1\"]/AccessPoint/Server/LDevice[@inst=\"LDEPF\"]"), Tuple.tuple("DO@name=Mod/DA@name=stVal not found in DataTypeTemplate", "SCL/IED[@name=\"IED_NAME2\"]/AccessPoint/Server/LDevice[@inst=\"LDEPF\"]"), Tuple.tuple("DO@name=Mod/DA@name=stVal not found in DataTypeTemplate", @@ -865,7 +865,7 @@ void debindCompasFlowsAndExtRefsBasedOnVoltageLevel(String testCase, SCL scd, Tu .containsExactly(flow2); } - private static Stream provideFlowAndExtRefForDebinding(){ + private static Stream provideFlowAndExtRefForDebinding() { SCL scd = SclTestMarshaller.getSCLFromFile("/scd-extref-flow-debind/scd_extref_flow_debind_success.xml"); SCL scdVoltageLevel0 = SclTestMarshaller.getSCLFromFile("/scd-extref-flow-debind/scd_extref_flow_debind_volatagelevelname_0.xml"); SCL scdVoltageLevelUnknown = SclTestMarshaller.getSCLFromFile("/scd-extref-flow-debind/scd_extref_flow_debind_volatagelevelname_unknown.xml"); @@ -901,7 +901,7 @@ private TInputs findInputs(SCL scd) { } @Test - void updateIedNameBasedOnLnode_should_update_CompasFlow_and_ExtRef_iedName(){ + void updateIedNameBasedOnLnode_should_update_CompasFlow_and_ExtRef_iedName() { // Given SCL scd = SclTestMarshaller.getSCLFromFile("/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_success.xml"); // When @@ -914,7 +914,7 @@ void updateIedNameBasedOnLnode_should_update_CompasFlow_and_ExtRef_iedName(){ } @Test - void updateIedNameBasedOnLnode_when_no_matching_lnode_should_clear_binding(){ + void updateIedNameBasedOnLnode_when_no_matching_lnode_should_clear_binding() { // Given SCL scd = SclTestMarshaller.getSCLFromFile("/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_success.xml"); PrivateUtils.extractCompasPrivate(scd.getSubstation().get(0).getVoltageLevel().get(0).getBay().get(0), TCompasTopo.class).orElseThrow().setNode("99"); @@ -928,4 +928,31 @@ void updateIedNameBasedOnLnode_when_no_matching_lnode_should_clear_binding(){ assertExtRefIsNotBound(findExtRef(scd, "IED_NAME1", "LD_INST11", "STAT_LDSUIED_LPDO 1 Sortie_13_BOOLEAN_18_stVal_1")); } + + @Test + void updateIedNameBasedOnLnode_when_several_ied_match_compasFlow_should_return_an_error() { + // Given + SCL scd = SclTestMarshaller.getSCLFromFile("/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_several_ied_matching_compasFlow.xml"); + // When + List result = extRefEditorService.updateIedNameBasedOnLnode(scd); + // Then + assertThat(result) + .extracting(SclReportItem::isError, SclReportItem::message) + .containsExactly(Tuple.tuple(true, + "Several LNode@IedName ('IED_NAME2', 'IED_NAME3') are found in the bay 'BAY_1' for the following compas-flow attributes " + + ": @FlowSourceIEDType 'SCU' @FlowSourceIEDredundancy 'A' @FlowIEDSystemVersioninstance '1'")); + } + + @Test + void updateIedNameBasedOnLnode_when_no_Compas_ICD_Header_should_return_an_error() { + // Given + SCL scd = SclTestMarshaller.getSCLFromFile("/scd-extref-iedname/scd_set_extref_iedname_fails_no_Compas_ICDHeader.xml"); + // When + List result = extRefEditorService.updateIedNameBasedOnLnode(scd); + // Then + assertThat(result) + .extracting(SclReportItem::isError, SclReportItem::message) + .containsExactly(Tuple.tuple(true, + "The substation LNode with following attributes : IedName:IED_NAME2 / LdInst:LD_INST21 / LnClass:ANCR / LnInst:1 does not contain the needed (COMPAS - ICDHeader) private")); + } } diff --git a/sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_several_ied_matching_compasFlow.xml b/sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_several_ied_matching_compasFlow.xml new file mode 100644 index 000000000..039ec0be5 --- /dev/null +++ b/sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_several_ied_matching_compasFlow.xml @@ -0,0 +1,131 @@ + + + + + +
+ + + 0 + + + + + + + + + + + + + + + + on + + + + + + + + + + + on + + + + + + + + + + + + + + + + + on + + + + + + + + + + + + + + + + + + + + + + + + + on + + + + + + + + + + + + + + + + + + + + on + + + + + + + + + + + + + + + + + + + + + + + on + off + test + + + diff --git a/sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_success.xml b/sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_success.xml index f42453fb9..3cb543dbb 100644 --- a/sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_success.xml +++ b/sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_based_on_lnode_success.xml @@ -19,7 +19,12 @@ - + + + + + @@ -41,7 +46,8 @@ - + diff --git a/sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_fails_no_Compas_ICDHeader.xml b/sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_fails_no_Compas_ICDHeader.xml new file mode 100644 index 000000000..4565f43be --- /dev/null +++ b/sct-commons/src/test/resources/scd-extref-iedname/scd_set_extref_iedname_fails_no_Compas_ICDHeader.xml @@ -0,0 +1,95 @@ + + + + + +
+ + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + on + + + + + + + + + + + + + + + + + + + + + + + + + on + + + + + + + + + + + + + + + + + + + + + + + on + off + test + + + From 98d9f1c2eef2a70397f78381e1becfbb7d1debc8 Mon Sep 17 00:00:00 2001 From: gleizesDor <115622893+gleizesDor@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:44:31 +0200 Subject: [PATCH 3/3] feat(#405): Remove LDname limitation Signed-off-by: gleizesDor <115622893+gleizesDor@users.noreply.github.com> --- .../commons/scl/ldevice/LDeviceAdapter.java | 9 +-- .../scl/ldevice/LDeviceAdapterTest.java | 63 +++++++------------ 2 files changed, 24 insertions(+), 48 deletions(-) diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ldevice/LDeviceAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ldevice/LDeviceAdapter.java index ff5cea878..34c14a62f 100644 --- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ldevice/LDeviceAdapter.java +++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ldevice/LDeviceAdapter.java @@ -164,15 +164,10 @@ public String getXPath() { /** * Updates LDevice name by combining IED name and LDevice ldInst value - * - * @throws ScdException throws when renaming LDevice and new name has more than 33 caracteres */ - public void updateLDName() throws ScdException { + public void updateLDName() { String newLdName = parentAdapter.getCurrentElem().getName() + currentElem.getInst(); - if (newLdName.length() > 33) { - throw new ScdException(newLdName + "(IED.name + LDevice.inst) has more than 33 characters"); - } - // renaming ldName + // renaming ldName; Carefull because the maximum ldevice name length is 64 based on xsd currentElem.setLdName(newLdName); } diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ldevice/LDeviceAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ldevice/LDeviceAdapterTest.java index c39113499..6e12e9abc 100644 --- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ldevice/LDeviceAdapterTest.java +++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ldevice/LDeviceAdapterTest.java @@ -39,55 +39,36 @@ class LDeviceAdapterTest { - private IEDAdapter iAdapter; + private IEDAdapter iedAdapter; @BeforeEach public void init() { SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml"); SclRootAdapter sclRootAdapter = new SclRootAdapter(scd); - iAdapter = assertDoesNotThrow(() -> sclRootAdapter.getIEDAdapterByName("IED_NAME")); + iedAdapter = assertDoesNotThrow(() -> sclRootAdapter.getIEDAdapterByName("IED_NAME")); } @Test - void updateLDName_when_ldName_pass_33_characters_should_throw_exception() { + void updateLDName_when_ldName_should_update() { // Given - LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.findLDeviceAdapterByLdInst("LD_INS1").get()); - lDeviceAdapter.updateLDName(); - assertThat(lDeviceAdapter.getLdName()).isEqualTo("IED_NAMELD_INS1"); - assertThat(lDeviceAdapter.getInst()).isEqualTo("LD_INS1"); - String iedName = new Random().ints(97, 122) - .limit(27) - .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append) - .toString(); - iAdapter.setIEDName(iedName); - // When Then - assertThatThrownBy(lDeviceAdapter::updateLDName) - .isInstanceOf(ScdException.class) - .hasMessageContaining("has more than 33 characters"); - } + SCL std = SclTestMarshaller.getSCLFromFile("/std/std_sample.std"); + TIED tied = std.getIED().getFirst(); + TLDevice tlDevice = tied.getAccessPoint().getFirst().getServer().getLDevice().getFirst(); + LDeviceAdapter lDeviceAdapter = new LDeviceAdapter(new IEDAdapter(new SclRootAdapter(std), tied), tlDevice); - @Test - void updateLDName_when_ldName_less_than_33_characters_should_not_throw_exception() { - // Given - LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.findLDeviceAdapterByLdInst("LD_INS1").get()); + //When lDeviceAdapter.updateLDName(); - assertThat(lDeviceAdapter.getLdName()).isEqualTo("IED_NAMELD_INS1"); - assertThat(lDeviceAdapter.getInst()).isEqualTo("LD_INS1"); - String iedName = new Random().ints(97, 122) - .limit(26) - .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append) - .toString(); - iAdapter.setIEDName(iedName); - // When Then - assertThatCode(lDeviceAdapter::updateLDName).doesNotThrowAnyException(); - assertThat(lDeviceAdapter.getLdName()).isEqualTo(iedName+"LD_INS1"); + + //When + assertThat(lDeviceAdapter.getLdName()).isEqualTo("IED4d4fe1a8cda64cf88a5ee4176a1a0eefLDSUIED"); + assertThat(lDeviceAdapter.getInst()).isEqualTo("LDSUIED"); } @Test @Tag("issue-321") void testGetLNAdapters() { // Given - LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.findLDeviceAdapterByLdInst("LD_INS2").get()); + LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iedAdapter.findLDeviceAdapterByLdInst("LD_INS2").get()); assertThat(lDeviceAdapter.getLNAdapters()).hasSize(1); // When Then assertDoesNotThrow(() -> lDeviceAdapter.getLNAdapter("ANCR","1",null)); @@ -99,7 +80,7 @@ void testGetLNAdapters() { @Test void findLnAdapter_shouldReturnAdapter(){ // Given - LDeviceAdapter lDeviceAdapter = iAdapter.findLDeviceAdapterByLdInst("LD_INS2").get(); + LDeviceAdapter lDeviceAdapter = iedAdapter.findLDeviceAdapterByLdInst("LD_INS2").get(); // When Optional lnAdapter = lDeviceAdapter.findLnAdapter("ANCR", "1", null); // Then @@ -110,7 +91,7 @@ void findLnAdapter_shouldReturnAdapter(){ @Test void getExtRefBinders_whenExist_shouldReturnExtRefBindingInfo() { //Given - LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.findLDeviceAdapterByLdInst("LD_INS2").get()); + LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iedAdapter.findLDeviceAdapterByLdInst("LD_INS2").get()); ExtRefSignalInfo signalInfo = DTO.createExtRefSignalInfo(); signalInfo.setPDO("Do.sdo1"); signalInfo.setPDA("da.bda1.bda2.bda3"); @@ -122,7 +103,7 @@ void getExtRefBinders_whenExist_shouldReturnExtRefBindingInfo() { @Test void getExtRefBinders_when_PLN_NotMatch_shouldReturnEmptyList() { //Given - LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.getLDeviceAdapterByLdInst("LD_INS2")); + LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iedAdapter.getLDeviceAdapterByLdInst("LD_INS2")); ExtRefSignalInfo signalInfo = new ExtRefSignalInfo(); signalInfo.setPLN("CSWI"); //When Then @@ -133,7 +114,7 @@ void getExtRefBinders_when_PLN_NotMatch_shouldReturnEmptyList() { @Test void getExtRefBinders_when_PLN_NotSet_shouldReturnEmptyList() { //Given - LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.getLDeviceAdapterByLdInst("LD_INS2")); + LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iedAdapter.getLDeviceAdapterByLdInst("LD_INS2")); ExtRefSignalInfo signalInfo = new ExtRefSignalInfo(); //When Then assertDoesNotThrow(()-> lDeviceAdapter.getExtRefBinders(signalInfo)); @@ -144,7 +125,7 @@ void getExtRefBinders_when_PLN_NotSet_shouldReturnEmptyList() { @Tag("issue-321") void getExtRefInfo_should_return_expected_list_of_ExtRefInfo() { // Given - LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.getLDeviceAdapterByLdInst("LD_INS2")); + LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iedAdapter.getLDeviceAdapterByLdInst("LD_INS2")); // When List extRefInfoList = assertDoesNotThrow(lDeviceAdapter::getExtRefInfo); // Then @@ -155,7 +136,7 @@ void getExtRefInfo_should_return_expected_list_of_ExtRefInfo() { @Tag("issue-321") void TestGetDAI() { // Given - LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.getLDeviceAdapterByLdInst("LD_INS1")); + LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iedAdapter.getLDeviceAdapterByLdInst("LD_INS1")); // When var dataAttributeRefs = lDeviceAdapter.getDAI(new DataAttributeRef(),true); // Then @@ -170,7 +151,7 @@ void TestGetDAI() { assertThat(dataAttributeRefs).hasSize(4); // Given - lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.findLDeviceAdapterByLdInst("LD_INS2").get()); + lDeviceAdapter = assertDoesNotThrow(()-> iedAdapter.findLDeviceAdapterByLdInst("LD_INS2").get()); filter.setLnClass("ANCR"); filter.setLnInst("1"); // When @@ -183,7 +164,7 @@ void TestGetDAI() { @Tag("issue-321") void addPrivate_with_type_and_source_should_create_Private() { // Given - LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.getLDeviceAdapterByLdInst("LD_INS2")); + LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iedAdapter.getLDeviceAdapterByLdInst("LD_INS2")); TPrivate tPrivate = new TPrivate(); tPrivate.setType("Private Type"); tPrivate.setSource("Private Source"); @@ -230,7 +211,7 @@ void getLDeviceStatus_should_succeed() { @Test void getLNAdaptersIncludingLN0_should_return_expected_list_of_AbstractLNAdapter() { //Given - LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.getLDeviceAdapterByLdInst("LD_INS2")); + LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iedAdapter.getLDeviceAdapterByLdInst("LD_INS2")); //When List> lnAdapters = lDeviceAdapter.getLNAdaptersIncludingLN0(); //Then