Skip to content

Commit

Permalink
Merge pull request #209 from com-pas/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
AliouDIAITE authored Dec 1, 2022
2 parents bc57e31 + 08b62f7 commit 17a46a5
Show file tree
Hide file tree
Showing 55 changed files with 1,115 additions and 1,891 deletions.
52 changes: 32 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,36 @@
<sonar.coverage.exclusions>sct-coverage/**</sonar.coverage.exclusions>
<aggregate.report.dir>../sct-coverage/target/site/jacoco-aggregate/jacoco.xml</aggregate.report.dir>
<sonar.coverage.jacoco.xmlReportPaths>${basedir}/${aggregate.report.dir}</sonar.coverage.jacoco.xmlReportPaths>
<scl-extension.version>0.9.1</scl-extension.version>
<compas-core.version>0.12.0</compas-core.version>
<compas-scl-xsd.version>0.0.4</compas-scl-xsd.version>
<maven.plugin.javadoc>3.4.1</maven.plugin.javadoc>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<junit-version>5.9.0</junit-version>
<logback-classic.version>1.4.5</logback-classic.version>
<assertj.version>3.22.0</assertj.version>
<lombok.version>1.18.24</lombok.version>
</properties>

<dependencies>
<dependency>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl2007b4</artifactId>
</dependency>
<dependency>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -72,12 +89,12 @@
<dependency>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl2007b4</artifactId>
<version>0.2.1</version>
<version>${compas-core.version}</version>
</dependency>
<dependency>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
<version>${scl-extension.version}</version>
<version>${compas-core.version}</version>
</dependency>
<dependency>
<groupId>org.lfenergy.compas.xsd</groupId>
Expand All @@ -87,24 +104,15 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.6</version>
<version>${logback-classic.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl2007b4</artifactId>
</dependency>
<dependency>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
</dependencies>
<modules>
<module>sct-commons</module>
<module>sct-coverage</module>
Expand All @@ -123,12 +131,16 @@
<plugin>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
<version>${scl-extension.version}</version>
<version>${compas-core.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
Expand Down
17 changes: 1 addition & 16 deletions sct-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,16 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.6.28</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.23.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -102,6 +91,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>unpack</id>
Expand All @@ -120,11 +110,6 @@
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
<version>0.8.0</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
Expand Down
4 changes: 2 additions & 2 deletions sct-app/src/test/resources/std_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<compas:SystemVersion MainSystemVersion="01.00" MinorSystemVersion="009.001.001"/>
</Private>
<Private type="COMPAS-ICDHeader">
<compas:ICDHeader IEDType="GTW" ICDSystemVersionUUID="b4f8089e-4170-47f1-b6ad-dd1f50885518" VendorName="RTE" IEDredundancy="A" IEDmodel="ICDfromModeling" hwRev="01.00.00" swRev="01.00.00" headerId="f8dbc8c1-2db7-4652-a9d6-0b414bdeccfa" headerVersion="01.00.00" headerRevision="01.00.00"/>
<compas:ICDHeader IEDType="SCU" ICDSystemVersionUUID="b4f8089e-4170-47f1-b6ad-dd1f50885518" VendorName="RTE" IEDredundancy="A" IEDmodel="ICDfromModeling" hwRev="01.00.00" swRev="01.00.00" headerId="f8dbc8c1-2db7-4652-a9d6-0b414bdeccfa" headerVersion="01.00.00" headerRevision="01.00.00"/>
</Private>
<Services nameLength="64">
<ConfLNs fixPrefix="true" fixLnInst="true"/>
Expand Down Expand Up @@ -341,4 +341,4 @@
<EnumVal ord="24">Y</EnumVal>
</EnumType>
</DataTypeTemplates>
</SCL>
</SCL>
19 changes: 2 additions & 17 deletions sct-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
<properties>
<sonar.coverage.jacoco.xmlReportPaths>${basedir}/${aggregate.report.dir}</sonar.coverage.jacoco.xmlReportPaths>
<sonar.jacoco.excludes>**/scl2007b4/**/*</sonar.jacoco.excludes>
<assertJ.version>3.22.0</assertJ.version>
<opencsv.version>5.6</opencsv.version>
<opencsv.version>5.7.1</opencsv.version>
<mockito.version>4.9.0</mockito.version>
</properties>

Expand Down Expand Up @@ -91,11 +90,6 @@
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.12.3</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
Expand All @@ -110,7 +104,6 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertJ.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -125,10 +118,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -161,6 +150,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>unpack</id>
Expand All @@ -179,11 +169,6 @@
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl-extension</artifactId>
<version>0.8.0</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static DataSetInfo from(TDataSet tDataSet) {
* @return Set of DataSetInfo
*/
public static Set<DataSetInfo> getDataSets(AbstractLNAdapter<? extends TAnyLN> lnAdapter){
return lnAdapter.getDataSet(null)
return lnAdapter.getDataSetMatchingExtRefInfo(null)
.stream().map(DataSetInfo::from).collect(Collectors.toSet());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@


import lombok.*;
import org.apache.commons.lang3.StringUtils;
import org.lfenergy.compas.scl2007b4.model.TExtRef;
import org.lfenergy.compas.scl2007b4.model.TFCDA;
import org.lfenergy.compas.scl2007b4.model.TLLN0Enum;
import org.lfenergy.compas.sct.commons.scl.ied.AbstractLNAdapter;

import java.util.Objects;
/**
* A representation of the model object <em><b>ExtRef</b></em>.
*
Expand Down Expand Up @@ -75,48 +70,6 @@ public static ExtRefInfo from(TExtRef tExtRef, String iedName, String ldInst,
return extRefInfo;
}

/**
* Check match between FCDA and ExtRef information (for binding)
* @param tfcda FCDA data object
* @return match state
*/
//TODO this method should be checked, return if parameter tested are not present in FCDA even if two object are different
public boolean matchFCDA(@NonNull TFCDA tfcda){
boolean returnValue = true;
if(AbstractLNAdapter.isFCDANull(tfcda)) {
returnValue = false;
}

if(tfcda.getLdInst() != null &&
(bindingInfo == null || !tfcda.getLdInst().equals(bindingInfo.getLdInst()))){
returnValue = false;
}
if (!tfcda.getLnClass().isEmpty() &&
( bindingInfo == null || !tfcda.getLnClass().contains(bindingInfo.getLnClass())) ){
returnValue = false;
}

boolean isLN0 = tfcda.getLnClass().contains(TLLN0Enum.LLN_0.value());
if (!isLN0 && tfcda.getLnInst() != null &&
(bindingInfo == null || !tfcda.getLnInst().equals(bindingInfo.getLnInst()))) {
returnValue = false;
}
if (!isLN0 && !StringUtils.isBlank(tfcda.getPrefix()) &&
(bindingInfo == null || !tfcda.getPrefix().equals(bindingInfo.getPrefix()))) {
returnValue = false;
}

if(!StringUtils.isBlank(tfcda.getDoName()) &&
(signalInfo == null || !Objects.equals(signalInfo.getPDO(),tfcda.getDoName())) ){
returnValue = false;
}

if(!StringUtils.isBlank(tfcda.getDaName()) &&
(signalInfo == null || !Objects.equals(signalInfo.getPDA(),tfcda.getDaName())) ){
returnValue = false;
}
return returnValue;
}
/**
* Check matching between FCDA and ExtRef information (for external binding)
* Check is done for parameter lDInst(mandatory), lNClass(mandatory), lNInst, prefix doName as pDO(mandatory) and daName as pDA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public static TExtRef updateExtRefSource(SCL scd, ExtRefInfo extRefInfo) throws
if (bindingInfo == null || !bindingInfo.isValid()) {
throw new ScdException(INVALID_OR_MISSING_ATTRIBUTES_IN_EXT_REF_BINDING_INFO);
}
if (bindingInfo.getIedName().equals(iedName)) {
if (bindingInfo.getIedName().equals(iedName) || TServiceType.POLL.equals(bindingInfo.getServiceType())) {
throw new ScdException("Internal binding can't have control block");
}
ExtRefSourceInfo sourceInfo = extRefInfo.getSourceInfo();
Expand All @@ -377,7 +377,7 @@ public static TExtRef updateExtRefSource(SCL scd, ExtRefInfo extRefInfo) throws
IEDAdapter iedAdapter = sclRootAdapter.getIEDAdapterByName(iedName);
LDeviceAdapter lDeviceAdapter = iedAdapter.findLDeviceAdapterByLdInst(ldInst)
.orElseThrow(() -> new ScdException(String.format(UNKNOWN_LDEVICE_S_IN_IED_S, ldInst, iedName)));
var anLNAdapter = AbstractLNAdapter.builder()
AbstractLNAdapter<?> anLNAdapter = AbstractLNAdapter.builder()
.withLDeviceAdapter(lDeviceAdapter)
.withLnClass(lnClass)
.withLnInst(lnInst)
Expand Down
Loading

0 comments on commit 17a46a5

Please sign in to comment.