diff --git a/.github/workflows/automate_projects.yml b/.github/workflows/automate_projects.yml
index c7e2661d4..82d690ad9 100644
--- a/.github/workflows/automate_projects.yml
+++ b/.github/workflows/automate_projects.yml
@@ -23,8 +23,8 @@ jobs:
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened'
uses: alex-page/github-project-automation-plus@v0.8.3
with:
- project: CoMPAS SCT Board
- column: To do
+ project: "CoMPAS SCT Board"
+ column: "To do"
repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }}
- name: add-new-issues-to-organization-based-project-column
diff --git a/sct-commons/pom.xml b/sct-commons/pom.xml
index a442ebc2c..afd3a44d7 100644
--- a/sct-commons/pom.xml
+++ b/sct-commons/pom.xml
@@ -197,25 +197,6 @@
false
-
- cb_po
-
- xjc
-
-
-
-
-
-
- ${project.basedir}/src/main/resources/binding_configuration.xjb
-
- org.lfenergy.compas.sct.commons.model.cb_po
- true
- false
-
-
cbcom
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/HmiService.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/HmiService.java
deleted file mode 100644
index 8969e7ad3..000000000
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/HmiService.java
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-FileCopyrightText: 2023 RTE FRANCE
-//
-// SPDX-License-Identifier: Apache-2.0
-
-package org.lfenergy.compas.sct.commons;
-
-import org.lfenergy.compas.scl2007b4.model.SCL;
-import org.lfenergy.compas.sct.commons.api.HmiEditor;
-import org.lfenergy.compas.sct.commons.model.cb_po.PO;
-import org.lfenergy.compas.sct.commons.scl.SclRootAdapter;
-import org.lfenergy.compas.sct.commons.scl.ied.IEDAdapter;
-
-public class HmiService implements HmiEditor {
-
- @Override
- public void createAllHmiReportControlBlocks(SCL scd, PO po) {
- SclRootAdapter sclRootAdapter = new SclRootAdapter(scd);
- sclRootAdapter.streamIEDAdapters()
- .flatMap(IEDAdapter::streamLDeviceAdapters)
- .forEach(lDeviceAdapter -> lDeviceAdapter.createHmiReportControlBlocks(po));
- }
-
-}
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/HmiEditor.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/HmiEditor.java
deleted file mode 100644
index d90a55626..000000000
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/HmiEditor.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-FileCopyrightText: 2023 RTE FRANCE
-//
-// SPDX-License-Identifier: Apache-2.0
-
-package org.lfenergy.compas.sct.commons.api;
-
-import org.lfenergy.compas.scl2007b4.model.SCL;
-import org.lfenergy.compas.scl2007b4.model.TReportControl;
-import org.lfenergy.compas.sct.commons.model.cb_po.PO;
-
-/**
- * Service class that will be used to manage elements related to the HMI {@link TReportControl Report Control Blocks}.
- *
- * @see Issue !258
- */
-public interface HmiEditor {
-
- /**
- * Create the DataSet and ReportControl Blocks for the HMI with the given FCDAs.
- *
- * @param po object containing list of FCDA for which we must create the DataSet and ReportControl Blocks
- */
- void createAllHmiReportControlBlocks(SCL scd, PO po);
-}
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 b12be812f..d606ec041 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
@@ -10,24 +10,18 @@
import org.lfenergy.compas.scl2007b4.model.*;
import org.lfenergy.compas.sct.commons.dto.*;
import org.lfenergy.compas.sct.commons.exception.ScdException;
-import org.lfenergy.compas.sct.commons.model.cb_po.PO;
-import org.lfenergy.compas.sct.commons.model.cb_po.TFCDAFilter;
import org.lfenergy.compas.sct.commons.scl.SclElementAdapter;
import org.lfenergy.compas.sct.commons.scl.dtt.DataTypeTemplateAdapter;
-import org.lfenergy.compas.sct.commons.scl.ied.ControlBlockAdapter;
-import org.lfenergy.compas.sct.commons.scl.ied.DataSetAdapter;
import org.lfenergy.compas.sct.commons.scl.ied.IEDAdapter;
import org.lfenergy.compas.sct.commons.scl.ln.AbstractLNAdapter;
import org.lfenergy.compas.sct.commons.scl.ln.LN0Adapter;
import org.lfenergy.compas.sct.commons.scl.ln.LNAdapter;
-import org.lfenergy.compas.sct.commons.util.ActiveStatus;
import org.lfenergy.compas.sct.commons.util.ControlBlockEnum;
import org.lfenergy.compas.sct.commons.util.MonitoringLnClassEnum;
import org.lfenergy.compas.sct.commons.util.Utils;
import java.util.*;
-import static org.lfenergy.compas.sct.commons.util.CommonConstants.*;
import static org.lfenergy.compas.sct.commons.util.Utils.copySclElement;
/**
@@ -63,10 +57,7 @@
@Slf4j
public class LDeviceAdapter extends SclElementAdapter {
- private static final long INTG_PD_VALUE_FOR_FC_MX = 2000L;
-
private static final String DA_SETSRCREF = "setSrcRef";
- private static final String CYC_REPORT_TYPE = "CYC";
/**
* Constructor
@@ -78,43 +69,6 @@ public LDeviceAdapter(IEDAdapter parentAdapter, TLDevice currentElem) {
super(parentAdapter, currentElem);
}
- /**
- * Create DataSet and ReportControl Blocks for the HMI with the given FCDAs.
- * DataSet and ReportControl are created in LN0, even if FCDA refers to another LN.
- *
- * @param po object containing list of FCDA for which we must create the DataSet and ReportControl
- */
- public void createHmiReportControlBlocks(PO po) {
- LN0Adapter ln0 = getLN0Adapter();
- if (!ln0.getDaiModStValValue().map(ActiveStatus::fromValue).map(ActiveStatus.ON::equals).orElse(false)) return;
- po.getFCDAs().getFCDA().stream()
- .filter(tfcdaFilter -> getInst().equals(tfcdaFilter.getLdInst()) && tfcdaFilter.isSetLnClass())
- .forEach(tfcdaFilter -> (tfcdaFilter.getLnClass().equals(TLLN0Enum.LLN_0.value()) ?
- Optional.of(ln0) // ln0 Mod stVal "ON" has already been checked, no need to check it again
- :
- findLnAdapter(tfcdaFilter.getLnClass(), tfcdaFilter.getLnInst(), tfcdaFilter.getPrefix()).filter(lnAdapter -> lnAdapter.getDaiModStValValue().map(ActiveStatus::fromValue).map(ActiveStatus.ON::equals).orElse(true)))
- .map(sourceLn -> sourceLn.getDAI(new DataAttributeRef(toFCDA(tfcdaFilter)), false))
- .filter(das -> das.stream().anyMatch(da -> TFCEnum.fromValue(tfcdaFilter.getFc().value()) == da.getFc())) // getDAI does not filter on DA.
- .ifPresent(dataAttributeRefs -> createHmiReportCB(ln0, tfcdaFilter)));
- }
-
- private void createHmiReportCB(LN0Adapter ln0, TFCDAFilter tfcdaFilter) {
- TFCDA fcda = toFCDA(tfcdaFilter);
- String dataSetSuffix = getInst().toUpperCase(Locale.ENGLISH) + ATTRIBUTE_VALUE_SEPARATOR + tfcdaFilter.getReportType().substring(0, 2) + "PO";
- String dataSetName = DATASET_NAME_PREFIX + dataSetSuffix;
- DataSetAdapter dataSet = ln0.createDataSetIfNotExists(dataSetName, ControlBlockEnum.REPORT);
- dataSet.createFCDAIfNotExists(fcda.getLdInst(), fcda.getPrefix(), fcda.getLnClass().getFirst(), fcda.getLnInst(), fcda.getDoName(), fcda.getDaName(), fcda.getFc());
- String cbName = CONTROLBLOCK_NAME_PREFIX + dataSetSuffix;
- String cbId = ln0.generateControlBlockId(getLdName(), cbName);
- ControlBlockAdapter controlBlockAdapter = ln0.createControlBlockIfNotExists(cbName, cbId, dataSetName, ControlBlockEnum.REPORT);
- if (tfcdaFilter.getReportType().equals(CYC_REPORT_TYPE)) {
- TReportControl tReportControl = (TReportControl) controlBlockAdapter.getCurrentElem();
- tReportControl.setIntgPd(INTG_PD_VALUE_FOR_FC_MX);
- tReportControl.getTrgOps().setDchg(false);
- tReportControl.getTrgOps().setQchg(false);
- }
- }
-
/**
* Check if node is child of the reference node
*
@@ -483,15 +437,4 @@ private String createVal(TExtRef tExtRef) {
return sourceLdName + "/" + lnClass + "." + tExtRef.getSrcCBName();
}
- private TFCDA toFCDA(TFCDAFilter tfcdaFilter) {
- TFCDA tfcda = new TFCDA();
- tfcda.setLdInst(tfcdaFilter.getLdInst());
- tfcda.getLnClass().add(tfcdaFilter.getLnClass());
- tfcda.setPrefix(tfcdaFilter.getPrefix());
- tfcda.setLnInst(tfcdaFilter.getLnInst());
- tfcda.setDoName(tfcdaFilter.getDoName());
- tfcda.setFc(TFCEnum.fromValue(tfcdaFilter.getFc().value()));
- return tfcda;
- }
-
}
diff --git a/sct-commons/src/main/resources/xsd/CB_REPORT_SUPERVISION_Config_file.xsd b/sct-commons/src/main/resources/xsd/CB_REPORT_SUPERVISION_Config_file.xsd
deleted file mode 100644
index 307fc0f88..000000000
--- a/sct-commons/src/main/resources/xsd/CB_REPORT_SUPERVISION_Config_file.xsd
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/HmiServiceTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/HmiServiceTest.java
deleted file mode 100644
index 500065cc4..000000000
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/HmiServiceTest.java
+++ /dev/null
@@ -1,248 +0,0 @@
-// SPDX-FileCopyrightText: 2023 RTE FRANCE
-//
-// SPDX-License-Identifier: Apache-2.0
-
-package org.lfenergy.compas.sct.commons;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.lfenergy.compas.scl2007b4.model.*;
-import org.lfenergy.compas.sct.commons.model.cb_po.FCDAs;
-import org.lfenergy.compas.sct.commons.model.cb_po.PO;
-import org.lfenergy.compas.sct.commons.model.cb_po.TFCDAFilter;
-import org.lfenergy.compas.sct.commons.model.cb_po.Tfc;
-import org.lfenergy.compas.sct.commons.scl.ied.DataSetAdapter;
-import org.lfenergy.compas.sct.commons.scl.ln.LN0Adapter;
-import org.lfenergy.compas.sct.commons.scl.ln.LNAdapter;
-import org.lfenergy.compas.sct.commons.testhelpers.SclTestMarshaller;
-import org.lfenergy.compas.sct.commons.util.ActiveStatus;
-import org.lfenergy.compas.sct.commons.util.CommonConstants;
-import org.mockito.InjectMocks;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.lfenergy.compas.sct.commons.testhelpers.SclHelper.*;
-
-@ExtendWith(MockitoExtension.class)
-class HmiServiceTest {
-
- private static final String DQC_REPORT_TYPE = "DQC";
- private static final String CYC_REPORT_TYPE = "CYC";
- @InjectMocks
- HmiService hmiService;
-
- private final PO po = new PO();
-
- @BeforeEach
- void setUp() {
- FCDAs fcdAs = new FCDAs();
- po.setFCDAs(fcdAs);
- }
-
- @Test
- void createAllIhmReportControlBlocks_with_fc_ST_should_create_dataset_and_controlblock() {
- // Given
- SCL scd = SclTestMarshaller.getSCLFromFile("/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml");
- TFCDAFilter tfcdaFilter = createFCDAFilter("LdInst11", "ANCR", "1", null, "DoName1", Tfc.ST, DQC_REPORT_TYPE);
- po.getFCDAs().getFCDA().add(tfcdaFilter);
- // When
- hmiService.createAllHmiReportControlBlocks(scd, po);
- // Then
- // Check DataSet is created
- DataSetAdapter dataSet = findDataSet(scd, "IedName1", "LdInst11", "DS_LDINST11_DQPO");
- assertThat(dataSet.getCurrentElem().getFCDA()).hasSize(1).first()
- .usingRecursiveComparison().isEqualTo(toFCDA(tfcdaFilter));
- // Check ControlBlock is created
- LN0Adapter ln0 = findLn0(scd, "IedName1", "LdInst11");
- assertThat(ln0.getTControlsByType(TReportControl.class)).hasSize(1);
- TReportControl reportControl = findControlBlock(scd, "IedName1", "LdInst11", "CB_LDINST11_DQPO", TReportControl.class);
- assertThat(reportControl).extracting(TReportControl::getRptID, TControl::getDatSet, TReportControl::getConfRev, TReportControl::isBuffered, TReportControl::getBufTime, TReportControl::isIndexed,
- TControlWithTriggerOpt::getIntgPd)
- .containsExactly("IedName1LdInst11/LLN0.CB_LDINST11_DQPO", "DS_LDINST11_DQPO", 1L, true, 0L, true, 60000L);
- assertThat(reportControl.getTrgOps())
- .extracting(TTrgOps::isDchg, TTrgOps::isQchg, TTrgOps::isDupd, TTrgOps::isPeriod, TTrgOps::isGi)
- .containsExactly(true, true, false, true, true);
- assertThat(reportControl.getRptEnabled().getMax()).isEqualTo(1);
- assertThat(reportControl.getRptEnabled().isSetClientLN()).isFalse();
- }
-
- @Test
- void createAllIhmReportControlBlocks_with_fc_MX_should_create_dataset_and_controlblock() {
- // Given
- SCL scd = SclTestMarshaller.getSCLFromFile("/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml");
- TFCDAFilter tfcdaFilter = createFCDAFilter("LdInst11", "PVOC", "1", null, "DoName2", Tfc.MX, CYC_REPORT_TYPE);
- po.getFCDAs().getFCDA().add(tfcdaFilter);
- // When
- hmiService.createAllHmiReportControlBlocks(scd, po);
- // Then
- // Check DataSet is created
- DataSetAdapter dataSet = findDataSet(scd, "IedName1", "LdInst11", "DS_LDINST11_CYPO");
- assertThat(dataSet.getCurrentElem().getFCDA()).hasSize(1).first()
- .usingRecursiveComparison().isEqualTo(toFCDA(tfcdaFilter));
- // Check ControlBlock is created
- LN0Adapter ln0 = findLn0(scd, "IedName1", "LdInst11");
- assertThat(ln0.getTControlsByType(TReportControl.class)).hasSize(1);
-
- TReportControl reportControl = findControlBlock(scd, "IedName1", "LdInst11", "CB_LDINST11_CYPO", TReportControl.class);
- assertThat(reportControl).extracting(TReportControl::getRptID, TControl::getDatSet, TReportControl::getConfRev, TReportControl::isBuffered, TReportControl::getBufTime, TReportControl::isIndexed,
- TControlWithTriggerOpt::getIntgPd)
- .containsExactly("IedName1LdInst11/LLN0.CB_LDINST11_CYPO", "DS_LDINST11_CYPO", 1L, true, 0L, true, 2000L);
- assertThat(reportControl.getTrgOps())
- .extracting(TTrgOps::isDchg, TTrgOps::isQchg, TTrgOps::isDupd, TTrgOps::isPeriod, TTrgOps::isGi)
- .containsExactly(false, false, false, true, true);
- assertThat(reportControl.getRptEnabled().getMax()).isEqualTo(1);
- assertThat(reportControl.getRptEnabled().isSetClientLN()).isFalse();
- }
-
- @Test
- void createAllIhmReportControlBlocks_with_fc_MX_and_DQC_REPORT_TYPE_should_create_dataset_and_controlblock_with_suffix_DQPO() {
- // Given
- SCL scd = SclTestMarshaller.getSCLFromFile("/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml");
- TFCDAFilter tfcdaFilter = createFCDAFilter("LdInst11", "PVOC", "1", null, "DoName2", Tfc.MX, DQC_REPORT_TYPE);
- po.getFCDAs().getFCDA().add(tfcdaFilter);
- // When
- hmiService.createAllHmiReportControlBlocks(scd, po);
- // Then
- // Check DataSet is created
- DataSetAdapter dataSet = findDataSet(scd, "IedName1", "LdInst11", "DS_LDINST11_DQPO");
- assertThat(dataSet.getCurrentElem().getFCDA()).hasSize(1).first()
- .usingRecursiveComparison().isEqualTo(toFCDA(tfcdaFilter));
- // Check ControlBlock is created
- LN0Adapter ln0 = findLn0(scd, "IedName1", "LdInst11");
- assertThat(ln0.getTControlsByType(TReportControl.class)).hasSize(1);
-
- TReportControl reportControl = findControlBlock(scd, "IedName1", "LdInst11", "CB_LDINST11_DQPO", TReportControl.class);
- assertThat(reportControl).extracting(TReportControl::getRptID, TControl::getDatSet, TReportControl::getConfRev, TReportControl::isBuffered, TReportControl::getBufTime, TReportControl::isIndexed,
- TControlWithTriggerOpt::getIntgPd)
- .containsExactly("IedName1LdInst11/LLN0.CB_LDINST11_DQPO", "DS_LDINST11_DQPO", 1L, true, 0L, true, 60000L);
- assertThat(reportControl.getTrgOps())
- .extracting(TTrgOps::isDchg, TTrgOps::isQchg, TTrgOps::isDupd, TTrgOps::isPeriod, TTrgOps::isGi)
- .containsExactly(true, true, false, true, true);
- assertThat(reportControl.getRptEnabled().getMax()).isEqualTo(1);
- assertThat(reportControl.getRptEnabled().isSetClientLN()).isFalse();
- }
-
- @Test
- void createAllIhmReportControlBlocks_with_FCDA_on_ln0_should_create_dataset_and_controlblock() {
- // Given
- SCL scd = SclTestMarshaller.getSCLFromFile("/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml");
- TFCDAFilter tfcdaFilter = createFCDAFilter("LdInst11", "LLN0", null, null, "DoName0", Tfc.ST, DQC_REPORT_TYPE);
- po.getFCDAs().getFCDA().add(tfcdaFilter);
- // When
- hmiService.createAllHmiReportControlBlocks(scd, po);
- // Then
- // Check DataSet is created
- DataSetAdapter dataSet = findDataSet(scd, "IedName1", "LdInst11", "DS_LDINST11_DQPO");
- assertThat(dataSet.getCurrentElem().getFCDA()).hasSize(1).first()
- .usingRecursiveComparison().isEqualTo(toFCDA(tfcdaFilter));
- // Check ControlBlock is created
- LN0Adapter ln0 = findLn0(scd, "IedName1", "LdInst11");
- assertThat(ln0.getTControlsByType(TReportControl.class)).hasSize(1);
- TReportControl reportControl = findControlBlock(scd, "IedName1", "LdInst11", "CB_LDINST11_DQPO", TReportControl.class);
- assertThat(reportControl).extracting(TReportControl::getRptID, TControl::getDatSet, TReportControl::getConfRev, TReportControl::isBuffered, TReportControl::getBufTime, TReportControl::isIndexed,
- TControlWithTriggerOpt::getIntgPd)
- .containsExactly("IedName1LdInst11/LLN0.CB_LDINST11_DQPO", "DS_LDINST11_DQPO", 1L, true, 0L, true, 60000L);
- assertThat(reportControl.getTrgOps())
- .extracting(TTrgOps::isDchg, TTrgOps::isQchg, TTrgOps::isDupd, TTrgOps::isPeriod, TTrgOps::isGi)
- .containsExactly(true, true, false, true, true);
- assertThat(reportControl.getRptEnabled().getMax()).isEqualTo(1);
- assertThat(reportControl.getRptEnabled().isSetClientLN()).isFalse();
- }
-
- @Test
- void createAllIhmReportControlBlocks_when_lDevice_ON_but_LN_Mod_StVal_missing_should_create_dataset_and_controlblock() {
- // Given
- SCL scd = SclTestMarshaller.getSCLFromFile("/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml");
- LNAdapter ln = findLn(scd, "IedName1", "LdInst11", "ANCR", "1", null);
- ln.getCurrentElem().unsetDOI();
- TFCDAFilter tfcdaFilter = createFCDAFilter("LdInst11", "ANCR", "1", null, "DoName1", Tfc.ST, DQC_REPORT_TYPE);
- po.getFCDAs().getFCDA().add(tfcdaFilter);
- // When
- hmiService.createAllHmiReportControlBlocks(scd, po);
- // Then
- // Check DataSet is created
- DataSetAdapter dataSet = findDataSet(scd, "IedName1", "LdInst11", "DS_LDINST11_DQPO");
- assertThat(dataSet.getCurrentElem().getFCDA()).hasSize(1).first()
- .usingRecursiveComparison().isEqualTo(toFCDA(tfcdaFilter));
- // Check ControlBlock is created
- LN0Adapter ln0 = findLn0(scd, "IedName1", "LdInst11");
- assertThat(ln0.getTControlsByType(TReportControl.class)).hasSize(1);
- TReportControl reportControl = findControlBlock(scd, "IedName1", "LdInst11", "CB_LDINST11_DQPO", TReportControl.class);
- assertThat(reportControl).extracting(TReportControl::getRptID, TControl::getDatSet, TReportControl::getConfRev, TReportControl::isBuffered, TReportControl::getBufTime, TReportControl::isIndexed,
- TControlWithTriggerOpt::getIntgPd)
- .containsExactly("IedName1LdInst11/LLN0.CB_LDINST11_DQPO", "DS_LDINST11_DQPO", 1L, true, 0L, true, 60000L);
- }
-
- @Test
- void createAllIhmReportControlBlocks_when_lDevice_ON_but_LN_Mod_StVal_OFF_should_not_create_dataset() {
- // Given
- SCL scd = SclTestMarshaller.getSCLFromFile("/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml");
- LNAdapter ln = findLn(scd, "IedName1", "LdInst11", "ANCR", "1", null);
- ln.getDOIAdapterByName(CommonConstants.MOD_DO_NAME).getDataAdapterByName(CommonConstants.STVAL_DA_NAME).setVal("off");
- assertThat(ln.getDaiModStValValue()).hasValue("off");
- TFCDAFilter tfcdaFilter = createFCDAFilter("LdInst11", "ANCR", "1", null, "DoName1", Tfc.ST, DQC_REPORT_TYPE);
- po.getFCDAs().getFCDA().add(tfcdaFilter);
- // When
- hmiService.createAllHmiReportControlBlocks(scd, po);
- // Then
- assertThat(streamAllDataSets(scd)).isEmpty();
- assertThat(streamAllControlBlocks(scd, TReportControl.class)).isEmpty();
- }
-
- @Test
- void createAllIhmReportControlBlocks_when_lDevice_OFF_should_not_create_dataset() {
- // Given
- SCL scd = SclTestMarshaller.getSCLFromFile("/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml");
- LN0Adapter ln0 = findLn0(scd, "IedName1", "LdInst11");
- ln0.getDOIAdapterByName(CommonConstants.MOD_DO_NAME).getDataAdapterByName(CommonConstants.STVAL_DA_NAME).setVal("off");
- assertThat(findLDevice(scd, "IedName1", "LdInst11").getLDeviceStatus()).hasValue(ActiveStatus.OFF.getValue());
- TFCDAFilter tfcdaFilter = createFCDAFilter("LdInst11", "ANCR", "1", null, "DoName1", Tfc.ST, DQC_REPORT_TYPE);
- po.getFCDAs().getFCDA().add(tfcdaFilter);
- // When
- hmiService.createAllHmiReportControlBlocks(scd, po);
- // Then
- assertThat(streamAllDataSets(scd)).isEmpty();
- assertThat(streamAllControlBlocks(scd, TReportControl.class)).isEmpty();
- }
-
- @Test
- void createAllIhmReportControlBlocks_when_LDevice_has_no_status_should_not_create_dataset() {
- // Given
- SCL scd = SclTestMarshaller.getSCLFromFile("/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml");
- LN0Adapter ln0 = findLn0(scd, "IedName1", "LdInst11");
- ln0.getDOIAdapterByName(CommonConstants.MOD_DO_NAME).getDataAdapterByName(CommonConstants.STVAL_DA_NAME).getCurrentElem().unsetVal();
- assertThat(findLDevice(scd, "IedName1", "LdInst11").getLDeviceStatus()).isEmpty();
- TFCDAFilter tfcdaFilter = createFCDAFilter("LdInst11", "ANCR", "1", null, "DoName1", Tfc.ST, DQC_REPORT_TYPE);
- po.getFCDAs().getFCDA().add(tfcdaFilter);
- // When
- hmiService.createAllHmiReportControlBlocks(scd, po);
- // Then
- assertThat(streamAllDataSets(scd)).isEmpty();
- assertThat(streamAllControlBlocks(scd, TReportControl.class)).isEmpty();
- }
-
- private static TFCDAFilter createFCDAFilter(String ldInst, String lnClass, String lnInst, String prefix, String doName, Tfc tfc, String reportType) {
- TFCDAFilter tfcdaFilter = new TFCDAFilter();
- tfcdaFilter.setLdInst(ldInst);
- tfcdaFilter.setLnClass(lnClass);
- tfcdaFilter.setPrefix(prefix);
- tfcdaFilter.setDoName(doName);
- tfcdaFilter.setLnInst(lnInst);
- tfcdaFilter.setFc(tfc);
- tfcdaFilter.setReportType(reportType);
- return tfcdaFilter;
- }
-
- private static TFCDA toFCDA(TFCDAFilter tfcdaFilter) {
- TFCDA tfcda = new TFCDA();
- tfcda.setLdInst(tfcdaFilter.getLdInst());
- tfcda.getLnClass().add(tfcdaFilter.getLnClass());
- tfcda.setPrefix(tfcdaFilter.getPrefix());
- tfcda.setLnInst(tfcdaFilter.getLnInst());
- tfcda.setDoName(tfcdaFilter.getDoName());
- tfcda.setFc(TFCEnum.fromValue(tfcdaFilter.getFc().value()));
- return tfcda;
- }
-
-}
diff --git a/sct-commons/src/test/resources/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml b/sct-commons/src/test/resources/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml
deleted file mode 100644
index e50105482..000000000
--- a/sct-commons/src/test/resources/scd-hmi-create-report-cb/scd_create_dataset_and_controlblocks_for_hmi.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- on
-
-
-
-
-
-
- on
-
-
-
-
-
-
- on
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- on
- off
- test
-
-
-