Skip to content

Commit

Permalink
Merge pull request #160 from com-pas/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
Dennis Labordus authored Nov 24, 2022
2 parents 8510767 + 295d51c commit 8c0ed76
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 32 deletions.
21 changes: 14 additions & 7 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SPDX-License-Identifier: Apache-2.0
</dependency>
<dependency>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>jaxrs-commons</artifactId>
<artifactId>rest-commons</artifactId>
</dependency>

<dependency>
Expand All @@ -52,27 +52,34 @@ SPDX-License-Identifier: Apache-2.0
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-jwt</artifactId>
<artifactId>quarkus-resteasy-jaxb</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
<artifactId>quarkus-hibernate-validator</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
<artifactId>quarkus-smallrye-jwt</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jaxb</artifactId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-container-image-docker</artifactId>
<artifactId>quarkus-smallrye-health</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>log4j2-jboss-logmanager</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
<artifactId>quarkus-container-image-docker</artifactId>
</dependency>

<!-- Test Dependencies -->
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/docker/Dockerfile.jvm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/app-jvm
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-923

ARG JAVA_PACKAGE=java-17-openjdk-headless
ARG RUN_JAVA_VERSION=1.3.8
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/docker/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# docker run -i --rm -p 8080:8080 quarkus/app
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-923
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*/
@RegisterForReflection(targets = {com.powsybl.sld.library.Components.class,
com.powsybl.sld.library.Component.class,
org.lfenergy.compas.core.jaxrs.model.ErrorResponse.class,
org.lfenergy.compas.core.jaxrs.model.ErrorMessage.class})
org.lfenergy.compas.core.commons.model.ErrorResponse.class,
org.lfenergy.compas.core.commons.model.ErrorMessage.class})
public class CompasSclAutoAlignmentConfiguration {
@Produces
@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
package org.lfenergy.compas.scl.auto.alignment.rest.v1;

import io.quarkus.security.Authenticated;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.microprofile.jwt.JsonWebToken;
import org.lfenergy.compas.scl.auto.alignment.rest.UserInfoProperties;
import org.lfenergy.compas.scl.auto.alignment.rest.v1.model.SclAutoAlignRequest;
import org.lfenergy.compas.scl.auto.alignment.rest.v1.model.SclAutoAlignResponse;
import org.lfenergy.compas.scl.auto.alignment.rest.v1.model.SclAutoAlignSVGRequest;
import org.lfenergy.compas.scl.auto.alignment.service.SclAutoAlignmentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
Expand All @@ -26,7 +26,7 @@
@RequestScoped
@Path("/auto/alignment/v1")
public class SclAutoAlignmentResource {
private static final Logger LOGGER = LoggerFactory.getLogger(SclAutoAlignmentResource.class);
private static final Logger LOGGER = LogManager.getLogger(SclAutoAlignmentResource.class);

private final SclAutoAlignmentService sclAutoAlignmentService;

Expand All @@ -45,6 +45,8 @@ public SclAutoAlignmentResource(SclAutoAlignmentService compasCimMappingService)
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public SclAutoAlignResponse alignment(@Valid SclAutoAlignRequest request) {
LOGGER.info("Auto align SCL for Substation(s) {}.", request.getSubstationNames());

String who = jsonWebToken.getClaim(userInfoProperties.who());
LOGGER.trace("Username used for Who {}", who);

Expand All @@ -58,6 +60,7 @@ public SclAutoAlignResponse alignment(@Valid SclAutoAlignRequest request) {
@Produces(MediaType.APPLICATION_SVG_XML)
@Path("/svg")
public String svg(@Valid SclAutoAlignSVGRequest request) {
LOGGER.info("Creating SVG for Substation {}.", request.getSubstationName());
return sclAutoAlignmentService.getSVG(request.getSclData(), request.getSubstationName());
}
}
5 changes: 3 additions & 2 deletions app/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ quarkus.log.category."org.lfenergy.compas.scl.auto.alignment".level = INFO
quarkus.index-dependency.compas-commons.group-id = org.lfenergy.compas.core
quarkus.index-dependency.compas-commons.artifact-id = commons

quarkus.index-dependency.jaxrs-commons.group-id = org.lfenergy.compas.core
quarkus.index-dependency.jaxrs-commons.artifact-id = jaxrs-commons
quarkus.index-dependency.rest-commons.group-id = org.lfenergy.compas.core
quarkus.index-dependency.rest-commons.artifact-id = rest-commons

quarkus.index-dependency.jaxb-api.group-id = org.jboss.spec.javax.xml.bind
quarkus.index-dependency.jaxb-api.artifact-id = jboss-jaxb-api_2.3_spec
Expand All @@ -32,6 +32,7 @@ quarkus.native.resources.includes=ConvergenceLibrary/*.*,*.css
%dev.quarkus.http.cors = true

%dev.quarkus.log.level = DEBUG
%dev.quarkus.log.category."com.powsybl".level = INFO
%dev.quarkus.log.category."org.lfenergy.compas.scl.auto.alignment".level = DEBUG

# Smallrye JWT Properties (Microprofile)
Expand Down
29 changes: 20 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ SPDX-License-Identifier: Apache-2.0
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
<sonarqube-plugin.version>3.2.0</sonarqube-plugin.version>

<compas.core.version>0.9.3</compas.core.version>
<compas.core.version>0.11.0</compas.core.version>

<quarkus.platform.version>2.14.0.Final</quarkus.platform.version>
<slf4j.version>2.0.3</slf4j.version>
<powsybl.sld.version>2.13.1</powsybl.sld.version>
<quarkus.platform.version>2.14.1.Final</quarkus.platform.version>
<log4j2.version>2.19.0</log4j2.version>
<powsybl.sld.version>3.0.0</powsybl.sld.version>
<gson.version>2.10</gson.version>
<openpojo.version>0.9.1</openpojo.version>
</properties>
Expand Down Expand Up @@ -76,7 +76,7 @@ SPDX-License-Identifier: Apache-2.0
</dependency>
<dependency>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>jaxrs-commons</artifactId>
<artifactId>rest-commons</artifactId>
<version>${compas.core.version}</version>
</dependency>

Expand All @@ -95,13 +95,24 @@ SPDX-License-Identifier: Apache-2.0
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<version>3.0</version>
<version>3.1</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<!-- Bridge is needed for other dependency -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j2.version}</version>
</dependency>

<dependency>
Expand Down
20 changes: 13 additions & 7 deletions service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,19 @@ SPDX-License-Identifier: Apache-2.0
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>provided</scope>
</dependency>
<!-- Bridge is needed for other dependency -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>provided</scope>
</dependency>

<!-- Test Dependencies -->
Expand All @@ -57,11 +68,6 @@ SPDX-License-Identifier: Apache-2.0
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.openpojo</groupId>
<artifactId>openpojo</artifactId>
Expand Down
27 changes: 27 additions & 0 deletions service/src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2022 Alliander N.V.
SPDX-License-Identifier: Apache-2.0
-->
<Configuration strict="true" name="TestConfiguration">
<Appenders>
<Appender type="Console" name="STDOUT">
<Layout type="PatternLayout" pattern="%d %p %C{3.} [%t] %m%n"/>
</Appender>
</Appenders>

<Loggers>
<Logger name="org.lfenergy.compas" level="debug" additivity="false">
<AppenderRef ref="STDOUT"/>
</Logger>

<Logger name="com.powsybl" level="info" additivity="false">
<AppenderRef ref="STDOUT"/>
</Logger>

<Root level="debug">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>

0 comments on commit 8c0ed76

Please sign in to comment.