├── .github ├── dependabot.yml └── workflows │ ├── automate_javadoc.yml │ ├── automate_projects.yml │ ├── build-project.yml │ ├── release-project.yml │ ├── reuse.yml │ ├── sonarcloud-analysis.yml │ └── sonarcloud-build.yml ├── .gitignore ├── .reuse └── dep5 ├── LICENSE ├── LICENSES ├── Apache-2.0.txt └── CC-BY-4.0.txt ├── README.md ├── SECURITY.md ├── docs ├── 404.html ├── HOME.md ├── QUICK_START.md ├── SCD_GENERATION.md ├── _config.yml ├── _includes │ ├── git-logo.html │ ├── head.html │ └── sidebar.html ├── _layouts │ ├── default.html │ └── page.html ├── blob-files │ └── CoMPAS_Technical_Charter_2020-06-07.pdf ├── compas-sct.md ├── drawio │ ├── SCD Process ver06.drawio │ ├── SCD_file_generation.drawio │ └── compas-sct.drawio ├── examples │ └── example-app │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── lfenergy │ │ │ └── compas │ │ │ └── sct │ │ │ └── examples │ │ │ └── SctAppExample.java │ │ └── test │ │ └── java │ │ └── org │ │ └── lfenergy │ │ └── compas │ │ └── sct │ │ └── examples │ │ └── SctAppExampleTest.java ├── github_pages │ └── _config.yml ├── images │ ├── PackageDiagram-CompasSCT.png │ └── SequenceDiagram-CompasSCT.png └── public │ ├── LFEnergy-slack.svg │ ├── LFEnergy-slack.svg.license │ ├── apple-touch-icon-144-precomposed.png │ ├── apple-touch-icon-144-precomposed.png.license │ ├── compas-horizontal-color.svg │ ├── compas-horizontal-color.svg.license │ ├── css │ ├── gitbutton.css │ ├── hyde.css │ ├── poole.css │ └── syntax.css │ ├── favicon.ico │ └── favicon.ico.license ├── pom.xml ├── sct-app ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── lfenergy │ │ └── compas │ │ └── sct │ │ └── app │ │ ├── SclAutomationService.java │ │ └── package-info.java │ └── test │ ├── java │ └── org.lfenergy.compas.sct.app │ │ ├── SclAutomationServiceIntegrationTest.java │ │ └── SclAutomationServiceTest.java │ └── resources │ ├── std_1.xml │ ├── std_2.xml │ └── std_3.xml ├── sct-commons ├── pom.xml └── src │ ├── main │ ├── java │ │ ├── lombok.config │ │ └── org │ │ │ └── lfenergy │ │ │ └── compas │ │ │ ├── scl2007b4 │ │ │ └── model │ │ │ │ └── package-info.java │ │ │ └── sct │ │ │ └── commons │ │ │ ├── BDAService.java │ │ │ ├── ConnectedAPService.java │ │ │ ├── ControlBlockEditorService.java │ │ │ ├── DaService.java │ │ │ ├── DaTypeService.java │ │ │ ├── DaiService.java │ │ │ ├── DataSetService.java │ │ │ ├── DataTypeTemplatesService.java │ │ │ ├── DoService.java │ │ │ ├── DoTypeService.java │ │ │ ├── DoiService.java │ │ │ ├── ExtRefEditorService.java │ │ │ ├── ExtRefReaderService.java │ │ │ ├── IedService.java │ │ │ ├── LdeviceService.java │ │ │ ├── LnService.java │ │ │ ├── LnodeTypeService.java │ │ │ ├── SclElementsProviderService.java │ │ │ ├── SclService.java │ │ │ ├── SdoService.java │ │ │ ├── SubNetworkService.java │ │ │ ├── SubstationService.java │ │ │ ├── VoltageLevelService.java │ │ │ ├── api │ │ │ ├── ControlBlockEditor.java │ │ │ ├── DataTypeTemplateReader.java │ │ │ ├── ExtRefEditor.java │ │ │ ├── ExtRefReader.java │ │ │ ├── LnEditor.java │ │ │ ├── SclEditor.java │ │ │ ├── SclElementsProvider.java │ │ │ ├── SubstationEditor.java │ │ │ └── package-info.java │ │ │ ├── domain │ │ │ ├── DaVal.java │ │ │ ├── DataAttribute.java │ │ │ ├── DataObject.java │ │ │ ├── DoLinkedToDa.java │ │ │ └── DoLinkedToDaFilter.java │ │ │ ├── dto │ │ │ ├── ConnectedApDTO.java │ │ │ ├── ControlBlock.java │ │ │ ├── ControlBlockTarget.java │ │ │ ├── DaTypeName.java │ │ │ ├── DataAttributeRef.java │ │ │ ├── DataSetInfo.java │ │ │ ├── DataTypeName.java │ │ │ ├── DoTypeName.java │ │ │ ├── EnumValDTO.java │ │ │ ├── ExtRefBindingInfo.java │ │ │ ├── ExtRefInfo.java │ │ │ ├── ExtRefSignalInfo.java │ │ │ ├── ExtRefSourceInfo.java │ │ │ ├── ExtrefTarget.java │ │ │ ├── FCDAInfo.java │ │ │ ├── GooseControlBlock.java │ │ │ ├── HeaderDTO.java │ │ │ ├── IedDTO.java │ │ │ ├── LDeviceDTO.java │ │ │ ├── LNodeDTO.java │ │ │ ├── LNodeMetaData.java │ │ │ ├── LNodeMetaDataEmbedder.java │ │ │ ├── LogicalNodeOptions.java │ │ │ ├── PrivateLinkedToStds.java │ │ │ ├── ReportControlBlock.java │ │ │ ├── SMVControlBlock.java │ │ │ ├── SclDTO.java │ │ │ ├── SclReportItem.java │ │ │ ├── SubNetworkDTO.java │ │ │ ├── SubNetworkTypeDTO.java │ │ │ └── package-info.java │ │ │ ├── exception │ │ │ └── ScdException.java │ │ │ ├── scl │ │ │ ├── ControlService.java │ │ │ ├── ExtRefService.java │ │ │ ├── ObjectReference.java │ │ │ ├── SclElementAdapter.java │ │ │ ├── SclRootAdapter.java │ │ │ ├── com │ │ │ │ ├── CommunicationAdapter.java │ │ │ │ ├── ConnectedAPAdapter.java │ │ │ │ ├── SubNetworkAdapter.java │ │ │ │ └── package-info.java │ │ │ ├── dtt │ │ │ │ ├── AbstractDataAttributeAdapter.java │ │ │ │ ├── AbstractDataTypeAdapter.java │ │ │ │ ├── DAAdapter.java │ │ │ │ ├── DATypeAdapter.java │ │ │ │ ├── DOAdapter.java │ │ │ │ ├── DOTypeAdapter.java │ │ │ │ ├── DataTypeTemplateAdapter.java │ │ │ │ ├── EnumTypeAdapter.java │ │ │ │ ├── IDTTComparable.java │ │ │ │ ├── IDataTemplate.java │ │ │ │ ├── LNodeTypeAdapter.java │ │ │ │ └── package-info.java │ │ │ ├── header │ │ │ │ ├── HeaderAdapter.java │ │ │ │ └── package-info.java │ │ │ ├── icd │ │ │ │ └── IcdHeader.java │ │ │ ├── ied │ │ │ │ ├── AbstractDAIAdapter.java │ │ │ │ ├── AccessPointAdapter.java │ │ │ │ ├── ControlBlockAdapter.java │ │ │ │ ├── DAITracker.java │ │ │ │ ├── DOIAdapter.java │ │ │ │ ├── DataSetAdapter.java │ │ │ │ ├── IDataAdapter.java │ │ │ │ ├── IDataParentAdapter.java │ │ │ │ ├── IEDAdapter.java │ │ │ │ ├── InputsAdapter.java │ │ │ │ ├── RootSDIAdapter.java │ │ │ │ ├── SDIAdapter.java │ │ │ │ └── package-info.java │ │ │ ├── ldevice │ │ │ │ └── LDeviceAdapter.java │ │ │ ├── ln │ │ │ │ ├── AbstractLNAdapter.java │ │ │ │ ├── LN0Adapter.java │ │ │ │ ├── LNAdapter.java │ │ │ │ ├── LNAdapterBuilder.java │ │ │ │ └── LnId.java │ │ │ ├── package-info.java │ │ │ └── sstation │ │ │ │ ├── BayAdapter.java │ │ │ │ ├── FunctionAdapter.java │ │ │ │ ├── LNodeAdapter.java │ │ │ │ ├── SubstationAdapter.java │ │ │ │ ├── VoltageLevelAdapter.java │ │ │ │ └── package-info.java │ │ │ └── util │ │ │ ├── ActiveStatus.java │ │ │ ├── CommonConstants.java │ │ │ ├── ControlBlockEnum.java │ │ │ ├── MonitoringLnClassEnum.java │ │ │ ├── PrivateEnum.java │ │ │ ├── PrivateUtils.java │ │ │ ├── SclConstructorHelper.java │ │ │ ├── ServicesConfigEnum.java │ │ │ └── Utils.java │ └── resources │ │ ├── binding_configuration.xjb │ │ ├── error_messages.properties │ │ └── xsd │ │ ├── CB_COMM_V1.xsd │ │ ├── GSE_SMV_CB_COM.xsd │ │ └── LDEPF.xsd │ └── test │ ├── java │ └── org │ │ └── lfenergy │ │ └── compas │ │ ├── scl2007b4 │ │ └── model │ │ │ └── NamespaceConfigurationTest.java │ │ └── sct │ │ └── commons │ │ ├── ControlBlockEditorServiceTest.java │ │ ├── DaServiceTest.java │ │ ├── DaiServiceTest.java │ │ ├── DataSetServiceTest.java │ │ ├── DataTypeTemplatesServiceTest.java │ │ ├── DoServiceTest.java │ │ ├── DoTypeServiceTest.java │ │ ├── DoiServiceTest.java │ │ ├── ExtRefEditorServiceTest.java │ │ ├── IedServiceTest.java │ │ ├── LdeviceServiceTest.java │ │ ├── LnServiceTest.java │ │ ├── LnodeTypeServiceTest.java │ │ ├── SclElementsProviderServiceTest.java │ │ ├── SclServiceTest.java │ │ ├── SdoServiceTest.java │ │ ├── SubNetworkServiceTest.java │ │ ├── SubstationServiceTest.java │ │ ├── VoltageLevelServiceTest.java │ │ ├── domain │ │ ├── DataAttributeTest.java │ │ ├── DoLinkedToDaFilterTest.java │ │ └── DoLinkedToDaTest.java │ │ ├── dto │ │ ├── ConnectedApDTOTest.java │ │ ├── ControlBlockTargetTest.java │ │ ├── DTO.java │ │ ├── DaTypeNameTest.java │ │ ├── DataAttributeRefTest.java │ │ ├── DataSetInfoTest.java │ │ ├── DoTypeNameTest.java │ │ ├── ExtRefBindingInfoTest.java │ │ ├── ExtRefInfoTest.java │ │ ├── ExtRefSignalInfoTest.java │ │ ├── ExtRefSourceInfoTest.java │ │ ├── FCDAInfoTest.java │ │ ├── FCDARecordTest.java │ │ ├── GooseControlBlockTest.java │ │ ├── HeaderDTOTest.java │ │ ├── IedDTOTest.java │ │ ├── LDeviceDTOTest.java │ │ ├── LNodeDTOTest.java │ │ ├── LogicalNodeOptionsTest.java │ │ ├── ReportControlBlockTest.java │ │ ├── SMVControlBlockTest.java │ │ ├── SclDTOTest.java │ │ └── SubNetworkDTOTest.java │ │ ├── exception │ │ └── ScdExceptionTest.java │ │ ├── scl │ │ ├── ExtRefServiceTest.java │ │ ├── ObjectReferenceTest.java │ │ ├── SclRootAdapterTest.java │ │ ├── com │ │ │ ├── CommunicationAdapterTest.java │ │ │ ├── ConnectedAPAdapterTest.java │ │ │ └── SubNetworkAdapterTest.java │ │ ├── dtt │ │ │ ├── BDAAdapterTest.java │ │ │ ├── DAAdapterTest.java │ │ │ ├── DATypeAdapterTest.java │ │ │ ├── DOAdapterTest.java │ │ │ ├── DOTypeAdapterTest.java │ │ │ ├── DataTypeTemplateAdapterTest.java │ │ │ ├── DataTypeTemplateTestUtils.java │ │ │ ├── EnumTypeAdapterTest.java │ │ │ └── LNodeTypeAdapterTest.java │ │ ├── header │ │ │ └── HeaderAdapterTest.java │ │ ├── icd │ │ │ └── IcdHeaderTest.java │ │ ├── ied │ │ │ ├── AccessPointAdapterTest.java │ │ │ ├── ControlBlockAdapterTest.java │ │ │ ├── DAITrackerTest.java │ │ │ ├── DOIAdapterTest.java │ │ │ ├── DataSetAdapterTest.java │ │ │ ├── IEDAdapterTest.java │ │ │ ├── InputsAdapterTest.java │ │ │ ├── RootSDIAdapterTest.java │ │ │ └── SDIAdapterTest.java │ │ ├── ldevice │ │ │ └── LDeviceAdapterTest.java │ │ ├── ln │ │ │ ├── LN0AdapterTest.java │ │ │ ├── LNAdapterTest.java │ │ │ └── LnIdTest.java │ │ └── sstation │ │ │ ├── BayAdapterTest.java │ │ │ ├── FunctionAdapterTest.java │ │ │ ├── LNodeAdapterTest.java │ │ │ ├── SubstationAdapterTest.java │ │ │ └── VoltageLevelAdapterTest.java │ │ ├── testhelpers │ │ ├── DaComParamTestMarshaller.java │ │ ├── DaComTestMarshallerHelper.java │ │ ├── DataTypeUtils.java │ │ ├── FCDARecord.java │ │ ├── MarshallerWrapper.java │ │ ├── SclHelper.java │ │ └── SclTestMarshaller.java │ │ └── util │ │ ├── ActiveStatusEnumTest.java │ │ ├── CommonConstantsTest.java │ │ ├── ControlBlockEnumTest.java │ │ ├── MonitoringLnClassEnumTest.java │ │ ├── PrivateEnumTest.java │ │ ├── PrivateUtilsTest.java │ │ ├── SclConstructorHelperTest.java │ │ └── UtilsTest.java │ └── resources │ ├── cb_comm │ └── Template_DA_COMM_v1.xml │ ├── da_comm-marshaller-config.yml │ ├── dtt-test-schema-conf │ ├── scd_dtt_do_sdo_da_bda.xml │ ├── scd_dtt_do_sdo_da_bda_test.xml │ ├── scd_dtt_do_sdo_da_bda_tests.xml │ ├── scd_dtt_import_sameid-diff-content-test.xml │ └── scd_dtt_import_test.xml │ ├── error_messages.properties │ ├── error_messages_fr.properties │ ├── ied-test-schema-conf │ ├── ied_unit_test.xml │ └── scd_with_dai_test.xml │ ├── limitation_cb_dataset_fcda │ ├── scd_check_coherent_extRefs.xml │ ├── scd_check_limitation_bound_ied_controls_fcda.xml │ └── scd_check_limitation_ied_controls_dataset.xml │ ├── logback-test.xml │ ├── marshaller-builder │ ├── Employee.xsd │ ├── scl_schema.yml │ └── scl_schema_error.yml │ ├── monitoring_lns │ ├── scd_monitoring_lsvs_lgos.xml │ ├── scd_monitoring_lsvs_lgos_with_many_extref_for_same_ied_source.xml │ └── scd_monitoring_lsvs_lgos_with_privates.xml │ ├── scd-extref-cb │ ├── scd_get_binders_test.xml │ └── scd_get_cbs_test.xml │ ├── scd-extref-create-dataset-and-controlblocks │ ├── scd_create_controlblock_network_configuration.xml │ ├── scd_create_dataset_and_controlblocks_extref_errors.xml │ ├── scd_create_dataset_and_controlblocks_ied_errors.xml │ ├── scd_create_dataset_and_controlblocks_success.xml │ ├── scd_create_dataset_and_controlblocks_success_analyze.xml │ └── scd_create_dataset_and_controlblocks_success_test_fcda_sort.xml │ ├── scd-extref-iedname │ └── scd_set_extref_iedname_with_extref_errors.xml │ ├── scd-ied-dtt-com-import-stds │ ├── scd.xml │ ├── scd_lnode_with_many_compas_icdheader.xml │ ├── scd_with_same_compas_icd_header_in_different_functions.xml │ ├── ssd.xml │ ├── std.xml │ ├── std_SITESITE1SCU1.xml │ ├── std_SITESITE1SCU2.xml │ └── std_with_same_ICDSystemVersionUUID.xml │ ├── scd-ldepf │ ├── scd_ldepf_dataTypeTemplateValid.xml │ ├── scd_ldepf_extref_with_IedType_BCU.xml │ ├── scd_ldepf_extrefbayRef.xml │ ├── scd_ldepf_iedSources_in_different_bay.xml │ ├── scd_ldepf_manyIedSources_in_same_bay.xml │ ├── scd_ldepf_postProcessing.xml │ ├── scd_ldepf_postProcessing_when_ln0_off.xml │ ├── scd_ldepf_processing_external_bind.xml │ ├── scd_ldepf_processing_internal_bind.xml │ ├── scd_ldepf_processing_when_status_ln0_off.xml │ └── scd_ldepf_withoutModStValInDataTypeTemplate.xml │ ├── scd-ldevice-adapter │ └── scd_ldevice.xml │ ├── scd-refresh-lnode │ ├── issue68_Test_Template.scd │ ├── issue_165_enhance_68_Test_Dai_Updatable.scd │ └── scd-with-substation-lnode.xml │ ├── scd-substation-import-ssd │ ├── scd_with_substation.xml │ ├── scd_with_substation_name_different.xml │ ├── ssd.xml │ ├── ssd_with_2_substations.xml │ └── ssd_without_substations.xml │ ├── scd-test-update-inref │ ├── scd_update_inref_extref_bind.xml │ ├── scd_update_inref_extref_bind_desc_suffix_not_match.xml │ ├── scd_update_inref_extref_not_bind.xml │ ├── scd_update_inref_issue_231_test_ok.xml │ ├── scd_update_inref_no_Extref.xml │ ├── scd_update_inref_test.xml │ └── scd_update_inref_when_inref_purpose_not_set.xml │ ├── scl-ln-adapter │ └── scd_with_ln.xml │ ├── scl-remove-controlBlocks-dataSet-extRefSrc │ └── scl-with-control-blocks.xml │ ├── scl-root-test-schema-conf │ ├── add_ied_test.xml │ ├── icd1_to_add_test.xml │ └── icd2_to_add_test.xml │ ├── scl-srv-import-ieds │ ├── ied_1_test.xml │ ├── ied_2_test.xml │ ├── ied_3_test.xml │ ├── ied_test_aggregate_DAI.xml │ ├── ied_test_updatable_DAI.xml │ └── ied_with_filled_communication.xml │ ├── scl-srv-scd-extref-cb │ ├── issue_175_scd_get_cbs_test.xml │ ├── scd_get_binders_test.xml │ └── scd_get_cbs_test.xml │ ├── scl_update_communication │ ├── scd_without_communication.xml │ ├── std_with_communication.xml │ ├── std_with_full_filled_communication.xml │ └── std_without_communication.xml │ └── std │ └── std_sample.std └── sct-coverage └── pom.xml /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Alliander N.V. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | version: 2 6 | 7 | registries: 8 | maven-github: 9 | type: maven-repository 10 | url: https://maven.pkg.github.com/com-pas/* 11 | username: OWNER 12 | password: ${{ secrets.DB_GITHUB_PACKAGES }} 13 | 14 | updates: 15 | # Maintain dependencies for GitHub Actions 16 | - package-ecosystem: "github-actions" 17 | directory: "/" 18 | schedule: 19 | interval: "weekly" 20 | open-pull-requests-limit: 5 21 | 22 | # Maintain dependencies for Maven 23 | - package-ecosystem: "maven" 24 | directory: "/" 25 | registries: 26 | - maven-github 27 | schedule: 28 | interval: "weekly" 29 | open-pull-requests-limit: 5 30 | ignore: 31 | # Next dependencies shouldn't be upgrade automatically, because they need to update associated code 32 | - dependency-name: com.sun.xml.bind:jaxb-impl 33 | versions: [ "[2.3.3,)" ] 34 | - dependency-name: jakarta.xml.bind:jakarta.xml.bind-api 35 | versions: [ "[2.3.3,)" ] 36 | - dependency-name: org.glassfish.jaxb:jaxb-runtime 37 | versions: [ "[2.3.1,)" ] 38 | - dependency-name: jakarta.annotation:jakarta.annotation-api 39 | versions: [ "[1.3.5,)" ] 40 | - dependency-name: org.codehaus.mojo:jaxb2-maven-plugin 41 | versions: [ "[2.5.0,)" ] 42 | -------------------------------------------------------------------------------- /.github/workflows/automate_javadoc.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 2023 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | name: Continuous Deployment - JavaDocs 5 | 6 | on: 7 | pull_request_target: 8 | types: [ labeled, closed ] 9 | 10 | jobs: 11 | build: 12 | if: ${{ github.event.pull_request.base.ref == 'develop' && github.actor != 'dependabot[bot]' && github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'javadoc') }} 13 | name: Java Docs 14 | runs-on: ubuntu-latest 15 | env: 16 | DEPLOYMENT_BRANCH: gh-pages 17 | DEPENDABOT_BRANCH: dependabot/javadoc-${{ github.head_ref || github.ref_name }}-${{ github.event.pull_request.number }} 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v4 21 | 22 | - name: Set up JDK 21 23 | uses: actions/setup-java@v4 24 | with: 25 | distribution: 'zulu' 26 | java-version: '21' 27 | 28 | - name: Create custom Maven Settings.xml 29 | uses: whelk-io/maven-settings-xml-action@v21 30 | with: 31 | output_file: custom_maven_settings.xml 32 | servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]' 33 | 34 | - name: Configure Git 35 | run: | 36 | git config --global user.name '${{ secrets.CONFIG_CI_USER_NAME }}' 37 | git config --global user.email '${{ secrets.CONFIG_CI_USER_EMAIL }}' 38 | git config pull.rebase false 39 | git fetch origin ${{ env.DEPLOYMENT_BRANCH }} 40 | 41 | - name: Import GPG key 42 | id: import_gpg 43 | uses: crazy-max/ghaction-import-gpg@v6 44 | with: 45 | gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY_BOT}} 46 | git_user_signingkey: true 47 | git_commit_gpgsign: true 48 | 49 | # Take note that your GitHub Pages site is currently being built from the /docs folder in the DEPLOYMENT_BRANCH branch. 50 | - name: Prepare Pull Request branch & commit files 51 | run: | 52 | mvn -s custom_maven_settings.xml clean javadoc:aggregate -P javadoc 53 | mkdir -p docs/javadoc 54 | yes | cp -Rf target/site/apidocs/* docs/javadoc/ 55 | git checkout -b temp 56 | git add docs/javadoc/ 57 | git commit -m "[dependabot/javadoc/temp]: update javadoc" 58 | git checkout ${{ env.DEPLOYMENT_BRANCH }} 59 | git clean -fdx 60 | git checkout -b ${{ env.DEPENDABOT_BRANCH }} 61 | git cherry-pick -n -X theirs temp 62 | git commit -m "[dependabot/javadoc]: update javadoc" 63 | git checkout ${{ env.DEPLOYMENT_BRANCH }} 64 | git merge ${{ env.DEPENDABOT_BRANCH }} 65 | 66 | - name: Push Git Branch 67 | uses: ad-m/github-push-action@v0.8.0 68 | with: 69 | github_token: ${{ secrets.GITHUB_TOKEN }} 70 | branch: ${{ env.DEPLOYMENT_BRANCH }} -------------------------------------------------------------------------------- /.github/workflows/automate_projects.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Alliander N.V. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Add issues and pull request to project boards 6 | 7 | on: [ issues, pull_request, pull_request_target ] 8 | 9 | jobs: 10 | github-actions-automate-projects: 11 | runs-on: ubuntu-latest 12 | 13 | if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }} 14 | steps: 15 | - name: add-new-issues-to-repository-based-project-column 16 | if: github.event_name == 'issues' && github.event.action == 'opened' 17 | uses: alex-page/github-project-automation-plus@v0.8.3 18 | with: 19 | project: CoMPAS SCT Board 20 | column: To do 21 | repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }} 22 | - name: add-new-pull-request-to-repository-based-project-column 23 | if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened' 24 | uses: alex-page/github-project-automation-plus@v0.8.3 25 | with: 26 | project: CoMPAS SCT Board 27 | column: To do 28 | repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }} 29 | 30 | - name: add-new-issues-to-organization-based-project-column 31 | if: github.event_name == 'issues' && github.event.action == 'opened' 32 | uses: alex-page/github-project-automation-plus@v0.8.3 33 | with: 34 | project: CoMPAS Issues Overview Board 35 | column: To do 36 | repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }} 37 | - name: add-new-pull-request-to-organization-based-project-column 38 | if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened' 39 | uses: alex-page/github-project-automation-plus@v0.8.3 40 | with: 41 | project: CoMPAS Pull Request Overview Board 42 | column: To do 43 | repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }} 44 | -------------------------------------------------------------------------------- /.github/workflows/build-project.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Alliander N.V. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Build Project 6 | 7 | on: 8 | push: 9 | branches: 10 | - '**' 11 | pull_request: 12 | branches: 13 | - 'main' 14 | - 'develop' 15 | 16 | jobs: 17 | build: 18 | name: Build 19 | runs-on: ubuntu-latest 20 | timeout-minutes: 15 21 | 22 | steps: 23 | - name: Checkout 24 | uses: actions/checkout@v4 25 | 26 | - name: Set up JDK 21 27 | uses: actions/setup-java@v4 28 | with: 29 | distribution: 'zulu' 30 | java-version: '21' 31 | 32 | - name: Create custom Maven Settings.xml 33 | uses: whelk-io/maven-settings-xml-action@v21 34 | with: 35 | output_file: custom_maven_settings.xml 36 | servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]' 37 | - name: Build with Maven 38 | run: mvn -s custom_maven_settings.xml -B clean verify 39 | -------------------------------------------------------------------------------- /.github/workflows/release-project.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Release Project 6 | 7 | on: 8 | release: 9 | types: [ published ] 10 | 11 | jobs: 12 | publish: 13 | runs-on: ubuntu-latest 14 | permissions: 15 | contents: read 16 | packages: write 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v4 20 | 21 | - name: Set up JDK 21 22 | uses: actions/setup-java@v4 23 | with: 24 | distribution: 'zulu' 25 | java-version: '21' 26 | 27 | - name: Create custom Maven Settings.xml 28 | uses: whelk-io/maven-settings-xml-action@v21 29 | with: 30 | output_file: custom_maven_settings.xml 31 | servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]' 32 | - name: Set version with Maven 33 | run: mvn -B versions:set -DprocessAllModules=true -DnewVersion=${{ github.ref_name }} 34 | env: 35 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 36 | - name: Deploy with Maven to GitHub Packages 37 | run: mvn --batch-mode -s custom_maven_settings.xml clean deploy 38 | env: 39 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 40 | -------------------------------------------------------------------------------- /.github/workflows/reuse.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: REUSE Compliance Check 6 | 7 | on: push 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v4 15 | - name: REUSE Compliance Check 16 | uses: fsfe/reuse-action@v2 17 | -------------------------------------------------------------------------------- /.github/workflows/sonarcloud-build.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: SonarCloud Build 6 | 7 | on: push 8 | 9 | jobs: 10 | build: 11 | name: Build 12 | runs-on: ubuntu-latest 13 | timeout-minutes: 15 14 | 15 | if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }} 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v4 19 | with: 20 | fetch-depth: 0 21 | 22 | - name: Cache SonarCloud packages 23 | uses: actions/cache@v3 24 | with: 25 | path: ~/.sonar/cache 26 | key: ${{ runner.os }}-sonar 27 | restore-keys: ${{ runner.os }}-sonar 28 | 29 | - name: Set up JDK 21 30 | uses: actions/setup-java@v4 31 | with: 32 | distribution: 'zulu' 33 | java-version: '21' 34 | cache: 'maven' 35 | 36 | - name: Create custom Maven Settings.xml 37 | uses: whelk-io/maven-settings-xml-action@v21 38 | with: 39 | output_file: custom_maven_settings.xml 40 | servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]' 41 | - name: Build and analyze (Pull Request) 42 | if: ${{ github.event_name == 'pull_request' || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }} 43 | env: 44 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 45 | run: | 46 | mvn -B -s custom_maven_settings.xml clean verify 47 | - name: Build and analyze (Push) 48 | if: ${{ github.event_name == 'push' }} 49 | env: 50 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 51 | run: | 52 | mvn -B -s custom_maven_settings.xml clean verify 53 | - name: Save PR number to file 54 | if: github.event_name == 'pull_request' 55 | run: echo ${{ github.event.number }} > PR_NUMBER.txt 56 | - name: Archive PR number 57 | if: github.event_name == 'pull_request' 58 | uses: actions/upload-artifact@v4 59 | with: 60 | name: PR_NUMBER 61 | path: PR_NUMBER.txt 62 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2020 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | HELP.md 6 | target/ 7 | .scannerwork 8 | sonar-project.properties 9 | !.mvn/wrapper/maven-wrapper.jar 10 | !**/src/main/** 11 | !**/src/test/** 12 | 13 | ### STS ### 14 | .apt_generated 15 | .classpath 16 | .factorypath 17 | .project 18 | .settings 19 | .springBeans 20 | .sts4-cache 21 | 22 | ### IntelliJ IDEA ### 23 | .idea 24 | *.iws 25 | *.iml 26 | *.ipr 27 | 28 | ### NetBeans ### 29 | /nbproject/private/ 30 | /nbbuild/ 31 | /dist/ 32 | /nbdist/ 33 | /.nb-gradle/ 34 | build/ 35 | 36 | ### VS Code ### 37 | .vscode/ 38 | -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: compas-sct 3 | Upstream-Contact: Mohamed SYLLA 4 | Source: https://github.com/com-pas/compas-sct 5 | 6 | Files: docs/images/* 7 | Copyright: 2022 RTE FRANCE 8 | License: Apache-2.0 9 | 10 | Files: docs/drawio/* 11 | Copyright: 2022 RTE FRANCE 12 | License: Apache-2.0 13 | 14 | Files: docs/blob-files/* 15 | Copyright: 2022 RTE FRANCE 16 | License: Apache-2.0 17 | 18 | Files: docs/javadoc/* 19 | Copyright: 2022 RTE FRANCE 20 | License: Apache-2.0 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | [![Maven Build Github Action Status]()](https://github.com/com-pas/compas-sct/actions?query=workflow%3A%22Build+Project%22) 8 | [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=com-pas_compas-sct&metric=alert_status)](https://sonarcloud.io/dashboard?id=com-pas_compas-sct) 9 | [![REUSE status](https://api.reuse.software/badge/github.com/com-pas/compas-sct)](https://api.reuse.software/info/github.com/com-pas/compas-sct) 10 | [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5925/badge)](https://bestpractices.coreinfrastructure.org/projects/5925) 11 | [![Slack](https://raw.githubusercontent.com/com-pas/compas-architecture/master/public/LFEnergy-slack.svg)](http://lfenergy.slack.com/) 12 | 13 | # System Configuration Tool (SCT) components 14 | The SCT tool is a library for generating SCD (System Configuration Description) files based on IEC 61850 standard. 15 | The code is written with Java (POJO) and is based on Chain of Responsability pattern. 16 | It's architecture is modular and is composed by 3 modules (sct-app, sct-commons and sct-data). 17 | The main feature is to generate a SCD file from SSD (Substation Specification Description) and STD (System Template definition) files. 18 | + ***sct-app*** : is the high level part and contains a service which allows automatic generation of the SCD file. This last 19 | calls sct-commons functions to realize features. 20 | For further use of the SCT tool this part could be used to add end points or other monitoring tools to use efficiently the SCT. 21 | This will allow to dockerize easily the tool for more portal and large usage. 22 | + ***sct-commons*** : contains implementation of basic elements of SCLin low level methods and functions (middle level methods) to realize needed operations for them in order to allow 23 | easy manipulation of SCL files. 24 | + ***sct-data*** : module which propose some interfaces to be implemented in order to interact with databases. 25 | 26 | The main use case of the product is generation of SCD file (automatically or manually by calling low level functions). 27 | Perspectives are given to users to implement other use cases in coherence with the standard IEC-61850 as the SCT stands for a library for now. 28 | 29 | For more informations about the project documentation (architecture, code documentation, etc), please refer to [Documentation](https://com-pas.github.io/compas-sct/) 30 | 31 | Interested in contributing? Please read carefully the [CONTRIBUTING guidelines](https://github.com/com-pas/contributing/blob/master/CONTRIBUTING.md). 32 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | # Security Policy 8 | 9 | ## Reporting a Vulnerability 10 | 11 | Please go to [Security Advisories](https://github.com/com-pas/compas-sct/security/advisories) to privately report a 12 | security vulnerability, 13 | our contributors will try to respond within a week of your report with a rough plan for a fix and new tests. -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 6 |
7 |

404: Page not found

8 |

Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. Head back home to try finding it again.

9 |
10 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | #-- SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | # -- -- 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | # Setup 6 | title: CoMPAS SCT 7 | tagline: 'CoMPAS project documentation' 8 | 9 | paginate: 5 10 | 11 | # Custom vars 12 | version: 0.1.0 13 | 14 | github: 15 | repo: https://github.com/com-pas/compas-sct 16 | 17 | github_username: com-pas 18 | git_repo: compas-sct 19 | git_branch: develop 20 | 21 | baseurl: /compas-sct 22 | contributingUrl: /contributing 23 | 24 | defaults: 25 | - 26 | scope: 27 | path: "HOME.md" 28 | values: 29 | permalink: "/" -------------------------------------------------------------------------------- /docs/_includes/git-logo.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 13 | -------------------------------------------------------------------------------- /docs/_includes/head.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% if page.name == "HOME.md" %} 17 | {{ site.title }} · {{ site.tagline }} 18 | {% else %} 19 | {{ page.title }} · {{ site.title }} 20 | {% endif %} 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/_includes/sidebar.html: -------------------------------------------------------------------------------- 1 | 6 | 42 | -------------------------------------------------------------------------------- /docs/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | {% include head.html %} 10 | 11 | 12 | {% include sidebar.html %} 13 | 14 |
15 | {{ content }} 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/_layouts/page.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 | 10 | 11 | 20 | -------------------------------------------------------------------------------- /docs/blob-files/CoMPAS_Technical_Charter_2020-06-07.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/com-pas/compas-sct/82aace946916b241075dc7f17e3e171cd16534a2/docs/blob-files/CoMPAS_Technical_Charter_2020-06-07.pdf -------------------------------------------------------------------------------- /docs/examples/example-app/src/main/java/org/lfenergy/compas/sct/examples/SctAppExample.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.examples; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.SCL; 8 | import org.lfenergy.compas.sct.commons.SclEditorService; 9 | import org.lfenergy.compas.sct.commons.api.SclEditor; 10 | 11 | import javax.xml.bind.JAXBContext; 12 | import javax.xml.bind.JAXBException; 13 | import javax.xml.bind.Marshaller; 14 | import java.util.UUID; 15 | 16 | public class SctAppExample { 17 | 18 | private static final SclEditor sclEditor = new SclEditorService(); 19 | 20 | public static void main( String[] args ) throws JAXBException { 21 | initSclWithSclService(UUID.randomUUID(), "1.0", "1.0"); 22 | } 23 | 24 | public static SCL initSclWithSclService(UUID hId, String hVersion, String hRevision) throws JAXBException { 25 | SCL scl = sclEditor.initScl(hId, hVersion, hRevision); 26 | marshaller.marshal(scl, System.out); 27 | return scl; 28 | } 29 | 30 | private static final Marshaller marshaller; 31 | static{ 32 | try { 33 | JAXBContext context = JAXBContext.newInstance(SCL.class); 34 | marshaller = context.createMarshaller(); 35 | marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); 36 | } catch (JAXBException ex) { 37 | throw new RuntimeException(ex); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /docs/examples/example-app/src/test/java/org/lfenergy/compas/sct/examples/SctAppExampleTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.examples; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.*; 9 | import org.lfenergy.compas.sct.commons.scl.SclRootAdapter; 10 | 11 | import javax.xml.bind.JAXBException; 12 | import java.util.List; 13 | import java.util.UUID; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | 18 | class SctAppExampleTest { 19 | 20 | @Test 21 | void initSclWithSclServiceTest() throws JAXBException { 22 | // Given : Header attributes 23 | UUID headerId = UUID.randomUUID(); 24 | String headerVersion = SclRootAdapter.VERSION; 25 | String headerRevision = SclRootAdapter.REVISION; 26 | // When: Sct Service 27 | SCL scl = SctAppExample.initSclWithSclService(headerId, headerVersion, headerRevision); 28 | // Then 29 | assertThat(scl.getHeader()).isNotNull(); 30 | assertThat(scl.getHeader().getId()).isEqualTo(headerId.toString()); 31 | assertThat(scl.getHeader().getVersion()).isEqualTo(headerVersion); 32 | assertThat(scl.getHeader().getRevision()).isEqualTo(headerRevision); 33 | THeader.History history = scl.getHeader().getHistory(); 34 | List substations = scl.getSubstation(); 35 | TCommunication communication = scl.getCommunication(); 36 | List iedList = scl.getIED(); 37 | TDataTypeTemplates dataTypeTemplates = scl.getDataTypeTemplates(); 38 | assertThat(history).isNull(); 39 | assertThat(substations).isEmpty(); 40 | assertThat(communication).isNull(); 41 | assertThat(iedList).isEmpty(); 42 | assertThat(dataTypeTemplates).isNull(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /docs/github_pages/_config.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Alliander N.V. 2 | # 3 | # SPDX-License-Identifier: CC-BY-4.0 4 | 5 | # Setup 6 | title: CoMPAS Contributing 7 | tagline: 'Contributing to the CoMPAS project' 8 | 9 | paginate: 5 10 | 11 | # Custom vars 12 | version: 0.0.1 13 | 14 | github: 15 | repo: https://github.com/com-pas/contributing 16 | 17 | github_username: com-pas 18 | git_repo: contributing 19 | git_branch: master 20 | 21 | baseurl: /contributing 22 | 23 | defaults: 24 | - 25 | scope: 26 | path: "HOME.md" 27 | values: 28 | permalink: "/" -------------------------------------------------------------------------------- /docs/images/PackageDiagram-CompasSCT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/com-pas/compas-sct/82aace946916b241075dc7f17e3e171cd16534a2/docs/images/PackageDiagram-CompasSCT.png -------------------------------------------------------------------------------- /docs/images/SequenceDiagram-CompasSCT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/com-pas/compas-sct/82aace946916b241075dc7f17e3e171cd16534a2/docs/images/SequenceDiagram-CompasSCT.png -------------------------------------------------------------------------------- /docs/public/LFEnergy-slack.svg: -------------------------------------------------------------------------------- 1 | LF Energy: slackLF Energyslack -------------------------------------------------------------------------------- /docs/public/LFEnergy-slack.svg.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: 2021 Alliander N.V. 2 | 3 | SPDX-License-Identifier: CC-BY-4.0 -------------------------------------------------------------------------------- /docs/public/apple-touch-icon-144-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/com-pas/compas-sct/82aace946916b241075dc7f17e3e171cd16534a2/docs/public/apple-touch-icon-144-precomposed.png -------------------------------------------------------------------------------- /docs/public/apple-touch-icon-144-precomposed.png.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: 2021 Alliander N.V. 2 | 3 | SPDX-License-Identifier: CC-BY-4.0 -------------------------------------------------------------------------------- /docs/public/compas-horizontal-color.svg.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: 2021 Alliander N.V. 2 | 3 | SPDX-License-Identifier: CC-BY-4.0 -------------------------------------------------------------------------------- /docs/public/css/gitbutton.css: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2021 Alliander N.V. 3 | * 4 | * SPDX-License-Identifier: CC-BY-4.0 5 | */ 6 | 7 | .icon.medium > svg { 8 | display: inline-block; 9 | width: 24px; 10 | height: 24px; 11 | vertical-align: middle; 12 | } 13 | 14 | .icon.medium > svg path { 15 | fill: #828282 16 | } 17 | 18 | .gitbutton { 19 | position: relative; 20 | overflow: visible; 21 | display: inline-block; 22 | padding: 0.5em 1em; 23 | border: 1px solid #d4d4d4; 24 | margin: 0; 25 | text-decoration: none; 26 | text-align: center; 27 | text-shadow: 1px 1px 0 #fff; 28 | /* 29 | * I removed the original CSS defining the font type, as it did not play nicely with 30 | * the CSS defining my link size. 31 | */ 32 | /*font:11px/normal sans-serif; */ 33 | color: #333; 34 | white-space: nowrap; 35 | cursor: pointer; 36 | outline: none; 37 | background-color: #ececec; 38 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f4f4f4), to(#ececec)); 39 | background-image: -moz-linear-gradient(#f4f4f4, #ececec); 40 | background-image: -ms-linear-gradient(#f4f4f4, #ececec); 41 | background-image: -o-linear-gradient(#f4f4f4, #ececec); 42 | background-image: linear-gradient(#f4f4f4, #ececec); 43 | -moz-background-clip: padding; /* for Firefox 3.6 */ 44 | background-clip: padding-box; 45 | border-radius: 0.2em; 46 | /* IE hacks */ 47 | zoom: 1; 48 | *display: inline; 49 | } 50 | 51 | .gitbutton:hover, 52 | .gitbutton:focus, 53 | .gitbutton:active, 54 | .gitbutton.active { 55 | border-color: #3072b3; 56 | border-bottom-color: #2a65a0; 57 | text-decoration: none; 58 | text-shadow: -1px -1px 0 rgba(0,0,0,0.3); 59 | color: #fff; 60 | background-color: #3c8dde; 61 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#599bdc), to(#3072b3)); 62 | background-image: -moz-linear-gradient(#599bdc, #3072b3); 63 | background-image: -o-linear-gradient(#599bdc, #3072b3); 64 | background-image: linear-gradient(#599bdc, #3072b3); 65 | } 66 | .gitbutton:active, 67 | .gitbutton.active { 68 | border-color: #2a65a0; 69 | border-bottom-color: #3884cd; 70 | background-color: #3072b3; 71 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#3072b3), to(#599bdc)); 72 | background-image: -moz-linear-gradient(#3072b3, #599bdc); 73 | background-image: -ms-linear-gradient(#3072b3, #599bdc); 74 | background-image: -o-linear-gradient(#3072b3, #599bdc); 75 | background-image: linear-gradient(#3072b3, #599bdc); 76 | } 77 | /* overrides extra padding on gitbutton elements in Firefox */ 78 | .gitbutton::-moz-focus-inner { 79 | padding: 0; 80 | border: 0; 81 | } 82 | 83 | .gitbutton.pill { 84 | border-radius: 50em; 85 | } -------------------------------------------------------------------------------- /docs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/com-pas/compas-sct/82aace946916b241075dc7f17e3e171cd16534a2/docs/public/favicon.ico -------------------------------------------------------------------------------- /docs/public/favicon.ico.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: 2021 Alliander N.V. 2 | 3 | SPDX-License-Identifier: CC-BY-4.0 -------------------------------------------------------------------------------- /sct-app/src/main/java/org/lfenergy/compas/sct/app/SclAutomationService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.app; 6 | 7 | import lombok.NonNull; 8 | import lombok.RequiredArgsConstructor; 9 | import org.lfenergy.compas.scl2007b4.model.SCL; 10 | import org.lfenergy.compas.sct.commons.api.ControlBlockEditor; 11 | import org.lfenergy.compas.sct.commons.api.SclEditor; 12 | import org.lfenergy.compas.sct.commons.api.SubstationEditor; 13 | import org.lfenergy.compas.sct.commons.dto.HeaderDTO; 14 | import org.lfenergy.compas.sct.commons.exception.ScdException; 15 | 16 | import java.util.*; 17 | 18 | /** 19 | * A representation of the {@link SclAutomationService SclAutomationService}. 20 | *

21 | * The following features are supported: 22 | *

23 | *
    24 | *
  • {@link SclAutomationService#createSCD(SCL, HeaderDTO, List) Adds all elements under the SCL object from given SSD and STD files} 25 | *
26 | */ 27 | @RequiredArgsConstructor 28 | public class SclAutomationService { 29 | 30 | private final SclEditor sclEditor; 31 | private final SubstationEditor substationEditor; 32 | private final ControlBlockEditor controlBlockEditor; 33 | 34 | /** 35 | * Create an SCD file from specified parameters, it calls all functions defined in the process one by one, every step 36 | * return an SCD file which will be used by the next step. 37 | * @param ssd : (mandatory) file contains substation datas 38 | * @param headerDTO : (mandatory) object which hold header datas and historys' one 39 | * @param stds : list of STD files containing IED datas (IED, Communication and DataTypeTemplate) 40 | * @return an SCD object 41 | * @throws ScdException 42 | */ 43 | public SCL createSCD(@NonNull SCL ssd, @NonNull HeaderDTO headerDTO, List stds) throws ScdException { 44 | SCL scd = sclEditor.initScl(headerDTO.getId(), headerDTO.getVersion(), headerDTO.getRevision()); 45 | if (!headerDTO.getHistoryItems().isEmpty()) { 46 | HeaderDTO.HistoryItem hItem = headerDTO.getHistoryItems().get(0); 47 | sclEditor.addHistoryItem(scd, hItem.getWho(), hItem.getWhat(), hItem.getWhy()); 48 | } 49 | substationEditor.addSubstation(scd, ssd); 50 | sclEditor.importSTDElementsInSCD(scd, stds); 51 | controlBlockEditor.removeAllControlBlocksAndDatasetsAndExtRefSrcBindings(scd); 52 | return scd; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /sct-app/src/main/java/org/lfenergy/compas/sct/app/package-info.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | /** 6 | *

sct-app is a group of automation services

7 | */ 8 | package org.lfenergy.compas.sct.app; -------------------------------------------------------------------------------- /sct-commons/src/main/java/lombok.config: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | config.stopBubbling = true 5 | lombok.addLombokGeneratedAnnotation = true 6 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/scl2007b4/model/package-info.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | @XmlSchema( 6 | namespace = "http://www.iec.ch/61850/2003/SCL", 7 | xmlns = { 8 | @XmlNs(namespaceURI = "http://www.iec.ch/61850/2003/SCL", prefix = ""), 9 | @XmlNs(namespaceURI = "https://www.lfenergy.org/compas/extension/v1", prefix = "compas") 10 | }, 11 | elementFormDefault = XmlNsForm.QUALIFIED) 12 | 13 | 14 | package org.lfenergy.compas.scl2007b4.model; 15 | 16 | /* This file is used by the Marshaller to set prefix "compas" for Compas Privates when marshalling JAXB objects */ 17 | 18 | import jakarta.xml.bind.annotation.XmlNs; 19 | import jakarta.xml.bind.annotation.XmlNsForm; 20 | import jakarta.xml.bind.annotation.XmlSchema; -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/BDAService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TBDA; 8 | import org.lfenergy.compas.scl2007b4.model.TDAType; 9 | 10 | import java.util.Optional; 11 | import java.util.function.Predicate; 12 | import java.util.stream.Stream; 13 | 14 | public class BDAService { 15 | 16 | public Stream getBDAs(TDAType tdaType) { 17 | return tdaType.getBDA().stream(); 18 | } 19 | 20 | public Stream getFilteredBDAs(TDAType tdaType, Predicate tTBDAPredicate) { 21 | return getBDAs(tdaType).filter(tTBDAPredicate); 22 | } 23 | 24 | public Optional findBDA(TDAType tdaType, Predicate tBDAPredicate) { 25 | return getFilteredBDAs(tdaType, tBDAPredicate).findFirst(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/ConnectedAPService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TConnectedAP; 8 | import org.lfenergy.compas.scl2007b4.model.TSubNetwork; 9 | 10 | import java.util.Optional; 11 | import java.util.function.Predicate; 12 | import java.util.stream.Stream; 13 | 14 | public class ConnectedAPService { 15 | 16 | public Stream getConnectedAP(TSubNetwork tSubNetwork) { 17 | if (!tSubNetwork.isSetConnectedAP()) { 18 | return Stream.empty(); 19 | } 20 | return tSubNetwork.getConnectedAP().stream(); 21 | } 22 | 23 | public Stream getFilteredConnectedAP(TSubNetwork tSubNetwork, Predicate tConnectedAPPredicate) { 24 | return getConnectedAP(tSubNetwork).filter(tConnectedAPPredicate); 25 | } 26 | 27 | public Optional findConnectedAP(TSubNetwork tSubNetwork, Predicate tConnectedAPPredicate) { 28 | return getFilteredConnectedAP(tSubNetwork, tConnectedAPPredicate).findFirst(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DaService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TDA; 8 | import org.lfenergy.compas.scl2007b4.model.TDOType; 9 | 10 | import java.util.Optional; 11 | import java.util.function.Predicate; 12 | import java.util.stream.Stream; 13 | 14 | public class DaService { 15 | 16 | public Stream getDAs(TDOType tdoType) { 17 | return tdoType.getSDOOrDA().stream() 18 | .filter(tUnNaming -> tUnNaming.getClass().equals(TDA.class)) 19 | .map(TDA.class::cast); 20 | } 21 | 22 | public Stream getFilteredDAs(TDOType tdoType, Predicate tdaPredicate) { 23 | return getDAs(tdoType).filter(tdaPredicate); 24 | } 25 | 26 | public Optional findDA(TDOType tdoType, Predicate tdaPredicate) { 27 | return getFilteredDAs(tdoType, tdaPredicate).findFirst(); 28 | } 29 | 30 | public Optional findDA(TDOType tdoType, String daName) { 31 | return getFilteredDAs(tdoType, tda -> tda.getName().equals(daName)).findFirst(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DaTypeService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TDAType; 8 | import org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates; 9 | 10 | import java.util.Optional; 11 | 12 | public class DaTypeService { 13 | 14 | public Optional findDaType(TDataTypeTemplates tDataTypeTemplates, String daTypeId) { 15 | return tDataTypeTemplates.getDAType().stream() 16 | .filter(tdaType -> tdaType.isSetId() && tdaType.getId().equals(daTypeId)).findFirst(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DaiService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.*; 8 | 9 | import java.util.Optional; 10 | import java.util.function.Predicate; 11 | import java.util.stream.Stream; 12 | 13 | public class DaiService { 14 | 15 | public Stream getDais(TDOI tdoi) { 16 | return tdoi.getSDIOrDAI() 17 | .stream() 18 | .filter(dai -> dai.getClass().equals(TDAI.class)) 19 | .map(TDAI.class::cast); 20 | } 21 | 22 | public Stream getFilteredDais(TDOI tdoi, Predicate tdaiPredicate) { 23 | return getDais(tdoi).filter(tdaiPredicate); 24 | } 25 | 26 | public Optional findDai(TDOI tdoi, Predicate tdaiPredicate) { 27 | return getFilteredDais(tdoi, tdaiPredicate).findFirst(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DataSetService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.LN0; 8 | import org.lfenergy.compas.scl2007b4.model.TAnyLN; 9 | import org.lfenergy.compas.scl2007b4.model.TDataSet; 10 | import org.lfenergy.compas.scl2007b4.model.TLN; 11 | 12 | import java.util.Optional; 13 | import java.util.function.Predicate; 14 | import java.util.stream.Stream; 15 | 16 | public class DataSetService { 17 | 18 | public Stream getDataSets(TAnyLN tAnyLN) { 19 | return switch (tAnyLN) { 20 | case LN0 ln0 -> ln0.isSetDataSet() ? ln0.getDataSet().stream() : Stream.empty(); 21 | case TLN tln -> tln.isSetDataSet() ? tln.getDataSet().stream() : Stream.empty(); 22 | default -> throw new IllegalStateException("Unexpected value: " + tAnyLN); 23 | }; 24 | } 25 | 26 | public Stream getFilteredDataSets(TAnyLN tAnyLN, Predicate dataSetPredicate) { 27 | return getDataSets(tAnyLN).filter(dataSetPredicate); 28 | } 29 | 30 | public Optional findDataSet(TAnyLN tAnyLN, Predicate dataSetPredicate) { 31 | return getFilteredDataSets(tAnyLN, dataSetPredicate).findFirst(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DoService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TDO; 8 | import org.lfenergy.compas.scl2007b4.model.TLNodeType; 9 | 10 | import java.util.Optional; 11 | import java.util.function.Predicate; 12 | import java.util.stream.Stream; 13 | 14 | public class DoService { 15 | 16 | public Stream getDos(TLNodeType tlNodeType) { 17 | return tlNodeType.getDO().stream(); 18 | } 19 | 20 | public Stream getFilteredDos(TLNodeType tlNodeType, Predicate tdoPredicate) { 21 | return getDos(tlNodeType).filter(tdoPredicate); 22 | } 23 | 24 | public Optional findDo(TLNodeType tlNodeType, Predicate tdoPredicate) { 25 | return getFilteredDos(tlNodeType, tdoPredicate).findFirst(); 26 | } 27 | 28 | public Optional findDo(TLNodeType tlNodeType, String doName) { 29 | return getFilteredDos(tlNodeType, tdo -> tdo.getName().equals(doName)).findFirst(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DoiService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TAnyLN; 8 | import org.lfenergy.compas.scl2007b4.model.TDOI; 9 | 10 | import java.util.Optional; 11 | import java.util.function.Predicate; 12 | import java.util.stream.Stream; 13 | 14 | public class DoiService { 15 | 16 | public Stream getDois(TAnyLN tAnyLN) { 17 | return tAnyLN.getDOI().stream(); 18 | } 19 | 20 | public Stream getFilteredDois(TAnyLN tAnyLN, Predicate tdoiPredicate) { 21 | return getDois(tAnyLN).filter(tdoiPredicate); 22 | } 23 | 24 | public Optional findDoi(TAnyLN tAnyLN, Predicate tdoiPredicate) { 25 | return getFilteredDois(tAnyLN, tdoiPredicate).findFirst(); 26 | } 27 | 28 | public Optional findDoiByName(TAnyLN tAnyLN, String doiName) { 29 | return findDoi(tAnyLN, tdoi -> tdoi.getName().equals(doiName)); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/ExtRefReaderService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.*; 8 | import org.lfenergy.compas.sct.commons.api.ExtRefReader; 9 | 10 | import java.util.stream.Stream; 11 | 12 | public class ExtRefReaderService implements ExtRefReader { 13 | 14 | public Stream getExtRefs(TAnyLN tAnyLN) { 15 | return switch (tAnyLN) { 16 | case LN0 ln0 -> ln0.isSetInputs() ? ln0.getInputs().getExtRef().stream() : Stream.empty(); 17 | case TLN tln -> tln.isSetInputs() ? tln.getInputs().getExtRef().stream() : Stream.empty(); 18 | default -> throw new IllegalStateException("Unexpected value: " + tAnyLN); 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/IedService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.SCL; 8 | import org.lfenergy.compas.scl2007b4.model.TIED; 9 | import org.lfenergy.compas.sct.commons.exception.ScdException; 10 | 11 | import java.util.Optional; 12 | import java.util.function.Predicate; 13 | import java.util.stream.Stream; 14 | 15 | public class IedService { 16 | 17 | public Stream getFilteredIeds(SCL scd, Predicate iedPredicate) { 18 | return scd.getIED().stream().filter(iedPredicate); 19 | } 20 | 21 | public Optional findIed(SCL scd, Predicate iedPredicate) { 22 | return getFilteredIeds(scd, iedPredicate).findFirst(); 23 | } 24 | 25 | public Optional findByName(SCL scd, String iedName) { 26 | if (null == iedName) 27 | throw new ScdException("The given iedName is null"); 28 | return findIed(scd, tied -> iedName.equals(tied.getName())); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/LdeviceService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import lombok.RequiredArgsConstructor; 8 | import org.lfenergy.compas.scl2007b4.model.TAccessPoint; 9 | import org.lfenergy.compas.scl2007b4.model.TIED; 10 | import org.lfenergy.compas.scl2007b4.model.TLDevice; 11 | import org.lfenergy.compas.scl2007b4.model.TServer; 12 | import org.lfenergy.compas.sct.commons.util.ActiveStatus; 13 | 14 | import java.util.Objects; 15 | import java.util.Optional; 16 | import java.util.function.Predicate; 17 | import java.util.stream.Stream; 18 | 19 | @RequiredArgsConstructor 20 | public class LdeviceService { 21 | 22 | private final LnService lnService; 23 | 24 | public Stream getLdevices(TIED tied) { 25 | if (!tied.isSetAccessPoint()) { 26 | return Stream.empty(); 27 | } 28 | return tied.getAccessPoint() 29 | .stream() 30 | .map(TAccessPoint::getServer) 31 | .filter(Objects::nonNull) 32 | .filter(TServer::isSetLDevice) 33 | .flatMap(tServer -> tServer.getLDevice().stream()); 34 | } 35 | 36 | public Stream getActiveLdevices(TIED tied) { 37 | return getLdevices(tied) 38 | .filter(ldevice -> getLdeviceStatus(ldevice).map(ActiveStatus.ON::equals).orElse(false)); 39 | } 40 | 41 | public Stream getFilteredLdevices(TIED tied, Predicate ldevicePredicate) { 42 | return getLdevices(tied).filter(ldevicePredicate); 43 | } 44 | 45 | public Optional findLdevice(TIED tied, Predicate ldevicePredicate) { 46 | return getFilteredLdevices(tied, ldevicePredicate).findFirst(); 47 | } 48 | 49 | public Optional findLdevice(TIED tied, String ldInst) { 50 | return findLdevice(tied, tlDevice -> tlDevice.getInst().equals(ldInst)); 51 | } 52 | 53 | public Optional getLdeviceStatus(TLDevice tlDevice) { 54 | return lnService.getDaiModStValValue(tlDevice.getLN0()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/LnodeTypeService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates; 8 | import org.lfenergy.compas.scl2007b4.model.TLNodeType; 9 | 10 | import java.util.Optional; 11 | import java.util.function.Predicate; 12 | import java.util.stream.Stream; 13 | 14 | public class LnodeTypeService { 15 | 16 | public Stream getLnodeTypes(TDataTypeTemplates tDataTypeTemplates) { 17 | return tDataTypeTemplates.getLNodeType().stream(); 18 | } 19 | 20 | public Stream getFilteredLnodeTypes(TDataTypeTemplates tDataTypeTemplates, Predicate tlNodeTypePredicate) { 21 | return getLnodeTypes(tDataTypeTemplates).filter(tlNodeTypePredicate); 22 | } 23 | 24 | public Optional findLnodeType(TDataTypeTemplates tDataTypeTemplates, Predicate tlNodeTypePredicate) { 25 | return getFilteredLnodeTypes(tDataTypeTemplates, tlNodeTypePredicate).findFirst(); 26 | } 27 | 28 | public Optional findLnodeType(TDataTypeTemplates tDataTypeTemplates, String lNodeTypeId) { 29 | return getFilteredLnodeTypes(tDataTypeTemplates, tlNodeType -> tlNodeType.getId().equals(lNodeTypeId)).findFirst(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/SdoService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TDOType; 8 | import org.lfenergy.compas.scl2007b4.model.TSDO; 9 | 10 | import java.util.Optional; 11 | import java.util.function.Predicate; 12 | import java.util.stream.Stream; 13 | 14 | public class SdoService { 15 | 16 | public Stream getSDOs(TDOType tdoType) { 17 | return tdoType.getSDOOrDA().stream() 18 | .filter(tUnNaming -> tUnNaming.getClass().equals(TSDO.class)) 19 | .map(TSDO.class::cast); 20 | } 21 | 22 | public Stream getFilteredSDOs(TDOType tdoType, Predicate tsdoPredicate) { 23 | return getSDOs(tdoType).filter(tsdoPredicate); 24 | } 25 | 26 | public Optional findSDO(TDOType tdoType, Predicate tsdoPredicate) { 27 | return getFilteredSDOs(tdoType, tsdoPredicate).findFirst(); 28 | } 29 | 30 | public Optional findSDO(TDOType tdoType, String sdoName) { 31 | return getFilteredSDOs(tdoType, tsdo -> tsdo.getName().equals(sdoName)).findFirst(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/SubNetworkService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.SCL; 8 | import org.lfenergy.compas.scl2007b4.model.TCommunication; 9 | import org.lfenergy.compas.scl2007b4.model.TSubNetwork; 10 | 11 | import java.util.Optional; 12 | import java.util.function.Predicate; 13 | import java.util.stream.Stream; 14 | 15 | public class SubNetworkService { 16 | 17 | public Stream getSubNetworks(SCL scl) { 18 | if (!scl.isSetCommunication()) { 19 | return Stream.empty(); 20 | } 21 | if (!scl.getCommunication().isSetSubNetwork()) { 22 | return Stream.empty(); 23 | } 24 | return scl.getCommunication().getSubNetwork().stream(); 25 | } 26 | 27 | public Stream getSubNetworks(TCommunication tCommunication) { 28 | if (!tCommunication.isSetSubNetwork()) { 29 | return Stream.empty(); 30 | } 31 | return tCommunication.getSubNetwork().stream(); 32 | } 33 | 34 | public Stream getFilteredSubNetworks(SCL tlNodeType, Predicate tdoPredicate) { 35 | return getSubNetworks(tlNodeType).filter(tdoPredicate); 36 | } 37 | 38 | public Optional findSubNetwork(SCL tlNodeType, Predicate tdoPredicate) { 39 | return getFilteredSubNetworks(tlNodeType, tdoPredicate).findFirst(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/VoltageLevelService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.*; 8 | 9 | import java.util.Collection; 10 | import java.util.Optional; 11 | import java.util.function.Predicate; 12 | import java.util.stream.Stream; 13 | 14 | public class VoltageLevelService { 15 | 16 | public Stream getVoltageLevels(SCL scd) { 17 | if (!scd.isSetSubstation()) { 18 | return Stream.empty(); 19 | } 20 | return scd.getSubstation() 21 | .stream() 22 | .map(TSubstation::getVoltageLevel) 23 | .flatMap(Collection::stream); 24 | } 25 | 26 | public Optional findVoltageLevel(SCL scd, Predicate tVoltageLevelPredicate) { 27 | return getVoltageLevels(scd).filter(tVoltageLevelPredicate).findFirst(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/DataTypeTemplateReader.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.api; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates; 8 | import org.lfenergy.compas.sct.commons.domain.DoLinkedToDa; 9 | import org.lfenergy.compas.sct.commons.domain.DoLinkedToDaFilter; 10 | 11 | import java.util.Optional; 12 | import java.util.stream.Stream; 13 | 14 | public interface DataTypeTemplateReader { 15 | 16 | boolean isDoModAndDaStValExist(TDataTypeTemplates dtt, String lNodeTypeId); 17 | 18 | Stream getAllDoLinkedToDa(TDataTypeTemplates tDataTypeTemplates); 19 | 20 | Stream getFilteredDoLinkedToDa(TDataTypeTemplates dtt, String lNodeTypeId, DoLinkedToDaFilter doLinkedToDaFilter); 21 | 22 | Optional findDoLinkedToDa(TDataTypeTemplates dtt, String lNodeTypeId, DoLinkedToDaFilter doLinkedToDaFilter); 23 | 24 | Stream getEnumValues(TDataTypeTemplates dataTypeTemplates, String lnType, DoLinkedToDaFilter doLinkedToDaFilter); 25 | } 26 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/ExtRefReader.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.api; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TAnyLN; 8 | import org.lfenergy.compas.scl2007b4.model.TExtRef; 9 | 10 | import java.util.stream.Stream; 11 | 12 | public interface ExtRefReader { 13 | 14 | Stream getExtRefs(TAnyLN tAnyLN); 15 | } 16 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/LnEditor.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.api; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.*; 8 | import org.lfenergy.compas.sct.commons.domain.DoLinkedToDa; 9 | import org.lfenergy.compas.sct.commons.domain.DoLinkedToDaFilter; 10 | import org.lfenergy.compas.sct.commons.util.ActiveStatus; 11 | 12 | import java.util.Optional; 13 | import java.util.function.Predicate; 14 | import java.util.stream.Stream; 15 | 16 | public interface LnEditor { 17 | 18 | Optional getDaiModStValValue(TAnyLN tAnyLN); 19 | 20 | Optional getDaiModStVal(TAnyLN tAnyLN); 21 | 22 | Optional getDOAndDAInstances(TAnyLN tAnyLN, DoLinkedToDaFilter doLinkedToDaFilter); 23 | 24 | void updateOrCreateDOAndDAInstances(TAnyLN tAnyLN, DoLinkedToDa doLinkedToDa); 25 | 26 | DoLinkedToDa getDoLinkedToDaCompletedFromDAI(TIED tied, String ldInst, TAnyLN anyLN, DoLinkedToDa doLinkedToDa); 27 | 28 | Stream getAnylns(TLDevice tlDevice); 29 | 30 | Optional findLn(TLDevice tlDevice, Predicate lnPredicate); 31 | 32 | boolean matchesLn(TAnyLN tAnyLN, String lnClass, String lnInst, String lnPrefix); 33 | } 34 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/SubstationEditor.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.api; 6 | 7 | import lombok.NonNull; 8 | import org.lfenergy.compas.scl2007b4.model.SCL; 9 | import org.lfenergy.compas.scl2007b4.model.TSubstation; 10 | import org.lfenergy.compas.sct.commons.exception.ScdException; 11 | import org.lfenergy.compas.sct.commons.scl.sstation.SubstationAdapter; 12 | 13 | /** 14 | * Service class that will be used to create, update or delete elements related to the {@link TSubstation TSubstation} object. 15 | *

The following features are supported:

16 | *
    17 | *
  • {@link SubstationEditor#addSubstation(SCL, SCL) Adds the Substation object from given SCL object}
  • 18 | *
19 | * @see SubstationAdapter 20 | */ 21 | public interface SubstationEditor { 22 | 23 | /** 24 | * Adds or Updates Substation section in SCL 25 | * @param scd SCL file in which Substation should be added/updated 26 | * @param ssd SCL file from which Substation should be copied 27 | * @throws ScdException throws when SCD contents already another Substation, or with different name, or contents 28 | * more than one Substation 29 | */ 30 | void addSubstation(@NonNull SCL scd, @NonNull SCL ssd) throws ScdException; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/package-info.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | /** 6 | *

commons.api contains interfaces for manipulating SCL Files

7 | */ 8 | package org.lfenergy.compas.sct.commons.api; -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/domain/DaVal.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.domain; 6 | 7 | public record DaVal(Long settingGroup, String val) { 8 | } 9 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/domain/DataAttribute.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.domain; 6 | 7 | import lombok.Getter; 8 | import lombok.Setter; 9 | import org.apache.commons.lang3.StringUtils; 10 | import org.lfenergy.compas.scl2007b4.model.TFCEnum; 11 | import org.lfenergy.compas.scl2007b4.model.TPredefinedBasicTypeEnum; 12 | import org.lfenergy.compas.scl2007b4.model.TVal; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | import java.util.Objects; 17 | 18 | @Getter 19 | @Setter 20 | public class DataAttribute { 21 | 22 | private String daName; 23 | private String type; 24 | private TPredefinedBasicTypeEnum bType; 25 | private TFCEnum fc; 26 | private boolean valImport; 27 | private List bdaNames = new ArrayList<>(); 28 | private List daiValues = new ArrayList<>(); 29 | 30 | public DataAttribute deepCopy() { 31 | DataAttribute dataAttribute = new DataAttribute(); 32 | dataAttribute.setDaName(getDaName()); 33 | dataAttribute.setType(getType()); 34 | dataAttribute.setBType(getBType()); 35 | dataAttribute.setFc(getFc()); 36 | dataAttribute.setValImport(isValImport()); 37 | dataAttribute.getBdaNames().addAll(getBdaNames()); 38 | dataAttribute.getDaiValues().addAll(getDaiValues()); 39 | return dataAttribute; 40 | } 41 | 42 | public void addDaVal(List vals) { 43 | vals.forEach(this::addDaVal); 44 | vals.forEach(tVal -> { 45 | Long settingGroup = tVal.isSetSGroup() ? tVal.getSGroup() : null; 46 | daiValues.removeIf(daVal -> Objects.equals(daVal.settingGroup(), settingGroup)); 47 | daiValues.add(new DaVal(settingGroup, tVal.getValue())); 48 | }); 49 | } 50 | 51 | public void addDaVal(TVal tVal) { 52 | Long settingGroup = tVal.isSetSGroup() ? tVal.getSGroup() : null; 53 | daiValues.removeIf(daVal -> Objects.equals(daVal.settingGroup(), settingGroup)); 54 | daiValues.add(new DaVal(settingGroup, tVal.getValue())); 55 | } 56 | 57 | @Override 58 | public String toString(){ 59 | return daName + (getBdaNames().isEmpty() ? StringUtils.EMPTY : "." + String.join(".", getBdaNames())); 60 | } 61 | 62 | /** 63 | * Check if DA Object is updatable 64 | * @return boolean value of DA state 65 | */ 66 | public boolean isUpdatable(){ 67 | return isValImport() && 68 | (fc == TFCEnum.CF || 69 | fc == TFCEnum.DC || 70 | fc == TFCEnum.SG || 71 | fc == TFCEnum.SP || 72 | fc == TFCEnum.ST || 73 | fc == TFCEnum.SE 74 | ); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/domain/DataObject.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.domain; 6 | 7 | import lombok.Getter; 8 | import lombok.NoArgsConstructor; 9 | import lombok.Setter; 10 | import org.apache.commons.lang3.StringUtils; 11 | import org.lfenergy.compas.scl2007b4.model.TPredefinedCDCEnum; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | @Getter 17 | @Setter 18 | @NoArgsConstructor 19 | public class DataObject { 20 | 21 | private String doName; 22 | private TPredefinedCDCEnum cdc; 23 | private List sdoNames = new ArrayList<>(); 24 | 25 | public DataObject(String doName, TPredefinedCDCEnum cdc, List sdoNames) { 26 | this.doName = doName; 27 | this.cdc = cdc; 28 | this.sdoNames.addAll(sdoNames); 29 | } 30 | 31 | public DataObject deepCopy() { 32 | return new DataObject(getDoName(), getCdc(), getSdoNames()); 33 | } 34 | 35 | @Override 36 | public String toString(){ 37 | return doName + (getSdoNames().isEmpty() ? StringUtils.EMPTY : "." + String.join(".", getSdoNames())); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/domain/DoLinkedToDa.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.domain; 6 | 7 | 8 | import static org.lfenergy.compas.sct.commons.util.CommonConstants.MOD_DO_NAME; 9 | import static org.lfenergy.compas.sct.commons.util.CommonConstants.STVAL_DA_NAME; 10 | 11 | 12 | public record DoLinkedToDa(DataObject dataObject, DataAttribute dataAttribute) { 13 | 14 | public DoLinkedToDa deepCopy() { 15 | return new DoLinkedToDa( 16 | dataObject().deepCopy(), 17 | dataAttribute().deepCopy()); 18 | } 19 | 20 | public String getDoRef() { 21 | return dataObject != null ? dataObject.toString() : ""; 22 | } 23 | 24 | public String getDaRef() { 25 | return dataAttribute != null ? dataAttribute.toString() : ""; 26 | } 27 | 28 | /** 29 | * Checks if DA/DO is updatable 30 | * 31 | * @return true if updatable, false otherwise 32 | */ 33 | public boolean isUpdatable() { 34 | return isDOModDAstVal() || dataAttribute.isUpdatable(); 35 | } 36 | 37 | /** 38 | * Checks if DO is Mod and DA is stVal 39 | * 40 | * @return true if DO is "Mod" and DA is "stVal", false otherwise 41 | */ 42 | private boolean isDOModDAstVal() { 43 | return dataObject.getDoName().equals(MOD_DO_NAME) && dataAttribute.getDaName().equals(STVAL_DA_NAME); 44 | } 45 | 46 | /** 47 | * Create DoLinkedToDaFilter from this 48 | * @return new DoLinkedToDaFilter instance with same data Object and data Attribute Ref 49 | */ 50 | public DoLinkedToDaFilter toFilter() { 51 | return DoLinkedToDaFilter.from(getDoRef(), getDaRef()); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/domain/DoLinkedToDaFilter.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.domain; 6 | 7 | 8 | import org.apache.commons.lang3.StringUtils; 9 | 10 | import java.util.Arrays; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public record DoLinkedToDaFilter(String doName, List sdoNames, String daName, List bdaNames) { 15 | 16 | public DoLinkedToDaFilter(String doName, List sdoNames, String daName, List bdaNames) { 17 | this.doName = StringUtils.isBlank(doName) ? null : doName; 18 | this.sdoNames = sdoNames == null ? Collections.emptyList() : List.copyOf(sdoNames); 19 | this.daName = StringUtils.isBlank(daName) ? null : daName; 20 | this.bdaNames = bdaNames == null ? Collections.emptyList() : List.copyOf(bdaNames); 21 | } 22 | 23 | public static DoLinkedToDaFilter from(String doNames, String daNames) { 24 | String doName = null; 25 | List sdoNames = null; 26 | String daName = null; 27 | List bdaNames = null; 28 | if (StringUtils.isNotBlank(doNames)) { 29 | doName = doNames.split("\\.")[0]; 30 | sdoNames = Arrays.stream(doNames.split("\\.")).skip(1).toList(); 31 | } 32 | if (StringUtils.isNotBlank(daNames)) { 33 | daName = daNames.split("\\.")[0]; 34 | bdaNames = Arrays.stream(daNames.split("\\.")).skip(1).toList(); 35 | } 36 | return new DoLinkedToDaFilter(doName, sdoNames, daName, bdaNames); 37 | } 38 | 39 | public String getDoRef() { 40 | return doName + (sdoNames().isEmpty() ? StringUtils.EMPTY : "." + String.join(".", sdoNames())); 41 | } 42 | 43 | public String getDaRef() { 44 | return daName + (bdaNames().isEmpty() ? StringUtils.EMPTY : "." + String.join(".", bdaNames())); 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return getDoRef() + "." + getDaRef(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/ConnectedApDTO.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import org.lfenergy.compas.sct.commons.scl.com.ConnectedAPAdapter; 8 | 9 | import java.util.Objects; 10 | 11 | /** 12 | * A representation of the model object Connected AP. 13 | * 14 | *

15 | * The following features are supported: 16 | *

17 | *
    18 | *
  • {@link ConnectedApDTO#apName()} () Ap Name}
  • 19 | *
  • {@link ConnectedApDTO#iedName()} () Ied Name}
  • 20 | *
21 | * 22 | * @see org.lfenergy.compas.scl2007b4.model.TConnectedAP 23 | */ 24 | public record ConnectedApDTO(String iedName, String apName) { 25 | 26 | /** 27 | * Convert ConnectedAPAdapter object to dto ConnectedApDTO 28 | * 29 | * @param connectedAPAdapter object to convert 30 | * @return dto ConnectedApDTO 31 | */ 32 | public static ConnectedApDTO from(ConnectedAPAdapter connectedAPAdapter) { 33 | return new ConnectedApDTO(connectedAPAdapter.getIedName(), connectedAPAdapter.getApName()); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/DataSetInfo.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | package org.lfenergy.compas.sct.commons.dto; 5 | 6 | import lombok.Getter; 7 | import lombok.NoArgsConstructor; 8 | import org.lfenergy.compas.scl2007b4.model.TDataSet; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * A representation of the model object Data Set. 15 | * 16 | *

17 | * The following features are supported: 18 | *

19 | *
    20 | *
  • {@link DataSetInfo#getName() Name}
  • 21 | *
  • {@link DataSetInfo#getFcdaInfos()} Refers to FCDA infos}
  • 22 | *
23 | * 24 | * @see org.lfenergy.compas.scl2007b4.model.TDataSet 25 | */ 26 | @Getter 27 | @NoArgsConstructor 28 | public class DataSetInfo extends LNodeMetaDataEmbedder { 29 | //TODO this is a DTO object; it's meant to be used for carry information; he must be created be the one responsible for carying the info 30 | private String name; 31 | private List fcdaInfos = new ArrayList<>(); 32 | 33 | public DataSetInfo(TDataSet tDataSet) { 34 | super(); 35 | this.name = tDataSet.getName(); 36 | this.fcdaInfos = tDataSet.getFCDA() 37 | .stream() 38 | .map(fcda -> new FCDAInfo(name, fcda.getFc(), fcda.getLdInst(), fcda.getPrefix(), fcda.getLnClass().get(0), fcda.getLnInst(), new DoTypeName(fcda.getDoName()), new DaTypeName(fcda.getDaName()), fcda.getIx())) 39 | .toList(); 40 | } 41 | 42 | /** 43 | * Check DataSet validity 44 | * @return validity state 45 | */ 46 | public boolean isValid() { 47 | if (name.length() > 32 || fcdaInfos.isEmpty()) { 48 | return false; 49 | } 50 | return fcdaInfos.stream().allMatch(FCDAInfo::isValid); 51 | } 52 | } -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/EnumValDTO.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | public record EnumValDTO(Integer ord, String value) { 8 | } 9 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/ExtrefTarget.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | public enum ExtrefTarget { 8 | SRC_REF, SRC_CB 9 | } 10 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/FCDAInfo.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import com.fasterxml.jackson.annotation.JsonIgnore; 8 | import lombok.*; 9 | import org.apache.commons.lang3.StringUtils; 10 | import org.lfenergy.compas.scl2007b4.model.TFCDA; 11 | import org.lfenergy.compas.scl2007b4.model.TFCEnum; 12 | 13 | /** 14 | * A representation of the model object FCDA. 15 | * 16 | *

17 | * The following features are supported: 18 | *

19 | *
    20 | *
  • {@link FCDAInfo#getDaName Da Name}
  • 21 | *
  • {@link FCDAInfo#getDoName Do Name}
  • 22 | *
  • {@link FCDAInfo#getFc Fc}
  • 23 | *
  • {@link FCDAInfo#getIx em>Ix}
  • 24 | *
  • {@link FCDAInfo#getLdInst Ld Inst}
  • 25 | *
  • {@link FCDAInfo#getLnClass Ln Class}
  • 26 | *
  • {@link FCDAInfo#getLnInst Ln Inst}
  • 27 | *
  • {@link FCDAInfo#getPrefix Prefix}
  • 28 | *
29 | * 30 | * @see org.lfenergy.compas.scl2007b4.model.TFCDA 31 | */ 32 | @Getter 33 | @AllArgsConstructor 34 | @NoArgsConstructor 35 | public class FCDAInfo { 36 | 37 | private String dataSet; 38 | 39 | private TFCEnum fc; 40 | private String ldInst; 41 | private String prefix; 42 | private String lnClass; 43 | private String lnInst; 44 | private DoTypeName doName; //doName.[...sdoNames] 45 | private DaTypeName daName; //daName.[...bdaNames] 46 | private Long ix; 47 | 48 | /** 49 | * Checks FCDAInfo validity 50 | * @return validity state 51 | */ 52 | public boolean isValid() { 53 | return doName != null && doName.isDefined(); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LNodeMetaData.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import lombok.Getter; 8 | import lombok.NoArgsConstructor; 9 | import lombok.NonNull; 10 | import lombok.Setter; 11 | import org.lfenergy.compas.sct.commons.scl.ln.AbstractLNAdapter; 12 | import org.lfenergy.compas.sct.commons.scl.ldevice.LDeviceAdapter; 13 | 14 | /** 15 | * A representation of common attributes that defines LDName, LNName. 16 | *
    17 | *
  • {@link LNodeMetaData#getIedName Ied Name}
  • 18 | *
  • {@link LNodeMetaData#getLdInst Ld Inst}
  • 19 | *
  • {@link LNodeMetaData#getLnClass Ln Class}
  • 20 | *
  • {@link LNodeMetaData#getLnInst Ln Inst}
  • 21 | *
  • {@link LNodeMetaData#getLnPrefix Prefix}
  • 22 | *
23 | * @see org.lfenergy.compas.sct.commons.scl.ObjectReference 24 | */ 25 | @Getter 26 | @Setter 27 | @NoArgsConstructor 28 | public class LNodeMetaData { 29 | private String iedName; 30 | private String ldInst; 31 | private String lnClass; 32 | private String lnInst; 33 | private String lnPrefix; 34 | 35 | /** 36 | * Initializes LNode meta data's' 37 | * @param tAbstractLNAdapter input 38 | * @return LNodeMetaData object 39 | */ 40 | public static LNodeMetaData from(@NonNull AbstractLNAdapter tAbstractLNAdapter) { 41 | LNodeMetaData metaData = new LNodeMetaData(); 42 | metaData.lnClass = tAbstractLNAdapter.getLNClass(); 43 | metaData.lnInst = tAbstractLNAdapter.getLNInst(); 44 | metaData.lnPrefix = tAbstractLNAdapter.getPrefix(); 45 | 46 | LDeviceAdapter lDeviceAdapter = tAbstractLNAdapter.getParentAdapter(); 47 | if(lDeviceAdapter != null){ 48 | metaData.ldInst = lDeviceAdapter.getInst(); 49 | if(lDeviceAdapter.getParentAdapter() != null){ 50 | metaData.iedName = lDeviceAdapter.getParentAdapter().getName(); 51 | } 52 | } 53 | return metaData; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptions.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import lombok.Getter; 8 | import lombok.NoArgsConstructor; 9 | import lombok.Setter; 10 | 11 | /** 12 | * A representation of the model object LogicalNodeOptions. 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link LogicalNodeOptions#withExtRef withExtRef}
  • 18 | *
  • {@link LogicalNodeOptions#withDataAttributeRef withDataAttributeRef}
  • 19 | *
  • {@link LogicalNodeOptions#withDatSet withDatSet}
  • 20 | *
  • {@link LogicalNodeOptions#withCB withCB}
  • 21 | *
22 | */ 23 | @Getter 24 | @Setter 25 | @NoArgsConstructor 26 | public class LogicalNodeOptions { 27 | private boolean withExtRef = false; 28 | private boolean withDataAttributeRef = false; 29 | private boolean withCB = false; 30 | private boolean withDatSet = false; 31 | 32 | /** 33 | * Constructor 34 | * @param withExtRef input 35 | * @param withDataAttributeRef input 36 | * @param withCB input 37 | * @param withDatSet input 38 | */ 39 | public LogicalNodeOptions(boolean withExtRef, boolean withDataAttributeRef, boolean withCB, boolean withDatSet) { 40 | this.withExtRef = withExtRef; 41 | this.withDataAttributeRef = withDataAttributeRef; 42 | this.withCB = withCB; 43 | this.withDatSet = withDatSet; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/PrivateLinkedToStds.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.SCL; 8 | import org.lfenergy.compas.scl2007b4.model.TPrivate; 9 | 10 | import java.util.List; 11 | 12 | public record PrivateLinkedToStds(TPrivate tPrivate, List stdList) { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/SclReportItem.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | public record SclReportItem(String xpath, String message, boolean isError) { 8 | 9 | public static SclReportItem error(String xpath, String message) { 10 | return new SclReportItem(xpath, message, true); 11 | } 12 | 13 | public static SclReportItem warning(String xpath, String message) { 14 | return new SclReportItem(xpath, message, false); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/SubNetworkTypeDTO.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import java.util.List; 8 | 9 | public record SubNetworkTypeDTO(String subnetworkName, String subnetworkType, List accessPointNames) { 10 | } 11 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/package-info.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | /** 6 | *

sct.commons.dto is a group of DTO utils for operating on 7 | * {@link org.lfenergy.compas.scl2007b4.model.SCL SCL} services 8 | *

9 | */ 10 | package org.lfenergy.compas.sct.commons.dto; -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/exception/ScdException.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.exception; 6 | 7 | /** 8 | * Thrown when SCD is inconsistent 9 | */ 10 | public class ScdException extends RuntimeException { 11 | /** 12 | * Constructor 13 | * @param message input (message to display) 14 | */ 15 | public ScdException(String message) { 16 | super(message); 17 | } 18 | 19 | /** 20 | * Constructor 21 | * @param message input (message to display) 22 | * @param cause input (cause message to display) 23 | */ 24 | public ScdException(String message, Throwable cause) { 25 | super(message, cause); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ControlService.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.scl; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.*; 8 | 9 | import java.util.stream.Stream; 10 | 11 | public class ControlService { 12 | 13 | public Stream getControls(TAnyLN tAnyLN, Class tControlClass){ 14 | if (tControlClass == TGSEControl.class && tAnyLN instanceof TLN0 tln0 && tln0.isSetGSEControl()){ 15 | return tln0.getGSEControl().stream().map(tControlClass::cast); 16 | } else if (tControlClass == TSampledValueControl.class && tAnyLN instanceof TLN0 tln0 && tln0.isSetSampledValueControl()){ 17 | return tln0.getSampledValueControl().stream().map(tControlClass::cast); 18 | } else if (tControlClass == TReportControl.class && tAnyLN.isSetReportControl()){ 19 | return tAnyLN.getReportControl().stream().map(tControlClass::cast); 20 | } else if (tControlClass == TLogControl.class){ 21 | return tAnyLN.getLogControl().stream().map(tControlClass::cast); 22 | } 23 | return Stream.empty(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/com/package-info.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | /** 6 | *

scl.com is a group of services for operating on 7 | * {@link org.lfenergy.compas.scl2007b4.model.TCommunication Communication} object 8 | *

9 | * @see org.lfenergy.compas.scl2007b4.model.TCommunication 10 | * @see org.lfenergy.compas.scl2007b4.model.TSubNetwork 11 | * @see org.lfenergy.compas.scl2007b4.model.TConnectedAP 12 | * @see Issue !76 13 | */ 14 | package org.lfenergy.compas.sct.commons.scl.com; -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/AbstractDataTypeAdapter.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.scl.dtt; 6 | 7 | import org.lfenergy.compas.sct.commons.scl.SclElementAdapter; 8 | 9 | /** 10 | * A representation of the model object 11 | * {@link org.lfenergy.compas.sct.commons.scl.dtt.AbstractDataTypeAdapter DataTemplate}. 12 | *

13 | * The following features are supported: 14 | *

15 | *
    16 | *
  1. Adapter
  2. 17 | *
      18 | *
    • {@link AbstractDataTypeAdapter#getDataTypeTemplateAdapter get DataTypeTemplateAdapter}
    • 19 | *
    20 | *
  3. Principal functions
  4. 21 | *
      22 | *
    • {@link AbstractDataTypeAdapter#addPrivate Add TPrivate under this object}
    • 23 | *
    24 | *
  5. Checklist functions
  6. 25 | *
      26 | *
    • {@link AbstractDataTypeAdapter#hasSameContentAs Compare Two SCL element}
    • 27 | *
    28 | *
29 | * @see org.lfenergy.compas.sct.commons.scl.SclElementAdapter 30 | * @see org.lfenergy.compas.sct.commons.scl.dtt.DataTypeTemplateAdapter 31 | * @see org.lfenergy.compas.sct.commons.scl.dtt.IDataTemplate 32 | * @see org.lfenergy.compas.sct.commons.scl.dtt.IDTTComparable 33 | */ 34 | public abstract class AbstractDataTypeAdapter 35 | extends SclElementAdapter implements IDataTemplate, IDTTComparable{ 36 | 37 | /** 38 | * Constructor 39 | * @param parentAdapter Parent container reference 40 | * @param currentElem Current reference 41 | */ 42 | protected AbstractDataTypeAdapter(DataTypeTemplateAdapter parentAdapter, T currentElem) { 43 | super(parentAdapter, currentElem); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/IDTTComparable.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.scl.dtt; 6 | 7 | /** 8 | * A representation of the model object 9 | * {@link org.lfenergy.compas.sct.commons.scl.dtt.IDTTComparable DTTComparable}. 10 | *

11 | * The following features are supported: 12 | *

13 | *
    14 | *
  • {@link IDTTComparable#hasSameContentAs Compare Two SCL element}
  • 15 | *
16 | * 17 | */ 18 | public interface IDTTComparable { 19 | 20 | /** 21 | * Compares if two elements has the content 22 | * @param sclElement element to compare with 23 | * @return Boolean value of comparison result 24 | */ 25 | boolean hasSameContentAs(T sclElement); 26 | } 27 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/IDataTemplate.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.scl.dtt; 6 | 7 | /** 8 | * A representation of the model object 9 | * {@link org.lfenergy.compas.sct.commons.scl.dtt.IDataTemplate DataTemplate}. 10 | *

11 | * The following features are supported: 12 | *

13 | *
    14 | *
  • {@link IDataTemplate#getDataTypeTemplateAdapter get DataTypeTemplateAdapter}
  • 15 | *
16 | * 17 | */ 18 | public interface IDataTemplate { 19 | 20 | /** 21 | * Gets linked DataTypeTemplateAdapter as parent 22 | * @return DataTypeTemplateAdapter object 23 | */ 24 | DataTypeTemplateAdapter getDataTypeTemplateAdapter(); 25 | } 26 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/package-info.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | /** 6 | *

scl.dtt is a group of services for operating on 7 | * {@link org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates DataTypeTemplates} object 8 | *

9 | * @see org.lfenergy.compas.scl2007b4.model.TLNodeType 10 | * @see org.lfenergy.compas.scl2007b4.model.TDOType 11 | * @see org.lfenergy.compas.scl2007b4.model.TDAType 12 | * @see org.lfenergy.compas.scl2007b4.model.TEnumType 13 | * @see Issue !3 14 | * @see Issue !5 15 | */ 16 | package org.lfenergy.compas.sct.commons.scl.dtt; -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/header/package-info.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | /** 6 | *

scl.header is a group of services for operating on 7 | * {@link org.lfenergy.compas.scl2007b4.model.THeader Header} object 8 | *

9 | * @see org.lfenergy.compas.scl2007b4.model.THeader 10 | * @see org.lfenergy.compas.scl2007b4.model.THitem 11 | * @see Issue !6 12 | * @see Issue !71 13 | */ 14 | package org.lfenergy.compas.sct.commons.scl.header; -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/IDataAdapter.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.scl.ied; 6 | 7 | 8 | public interface IDataAdapter { 9 | } 10 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/package-info.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | /** 6 | *

scl.ied is a group of services for operating on 7 | * {@link org.lfenergy.compas.scl2007b4.model.TIED IED} object 8 | *

9 | * @see org.lfenergy.compas.scl2007b4.model.TAccessPoint 10 | * @see org.lfenergy.compas.scl2007b4.model.TServices 11 | * @see org.lfenergy.compas.scl2007b4.model.TLDevice 12 | * @see org.lfenergy.compas.scl2007b4.model.TLNode 13 | * @see Issue !3 14 | * @see Issue !5 15 | */ 16 | package org.lfenergy.compas.sct.commons.scl.ied; -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ln/LNAdapterBuilder.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.scl.ln; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TLLN0Enum; 8 | import org.lfenergy.compas.sct.commons.exception.ScdException; 9 | import org.lfenergy.compas.sct.commons.scl.ldevice.LDeviceAdapter; 10 | 11 | /** 12 | * A representation of the model object 13 | * {@link LNAdapterBuilder LNAdapterBuilder}. 14 | *

15 | * The following features are supported: 16 | *

17 | *
    18 | *
  • {@link LNAdapterBuilder#build() Returns Adapter of Given TAnyLN attributes }
  • 19 | *
20 | * @see org.lfenergy.compas.scl2007b4.model.TAnyLN 21 | */ 22 | public class LNAdapterBuilder { 23 | private String lnInst = ""; 24 | private String prefix = ""; 25 | private String lnClass = TLLN0Enum.LLN_0.value(); 26 | private LDeviceAdapter lDeviceAdapter; 27 | 28 | public LNAdapterBuilder withLnClass(String lnClass){ 29 | this.lnClass = lnClass; 30 | return this; 31 | } 32 | 33 | public LNAdapterBuilder withLnInst(String lnInst){ 34 | this.lnInst = lnInst; 35 | return this; 36 | } 37 | 38 | public LNAdapterBuilder withLnPrefix(String prefix){ 39 | this.prefix = prefix; 40 | return this; 41 | } 42 | 43 | public LNAdapterBuilder withLDeviceAdapter(LDeviceAdapter lDeviceAdapter){ 44 | this.lDeviceAdapter = lDeviceAdapter; 45 | return this; 46 | } 47 | 48 | public AbstractLNAdapter build() throws ScdException { 49 | if(lDeviceAdapter == null){ 50 | throw new IllegalArgumentException("Cannot build LNode adapter without LDevice"); 51 | } 52 | if(TLLN0Enum.LLN_0.value().equals(lnClass)){ 53 | return lDeviceAdapter.getLN0Adapter(); 54 | } 55 | 56 | if(lnClass == null || lnInst == null){ // none LLN0 must an lnInst! 57 | throw new IllegalArgumentException("Missing lnClass and/or lnInst"); 58 | } 59 | return lDeviceAdapter.getLNAdapter(lnClass, lnInst, prefix); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/package-info.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | /** 6 | *

commons.scl is a group of services for operating on 7 | * {@link org.lfenergy.compas.scl2007b4.model.THeader Header} , 8 | * {@link org.lfenergy.compas.scl2007b4.model.TSubstation Substation} , 9 | * {@link org.lfenergy.compas.scl2007b4.model.TCommunication Communication} , 10 | * {@link org.lfenergy.compas.scl2007b4.model.TIED IED} , 11 | * {@link org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates DataTypeTemplates} objects 12 | *

13 | * @see org.lfenergy.compas.scl2007b4.model.SCL 14 | */ 15 | package org.lfenergy.compas.sct.commons.scl; -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/FunctionAdapter.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | package org.lfenergy.compas.sct.commons.scl.sstation; 5 | 6 | import org.lfenergy.compas.scl2007b4.model.TFunction; 7 | import org.lfenergy.compas.sct.commons.scl.SclElementAdapter; 8 | import org.lfenergy.compas.sct.commons.util.Utils; 9 | 10 | /** 11 | * A representation of the model object 12 | * {@link FunctionAdapter FunctionAdapter}. 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  1. Principal functions
  2. 18 | *
      19 | *
    • {@link FunctionAdapter#addPrivate Add TPrivate under this object}
    • 20 | *
    • {@link FunctionAdapter#elementXPath Returns the XPATH for this object}
    • 21 | *
    22 | *
23 | *

24 | * XPATH Example : 25 | *

26 |  *           Function[@name="functionName"]
27 |  *       
28 | *

29 | * @see org.lfenergy.compas.scl2007b4.model.TLNode 30 | * @see org.lfenergy.compas.scl2007b4.model.TCompasICDHeader 31 | * @see Issue !124 (update LNode iedName) 32 | */ 33 | public class FunctionAdapter extends SclElementAdapter { 34 | 35 | /** 36 | * Constructor 37 | * @param parentAdapter Parent container reference 38 | * @param currentElem Current reference 39 | */ 40 | public FunctionAdapter(BayAdapter parentAdapter, TFunction currentElem) { 41 | super(parentAdapter, currentElem); 42 | } 43 | 44 | /** 45 | * Check if node is child of the reference node 46 | * @return link parent child existence 47 | */ 48 | @Override 49 | protected boolean amChildElementRef() { 50 | return parentAdapter.getCurrentElem().getFunction().contains(currentElem); 51 | } 52 | 53 | /** 54 | * Returns XPath path to current Function 55 | * @return path to current Function 56 | */ 57 | @Override 58 | protected String elementXPath() { 59 | return String.format("Function[%s]", Utils.xpathAttributeFilter("name", currentElem.isSetName() ? currentElem.getName() : null)); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/sstation/package-info.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | /** 5 | *

scl.sstation is a group of services for operating on 6 | * {@link org.lfenergy.compas.scl2007b4.model.TSubstation Substation} object 7 | *

8 | * @see org.lfenergy.compas.scl2007b4.model.TVoltageLevel 9 | * @see org.lfenergy.compas.scl2007b4.model.TFunction 10 | * @see org.lfenergy.compas.scl2007b4.model.TBay 11 | * @see org.lfenergy.compas.scl2007b4.model.TLNode 12 | * @see org.lfenergy.compas.scl2007b4.model.TCompasICDHeader 13 | */ 14 | package org.lfenergy.compas.sct.commons.scl.sstation; -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/ActiveStatus.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.util; 6 | 7 | import lombok.Getter; 8 | 9 | import java.util.Arrays; 10 | 11 | /** 12 | * Object describing Status, prefere this to LdeviceStatus constants as we can get the list of constants here. 13 | */ 14 | public enum ActiveStatus { 15 | ON("on"), 16 | OFF("off"); 17 | 18 | @Getter 19 | private final String value; 20 | 21 | ActiveStatus(String value) { 22 | this.value = value; 23 | } 24 | 25 | public static ActiveStatus fromValue(String activeStatus) { 26 | return Arrays.stream(ActiveStatus.values()) 27 | .filter(status -> status.getValue().equals(activeStatus)) 28 | .findFirst() 29 | .orElseThrow(() -> new IllegalArgumentException("The status " + activeStatus + " does not exist. It should be among " + Arrays.stream(ActiveStatus.values()).map(ActiveStatus::getValue).toList())); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/CommonConstants.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.util; 6 | 7 | 8 | /** 9 | * A representation of constants used in application 10 | */ 11 | public final class CommonConstants { 12 | 13 | public static final String ICD_SYSTEM_VERSION_UUID = "ICDSystemVersionUUID"; 14 | public static final String IED_NAME = "IEDName"; 15 | public static final String HEADER_ID = "headerId"; 16 | public static final String HEADER_VERSION = "headerVersion"; 17 | public static final String HEADER_REVISION = "headerRevision"; 18 | public static final String BEHAVIOUR_DO_NAME = "Beh"; 19 | public static final String MOD_DO_NAME = "Mod"; 20 | public static final String STVAL_DA_NAME = "stVal"; 21 | public static final String ATTRIBUTE_VALUE_SEPARATOR = "_"; 22 | public static final String CONTROLBLOCK_NAME_PREFIX = "CB" + ATTRIBUTE_VALUE_SEPARATOR; 23 | public static final String DATASET_NAME_PREFIX = "DS" + ATTRIBUTE_VALUE_SEPARATOR; 24 | 25 | public static final String LN_RADR = "RADR"; 26 | public static final String LN_RBDR = "RBDR"; 27 | public static final String LN_PREFIX_A = "a"; 28 | public static final String LN_PREFIX_B = "b"; 29 | public static final String LDEVICE_LDEPF = "LDEPF"; 30 | public static final String LDEVICE_LDSUIED = "LDSUIED"; 31 | public static final String CHNUM1_DO_NAME = "ChNum1"; 32 | public static final String LEVMOD_DO_NAME = "LevMod"; 33 | public static final String SRCREF_DO_NAME = "SrcRef"; 34 | public static final String DU_DA_NAME = "dU"; 35 | public static final String SETVAL_DA_NAME = "setVal"; 36 | public static final String SETSRCREF_DA_NAME = "setSrcRef"; 37 | public static final String SETSRCCB_DA_NAME = "setSrcCB"; 38 | public static final String SETTSTREF_DA_NAME = "setTstRef"; 39 | public static final String SETTSTCB_DA_NAME = "setTstCB"; 40 | public static final String PURPOSE_DA_NAME = "purpose"; 41 | public static final String Q_DA_NAME = "q"; 42 | public static final String IED_TEST_NAME = "IEDTEST"; 43 | public static final String INREF_PREFIX = "InRef"; 44 | 45 | /** 46 | * Private Controlller, should not be instanced 47 | */ 48 | private CommonConstants() { 49 | throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/ControlBlockEnum.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.util; 6 | 7 | import lombok.Getter; 8 | import lombok.RequiredArgsConstructor; 9 | import org.lfenergy.compas.scl2007b4.model.*; 10 | import org.lfenergy.compas.sct.commons.model.cbcom.TCBType; 11 | 12 | import java.util.Arrays; 13 | import java.util.Objects; 14 | 15 | @Getter 16 | @RequiredArgsConstructor 17 | public enum ControlBlockEnum { 18 | GSE(TGSEControl.class, "GSEControl"), 19 | SAMPLED_VALUE(TSampledValueControl.class, "SampledValueControl"), 20 | REPORT(TReportControl.class, "ReportControl"), 21 | LOG(TLogControl.class, "LogControl"); 22 | 23 | private final Class controlBlockClass; 24 | private final String elementName; 25 | 26 | public static ControlBlockEnum from(TServiceType tServiceType) { 27 | Objects.requireNonNull(tServiceType); 28 | return switch (tServiceType) { 29 | case GOOSE -> GSE; 30 | case SMV -> SAMPLED_VALUE; 31 | case REPORT -> REPORT; 32 | default -> throw new IllegalArgumentException("Unsupported TServiceType " + tServiceType); 33 | }; 34 | } 35 | 36 | public static ControlBlockEnum from(Class tControlClass) { 37 | return Arrays.stream(values()) 38 | .filter(controlBlockEnum -> controlBlockEnum.controlBlockClass.isAssignableFrom(tControlClass)) 39 | .findFirst() 40 | .orElseThrow(() -> new IllegalArgumentException("Unsupported TControl class : " + tControlClass.getSimpleName())); 41 | } 42 | 43 | public static ControlBlockEnum from(TCBType tcbType) { 44 | return switch (tcbType){ 45 | case GOOSE -> GSE; 46 | case SV -> SAMPLED_VALUE; 47 | default -> throw new IllegalArgumentException("Unsupported TCBType: " + tcbType); 48 | }; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/MonitoringLnClassEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * // SPDX-FileCopyrightText: 2023 RTE FRANCE 3 | * // 4 | * // SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package org.lfenergy.compas.sct.commons.util; 8 | 9 | public enum MonitoringLnClassEnum { 10 | LSVS("LSVS"), 11 | LGOS("LGOS"); 12 | 13 | private final String value; 14 | 15 | MonitoringLnClassEnum(String v) { 16 | value = v; 17 | } 18 | 19 | public String value() { 20 | return value; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/PrivateEnum.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.util; 6 | 7 | import lombok.Getter; 8 | import org.lfenergy.compas.scl2007b4.model.*; 9 | 10 | import java.util.Arrays; 11 | import java.util.Map; 12 | import java.util.NoSuchElementException; 13 | import java.util.function.Function; 14 | import java.util.stream.Collectors; 15 | 16 | /** 17 | * A representation of the literals of the enumeration 'Private Enum', 18 | * and utility methods for working with them. 19 | */ 20 | public enum PrivateEnum { 21 | 22 | COMPAS_BAY("COMPAS-Bay", TCompasBay.class), 23 | COMPAS_CRITERIA("COMPAS-Criteria", TCompasCriteria.class), 24 | COMPAS_FUNCTION("COMPAS-Function", TCompasFunction.class), 25 | COMPAS_ICDHEADER("COMPAS-ICDHeader", TCompasICDHeader.class), 26 | COMPAS_LDEVICE("COMPAS-LDevice", TCompasLDevice.class), 27 | COMPAS_SCL_FILE_TYPE("COMPAS-SclFileType", TCompasSclFileType.class), 28 | COMPAS_SYSTEM_VERSION("COMPAS-SystemVersion", TCompasSystemVersion.class), 29 | COMPAS_TOPO("COMPAS-Topo", TCompasTopo.class), 30 | COMPAS_IED_TYPE("COMPAS-IEDType", TCompasIEDType.class); 31 | 32 | private static final Map, PrivateEnum> classToEnum = Arrays.stream(PrivateEnum.values()).collect(Collectors.toMap( 33 | compasPrivateEnum -> compasPrivateEnum.compasClass, 34 | Function.identity())); 35 | 36 | @Getter 37 | private final String privateType; 38 | @Getter 39 | private final Class compasClass; 40 | 41 | PrivateEnum(String privateType, Class compasClass) { 42 | this.privateType = privateType; 43 | this.compasClass = compasClass; 44 | } 45 | 46 | public static PrivateEnum fromClass(Class compasClass) { 47 | PrivateEnum result = classToEnum.get(compasClass); 48 | if (result == null) { 49 | throw new NoSuchElementException(String.format("Class %s is not mapped to a compas type. See %s", compasClass.getName(), 50 | PrivateEnum.class.getName())); 51 | } 52 | return result; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return privateType; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/ServicesConfigEnum.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.util; 6 | 7 | import lombok.Getter; 8 | import org.lfenergy.compas.scl2007b4.model.TServiceType; 9 | 10 | @Getter 11 | public enum ServicesConfigEnum { 12 | GSE("GOOSE Control Block"), 13 | SMV("SMV Control Block"), 14 | REPORT("Report Control Block"), 15 | DATASET("DataSet"), 16 | FCDA("FCDA"); 17 | 18 | private final String displayName; 19 | 20 | ServicesConfigEnum(String displayName) { 21 | this.displayName = displayName; 22 | } 23 | 24 | public static ServicesConfigEnum from(TServiceType tServiceType){ 25 | return switch (tServiceType){ 26 | case GOOSE -> GSE; 27 | case SMV -> SMV; 28 | case REPORT -> REPORT; 29 | default -> throw new IllegalArgumentException("Unsupported TServiceType " + tServiceType); 30 | }; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /sct-commons/src/main/resources/binding_configuration.xjb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /sct-commons/src/main/resources/error_messages.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | #SCL root errors 6 | Invalid_Scd_No_Header="Invalid SCD file: no Header tag found" -------------------------------------------------------------------------------- /sct-commons/src/main/resources/xsd/CB_COMM_V1.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/scl2007b4/model/NamespaceConfigurationTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.scl2007b4.model; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.sct.commons.util.PrivateUtils; 9 | import org.lfenergy.compas.sct.commons.testhelpers.MarshallerWrapper; 10 | 11 | import static org.assertj.core.api.Assertions.assertThat; 12 | 13 | class NamespaceConfigurationTest { 14 | 15 | @Test 16 | void marshalling_SCL_and_Compas_Privates_should_set_correct_prefix() { 17 | // Given 18 | SCL scl = createValidScl(); 19 | TPrivate aCompasPrivate = PrivateUtils.createPrivate(TCompasSclFileType.SCD); 20 | scl.getPrivate().add(aCompasPrivate); 21 | // When 22 | String result = MarshallerWrapper.marshall(scl); 23 | // Then 24 | assertThat(result) 25 | .containsPattern("(?s)]* xmlns=\"http://www\\.iec\\.ch/61850/2003/SCL\"") 26 | .containsPattern("(?s)]* xmlns:compas=\"https://www\\.lfenergy\\.org/compas/extension/v1\""); 27 | } 28 | 29 | private static SCL createValidScl() { 30 | SCL scl = new SCL(); 31 | scl.setVersion("2007"); 32 | scl.setRevision("B"); 33 | scl.setRelease((short) 4); 34 | THeader tHeader = new THeader(); 35 | tHeader.setId("headerId"); 36 | scl.setHeader(tHeader); 37 | return scl; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/DaServiceTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.TDA; 9 | import org.lfenergy.compas.scl2007b4.model.TDOType; 10 | import org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates; 11 | import org.lfenergy.compas.sct.commons.testhelpers.SclTestMarshaller; 12 | 13 | import java.util.List; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | class DaServiceTest { 18 | 19 | private final DaService daService = new DaService(); 20 | 21 | @Test 22 | void getDAs() { 23 | //Given 24 | TDataTypeTemplates dataTypeTemplates = SclTestMarshaller.getSCLFromFile("/std/std_sample.std").getDataTypeTemplates(); 25 | TDOType tdoType = dataTypeTemplates.getDOType().getFirst(); 26 | 27 | //When 28 | List dAs = daService.getDAs(tdoType).toList(); 29 | 30 | //Then 31 | assertThat(dAs).hasSize(8) 32 | .extracting(TDA::getName) 33 | .containsExactly("vendor", "hwRev", "swRev", "serNum", "model", "location", "name", "d"); 34 | } 35 | 36 | @Test 37 | void getFilteredDAs() { 38 | //Given 39 | TDataTypeTemplates dataTypeTemplates = SclTestMarshaller.getSCLFromFile("/std/std_sample.std").getDataTypeTemplates(); 40 | TDOType tdoType = dataTypeTemplates.getDOType().getFirst(); 41 | 42 | //When 43 | List dAs = daService.getFilteredDAs(tdoType, tda -> tda.getName().equals("vendor")).toList(); 44 | 45 | //Then 46 | assertThat(dAs) 47 | .hasSize(1) 48 | .extracting(TDA::getName) 49 | .containsExactly("vendor"); 50 | } 51 | 52 | @Test 53 | void findDA() { 54 | //Given 55 | TDataTypeTemplates dataTypeTemplates = SclTestMarshaller.getSCLFromFile("/std/std_sample.std").getDataTypeTemplates(); 56 | TDOType tdoType = dataTypeTemplates.getDOType().getFirst(); 57 | 58 | //When 59 | TDA da = daService.findDA(tdoType, tda -> tda.getName().equals("vendor")).orElseThrow(); 60 | 61 | //Then 62 | assertThat(da) 63 | .extracting(TDA::getName) 64 | .isEqualTo("vendor"); 65 | } 66 | 67 | @Test 68 | void findDA_should_find_by_name() { 69 | //Given 70 | TDataTypeTemplates dataTypeTemplates = SclTestMarshaller.getSCLFromFile("/std/std_sample.std").getDataTypeTemplates(); 71 | TDOType tdoType = dataTypeTemplates.getDOType().getFirst(); 72 | 73 | //When 74 | TDA da = daService.findDA(tdoType, "vendor").orElseThrow(); 75 | 76 | //Then 77 | assertThat(da) 78 | .extracting(TDA::getName) 79 | .isEqualTo("vendor"); 80 | } 81 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/DaiServiceTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.SCL; 9 | import org.lfenergy.compas.scl2007b4.model.TDAI; 10 | import org.lfenergy.compas.scl2007b4.model.TDOI; 11 | import org.lfenergy.compas.sct.commons.testhelpers.SclTestMarshaller; 12 | 13 | import java.util.List; 14 | import java.util.Optional; 15 | 16 | import static org.assertj.core.api.Assertions.assertThat; 17 | 18 | class DaiServiceTest { 19 | 20 | private final DaiService daiService = new DaiService(); 21 | 22 | @Test 23 | void getDais() { 24 | //Given 25 | SCL std = SclTestMarshaller.getSCLFromFile("/std/std_sample.std"); 26 | TDOI tdoi = std.getIED().get(0).getAccessPoint().get(0).getServer().getLDevice().get(0).getLN0().getDOI().get(3); 27 | 28 | //When 29 | List tdais = daiService.getDais(tdoi).toList(); 30 | 31 | //Then 32 | assertThat(tdais) 33 | .hasSize(5) 34 | .extracting(TDAI::getName) 35 | .containsExactly("paramRev", "valRev", "d", "configRev", "swRev"); 36 | } 37 | 38 | @Test 39 | void getFilteredDais() { 40 | //Given 41 | SCL std = SclTestMarshaller.getSCLFromFile("/std/std_sample.std"); 42 | TDOI tdoi = std.getIED().get(0).getAccessPoint().get(0).getServer().getLDevice().get(0).getLN0().getDOI().get(3); 43 | 44 | //When 45 | List tdais = daiService.getFilteredDais(tdoi, tdai -> tdai.getName().equals("configRev")).toList(); 46 | 47 | //Then 48 | assertThat(tdais) 49 | .hasSize(1) 50 | .extracting(TDAI::getName) 51 | .containsExactly("configRev"); 52 | } 53 | 54 | @Test 55 | void findDai() { 56 | //Given 57 | SCL std = SclTestMarshaller.getSCLFromFile("/std/std_sample.std"); 58 | TDOI tdoi = std.getIED().get(0).getAccessPoint().get(0).getServer().getLDevice().get(0).getLN0().getDOI().get(3); 59 | 60 | //When 61 | Optional dai = daiService.findDai(tdoi, tdai -> tdai.getName().equals("configRev")); 62 | 63 | //Then 64 | assertThat(dai.orElseThrow()) 65 | .extracting(TDAI::getName, tdai -> tdai.getVal().size()) 66 | .containsExactly("configRev", 1); 67 | } 68 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/DataSetServiceTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.TDataSet; 9 | import org.lfenergy.compas.scl2007b4.model.TLN; 10 | 11 | import java.util.Set; 12 | import java.util.stream.Collectors; 13 | 14 | import static org.assertj.core.api.Assertions.assertThat; 15 | 16 | class DataSetServiceTest { 17 | 18 | @Test 19 | void getDataSets_whenCalledWithLNContainsMatchingFCDA_shouldReturnDataSet() { 20 | //Given 21 | TDataSet dataSet = new TDataSet(); 22 | dataSet.setName("datasetName"); 23 | TLN tln = new TLN(); 24 | tln.getDataSet().add(dataSet); 25 | DataSetService dataSetService = new DataSetService(); 26 | 27 | //When 28 | Set dataSetInfos = dataSetService.getDataSets(tln).collect(Collectors.toSet()); 29 | 30 | //Then 31 | assertThat(dataSetInfos) 32 | .hasSize(1) 33 | .extracting(TDataSet::getName) 34 | .containsExactly("datasetName"); 35 | } 36 | 37 | @Test 38 | void getDataSets_whenCalledWithNoDataSetInLN_shouldReturnEmptyList(){ 39 | //Given 40 | TLN tln = new TLN(); 41 | DataSetService dataSetService = new DataSetService(); 42 | 43 | //When 44 | Set dataSetInfos = dataSetService.getDataSets(tln).collect(Collectors.toSet()); 45 | 46 | //Then 47 | assertThat(dataSetInfos).isEmpty(); 48 | } 49 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/SubNetworkServiceTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.SCL; 9 | import org.lfenergy.compas.scl2007b4.model.TCommunication; 10 | import org.lfenergy.compas.scl2007b4.model.TSubNetwork; 11 | import org.lfenergy.compas.sct.commons.testhelpers.SclTestMarshaller; 12 | 13 | import java.util.List; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | import static org.assertj.core.api.Assertions.assertThatCode; 17 | 18 | class SubNetworkServiceTest { 19 | 20 | private final SubNetworkService subNetworkService = new SubNetworkService(); 21 | 22 | @Test 23 | void getSubNetworks_from_scd_should_succeed() { 24 | // Given 25 | SCL scd = SclTestMarshaller.getSCLFromFile("/scd-ied-dtt-com-import-stds/std.xml"); 26 | // When 27 | List tSubNetworks = subNetworkService.getSubNetworks(scd).toList(); 28 | // Then 29 | assertThat(tSubNetworks).hasSize(2); 30 | } 31 | 32 | @Test 33 | void getSubNetworks_from_communication_should_succeed() { 34 | // Given 35 | SCL scd = SclTestMarshaller.getSCLFromFile("/scd-ied-dtt-com-import-stds/std.xml"); 36 | TCommunication communication = scd.getCommunication(); 37 | 38 | // When 39 | List tSubNetworks = subNetworkService.getSubNetworks(communication).toList(); 40 | // Then 41 | assertThat(tSubNetworks).hasSize(2); 42 | } 43 | 44 | @Test 45 | void findSubNetwork_when_SubNetwork_Exist_should_succeed() { 46 | // Given 47 | SCL scd = SclTestMarshaller.getSCLFromFile("/scd-ied-dtt-com-import-stds/std.xml"); 48 | // When Then 49 | assertThatCode(() -> subNetworkService.findSubNetwork(scd, tSubNetwork -> "RSPACE_PROCESS_NETWORK".equals(tSubNetwork.getName())).orElseThrow()) 50 | .doesNotThrowAnyException(); 51 | } 52 | 53 | @Test 54 | void findSubNetwork_when_SubNetwork_not_Exist_should_return_empty() { 55 | // Given 56 | SCL scd = SclTestMarshaller.getSCLFromFile("/scd-ied-dtt-com-import-stds/std.xml"); 57 | // When Then 58 | assertThat(subNetworkService.findSubNetwork(scd, tSubNetwork -> "unknown".equals(tSubNetwork.getName()))) 59 | .isEmpty(); 60 | } 61 | 62 | @Test 63 | void getFilteredSubNetworks() { 64 | // Given 65 | SCL scd = SclTestMarshaller.getSCLFromFile("/scd-ied-dtt-com-import-stds/std.xml"); 66 | // When 67 | List tSubNetworks = subNetworkService.getFilteredSubNetworks(scd, tSubNetwork -> "RSPACE_PROCESS_NETWORK".equals(tSubNetwork.getName())).toList(); 68 | // Then 69 | assertThat(tSubNetworks).hasSize(1); 70 | } 71 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/VoltageLevelServiceTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.SCL; 9 | import org.lfenergy.compas.scl2007b4.model.TVoltageLevel; 10 | import org.lfenergy.compas.sct.commons.testhelpers.SclTestMarshaller; 11 | 12 | import java.util.List; 13 | 14 | import static org.assertj.core.api.Assertions.assertThat; 15 | import static org.assertj.core.api.Assertions.assertThatCode; 16 | 17 | class VoltageLevelServiceTest { 18 | 19 | private final VoltageLevelService voltageLevelService = new VoltageLevelService(); 20 | 21 | @Test 22 | void getVoltageLevels_should_succeed() { 23 | // Given 24 | SCL scd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd.xml"); 25 | // When 26 | List tVoltageLevels = voltageLevelService.getVoltageLevels(scd).toList(); 27 | // Then 28 | assertThat(tVoltageLevels).hasSize(2); 29 | } 30 | 31 | @Test 32 | void findVoltageLevel_when_voltageLevelExist_should_succeed() { 33 | // Given 34 | SCL scd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd.xml"); 35 | // When Then 36 | assertThatCode(() -> voltageLevelService.findVoltageLevel(scd, tVoltageLevel1 -> "4".equals(tVoltageLevel1.getName())).orElseThrow()) 37 | .doesNotThrowAnyException(); 38 | } 39 | 40 | @Test 41 | void findVoltageLevel_when_voltageLevelNotExist_should_return_empty() { 42 | // Given 43 | SCL scd = SclTestMarshaller.getSCLFromFile("/scd-substation-import-ssd/ssd.xml"); 44 | // When Then 45 | assertThat(voltageLevelService.findVoltageLevel(scd, tVoltageLevel1 -> "5".equals(tVoltageLevel1.getName()))) 46 | .isEmpty(); 47 | } 48 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/domain/DoLinkedToDaFilterTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.domain; 6 | 7 | import org.junit.jupiter.params.ParameterizedTest; 8 | import org.junit.jupiter.params.provider.Arguments; 9 | import org.junit.jupiter.params.provider.MethodSource; 10 | 11 | import java.util.List; 12 | import java.util.stream.Stream; 13 | 14 | import static org.assertj.core.api.Assertions.assertThat; 15 | 16 | class DoLinkedToDaFilterTest { 17 | 18 | public static Stream provideDoLinkedToDaFilter() { 19 | return Stream.of( 20 | Arguments.of(null, null, new DoLinkedToDaFilter(null, null, null, null)), 21 | Arguments.of("", "", new DoLinkedToDaFilter(null, null, null, null)), 22 | Arguments.of("Do", "", new DoLinkedToDaFilter("Do", null, null, null)), 23 | Arguments.of("", "da", new DoLinkedToDaFilter(null, null, "da", null)), 24 | Arguments.of("Do", "da", new DoLinkedToDaFilter("Do", null, "da", null)), 25 | Arguments.of("Do.sdo", "da", new DoLinkedToDaFilter("Do", List.of("sdo"), "da", null)), 26 | Arguments.of("Do", "da.bda", new DoLinkedToDaFilter("Do", null, "da", List.of("bda"))), 27 | Arguments.of("Do.sdo", "da.bda", new DoLinkedToDaFilter("Do", List.of("sdo"), "da", List.of("bda"))), 28 | Arguments.of("Do.sdo1.sdo2.sdo3.sdo4", "da.bda1.bda2.bda3.bda4", new DoLinkedToDaFilter("Do", List.of("sdo1", "sdo2", "sdo3", "sdo4"), "da", List.of("bda1", "bda2", "bda3", "bda4"))) 29 | ); 30 | } 31 | 32 | @ParameterizedTest 33 | @MethodSource("provideDoLinkedToDaFilter") 34 | void from_should_parse_DO_and_DA(String doNames, String daNames, DoLinkedToDaFilter expected) { 35 | // Given : parameters 36 | // When 37 | DoLinkedToDaFilter result = DoLinkedToDaFilter.from(doNames, daNames); 38 | // Then 39 | assertThat(result).isEqualTo(expected); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/ConnectedApDTOTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | 8 | import org.junit.jupiter.api.Test; 9 | import org.lfenergy.compas.sct.commons.scl.com.ConnectedAPAdapter; 10 | import org.mockito.Mockito; 11 | 12 | import static org.assertj.core.api.Assertions.assertThat; 13 | import static org.mockito.Mockito.when; 14 | 15 | class ConnectedApDTOTest { 16 | 17 | @Test 18 | void from_whenCalledWithConnectedAPAdapter_shouldFillValues() { 19 | // Given 20 | ConnectedAPAdapter connectedAPAdapter = Mockito.mock(ConnectedAPAdapter.class); 21 | when(connectedAPAdapter.getApName()).thenReturn(DTO.AP_NAME); 22 | when(connectedAPAdapter.getIedName()).thenReturn(DTO.HOLDER_IED_NAME); 23 | 24 | // When 25 | ConnectedApDTO connectedApDTO = ConnectedApDTO.from(connectedAPAdapter); 26 | 27 | //Then 28 | assertThat(connectedApDTO.iedName()).isEqualTo(DTO.HOLDER_IED_NAME); 29 | assertThat(connectedApDTO.apName()).isEqualTo(DTO.AP_NAME); 30 | } 31 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/DataSetInfoTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.TDataSet; 9 | 10 | import static org.assertj.core.api.Assertions.assertThat; 11 | 12 | class DataSetInfoTest { 13 | 14 | @Test 15 | void from_WhenCalledWithDataSet_ThenValuesAreFilled(){ 16 | //Given 17 | TDataSet tDataSet = new TDataSet(); 18 | tDataSet.setName("dataset"); 19 | tDataSet.getFCDA().add(DTO.createFCDA()); 20 | 21 | //When 22 | DataSetInfo dataSetInfo = new DataSetInfo(tDataSet); 23 | 24 | //Then 25 | assertThat(dataSetInfo.getName()).isEqualTo("dataset"); 26 | assertThat(dataSetInfo.getFcdaInfos()).hasSize(1); 27 | } 28 | 29 | @Test 30 | void isValid_whenNameSizeMore32_shouldReturnFalse() { 31 | //Given 32 | TDataSet tDataSet = new TDataSet(); 33 | tDataSet.setName("DATA_INFO_TEST_CHARACTERE_NAME_MORE_THAN_32_CHARACTERES"); 34 | tDataSet.getFCDA().add(DTO.createFCDA()); 35 | DataSetInfo dataSetInfo = new DataSetInfo(tDataSet); 36 | 37 | //When 38 | boolean isValid = dataSetInfo.isValid(); 39 | 40 | //Then 41 | assertThat(isValid).isFalse(); 42 | } 43 | @Test 44 | void isValid_whenFCDAInfoEmpty_shouldReturnFalse() { 45 | TDataSet tDataSet = new TDataSet(); 46 | tDataSet.setName("DATA_INFO"); 47 | DataSetInfo dataSetInfo = new DataSetInfo(tDataSet); 48 | 49 | //When 50 | boolean isValid = dataSetInfo.isValid(); 51 | 52 | //Then 53 | assertThat(dataSetInfo.getFcdaInfos()).isEmpty(); 54 | assertThat(isValid).isFalse(); 55 | } 56 | 57 | @Test 58 | void isValid_whenFCDAInfosValidshouldReturnTrue() { 59 | //Given 60 | TDataSet tDataSet = new TDataSet(); 61 | tDataSet.setName("dataset"); 62 | tDataSet.getFCDA().add(DTO.createFCDA()); 63 | DataSetInfo dataSetInfo = new DataSetInfo(tDataSet); 64 | //When 65 | boolean isValid = dataSetInfo.isValid(); 66 | //Then 67 | assertThat(isValid).isTrue(); 68 | } 69 | 70 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/ExtRefSourceInfoTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import org.junit.jupiter.api.Tag; 8 | import org.junit.jupiter.api.Test; 9 | 10 | import static org.assertj.core.api.Assertions.assertThat; 11 | 12 | 13 | class ExtRefSourceInfoTest { 14 | 15 | @Test 16 | @Tag("issue-321") 17 | void testConstruction(){ 18 | // Given 19 | ExtRefSourceInfo sourceInfo = DTO.createExtRefSourceInfo(); 20 | ExtRefSourceInfo bindingInfo_bis = DTO.createExtRefSourceInfo(); 21 | // When 22 | ExtRefSourceInfo bindingInfo_ter = new ExtRefSourceInfo(DTO.createExtRef()); 23 | // When 24 | ExtRefSourceInfo bindingInfo_qt = new ExtRefSourceInfo(); 25 | 26 | // Then 27 | assertThat(bindingInfo_ter).isEqualTo(sourceInfo).hasSameHashCodeAs(sourceInfo); 28 | assertThat(bindingInfo_bis).isEqualTo(sourceInfo); 29 | assertThat(sourceInfo).isNotNull(); 30 | assertThat(bindingInfo_qt).isNotEqualTo(sourceInfo); 31 | assertThat(new ExtRefSourceInfo()).isNotEqualTo(sourceInfo); 32 | } 33 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/FCDAInfoTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import org.junit.jupiter.api.Tag; 8 | import org.junit.jupiter.api.Test; 9 | import org.lfenergy.compas.scl2007b4.model.TFCEnum; 10 | 11 | import static org.assertj.core.api.Assertions.assertThat; 12 | 13 | class FCDAInfoTest { 14 | 15 | @Test 16 | @Tag("issue-321") 17 | void constructor_whenCalled_shouldFillValues(){ 18 | // Given 19 | String dataSetName = "dataSet"; 20 | String ldInst = "LDInst"; 21 | String prefix = "pre"; 22 | String lnClass = "LN_Class"; 23 | String lnInst = "LNInst"; 24 | DoTypeName doName = new DoTypeName("doName"); 25 | DaTypeName daName = new DaTypeName("daName.bda1.bda2.bda3"); 26 | long ix = 1L; 27 | 28 | // When 29 | FCDAInfo fcdaInfo = new FCDAInfo(dataSetName, TFCEnum.CF, ldInst, prefix, lnClass, lnInst, doName, daName, ix); 30 | // Then 31 | assertThat(fcdaInfo.getDaName().getName()).isEqualTo("daName"); 32 | assertThat(fcdaInfo.getDoName().getName()).isEqualTo("doName"); 33 | assertThat(fcdaInfo.getDaName()).hasToString("daName.bda1.bda2.bda3"); 34 | assertThat(fcdaInfo.getDaName().getStructNames()).hasSize(3); 35 | assertThat(fcdaInfo.getFc()).isEqualTo(TFCEnum.CF); 36 | assertThat(fcdaInfo.isValid()).isTrue(); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/FCDARecordTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.TFCDA; 9 | import org.lfenergy.compas.scl2007b4.model.TFCEnum; 10 | import org.lfenergy.compas.sct.commons.testhelpers.FCDARecord; 11 | 12 | import static org.assertj.core.api.Assertions.assertThat; 13 | 14 | class FCDARecordTest { 15 | 16 | @Test 17 | void from_TFCDA_should_create_instance_with_same_attributes() { 18 | //Given 19 | TFCDA tfcda = new TFCDA(); 20 | tfcda.setLdInst("ldInst"); 21 | tfcda.getLnClass().add("lnClass"); 22 | tfcda.setLnInst("lnInst"); 23 | tfcda.setPrefix("prefix"); 24 | tfcda.setDoName("DoName.sdo"); 25 | tfcda.setDaName("daName.bda"); 26 | tfcda.setFc(TFCEnum.ST); 27 | //When 28 | FCDARecord fcdaRecord = FCDARecord.toFCDARecord(tfcda); 29 | //Then 30 | assertThat(fcdaRecord).isEqualTo( 31 | new FCDARecord("ldInst", "lnClass", "lnInst", "prefix", "DoName.sdo", "daName.bda", TFCEnum.ST)); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/HeaderDTOTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.THitem; 9 | 10 | import java.util.UUID; 11 | 12 | import static org.assertj.core.api.Assertions.assertThat; 13 | 14 | class HeaderDTOTest { 15 | 16 | @Test 17 | void constructor_whenCalled_shouldFillValues(){ 18 | // Given 19 | UUID id = UUID.randomUUID(); 20 | // When 21 | HeaderDTO headerDTO = DTO.createHeaderDTO(id); 22 | // Then 23 | assertThat(headerDTO.getId()).isEqualTo(id); 24 | assertThat(headerDTO.getVersion()).isEqualTo("1.0"); 25 | assertThat(headerDTO.getRevision()).isEqualTo("1.0"); 26 | assertThat(headerDTO.getHistoryItems()).asList().isNotEmpty(); 27 | HeaderDTO.HistoryItem historyItem = headerDTO.getHistoryItems().get(0); 28 | assertThat(historyItem.getRevision()).isEqualTo("1.0"); 29 | assertThat(historyItem.getVersion()).isEqualTo("1.0"); 30 | assertThat(historyItem.getWhat()).isEqualTo("what"); 31 | assertThat(historyItem.getWhy()).isEqualTo("why"); 32 | assertThat(historyItem.getWho()).isEqualTo("who"); 33 | assertThat(historyItem.getWhen()).isEqualTo(DTO.NOW_STR); 34 | headerDTO = new HeaderDTO(id,"1.0","1.0"); 35 | assertThat(headerDTO.getVersion()).isEqualTo("1.0"); 36 | assertThat(headerDTO.getRevision()).isEqualTo("1.0"); 37 | } 38 | 39 | @Test 40 | void from_WhenCalledWithHitem_shouldFillValues(){ 41 | // Given 42 | THitem tHitem = new THitem(); 43 | tHitem.setRevision("1.0"); 44 | tHitem.setVersion("1.0"); 45 | tHitem.setWhat("what"); 46 | tHitem.setWho("who"); 47 | tHitem.setWhy("why"); 48 | tHitem.setWhen(DTO.NOW_STR); 49 | // When 50 | HeaderDTO.HistoryItem historyItem = HeaderDTO.HistoryItem.from(tHitem); 51 | // Then 52 | assertThat(historyItem.getRevision()).isEqualTo("1.0"); 53 | assertThat(historyItem.getVersion()).isEqualTo("1.0"); 54 | assertThat(historyItem.getWhat()).isEqualTo("what"); 55 | assertThat(historyItem.getWhy()).isEqualTo("why"); 56 | assertThat(historyItem.getWho()).isEqualTo("who"); 57 | } 58 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/IedDTOTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.SCL; 9 | import org.lfenergy.compas.sct.commons.scl.SclRootAdapter; 10 | import org.lfenergy.compas.sct.commons.scl.ied.IEDAdapter; 11 | import org.lfenergy.compas.sct.commons.testhelpers.SclTestMarshaller; 12 | 13 | import static org.assertj.core.api.Assertions.assertThat; 14 | import static org.junit.jupiter.api.Assertions.assertAll; 15 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 16 | 17 | class IedDTOTest { 18 | 19 | @Test 20 | void constructor_whenCalled_shouldFillValues(){ 21 | // When 22 | IedDTO iedDTO = DTO.createIedDTO(); 23 | // Then 24 | assertAll("IedDTO", 25 | () -> assertThat(iedDTO.getName()).isEqualTo(DTO.HOLDER_IED_NAME), 26 | () -> assertThat(iedDTO.getLDevices()).isNotEmpty() 27 | ); 28 | assertThat(new IedDTO(DTO.HOLDER_IED_NAME).getName()).isEqualTo(DTO.HOLDER_IED_NAME); 29 | } 30 | 31 | @Test 32 | void from_whenCalledWithIEDAdapter_shouldFillValues() { 33 | // When 34 | SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml"); 35 | SclRootAdapter sclRootAdapter = new SclRootAdapter(scd); 36 | IEDAdapter iAdapter = assertDoesNotThrow(() -> sclRootAdapter.getIEDAdapterByName("IED_NAME")); 37 | // When 38 | IedDTO iedDTO = IedDTO.from(iAdapter,null); 39 | // Then 40 | assertThat(iedDTO.getLDevices()).isNotEmpty(); 41 | } 42 | 43 | @Test 44 | void addLDevice_whenCalled_shouldUpdateLDevicesList(){ 45 | // Given 46 | IedDTO iedDTO = new IedDTO(); 47 | assertThat(iedDTO.getLDevices()).isEmpty(); 48 | // When 49 | iedDTO.addLDevice(DTO.HOLDER_LD_INST, "LDName"); 50 | // Then 51 | assertThat(iedDTO.getLDevices()).isNotEmpty(); 52 | assertThat(iedDTO.getLDeviceDTO(DTO.HOLDER_LD_INST)).isPresent(); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/LDeviceDTOTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | 8 | import org.junit.jupiter.api.Tag; 9 | import org.junit.jupiter.api.Test; 10 | import org.lfenergy.compas.scl2007b4.model.SCL; 11 | import org.lfenergy.compas.sct.commons.scl.SclRootAdapter; 12 | import org.lfenergy.compas.sct.commons.scl.ied.IEDAdapter; 13 | import org.lfenergy.compas.sct.commons.scl.ldevice.LDeviceAdapter; 14 | import org.lfenergy.compas.sct.commons.testhelpers.SclTestMarshaller; 15 | 16 | import static org.assertj.core.api.Assertions.assertThat; 17 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 18 | import static org.lfenergy.compas.sct.commons.dto.DTO.HOLDER_LD_INST; 19 | import static org.lfenergy.compas.sct.commons.dto.DTO.LD_NAME; 20 | 21 | class LDeviceDTOTest { 22 | 23 | @Test 24 | void constructor_should_fill_values() { 25 | // Given 26 | // When 27 | LDeviceDTO lDeviceDTO = new LDeviceDTO(HOLDER_LD_INST, LD_NAME); 28 | 29 | // Then 30 | assertThat(lDeviceDTO.getLdInst()).isEqualTo(HOLDER_LD_INST); 31 | assertThat(lDeviceDTO.getLdName()).isEqualTo(LD_NAME); 32 | assertThat(lDeviceDTO.getLNodes()).isEmpty(); 33 | } 34 | 35 | @Test 36 | void addLNode_whenCalled_shouldNotUpdateLNodeList(){ 37 | // Given 38 | LDeviceDTO lDeviceDTO = new LDeviceDTO(); 39 | assertThat(lDeviceDTO.getLNodes()).isEmpty(); 40 | // When 41 | lDeviceDTO.addLNode(DTO.HOLDER_LN_CLASS, DTO.HOLDER_LN_INST, DTO.HOLDER_LN_PREFIX, DTO.LN_TYPE); 42 | // Then 43 | assertThat(lDeviceDTO.getLNodes()).isNotEmpty(); 44 | } 45 | 46 | @Test 47 | @Tag("issue-321") 48 | void from_whenCalledWithLDeviceAdapter_shouldFillValues() { 49 | // Given 50 | SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml"); 51 | SclRootAdapter sclRootAdapter = new SclRootAdapter(scd); 52 | // When Then 53 | IEDAdapter iAdapter = assertDoesNotThrow(() -> sclRootAdapter.getIEDAdapterByName("IED_NAME")); 54 | // When Then 55 | LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.findLDeviceAdapterByLdInst("LD_INS1").get()); 56 | 57 | // When 58 | LDeviceDTO lDeviceDTO = LDeviceDTO.from(lDeviceAdapter,null); 59 | // Then 60 | assertThat(lDeviceDTO).isNotNull(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptionsTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.dto; 6 | 7 | import org.junit.jupiter.api.Tag; 8 | import org.junit.jupiter.api.Test; 9 | 10 | import static org.assertj.core.api.Assertions.assertThat; 11 | 12 | 13 | class LogicalNodeOptionsTest { 14 | 15 | @Test 16 | @Tag("issue-321") 17 | void constructor_whenCalled_shouldFillValues() { 18 | // When 19 | LogicalNodeOptions logicalNodeOptions = new LogicalNodeOptions(); 20 | // Then 21 | assertThat(logicalNodeOptions.isWithExtRef()).isFalse(); 22 | assertThat(logicalNodeOptions.isWithCB()).isFalse(); 23 | assertThat(logicalNodeOptions.isWithDatSet()).isFalse(); 24 | assertThat(logicalNodeOptions.isWithDataAttributeRef()).isFalse(); 25 | 26 | logicalNodeOptions.setWithCB(true); 27 | logicalNodeOptions.setWithDatSet(false); 28 | logicalNodeOptions.setWithExtRef(false); 29 | logicalNodeOptions.setWithDataAttributeRef(false); 30 | // Then 31 | assertThat(logicalNodeOptions.isWithExtRef()).isFalse(); 32 | assertThat(logicalNodeOptions.isWithCB()).isTrue(); 33 | assertThat(logicalNodeOptions.isWithDatSet()).isFalse(); 34 | assertThat(logicalNodeOptions.isWithDataAttributeRef()).isFalse(); 35 | 36 | // When 37 | logicalNodeOptions = new LogicalNodeOptions(true,false, true,false); 38 | // Then 39 | assertThat(logicalNodeOptions.isWithExtRef()).isTrue(); 40 | assertThat(logicalNodeOptions.isWithCB()).isTrue(); 41 | assertThat(logicalNodeOptions.isWithDatSet()).isFalse(); 42 | assertThat(logicalNodeOptions.isWithDataAttributeRef()).isFalse(); 43 | } 44 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/exception/ScdExceptionTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.exception; 6 | 7 | import org.junit.jupiter.api.Test; 8 | 9 | import static org.assertj.core.api.Assertions.assertThat; 10 | 11 | 12 | class ScdExceptionTest { 13 | private static final String MSG = "MSG"; 14 | private static final String ANOTHER_MSG = "ANOTHER_MSG"; 15 | private static final String CAUSE_MSG = "CAUSE_MSG"; 16 | 17 | @Test 18 | void constructor_whenCalledWithMessage_shouldFillValues() { 19 | // When 20 | ScdException exception = new ScdException(MSG); 21 | // Then 22 | assertThat(exception.getMessage()).isEqualTo(MSG); 23 | } 24 | 25 | @Test 26 | void constructor_whenCalledWithMessageAndThrowable_shouldFillValues() { 27 | // When 28 | ScdException exception = new ScdException(ANOTHER_MSG, new RuntimeException(CAUSE_MSG)); 29 | // Then 30 | assertThat(exception.getMessage()).isEqualTo(ANOTHER_MSG); 31 | assertThat(exception.getCause().getClass()).isEqualTo(RuntimeException.class); 32 | assertThat(exception.getCause().getMessage()).isEqualTo(CAUSE_MSG); 33 | } 34 | 35 | 36 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ObjectReferenceTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.scl; 6 | 7 | import org.junit.jupiter.api.Test; 8 | 9 | import static org.assertj.core.api.Assertions.assertThat; 10 | import static org.assertj.core.api.Assertions.assertThatThrownBy; 11 | 12 | class ObjectReferenceTest { 13 | 14 | @Test 15 | void constructor_whenCalled_shouldFillValues() { 16 | // Given 17 | String ref = "IED_NAME_LD_NAME/PR_LN_INST.doi.sdoi.sdai.bdai.bda"; 18 | // When 19 | ObjectReference objRef = new ObjectReference(ref); 20 | objRef.init(); 21 | // Then 22 | assertThat(objRef.getLdName()).isEqualTo("IED_NAME_LD_NAME"); 23 | assertThat(objRef.getLNodeName()).isEqualTo("PR_LN_INST"); 24 | assertThat(objRef.getDataAttributes()).isEqualTo("doi.sdoi.sdai.bdai.bda"); 25 | } 26 | 27 | @Test 28 | void constructor_whenCalledWithInvalidLdName_shouldReturnException() { 29 | // Given 30 | String ref0 = "IED_NAME_LD_NAMEPR_LN_INST.doi.sdoi.sdai.bdai.bda"; 31 | // When Then 32 | assertThatThrownBy(() ->new ObjectReference(ref0)) 33 | .isInstanceOf(IllegalArgumentException.class) 34 | .hasMessage("Malformed ObjRef : IED_NAME_LD_NAMEPR_LN_INST.doi.sdoi.sdai.bdai.bda"); 35 | 36 | } 37 | 38 | @Test 39 | void constructor_whenCalledWithInvalidLNodeName_shouldReturnException() { 40 | // Given 41 | String ref1 = "IED_NAME_LD_NAME/PR_LN_INST"; 42 | // When Then 43 | assertThatThrownBy(() ->new ObjectReference(ref1)) 44 | .isInstanceOf(IllegalArgumentException.class) 45 | .hasMessage("Malformed ObjRef : IED_NAME_LD_NAME/PR_LN_INST"); 46 | 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DOAdapterTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.scl.dtt; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.TDO; 9 | import org.lfenergy.compas.scl2007b4.model.TLNodeType; 10 | 11 | import java.util.List; 12 | 13 | import static org.assertj.core.api.Assertions.assertThat; 14 | import static org.mockito.Mockito.mock; 15 | import static org.mockito.Mockito.when; 16 | 17 | class DOAdapterTest { 18 | 19 | @Test 20 | void elementXPath_should_return_expected_xpath_value() { 21 | // Given 22 | LNodeTypeAdapter lNodeAdapter = mock(LNodeTypeAdapter.class); 23 | TLNodeType tlNodeType = mock(TLNodeType.class); 24 | when(lNodeAdapter.getParentAdapter()).thenReturn(null); 25 | when(lNodeAdapter.getCurrentElem()).thenReturn(tlNodeType); 26 | TDO tdo = new TDO(); 27 | tdo.setName("doName"); 28 | when(tlNodeType.getDO()).thenReturn(List.of(tdo)); 29 | DOAdapter doAdapter = new DOAdapter(lNodeAdapter, tdo); 30 | // When 31 | String result = doAdapter.elementXPath(); 32 | // Then 33 | assertThat(result).isEqualTo("DO[@name=\"doName\" and not(@type)]"); 34 | } 35 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DataTypeTemplateTestUtils.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.scl.dtt; 6 | 7 | import lombok.experimental.UtilityClass; 8 | import org.lfenergy.compas.scl2007b4.model.SCL; 9 | import org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates; 10 | import org.lfenergy.compas.sct.commons.scl.SclRootAdapter; 11 | import org.lfenergy.compas.sct.commons.testhelpers.SclTestMarshaller; 12 | 13 | @UtilityClass 14 | public class DataTypeTemplateTestUtils { 15 | public static final String SCD_DTT = "/dtt-test-schema-conf/scd_dtt_import_test.xml"; 16 | public static final String SCD_DTT_DIFF_CONTENT_SAME_ID = "/dtt-test-schema-conf/scd_dtt_import_sameid-diff-content-test.xml"; 17 | public static final String SCD_DTT_DO_SDO_DA_BDA = "/dtt-test-schema-conf/scd_dtt_do_sdo_da_bda.xml"; 18 | 19 | public static DataTypeTemplateAdapter initDttAdapterFromFile(String fileName) { 20 | SCL scd = SclTestMarshaller.getSCLFromFile(fileName); 21 | SclRootAdapter sclRootAdapter = new SclRootAdapter(scd); 22 | return new DataTypeTemplateAdapter( 23 | sclRootAdapter, 24 | scd.getDataTypeTemplates() 25 | ); 26 | } 27 | 28 | public static TDataTypeTemplates initDttFromFile(String fileName) { 29 | return SclTestMarshaller.getSCLFromFile(fileName).getDataTypeTemplates(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ln/LnIdTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | 6 | package org.lfenergy.compas.sct.commons.scl.ln; 7 | 8 | import org.junit.jupiter.api.Test; 9 | import org.lfenergy.compas.scl2007b4.model.*; 10 | 11 | import static org.assertj.core.api.Assertions.assertThat; 12 | 13 | class LnIdTest { 14 | 15 | @Test 16 | void from_LN_should_succeed() { 17 | //Given 18 | TLN ln = new TLN(); 19 | ln.setInst("1"); 20 | ln.getLnClass().add(TSystemLNGroupEnum.LGOS.value()); 21 | ln.setPrefix("Prefix"); 22 | // When 23 | LnId lnId = LnId.from(ln); 24 | // Then 25 | assertThat(lnId.lnClass()).isEqualTo("LGOS"); 26 | assertThat(lnId.lnInst()).isEqualTo("1"); 27 | assertThat(lnId.prefix()).isEqualTo("Prefix"); 28 | } 29 | 30 | @Test 31 | void from_LN0_should_succeed() { 32 | //Given 33 | LN0 ln0 = new LN0(); 34 | ln0.getLnClass().add(TLLN0Enum.LLN_0.value()); 35 | // When 36 | LnId lnId = LnId.from(ln0); 37 | // Then 38 | assertThat(lnId).isSameAs(LnId.LN0_ID); 39 | } 40 | 41 | @Test 42 | void from_TLNode_should_succeed() { 43 | //Given 44 | TLNode tlNode = new TLNode(); 45 | tlNode.setLnInst("1"); 46 | tlNode.getLnClass().add(TSystemLNGroupEnum.LGOS.value()); 47 | tlNode.setPrefix("Prefix"); 48 | // When 49 | LnId lnId = LnId.from(tlNode); 50 | // Then 51 | assertThat(lnId.lnClass()).isEqualTo("LGOS"); 52 | assertThat(lnId.lnInst()).isEqualTo("1"); 53 | assertThat(lnId.prefix()).isEqualTo("Prefix"); 54 | } 55 | 56 | @Test 57 | void from_TLNode_LN0_should_succeed() { 58 | //Given 59 | TLNode tlNode = new TLNode(); 60 | tlNode.setLnInst(""); 61 | tlNode.getLnClass().add("LLN0"); 62 | tlNode.setPrefix(""); 63 | // When 64 | LnId lnId = LnId.from(tlNode); 65 | // Then 66 | assertThat(lnId).isSameAs(LnId.LN0_ID); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/sstation/FunctionAdapterTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.scl.sstation; 6 | 7 | import org.junit.jupiter.api.BeforeEach; 8 | import org.junit.jupiter.api.Test; 9 | import org.lfenergy.compas.scl2007b4.model.TBay; 10 | import org.lfenergy.compas.scl2007b4.model.TFunction; 11 | 12 | import static org.assertj.core.api.Assertions.assertThat; 13 | import static org.mockito.Mockito.mock; 14 | import static org.mockito.Mockito.when; 15 | 16 | class FunctionAdapterTest { 17 | 18 | private final BayAdapter bayAdapter = mock(BayAdapter.class); 19 | private FunctionAdapter functionAdapter; 20 | 21 | @BeforeEach 22 | void setUp() { 23 | TBay tBay = new TBay(); 24 | TFunction tFunction = new TFunction(); 25 | tFunction.setName("functionName"); 26 | tBay.getFunction().add(tFunction); 27 | when(bayAdapter.getCurrentElem()).thenReturn(tBay); 28 | functionAdapter = new FunctionAdapter(bayAdapter, tFunction); 29 | } 30 | 31 | @Test 32 | void amChildElementRef_should_succeed() { 33 | // Given : setUp 34 | // When 35 | boolean result = functionAdapter.amChildElementRef(); 36 | // Then 37 | assertThat(result).isTrue(); 38 | } 39 | 40 | @Test 41 | void amChildElementRef_when_parent_does_not_contain_function_shouldReturnFalse() { 42 | // Given : setUp 43 | functionAdapter.getParentAdapter().getCurrentElem().getFunction().clear(); 44 | // When 45 | boolean result = functionAdapter.amChildElementRef(); 46 | // Then 47 | assertThat(result).isFalse(); 48 | } 49 | 50 | @Test 51 | void elementXPath_should_return_expected_xpath_value() { 52 | // Given : setUp 53 | // When 54 | String result = functionAdapter.elementXPath(); 55 | // Then 56 | assertThat(result).isEqualTo("Function[@name=\"functionName\"]"); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/testhelpers/DaComParamTestMarshaller.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.testhelpers; 6 | 7 | import jakarta.xml.bind.Marshaller; 8 | import jakarta.xml.bind.Unmarshaller; 9 | import org.lfenergy.compas.core.commons.MarshallerWrapper; 10 | import org.lfenergy.compas.sct.commons.model.da_comm.DACOMM; 11 | 12 | public class DaComParamTestMarshaller extends MarshallerWrapper { 13 | 14 | public DaComParamTestMarshaller(Unmarshaller jaxbUnmarshaller, Marshaller jaxbMarshaller) { 15 | super(jaxbUnmarshaller, jaxbMarshaller); 16 | } 17 | 18 | @Override 19 | protected Class getResultClass() { 20 | return DACOMM.class; 21 | } 22 | 23 | public static class Builder extends MarshallerWrapper.Builder { 24 | public Builder() { 25 | withProperties("da_comm-marshaller-config.yml"); 26 | } 27 | 28 | @Override 29 | protected DaComParamTestMarshaller createMarshallerWrapper(Unmarshaller jaxbUnmarshaller, 30 | Marshaller jaxbMarshaller) { 31 | return new DaComParamTestMarshaller(jaxbUnmarshaller, jaxbMarshaller); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/testhelpers/DaComTestMarshallerHelper.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.testhelpers; 6 | 7 | import org.apache.commons.io.IOUtils; 8 | import org.lfenergy.compas.sct.commons.model.da_comm.DACOMM; 9 | 10 | import java.io.IOException; 11 | import java.io.UncheckedIOException; 12 | 13 | public class DaComTestMarshallerHelper { 14 | 15 | public static DACOMM getDACOMMFromFile(String filename) { 16 | byte[] rawXml; 17 | try { 18 | rawXml = IOUtils.resourceToByteArray(filename); 19 | } catch (IOException e) { 20 | throw new UncheckedIOException(e); 21 | } 22 | return new DaComParamTestMarshaller.Builder().build().unmarshall(rawXml); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/testhelpers/DataTypeUtils.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.testhelpers; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TFCEnum; 8 | import org.lfenergy.compas.scl2007b4.model.TPredefinedBasicTypeEnum; 9 | import org.lfenergy.compas.scl2007b4.model.TPredefinedCDCEnum; 10 | import org.lfenergy.compas.sct.commons.dto.DaTypeName; 11 | import org.lfenergy.compas.sct.commons.dto.DataAttributeRef; 12 | import org.lfenergy.compas.sct.commons.dto.DoTypeName; 13 | 14 | import java.util.Map; 15 | 16 | public class DataTypeUtils { 17 | public static DaTypeName createDa(String nameRef, TFCEnum fc, boolean valImport, Map daiValues) { 18 | DaTypeName resultDa = new DaTypeName(nameRef); 19 | resultDa.setFc(fc); 20 | resultDa.setBType(TPredefinedBasicTypeEnum.INT_8); 21 | resultDa.setValImport(valImport); 22 | resultDa.setDaiValues(daiValues); 23 | return resultDa; 24 | } 25 | 26 | public static DoTypeName createDo(String nameRef, TPredefinedCDCEnum cdc) { 27 | DoTypeName resultDo = new DoTypeName(nameRef); 28 | resultDo.setCdc(cdc); 29 | return resultDo; 30 | } 31 | 32 | public static DataAttributeRef createDataAttributeRef(DoTypeName doTypeName, DaTypeName daTypeName) { 33 | DataAttributeRef dataAttributeRef = new DataAttributeRef(); 34 | dataAttributeRef.setDoName(doTypeName); 35 | dataAttributeRef.setDaName(daTypeName); 36 | return dataAttributeRef; 37 | } 38 | 39 | private DataTypeUtils() { 40 | throw new UnsupportedOperationException("This is a utility class, it should not be instantiated."); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/testhelpers/FCDARecord.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.testhelpers; 6 | 7 | import org.lfenergy.compas.scl2007b4.model.TFCDA; 8 | import org.lfenergy.compas.scl2007b4.model.TFCEnum; 9 | 10 | /** 11 | * Record to easily compare FCDA with AssertJ (xjc does not implement an equals method for TFCDA class) 12 | */ 13 | public record FCDARecord(String ldInst, String lnClass, String lnInst, String prefix, String doName, String daName, TFCEnum fc) { 14 | static public FCDARecord toFCDARecord(TFCDA tfcda) { 15 | return new FCDARecord( 16 | tfcda.getLdInst(), 17 | tfcda.isSetLnClass() ? tfcda.getLnClass().get(0) : null, 18 | tfcda.getLnInst(), 19 | tfcda.getPrefix(), 20 | tfcda.getDoName(), 21 | tfcda.getDaName(), 22 | tfcda.getFc()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/testhelpers/SclTestMarshaller.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.testhelpers; 6 | 7 | import org.apache.commons.io.IOUtils; 8 | import org.lfenergy.compas.scl2007b4.model.SCL; 9 | 10 | import java.io.IOException; 11 | import java.io.UncheckedIOException; 12 | 13 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 14 | 15 | public class SclTestMarshaller { 16 | 17 | public static SCL getSCLFromFile(String filename) { 18 | byte[] rawXml; 19 | try { 20 | rawXml = IOUtils.resourceToByteArray(filename); 21 | } catch (IOException e) { 22 | throw new UncheckedIOException(e); 23 | } 24 | return MarshallerWrapper.unmarshall(rawXml, SCL.class); 25 | } 26 | 27 | public static String assertIsMarshallable(SCL scl) { 28 | return assertDoesNotThrow(() -> MarshallerWrapper.marshall(scl)); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/ActiveStatusEnumTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.util; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.params.ParameterizedTest; 9 | import org.junit.jupiter.params.provider.CsvSource; 10 | 11 | import static org.assertj.core.api.Assertions.assertThat; 12 | import static org.assertj.core.api.Assertions.assertThatCode; 13 | 14 | class ActiveStatusEnumTest { 15 | 16 | @ParameterizedTest 17 | @CsvSource({"on,ON", "off,OFF"}) 18 | void fromValue_withKnownStatus_shouldNotThrowException(String ldeviceStatus, String expected) { 19 | //Given 20 | //When 21 | ActiveStatus activeStatusEnum = ActiveStatus.fromValue(ldeviceStatus); 22 | //Then 23 | assertThat(activeStatusEnum).isEqualTo(ActiveStatus.valueOf(expected)); 24 | } 25 | 26 | @Test 27 | void fromValue_withUnknownStatus_shouldThrowException() { 28 | //Given 29 | String ldeviceStatus = "patate"; 30 | //When 31 | //Then 32 | assertThatCode(() -> ActiveStatus.fromValue(ldeviceStatus)) 33 | .isInstanceOf(IllegalArgumentException.class) 34 | .hasMessage("The status patate does not exist. It should be among [on, off]"); 35 | } 36 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/CommonConstantsTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.util; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.platform.commons.support.ReflectionSupport; 9 | 10 | import static org.assertj.core.api.Assertions.assertThatThrownBy; 11 | 12 | class CommonConstantsTest { 13 | 14 | @Test 15 | void constructor_should_throw_exception() { 16 | // Given 17 | // When & Then 18 | assertThatThrownBy(() -> ReflectionSupport.newInstance(Utils.class)) 19 | .isInstanceOf(UnsupportedOperationException.class); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/MonitoringLnClassEnumTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * // SPDX-FileCopyrightText: 2023 RTE FRANCE 3 | * // 4 | * // SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package org.lfenergy.compas.sct.commons.util; 8 | 9 | import org.junit.jupiter.api.Test; 10 | 11 | import static org.assertj.core.api.Assertions.assertThat; 12 | 13 | class MonitoringLnClassEnumTest { 14 | 15 | @Test 16 | void value_should_return_string_value() { 17 | // Given 18 | // When 19 | // Then 20 | assertThat(MonitoringLnClassEnum.LSVS.value()).isEqualTo("LSVS"); 21 | assertThat(MonitoringLnClassEnum.LGOS.value()).isEqualTo("LGOS"); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/PrivateEnumTest.java: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 RTE FRANCE 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package org.lfenergy.compas.sct.commons.util; 6 | 7 | import org.junit.jupiter.api.Test; 8 | import org.lfenergy.compas.scl2007b4.model.TCompasSclFileType; 9 | 10 | import java.util.NoSuchElementException; 11 | 12 | import static org.assertj.core.api.Assertions.assertThat; 13 | import static org.assertj.core.api.Assertions.assertThatThrownBy; 14 | 15 | class PrivateEnumTest { 16 | 17 | @Test 18 | void fromClass_should_return_PrivateEnum() { 19 | // Given 20 | Class compasClass = TCompasSclFileType.class; 21 | // When 22 | PrivateEnum result = PrivateEnum.fromClass(compasClass); 23 | // Then 24 | assertThat(result).isEqualTo(PrivateEnum.COMPAS_SCL_FILE_TYPE); 25 | } 26 | 27 | @Test 28 | void fromClass_with_unknown_class_should_throw_exception() { 29 | // Given 30 | Class classToTest = Object.class; 31 | // When & Then 32 | assertThatThrownBy(() -> PrivateEnum.fromClass(classToTest)).isInstanceOf(NoSuchElementException.class); 33 | } 34 | 35 | @Test 36 | void toString_should_return_private_type() { 37 | // Given 38 | PrivateEnum privateEnum = PrivateEnum.COMPAS_SCL_FILE_TYPE; 39 | // When 40 | String result = privateEnum.toString(); 41 | // Then 42 | assertThat(result).isEqualTo("COMPAS-SclFileType"); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/cb_comm/Template_DA_COMM_v1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/da_comm-marshaller-config.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Alliander N.V. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | --- 5 | compas: 6 | scl: 7 | schemas: 8 | - xsdPath: "xsd/CB_COMM_V1.xsd" 9 | namespace: "http://www.rte-france.com/dacomm" 10 | contextPath: "org.lfenergy.compas.sct.commons.model.da_comm" 11 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/dtt-test-schema-conf/scd_dtt_do_sdo_da_bda.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | val1 36 | val2 37 | 38 | 39 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/dtt-test-schema-conf/scd_dtt_do_sdo_da_bda_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | val1 41 | val2 42 | 43 | 44 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/dtt-test-schema-conf/scd_dtt_do_sdo_da_bda_tests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | REB 41 | RVB 42 | RVL 43 | RVB+L 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/dtt-test-schema-conf/scd_dtt_import_sameid-diff-content-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | IEC 61850-7-3:2007B 15 | IEC 61850-8-1:2003 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | C 32 | 33 | 34 | IEC 61850-8-1:2003 35 | 36 | 37 | 38 | 39 | 40 | Completed-diff 41 | 42 | 43 | Va 44 | 45 | 46 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/dtt-test-schema-conf/scd_dtt_import_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | B 10 | 11 | 12 | 13 | 14 | 15 | 16 | IEC 61850-7-3:2007B 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | C 31 | 32 | 33 | IEC 61850-8-1:2003 34 | 35 | 36 | 37 | 38 | 39 | Completed 40 | 41 | 42 | Va 43 | Vb 44 | 45 | 46 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/error_messages.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | #SCL root errors 6 | Invalid_Scd_No_Header="Invalid SCD file: no Header tag found" -------------------------------------------------------------------------------- /sct-commons/src/test/resources/error_messages_fr.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | #SCL root errors 6 | Invalid_Scd_No_Header="Fichier SCD invalide": tag 'Header' est manquant" -------------------------------------------------------------------------------- /sct-commons/src/test/resources/limitation_cb_dataset_fcda/scd_check_coherent_extRefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | [%green(%t)] %highlight(%-5level) %yellow(%C): %msg%n%throwable 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/marshaller-builder/Employee.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/marshaller-builder/scl_schema.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | --- 6 | compas: 7 | scl: 8 | # XsdPath currently is a reference to a XSD on the classpath, searched from the root. 9 | # ContextPath is the package where the ObjectFactory class can be found, mostly generated there. 10 | schemas: 11 | - xsdPath: "classpath:marshaller-builder/Employee.xsd" 12 | namespace: "http://www.employee.com" 13 | contextPath: "org.lfenergy.compas.sct.commons.testhelpers.marshaller" -------------------------------------------------------------------------------- /sct-commons/src/test/resources/marshaller-builder/scl_schema_error.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 RTE FRANCE 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | --- 6 | compas: 7 | scl: 8 | # XsdPath currently is a reference to a XSD on the classpath, searched from the root. 9 | # ContextPath is the package where the ObjectFactory class can be found, mostly generated there. 10 | schemas: 11 | xsdPath: "classpath:marshaller-builder/Employee.xsd" 12 | namespace: "http://www.employee.com" 13 | contextPath: "org.lfenergy.compas.sct.commons.testhelpers.marshaller" -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-ied-dtt-com-import-stds/scd.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | SCD 10 | 11 |
12 | 13 | 14 | 0 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-ied-dtt-com-import-stds/scd_with_same_compas_icd_header_in_different_functions.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | SCD 10 | 11 |
12 | 13 | 14 | 0 15 | 16 | 17 | 18 | 19 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-ied-dtt-com-import-stds/ssd.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | SSD 10 | 11 |
12 | 13 | 14 | 0 15 | 16 | 17 | 18 | 19 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-ldevice-adapter/scd_ldevice.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | on 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | on 46 | off 47 | test 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-refresh-lnode/scd-with-substation-lnode.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 90 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-substation-import-ssd/scd_with_substation_name_different.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 90 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-substation-import-ssd/ssd_with_2_substations.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | SSD 8 | 9 |
10 | 11 | 12 | 0 13 | 14 | 15 | 16 | 17 | 18 | 19 | 0 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-substation-import-ssd/ssd_without_substations.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | SSD 8 | 9 |
10 | 11 | 12 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-test-update-inref/scd_update_inref_extref_bind.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | purpose value 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-test-update-inref/scd_update_inref_extref_not_bind.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | purpose value 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scd-test-update-inref/scd_update_inref_no_Extref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | LD_WITHOUT_InRef_DOI_InRef1 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scl-root-test-schema-conf/add_ied_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scl-root-test-schema-conf/icd1_to_add_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | B 23 | 24 | 25 | 26 | 27 | 28 | 29 | IEC 61850-7-3:2007B 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | C 44 | 45 | 46 | IEC 61850-8-1:2003 47 | 48 | 49 | 50 | 51 | 52 | Completed 53 | 54 | 55 | Va 56 | Vb 57 | 58 | 59 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scl-root-test-schema-conf/icd2_to_add_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | IEC 61850-7-3:2007B 29 | IEC 61850-8-1:2003 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | C 45 | 46 | IEC 61850-8-1:2003 47 | 48 | 49 | 50 | 51 | 52 | Completed-diff 53 | 54 | 55 | Va 56 | 57 | 58 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scl_update_communication/scd_without_communication.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | SCD 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scl_update_communication/std_with_communication.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | STD 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scl_update_communication/std_with_full_filled_communication.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | STD 8 | 9 |
10 | 11 | 12 | 13 |
14 |

1.2.3.4

15 |
16 | 17 |
18 |

11

19 |
20 |
21 | 22 |

PL

23 |
24 |
25 |
26 |
27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /sct-commons/src/test/resources/scl_update_communication/std_without_communication.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | STD 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /sct-coverage/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 4.0.0 9 | 10 | 11 | org.lfenergy.compas 12 | compas-sct 13 | local-SNAPSHOT 14 | ../pom.xml 15 | 16 | 17 | pom 18 | sct-coverage 19 | SCT-Coverage 20 | 21 | 22 | true 23 | true 24 | 25 | 26 | 27 | 28 | org.lfenergy.compas 29 | sct-commons 30 | ${project.version} 31 | 32 | 33 | org.lfenergy.compas 34 | sct-app 35 | ${project.version} 36 | 37 | 38 | 39 | 40 | 41 | org.jacoco 42 | jacoco-maven-plugin 43 | 44 | 45 | **/scl2007b4/**/* 46 | 47 | 48 | 49 | 50 | report-aggregate 51 | test 52 | 53 | report-aggregate 54 | 55 | 56 | 57 | 58 | 59 | 60 | --------------------------------------------------------------------------------