Skip to content

Commit 7949e21

Browse files
author
Dennis Labordus
authored
Merge pull request #122 from com-pas/develop
New release
2 parents 4f30f66 + 7b25903 commit 7949e21

File tree

20 files changed

+8313
-5252
lines changed

20 files changed

+8313
-5252
lines changed

.github/workflows/build-project.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ jobs:
3737
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3838
restore-keys: ${{ runner.os }}-m2
3939

40-
- name: Set up JDK 1.11
41-
uses: actions/setup-java@v3.4.0
40+
- name: Set up JDK 17
41+
uses: actions/setup-java@v3.4.1
4242
with:
4343
distribution: 'zulu'
44-
java-version: '11'
44+
java-version: '17'
4545

4646
- name: Create custom Maven Settings.xml
4747
uses: whelk-io/maven-settings-xml-action@v20

.github/workflows/release-project.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ jobs:
4141
shell: bash
4242
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
4343
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
44-
- name: Set up JDK 1.11
45-
uses: actions/setup-java@v3.4.0
44+
- name: Set up JDK 17
45+
uses: actions/setup-java@v3.4.1
4646
with:
4747
distribution: 'zulu'
48-
java-version: '11'
48+
java-version: '17'
4949

5050
- name: Create custom Maven Settings.xml
5151
uses: whelk-io/maven-settings-xml-action@v20

.github/workflows/sonarcloud-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ jobs:
3030
with:
3131
fetch-depth: 0
3232

33-
- name: Set up JDK 1.11
34-
uses: actions/setup-java@v3.4.0
33+
- name: Set up JDK 17
34+
uses: actions/setup-java@v3.4.1
3535
with:
3636
distribution: 'zulu'
37-
java-version: '11'
37+
java-version: '17'
3838
- name: Cache SonarCloud packages
3939
uses: actions/cache@v3
4040
with:

.mvn/wrapper/maven-wrapper.properties

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
1-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
2-
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

DEVELOPMENT.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2022 Alliander N.V.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
7+
# Development for CoMPAS SCL Auto Alignment
8+
9+
This project uses Java 17 and Quarkus to build and run the application. The project is split into multi modules.
10+
The app module will use Quarkus to expose the services as REST XML Endpoints. The service module contains all
11+
the logic to determine X/Y Coordinates into IEC 61850 XML (using the namespace
12+
http://www.iec.ch/61850/2003/SCLcoordinates). This module uses no Quarkus dependencies, but mainly standard
13+
java dependencies and PowSyBl dependencies to determine coordinates. This way the service module can also be used in
14+
other environment as Java library, for instance a Spring project.
15+
16+
## Building the application
17+
18+
You can use Maven to build the application and see if all tests are working using:
19+
20+
```shell script
21+
./mvnw clean verify
22+
```
23+
24+
This should normally be enough to also run the application, but there were cases that we need to build using:
25+
26+
```shell script
27+
./mvnw clean install
28+
```
29+
30+
This to make the local modules available for the app module to run the application.
31+
32+
## Running the application locally in dev mode
33+
34+
You can run your application in dev mode that enables live coding using:
35+
36+
```shell script
37+
./mvnw package io.quarkus:quarkus-maven-plugin::dev
38+
```
39+
40+
### Application depends on a running KeyCloak instance for dev mode
41+
42+
A KeyCloak instance needs to be running on port 8089 by default in dev mode. If a custom KeyCloak instance is used see
43+
[Security](README.md#security) for more details.
44+
45+
There is a preconfigured Demo KeyCloak instance available for CoMPAS in the
46+
[CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment). This repository can be cloned and
47+
used to execute the following commands to create a local Docker Image with the CoMPAS Demo configuration.
48+
49+
```shell
50+
cd <CoMPAS Deployment Repository Directory>/compas/keycloak
51+
docker build -t compas_keycloak .
52+
```
53+
54+
A Docker Image `compas_keycloak` is created that can be started using the following command
55+
56+
```shell
57+
docker run --rm --name compas_keycloak \
58+
-p 8089:8080
59+
-d compas_keycloak:latest
60+
```
61+
62+
There are now 3 users available to be used, `scl-data-editor`, `scl-data-reader`, `scd-reader`. See
63+
[CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment) for more information about the users.
64+
65+
## Testing the application
66+
67+
The application is tested with unit and integration tests, but you can also manually test the application using for
68+
instance Postman. And there is also a way to test this service with the CoMPAS OpenSCD Frontend application.
69+
70+
### Postman
71+
72+
To manually test the application there is a Postman collection in the directory `postman` that can be imported
73+
and used to execute REST XML Calls.
74+
75+
To make the call work we also need to import an environment and authorisation collection. These files can be found
76+
in [CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment) in the directory `postman`
77+
(`auth.collection.json` and `local.environment.json`).
78+
79+
In the authorisation collection there are called for the 3 users known within the Demo KeyCloak instance.
80+
If one of these calls are executed there is a variable `bearer` filled.
81+
82+
Now one of the SCL Auto Alignment calls can be executed, the variable `bearer` is added to the header of the request.
83+
After the call is executed the result should be shown in Postman.
84+
85+
### CoMPAS OpenSCD Frontend application
86+
87+
To test the SCL Auto Alignment with the CoMPAS OpenSCD application just run the application in dev mode, including the
88+
KeyCloak instance. For further instruction how to start the CoMPAS OpenSCD application and use this locally see
89+
the file `DEVELOPMENT.md` in [CoMPAS OpenSCD application](https://github.com/com-pas/compas-open-scd).
90+
91+
## Docker Images
92+
93+
### Creating a Docker image with native executable
94+
95+
The releases created in the repository will create a docker image with a native executable. If you're running a Linux
96+
system it's possible to create and run the executable locally. You can create a Docker image with native executable
97+
using:
98+
99+
```shell script
100+
./mvnw package -Pnative-image
101+
```
102+
103+
You can then execute your native executable with: `./app/target/app-local-SNAPSHOT-runner`
104+
105+
### Creating a Docker image with JVM executable
106+
107+
There is also a profile to create a Docker Image which runs the application using a JVM. You can create a Docker Image
108+
with JVM executable using:
109+
110+
```shell script
111+
./mvnw package -Pjvm-image
112+
```
113+
114+
The JVM Image can also (temporary) be created by the release action if there are problems creating or running the
115+
native executable.

README.md

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
SPDX-FileCopyrightText: 2021 Alliander N.V.
2+
SPDX-FileCopyrightText: 2022 Alliander N.V.
33
44
SPDX-License-Identifier: Apache-2.0
55
-->
@@ -10,55 +10,11 @@ SPDX-License-Identifier: Apache-2.0
1010
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5925/badge)](https://bestpractices.coreinfrastructure.org/projects/5925)
1111
[![Slack](https://raw.githubusercontent.com/com-pas/compas-architecture/master/public/LFEnergy-slack.svg)](http://lfenergy.slack.com/)
1212

13-
# compas-scl-auto-alignment
13+
# CoMPAS SCL Auto Alignment
1414

15-
## Running the application in dev mode
15+
## Development
1616

17-
You can run your application in dev mode that enables live coding using:
18-
19-
```shell script
20-
./mvnw package io.quarkus:quarkus-maven-plugin::dev
21-
```
22-
23-
> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.
24-
25-
## Packaging and running the application
26-
27-
The application can be packaged using:
28-
29-
```shell script
30-
./mvnw package
31-
```
32-
33-
It produces the `quarkus-run.jar` file in the `app/target/quarkus-app/` directory. Be aware that it’s not an _über-jar_
34-
as the dependencies are copied into the `app/target/quarkus-app/lib/` directory.
35-
36-
If you want to build an _über-jar_, execute the following command:
37-
38-
```shell script
39-
./mvnw package -Dquarkus.package.type=uber-jar
40-
```
41-
42-
The application is now runnable using `java -jar app/target/quarkus-app/quarkus-run.jar`.
43-
44-
## Creating a native executable
45-
46-
You can create a native executable using:
47-
48-
```shell script
49-
./mvnw package -Pnative
50-
```
51-
52-
Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
53-
54-
```shell script
55-
./mvnw package -Pnative -Dquarkus.native.container-build=true
56-
```
57-
58-
You can then execute your native executable with: `./app/target/code-with-quarkus-local-SNAPSHOT-runner`
59-
60-
If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html
61-
.
17+
Information about how to run and develop for this project check [Development](DEVELOPMENT.md).
6218

6319
## Environment variables
6420

app/src/main/docker/Dockerfile.jvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
###
2424
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6
2525

26-
ARG JAVA_PACKAGE=java-11-openjdk-headless
26+
ARG JAVA_PACKAGE=java-17-openjdk-headless
2727
ARG RUN_JAVA_VERSION=1.3.8
2828
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
2929
# Install java and the run-java script

pom.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ SPDX-License-Identifier: Apache-2.0
1515

1616
<properties>
1717
<maven.compiler.parameters>true</maven.compiler.parameters>
18-
<maven.compiler.source>11</maven.compiler.source>
19-
<maven.compiler.target>11</maven.compiler.target>
18+
<maven.compiler.release>17</maven.compiler.release>
2019
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2120
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2221

@@ -26,10 +25,10 @@ SPDX-License-Identifier: Apache-2.0
2625

2726
<compas.core.version>0.9.1</compas.core.version>
2827

29-
<quarkus.platform.version>2.10.1.Final</quarkus.platform.version>
28+
<quarkus.platform.version>2.11.2.Final</quarkus.platform.version>
3029
<slf4j.version>1.7.36</slf4j.version>
31-
<powsybl.sld.version>2.11.0</powsybl.sld.version>
32-
<gson.version>2.9.0</gson.version>
30+
<powsybl.sld.version>2.12.0</powsybl.sld.version>
31+
<gson.version>2.9.1</gson.version>
3332
<openpojo.version>0.9.1</openpojo.version>
3433
</properties>
3534

postman/scl-auto-alignment-service.collection.json

Lines changed: 505 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2022 Alliander N.V.
2+
3+
SPDX-License-Identifier: Apache-2.0

0 commit comments

Comments
 (0)