Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #347

Merged
merged 9 commits into from
Nov 24, 2023
2 changes: 1 addition & 1 deletion .github/workflows/automate_javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
git merge ${{ env.DEPENDABOT_BRANCH }}

- name: Push Git Branch
uses: ad-m/github-push-action@v0.6.0
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.DEPLOYMENT_BRANCH }}
1 change: 0 additions & 1 deletion docs/QUICK_START.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Actually there are 4 packages available:
- compas-sct
- sct-commons
- sct-app
- sct-data


#### 2. Usage
Expand Down
46 changes: 4 additions & 42 deletions docs/compas-sct.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@
## Introduction

The CoMPAS SCT (System Configuration Tool) is part of the CoMPAS (Configuration Module for Power System Automation)
ecosystem which is an open source project aimed at providing a tool for configuring control system and
profile management related to the 61850 standard. Its architecture allows an easy integration with the other
components of CoMPAS, in addition to being modular and flexible with a high level of abstraction, it gives
ecosystem which is an open source project aimed at providing a tool for configuring control system and
profile management related to the 61850 standard. Its architecture allows an easy integration with the other
components of CoMPAS, in addition to being modular and flexible with a high level of abstraction, it gives
the freedom to implement the tool with the database of its choice.

The below package diagram shows different part of the tool architecture.
The below package diagram shows different part of the tool architecture.

![Package Diagram](images/PackageDiagram-CompasSCT.png)

Hence, we can distinguish four major parts:

* **[sct-commons](#SCT-COMMONS)** : a library that contents shared functionalities for the bound SCL object.
* **[sct-data](#SCT-DATA)** : It holds data models and database connectivity services.
* **[sct-app](#SCT-APPLICATION)** : *TODO*.

## SCT COMMONS
Expand Down Expand Up @@ -96,43 +95,6 @@ should always return `true`:
[...]
}

## SCT DATA
Data models and connectivity to database are defined here. Data access layer is an abstract layer that defined connectivity
interfaces. This layer manages a database with single table (SQL-Like database) or single collection (NoSQL-Like database).
The concrete data access layers are implemented in specific packages. A data model can implement the following interface

```
public interface IScd <ID> {
ID getId();
byte[] getRawXml();
ID getHeaderId();
String getHeaderRevision();
String getHeaderVersion();
String filename();
}
```

* ### SQL-Like Database
An implementation of the sct-data connectivity interface with custom data models. This allows the application to work with sql-like database.
The libraries ares use for SQL-Like databases, those that support XML type (PostgreSql, Oracle, etc)

* ### NoSQL-Like Database
Like SQL-like part, this package contains the sct-data connector interfaces implementation for NoSQL-Like databases (BaseX, existDB, etc )
that support XML processing.

This can also be a local repository connector (file system). For example, with meta-data headerID, headerVersion, headerRevision and filename
one can implement the connector to have the below output (with the constraint of having a single file in /pathTo/headerId/headerVersion/headerRevision):

```
myRepo
├───<headerID>
│ ├───<headerVersion1>
│ │ └───<headerRevision1>
│ │ | ├───<fileName1.scd>
│ │ └───<headerRevision2>
│ │ ├───<fileName2.scd>
```

## SCT APPLICATION
**TODO**
> In progress
Expand Down
50 changes: 49 additions & 1 deletion docs/drawio/compas-sct.drawio
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
<mxfile host="app.diagrams.net" modified="2022-01-11T09:05:14.268Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.57" etag="oE0U5b2gp_jQ03X_KlPB" version="15.9.4" type="device"><diagram id="3wWlgGhNNHLo4Hu9hpyk" name="Page-1">7Vtbd9o4EP41nLP7QI4lWzZ+TAhke9JLtrTb5qnH2AJ8aluuLQr011fC8lU2mGAubZeXSCNZSPN9M8yMnJ469NcPkRUu3hAHez2oOOueet+DEIABZH+4ZJNIDFUI5pHriEm5YOL+wEKoCOnSdXBcmkgJ8agbloU2CQJs05LMiiKyKk+bEa/8raE1x5JgYlueLP3kOnSRSAfQyOX/YHe+SL8Z6G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/TuC/jQI6jnfNPxHG5ipMmPjx16fGLlzSB0L8t+V0Go6AKNWhCXBQpcXq1k8pAcTjJoNKlWRYUlOwonci/s78SZLtlUzTuwBLeK9saaz9Oiqx8MCCRb3nZ+PbhZBt8FMBwLW8htj2oKMZUS/fC1JZsp7xFJk4UkIqvINNrtP0DKr7XVqDS5AJVt6Fxi5C2HG2o8OCIdm8woV0wmEB6GXJVUTsKJkA7R9uZr9pRIusZd+v1umfcX4WhXqb2bFZipJra2gCd07SNTuOnc9RN9hvydQVRTXHxwbYNzAvbtlyHtQKuR3sZU+Kzxn3zb3BAKGfOnjtYEaBsDZhblWtb3q3nzrkJU278d5boCYMuOYZ+V4XTStibeeei5wc1jKlmbt2ZqXkaM+0gv2/U995kR2tbQroyg5ayoupF+69i0OhcJc+mdLqUTScx3QsrnsbR8eH+3FxtSddLVqWQYZYopSrGy7hpVAJJTYHn5eZhhR1BzBczEcBDuXiDgNo2XTmiOFqu2R7B3kEtKdvQGf4WzrZK6HMX8JFcxalztixEqSQq5YRE/LQXsxchSiMjm3Fjm0RVAyjfdRyvKQiLyDJwtqazk2cHVDEqJT+gy7fP2jljKCRXMSTt51oA+4NVwmNPunUXNe9xdvrC7KBS1lTlgBQqpqxMUI0outOmnOj/KtrUqsXoGm2CugLbCbVZl4bvL/Eq7DObyQXUyb+v+69fPY5EStauWnodnienAerIEWWOflOBv1hOHZzTEcl59DFgvyX/w120boj2wg1ATY2tC7wfHldfHj865g+0gf992zifHp/HfTnLagN38qm7HElf4K2++zYjvGn5XMvBNA57+U1JPskjdnIdI41EOOT1UsJPfL33Kzlh9JwwEjtqONRIGFTNdGpqsnXv1w9OxZfrvdKWkocWWj5PmoBgw0urh6YJWpUNJ7qplja85+ZZ0+v31Ti/+j9Wx91Us27+X3LJ9Px/DdXRTw==</diagram></mxfile>
<mxfile host="app.diagrams.net" modified="2023-10-23T14:48:46.540Z" agent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" etag="nheHiNsbFz10tTo7-bE4" version="21.8.2" type="device">
<diagram id="3wWlgGhNNHLo4Hu9hpyk" name="Page-1">
<mxGraphModel dx="1578" dy="920" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="mlE7LE_FIp_m5NRGwoGI-30" value="COMPAS" style="shape=umlFrame;whiteSpace=wrap;html=1;fillColor=#d0cee2;strokeColor=#56517e;swimlaneFillColor=#D4E1F5;" parent="1" vertex="1">
<mxGeometry x="140" y="40" width="670" height="360" as="geometry" />
</mxCell>
<mxCell id="mlE7LE_FIp_m5NRGwoGI-31" value="COMPAS-SCT" style="shape=umlFrame;whiteSpace=wrap;html=1;width=120;height=30;fillColor=#fff2cc;strokeColor=#d6b656;swimlaneFillColor=#ffffff;" parent="1" vertex="1">
<mxGeometry x="170" y="90" width="420" height="260" as="geometry" />
</mxCell>
<mxCell id="mlE7LE_FIp_m5NRGwoGI-32" value="COMPAS-CORE" style="shape=umlFrame;whiteSpace=wrap;html=1;width=130;height=20;swimlaneFillColor=#E1D5E7;fillColor=#99CCFF;" parent="1" vertex="1">
<mxGeometry x="620" y="220" width="160" height="160" as="geometry" />
</mxCell>
<mxCell id="mlE7LE_FIp_m5NRGwoGI-33" value="sct-commons" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">
<mxGeometry x="360" y="260" width="90" height="50" as="geometry" />
</mxCell>
<mxCell id="mlE7LE_FIp_m5NRGwoGI-38" value="sct-app&lt;br&gt;(automation app)" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">
<mxGeometry x="320" y="135" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="mlE7LE_FIp_m5NRGwoGI-40" value="Use" style="endArrow=open;endSize=12;dashed=1;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0;entryY=0;entryDx=20;entryDy=0;entryPerimeter=0;" parent="1" source="mlE7LE_FIp_m5NRGwoGI-38" target="mlE7LE_FIp_m5NRGwoGI-33" edge="1">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="140" y="620" as="sourcePoint" />
<mxPoint x="300" y="620" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="mlE7LE_FIp_m5NRGwoGI-44" value="&lt;font color=&quot;#24292e&quot; size=&quot;1&quot;&gt;&lt;span style=&quot;font-weight: 400 ; white-space: normal ; font-size: 12px&quot;&gt;scl2007b4&lt;/span&gt;&lt;/font&gt;" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;" parent="1" vertex="1">
<mxGeometry x="680" y="270" width="70" height="50" as="geometry" />
</mxCell>
<mxCell id="mlE7LE_FIp_m5NRGwoGI-45" value="Use" style="endArrow=open;endSize=12;dashed=1;html=1;entryX=0;entryY=0;entryDx=0;entryDy=32;entryPerimeter=0;exitX=0;exitY=0;exitDx=90;exitDy=41;exitPerimeter=0;" parent="1" target="mlE7LE_FIp_m5NRGwoGI-44" edge="1" source="mlE7LE_FIp_m5NRGwoGI-33">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="560" y="303" as="sourcePoint" />
<mxPoint x="300" y="610" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="mlE7LE_FIp_m5NRGwoGI-53" value="" style="endArrow=open;dashed=1;html=1;exitX=0;exitY=0;exitDx=120;exitDy=32;exitPerimeter=0;entryX=0.513;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;edgeStyle=orthogonalEdgeStyle;endFill=0;" parent="1" source="mlE7LE_FIp_m5NRGwoGI-38" target="mlE7LE_FIp_m5NRGwoGI-32" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="140" y="660" as="sourcePoint" />
<mxPoint x="700" y="182" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="mlE7LE_FIp_m5NRGwoGI-54" value="Use" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="610" y="165" width="40" height="20" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Binary file modified docs/images/PackageDiagram-CompasSCT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
<modules>
<module>sct-commons</module>
<module>sct-coverage</module>
<module>sct-data</module>
<module>sct-app</module>
</modules>

Expand Down
5 changes: 0 additions & 5 deletions sct-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
<artifactId>sct-commons</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.lfenergy.compas</groupId>
<artifactId>sct-data</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.lfenergy.compas</groupId>
<artifactId>sct-commons</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.lfenergy.compas.scl2007b4.model.SCL;
import org.lfenergy.compas.sct.commons.api.ControlBlockEditor;
import org.lfenergy.compas.sct.commons.api.SclEditor;
import org.lfenergy.compas.sct.commons.api.SubstationEditor;
import org.lfenergy.compas.sct.commons.dto.HeaderDTO;
Expand All @@ -30,6 +31,7 @@ public class SclAutomationService {

private final SclEditor sclEditor;
private final SubstationEditor substationEditor;
private final ControlBlockEditor controlBlockEditor;

/**
* Possible Subnetwork and ConnectedAP names which should be used in generated SCD in order a have global coherence
Expand All @@ -56,7 +58,7 @@ public SCL createSCD(@NonNull SCL ssd, @NonNull HeaderDTO headerDTO, List<SCL> s
}
substationEditor.addSubstation(scd, ssd);
sclEditor.importSTDElementsInSCD(scd, stds, SUB_NETWORK_TYPES);
sclEditor.removeAllControlBlocksAndDatasetsAndExtRefSrcBindings(scd);
controlBlockEditor.removeAllControlBlocksAndDatasetsAndExtRefSrcBindings(scd);
return scd;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import org.junit.jupiter.api.Test;
import org.lfenergy.compas.scl2007b4.model.LN0;
import org.lfenergy.compas.scl2007b4.model.SCL;
import org.lfenergy.compas.sct.commons.SclEditorService;
import org.lfenergy.compas.sct.commons.ControlBlockService;
import org.lfenergy.compas.sct.commons.SclService;
import org.lfenergy.compas.sct.commons.SubstationService;
import org.lfenergy.compas.sct.commons.api.ControlBlockEditor;
import org.lfenergy.compas.sct.commons.api.SclEditor;
import org.lfenergy.compas.sct.commons.api.SubstationEditor;
import org.lfenergy.compas.sct.commons.dto.HeaderDTO;
Expand All @@ -29,8 +31,9 @@
class SclAutomationServiceIntegrationTest {

private SclAutomationService sclAutomationService ;
private static final SclEditor sclEditor = new SclEditorService() ;
private static final SclEditor sclEditor = new SclService() ;
private static final SubstationEditor substationEditor = new SubstationService() ;
private static final ControlBlockEditor controlBlockEditor = new ControlBlockService() ;

private HeaderDTO headerDTO;

Expand All @@ -40,7 +43,7 @@ void setUp() {
headerDTO.setId(UUID.randomUUID());
headerDTO.setRevision("hRevision");
headerDTO.setVersion("hVersion");
sclAutomationService = new SclAutomationService(sclEditor, substationEditor);
sclAutomationService = new SclAutomationService(sclEditor, substationEditor, controlBlockEditor);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.lfenergy.compas.scl2007b4.model.SCL;
import org.lfenergy.compas.scl2007b4.model.THeader;
import org.lfenergy.compas.sct.commons.api.ControlBlockEditor;
import org.lfenergy.compas.sct.commons.api.SclEditor;
import org.lfenergy.compas.sct.commons.api.SubstationEditor;
import org.lfenergy.compas.sct.commons.dto.HeaderDTO;
Expand Down Expand Up @@ -39,6 +40,8 @@ class SclAutomationServiceTest {
private SclEditor sclEditor;
@Mock
private SubstationEditor substationEditor;
@Mock
private ControlBlockEditor controlBlockEditor;

public static final short RELEASE = 4;
public static final String REVISION = "B";
Expand Down Expand Up @@ -81,7 +84,7 @@ void createSCD_without_headerHistory_should_return_generatedSCD() throws Invocat
verify(sclEditor, times(0)).addHistoryItem(any(SCL.class), anyString(), anyString(), anyString());
verify(substationEditor, times(1)).addSubstation(any(SCL.class), any(SCL.class));
verify(sclEditor, times(1)).importSTDElementsInSCD(any(SCL.class), anyList(), anyList());
verify(sclEditor, times(1)).removeAllControlBlocksAndDatasetsAndExtRefSrcBindings(any(SCL.class));
verify(controlBlockEditor, times(1)).removeAllControlBlocksAndDatasetsAndExtRefSrcBindings(any(SCL.class));
}

@Test
Expand Down Expand Up @@ -110,7 +113,7 @@ void createSCD_with_headerHistory_should_return_generatedSCD() throws Invocation
verify(sclEditor, times(1)).addHistoryItem(any(SCL.class), eq(historyItem.getWho()), eq(historyItem.getWhat()), eq(historyItem.getWhy()));
verify(substationEditor, times(1)).addSubstation(any(SCL.class), any(SCL.class));
verify(sclEditor, times(1)).importSTDElementsInSCD(any(SCL.class), anyList(), anyList());
verify(sclEditor, times(1)).removeAllControlBlocksAndDatasetsAndExtRefSrcBindings(any(SCL.class));
verify(controlBlockEditor, times(1)).removeAllControlBlocksAndDatasetsAndExtRefSrcBindings(any(SCL.class));
}

@Test
Expand Down Expand Up @@ -172,7 +175,7 @@ void createSCD_when_sclEditor_importSTDElementsInSCD_Fail_should_throw_exception
}

@Test
void createSCD_when_sclEditor_removeAllControlBlocksAndDatasetsAndExtRefSrcBindings_Fail_should_throw_exception() throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException {
void createSCD_when_controlBlockEditor_removeAllControlBlocksAndDatasetsAndExtRefSrcBindings_Fail_should_throw_exception() throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException {
// Given
SCL ssd = (SCL) BeanUtils.cloneBean(scl);
SCL std = (SCL) BeanUtils.cloneBean(scl);
Expand All @@ -182,7 +185,7 @@ void createSCD_when_sclEditor_removeAllControlBlocksAndDatasetsAndExtRefSrcBindi
doNothing().when(substationEditor).addSubstation(any(SCL.class), any(SCL.class));
doNothing().when(sclEditor).importSTDElementsInSCD(any(SCL.class), anyList(), anyList());
doThrow(new ScdException("removeAllControlBlocksAndDatasetsAndExtRefSrcBindings fail"))
.when(sclEditor).removeAllControlBlocksAndDatasetsAndExtRefSrcBindings(any(SCL.class));
.when(controlBlockEditor).removeAllControlBlocksAndDatasetsAndExtRefSrcBindings(any(SCL.class));
// When Then
assertThatThrownBy(() -> sclAutomationService.createSCD(ssd, headerDTO, List.of(std)))
.isInstanceOf(ScdException.class)
Expand Down
Loading