Skip to content

Commit c80598e

Browse files
author
Dennis Labordus
authored
Merge pull request #71 from com-pas/develop
New release
2 parents 74148e1 + b5405ba commit c80598e

File tree

35 files changed

+367
-146
lines changed

35 files changed

+367
-146
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,9 @@ updates:
2727
schedule:
2828
interval: "daily"
2929
open-pull-requests-limit: 5
30+
31+
- package-ecosystem: "docker"
32+
directory: "/app/src/main/docker/"
33+
schedule:
34+
interval: "daily"
35+
open-pull-requests-limit: 5

.github/workflows/build-project.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
submodules: 'true'
2727
- name: Set up Docker Buildx
2828
id: buildx
29-
uses: docker/setup-buildx-action@v1
29+
uses: docker/setup-buildx-action@v2
3030
- name: Cache Docker Register
3131
uses: actions/cache@v3
3232
with:
@@ -50,5 +50,9 @@ jobs:
5050
with:
5151
output_file: custom_maven_settings.xml
5252
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
53-
- name: Build with Maven
53+
- name: Build with Maven (Pull Request)
54+
if: ${{ github.event_name == 'pull_request' }}
55+
run: ./mvnw -s custom_maven_settings.xml -B -Pjvm-image clean verify
56+
- name: Build with Maven (Push)
57+
if: ${{ github.event_name == 'push' }}
5458
run: ./mvnw -s custom_maven_settings.xml -B clean verify

.github/workflows/release-project.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
submodules: 'true'
2121
- name: Set up Docker Buildx
2222
id: buildx
23-
uses: docker/setup-buildx-action@v1
23+
uses: docker/setup-buildx-action@v2
2424
- name: Login to Docker Hub
25-
uses: docker/login-action@v1
25+
uses: docker/login-action@v2
2626
with:
2727
username: ${{ secrets.DOCKER_HUB_USERNAME }}
2828
password: ${{ secrets.DOCKER_HUB_TOKEN }}
@@ -66,6 +66,6 @@ jobs:
6666
./mvnw -B -s custom_maven_settings.xml \
6767
-DaltDeploymentRepository=github-packages-compas::default::https://maven.pkg.github.com/com-pas/compas-scl-validator \
6868
-Dmaven.deploy.skip=snapshots \
69-
-Prelease clean deploy
69+
-Pjvm-image,release clean deploy
7070
env:
7171
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitmodules

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@
66
# Remark: the option to ignore 'untracked' files is needed, because the submodules don't contain a file '.gitignore'.
77
# This cause the target directories to be untracked.
88
#
9-
[submodule "riseclipse/riseclipse-developer"]
10-
path = riseclipse/riseclipse-developer
11-
url = [email protected]:riseclipse/riseclipse-developer.git
12-
ignore = dirty
13-
[submodule "riseclipse/riseclipse-main"]
14-
path = riseclipse/riseclipse-main
15-
url = [email protected]:riseclipse/riseclipse-main.git
16-
ignore = dirty
17-
[submodule "riseclipse/riseclipse-metamodel-scl2003"]
18-
path = riseclipse/riseclipse-metamodel-scl2003
19-
url = [email protected]:riseclipse/riseclipse-metamodel-scl2003.git
20-
ignore = dirty
219
[submodule "riseclipse/riseclipse-ocl-constraints-scl2003"]
2210
path = riseclipse/riseclipse-ocl-constraints-scl2003
2311
url = [email protected]:riseclipse/riseclipse-ocl-constraints-scl2003.git

DEVELOPMENT.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,51 +8,50 @@ SPDX-License-Identifier: Apache-2.0
88

99
## Git
1010

11-
If the project is already cloned and a submodule is added use the following commands, first `git submodule init` and
12-
next `git submodule update`.
11+
If the project is already cloned and a submodule is added use the following commands to retrieve the files from the
12+
RiseClipse Repository:
13+
14+
- `git submodule init`
15+
- `git submodule update`
1316

1417
More about Git Submodules can be found [here](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
1518

1619
**Remark**: The URLs to the submodules are configured in the file `.gitmodules`, but these are using the SSH URLs. There
1720
is a way described [here](https://git-scm.com/book/en/v2/Git-Tools-Submodules) that the URL can be overwritten locally
18-
with an HTTPS URL of the GIT Repository. Because of the subdirectory where the submodules are in, this doesn't work
19-
exactly that way. Use the following commands to update the URLs locally to HTTPS.
21+
with an HTTPS URL of the GIT Repository.
22+
23+
Because of the subdirectory where the submodules are in, this doesn't work exactly that way. Use the following commands
24+
to update the URLs locally to HTTPS.
2025

2126
```
22-
git config submodule.riseclipse/riseclipse-developer.url https://github.com/riseclipse/riseclipse-developer.git
23-
git config submodule.riseclipse/riseclipse-main.url https://github.com/riseclipse/riseclipse-main.git
24-
git config submodule.riseclipse/riseclipse-metamodel-scl2003.url https://github.com/riseclipse/riseclipse-metamodel-scl2003.git
2527
git config submodule.riseclipse/riseclipse-ocl-constraints-scl2003.url https://github.com/riseclipse/riseclipse-ocl-constraints-scl2003.git
2628
2729
git submodule init
2830
git submodule update
2931
```
3032

31-
## IntelliJ
33+
### Git update Submodules
3234

33-
Importing the project is a bit harder for the SCL Validator then normal. It's caused because of the submodules that are
34-
needed from RiseClipse. These projects are Eclipse projects using Eclipse Tycho to build and Eclipse project structure.
35+
A submodule in Git is fixed to a specific commit of the remote repository. To update the reference to the latest commit
36+
in the remote repository execute the following command from the root directory of the project.
3537

36-
The first step to make it work in IntelliJ is that an Eclipse version needs to be available on your local machine. The
37-
version we know that's working can be found [here](https://www.eclipse.org/downloads/packages/release/2019-06/r)
38-
Download (and install/unzip) Eclipse.
38+
```
39+
git submodule update --remote
40+
```
3941

40-
Next a way to make everything work in IntelliJ is importing the project in the following way.
42+
Next commit and push the changes to the Git Repository of CoMPAS. The build now uses the latest commit of the main
43+
branch.
4144

42-
- First step is to just import everything like it are Maven projects;
43-
- Next we need to add a Global Library in IntelliJ. Open the Module Settings and select "Global Libraries". And a new
44-
libraries and name it "ECLIPSE". Point it to the directory "<ECLIPSE_INSTALL_DIR>/plugins";
45-
- Next step is to re-import the RiseClipse Submodule as Eclipse;
46-
- In IntelliJ select "File" -> "New" -> "Module from Existing Sources...";
47-
- Select one of the RiseClipse Submodules, for instance "riseclipse-metamodel-scl2003";
48-
- Next select "Eclipse" by "Import module from External Model";
49-
- Follow the rest of the wizard, only to remember to select all subprojects that are available in the directory;
45+
## Eclipse
5046

51-
Now the module should be correctly imported in IntelliJ to be used. Check the Module Settings of one of the subprojects
52-
to check if the directory "src" is a Java Source Directory, for instance the module
53-
"riseclipse/riseclipse-metamodel-scl2003/fr.centralesupelec.edf.riseclipse.iec61850.scl.utilities".
47+
### Eclipse Dependencies
5448

55-
## Eclipse
49+
To make everything build and run Eclipse Dependencies are needed, but unlike the RiseClipse Dependencies these can't be
50+
found in the Maven Central Repository, but in an Eclipse P2 Repository. In RiseClipse there is a p2-to-m2 project that
51+
creates a local Maven Repository from the needed dependencies from the Eclipse P2 Repository. A CoMPAS Version of this
52+
maven module is created here, see [README.md](riseclipse/riseclipse-p2-to-m2/README.md) for more info.
53+
54+
### Eclipse OCL
5655

5756
Example about how to use Eclipse OCL was found
5857
[here](https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.ocl.doc%2Fhelp%2FPivotStandalone.html).

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SPDX-License-Identifier: Apache-2.0
77
[![Maven Build Github Action Status](<https://img.shields.io/github/workflow/status/com-pas/compas-scl-validator/Build%20Project?logo=GitHub>)](https://github.com/com-pas/compas-scl-validator/actions?query=workflow%3A%22Build+Project%22)
88
[![REUSE status](https://api.reuse.software/badge/github.com/com-pas/compas-scl-validator)](https://api.reuse.software/info/github.com/com-pas/compas-scl-validator)
99
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=com-pas_compas-scl-validator&metric=alert_status)](https://sonarcloud.io/dashboard?id=com-pas_compas-scl-validator)
10-
[![LFX Security Status](https://img.shields.io/badge/dynamic/json?color=orange&label=LFX%20Security%20Tool&query=issues%5B%3F%28%40%5B%27repository-name%27%5D%20%3D%3D%20%27compas-scl-validator%27%29%5D%5B%27high-open-issues%27%5D&suffix=%20High%20open%20issues&url=https%3A%2F%2Fapi.security.lfx.linuxfoundation.org%2Fv1%2Fproject%2Fe8b6fdf9-2686-44c5-bbaa-6965d04ad3e1%2Fissues)](https://security.lfx.linuxfoundation.org/#/e8b6fdf9-2686-44c5-bbaa-6965d04ad3e1/issues)
10+
[![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

1313
# compas-scl-validator
@@ -28,19 +28,19 @@ automatically determine the URL to be used.
2828

2929
## Development
3030

31-
For the RiseClipse implementation of the validator parts of the RiseClipse project are being used. Currently, these
32-
parts aren't distributed to any Maven Repository, so the Git Repositories need to be included. This is done using Git
33-
Submodules.
31+
Since version 1.2.x the JAR Files of RiseClipse are distributed through Maven Central Repository. The JAR Files can be
32+
retrieved from there and don't need to be build locally anymore. Only the OCL Files for the SCL validation still need to
33+
be downloaded from RiseClipse GIT Repository. This is still done using Git Submodules.
3434

3535
To clone the project or update the project this means that the Git commands are sometimes a little different. To clone
3636
the project use the following command `git clone --recurse-submodules [email protected]:com-pas/compas-scl-validator.git`.
3737
This will also clone the submodules.
3838

3939
Tip: The URL to the submodules are configured in the file `.gitmodules`, but these are using the SSH URL. There is a way
40-
described in the URL above that the URL can be overwritten locally with an HTTPS URL of the GIT Repository.
40+
described [here](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to overwrite the URL locally with an HTTPS URL of
41+
the GIT Repository.
4142

42-
Check the [Development](DEVELOPMENT.md) page for more detail information how to work with this repository, because of
43-
the mixture with RiseClipse.
43+
Check the [Development](DEVELOPMENT.md) page for more detail information how to develop in this GIT repository.
4444

4545
## Custom OCL Files
4646

app/pom.xml

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,31 +47,23 @@ SPDX-License-Identifier: Apache-2.0
4747
</dependency>
4848
<dependency>
4949
<groupId>io.quarkus</groupId>
50-
<artifactId>quarkus-resteasy</artifactId>
50+
<artifactId>quarkus-resteasy-reactive</artifactId>
5151
</dependency>
5252
<dependency>
5353
<groupId>io.quarkus</groupId>
54-
<artifactId>quarkus-smallrye-jwt</artifactId>
54+
<artifactId>quarkus-resteasy-reactive-jaxb</artifactId>
5555
</dependency>
5656
<dependency>
5757
<groupId>io.quarkus</groupId>
58-
<artifactId>quarkus-smallrye-openapi</artifactId>
59-
</dependency>
60-
<dependency>
61-
<groupId>io.quarkus</groupId>
62-
<artifactId>quarkus-smallrye-health</artifactId>
63-
</dependency>
64-
<dependency>
65-
<groupId>io.quarkus</groupId>
66-
<artifactId>quarkus-resteasy-jaxb</artifactId>
58+
<artifactId>quarkus-smallrye-jwt</artifactId>
6759
</dependency>
6860
<dependency>
6961
<groupId>io.quarkus</groupId>
70-
<artifactId>quarkus-resteasy-mutiny</artifactId>
62+
<artifactId>quarkus-smallrye-openapi</artifactId>
7163
</dependency>
7264
<dependency>
7365
<groupId>io.quarkus</groupId>
74-
<artifactId>quarkus-vertx</artifactId>
66+
<artifactId>quarkus-smallrye-health</artifactId>
7567
</dependency>
7668
<dependency>
7769
<groupId>io.quarkus</groupId>
@@ -170,14 +162,50 @@ SPDX-License-Identifier: Apache-2.0
170162

171163
<profiles>
172164
<profile>
173-
<id>native</id>
165+
<id>jvm-image</id>
174166

175167
<properties>
168+
<!-- Make a Docker Image, so the integration tests will be executed against the container -->
169+
<quarkus.container-image.build>true</quarkus.container-image.build>
170+
</properties>
171+
172+
<build>
173+
<plugins>
174+
<plugin>
175+
<groupId>org.apache.maven.plugins</groupId>
176+
<artifactId>maven-failsafe-plugin</artifactId>
177+
<version>${surefire-plugin.version}</version>
178+
<executions>
179+
<execution>
180+
<goals>
181+
<goal>integration-test</goal>
182+
<goal>verify</goal>
183+
</goals>
184+
<configuration>
185+
<systemPropertyVariables>
186+
<java.util.logging.manager>
187+
org.jboss.logmanager.LogManager
188+
</java.util.logging.manager>
189+
<maven.home>${maven.home}</maven.home>
190+
</systemPropertyVariables>
191+
</configuration>
192+
</execution>
193+
</executions>
194+
</plugin>
195+
</plugins>
196+
</build>
197+
</profile>
198+
199+
<profile>
200+
<id>native-image</id>
201+
202+
<properties>
203+
<!-- Make a Docker Image, so the integration tests will be executed against the container -->
204+
<quarkus.container-image.build>true</quarkus.container-image.build>
205+
176206
<quarkus.package.type>native</quarkus.package.type>
177207
<!-- Allows for creating a Linux executable without GraalVM being installed -->
178208
<quarkus.native.container-build>true</quarkus.native.container-build>
179-
<!-- Also make a Docker Image, so the native test will be executed against the container -->
180-
<quarkus.container-image.build>true</quarkus.container-image.build>
181209
<quarkus.native.additional-build-args>
182210
--allow-incomplete-classpath
183211
</quarkus.native.additional-build-args>
@@ -228,7 +256,9 @@ SPDX-License-Identifier: Apache-2.0
228256
<id>release</id>
229257

230258
<properties>
259+
<!-- Make a Docker Image from the component -->
231260
<quarkus.container-image.build>true</quarkus.container-image.build>
261+
232262
<!-- Properties only used for publishing a native docker image (default to Docker Hub) -->
233263
<quarkus.container-image.push>true</quarkus.container-image.push>
234264
<quarkus.container-image.additional-tags>latest</quarkus.container-image.additional-tags>

app/src/main/docker/Dockerfile.jvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/app-jvm
2222
#
2323
###
24-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
24+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6
2525

2626
ARG JAVA_PACKAGE=java-11-openjdk-headless
2727
ARG RUN_JAVA_VERSION=1.3.8

app/src/main/docker/Dockerfile.native

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# docker run -i --rm -p 8080:8080 quarkus/app
1515
#
1616
###
17-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
17+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6
1818
WORKDIR /work/
1919
RUN chown 1001 /work \
2020
&& chmod "g+rwX" /work \

app/src/main/java/org/lfenergy/compas/scl/validator/rest/v1/NsdocResource.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
package org.lfenergy.compas.scl.validator.rest.v1;
55

66
import io.quarkus.security.Authenticated;
7+
import io.smallrye.mutiny.Uni;
78
import org.lfenergy.compas.scl.validator.rest.v1.model.NsdocListResponse;
9+
import org.lfenergy.compas.scl.validator.rest.v1.model.NsdocResponse;
810
import org.lfenergy.compas.scl.validator.service.NsdocService;
911

1012
import javax.enterprise.context.RequestScoped;
@@ -27,17 +29,19 @@ public NsdocResource(NsdocService nsdocService) {
2729
@GET
2830
@Consumes(MediaType.APPLICATION_XML)
2931
@Produces(MediaType.APPLICATION_XML)
30-
public NsdocListResponse list() {
31-
NsdocListResponse response = new NsdocListResponse();
32+
public Uni<NsdocListResponse> list() {
33+
var response = new NsdocListResponse();
3234
response.setNsdocFiles(nsdocService.list());
33-
return response;
35+
return Uni.createFrom().item(response);
3436
}
3537

3638
@GET
3739
@Path("{" + ID_PARAM + "}")
3840
@Consumes(MediaType.APPLICATION_XML)
3941
@Produces(MediaType.APPLICATION_XML)
40-
public String get(@PathParam(ID_PARAM) UUID id) {
41-
return nsdocService.get(id);
42+
public Uni<NsdocResponse> get(@PathParam(ID_PARAM) UUID id) {
43+
var response = new NsdocResponse();
44+
response.setNsdocFile(nsdocService.get(id));
45+
return Uni.createFrom().item(response);
4246
}
4347
}

0 commit comments

Comments
 (0)