Skip to content

Commit

Permalink
Merge pull request #291 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 38baedc + 9e4784b commit bb04738
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 38 deletions.
21 changes: 14 additions & 7 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,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 @@ -47,27 +47,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 @@ -13,8 +13,8 @@
*/
@RegisterForReflection(targets = {
com.powsybl.triplestore.impl.rdf4j.TripleStoreFactoryServiceRDF4J.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,
javax.xml.namespace.QName.class
})
public class CompasCimMappingConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
package org.lfenergy.compas.cim.mapping.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.cim.mapping.rest.UserInfoProperties;
import org.lfenergy.compas.cim.mapping.rest.v1.model.MapRequest;
import org.lfenergy.compas.cim.mapping.rest.v1.model.MapResponse;
import org.lfenergy.compas.cim.mapping.service.CompasCimMappingService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

private CompasCimMappingService compasCimMappingService;

Expand All @@ -45,6 +45,7 @@ public CompasCimMappingResource(CompasCimMappingService compasCimMappingService)
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public MapResponse map(@Valid MapRequest request) {
LOGGER.info("Converting CIM File to SCL File");
String who = jsonWebToken.getClaim(userInfoProperties.who());
LOGGER.trace("Username used for Who {}", who);

Expand Down
6 changes: 4 additions & 2 deletions app/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ quarkus.log.level = INFO
quarkus.log.category."org.lfenergy.compas.cim.mapping".level = INFO

# Add scanning these dependencies for scanning, also used by native compilation.
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.scl2007b4.group-id = org.lfenergy.compas.core
quarkus.index-dependency.scl2007b4.artifact-id = scl2007b4
Expand All @@ -30,6 +30,8 @@ quarkus.native.additional-build-args=--initialize-at-run-time=org.eclipse.rdf4j.
%dev.quarkus.http.cors = true

%dev.quarkus.log.level = DEBUG
%dev.quarkus.log.category."com.powsybl".level = INFO
%dev.quarkus.log.category."org.eclipse.rdf4j".level = INFO
%dev.quarkus.log.category."org.lfenergy.compas.cim.mapping".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,12 +23,12 @@ 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>
<microprofile-openapi-api.version>3.0</microprofile-openapi-api.version>
<slf4j.version>2.0.3</slf4j.version>
<powsybl.version>4.10.1</powsybl.version>
<quarkus.platform.version>2.14.1.Final</quarkus.platform.version>
<microprofile-openapi-api.version>3.1</microprofile-openapi-api.version>
<powsybl.version>5.0.0</powsybl.version>
<log4j2.version>2.19.0</log4j2.version>
<mapstruct.version>1.5.3.Final</mapstruct.version>
<openpojo.version>0.9.1</openpojo.version>
</properties>
Expand Down Expand Up @@ -77,7 +77,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 Down Expand Up @@ -105,9 +105,20 @@ SPDX-License-Identifier: Apache-2.0
</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 PowSysBl dependency -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j2.version}</version>
</dependency>

<!-- Test -->
Expand Down
20 changes: 13 additions & 7 deletions service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,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 PowSysBl dependency -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>provided</scope>
</dependency>

<!-- Test Dependencies -->
Expand All @@ -67,11 +78,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
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import com.powsybl.commons.datasource.ReadOnlyMemDataSource;
import com.powsybl.triplestore.api.TripleStoreFactory;
import org.apache.commons.io.input.ReaderInputStream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lfenergy.compas.cim.mapping.exception.CompasCimMappingException;
import org.lfenergy.compas.cim.mapping.model.CimData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.enterprise.context.ApplicationScoped;
import java.io.InputStream;
Expand All @@ -28,7 +28,7 @@
*/
@ApplicationScoped
public class CgmesCimReader {
private static final Logger LOGGER = LoggerFactory.getLogger(CgmesCimReader.class);
private static final Logger LOGGER = LogManager.getLogger(CgmesCimReader.class);

/**
* Use PowSyBl to convert a CIM XML InputStream to the PowSyBl Cgmes Model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.cim.mapping.mapper;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lfenergy.compas.cim.mapping.model.*;
import org.lfenergy.compas.scl2007b4.model.*;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;

Expand All @@ -25,7 +25,7 @@
public abstract class CimToSclMapper {
public static final CimToSclMapper INSTANCE = Mappers.getMapper(CimToSclMapper.class);

private static final Logger LOGGER = LoggerFactory.getLogger(CimToSclMapper.class);
private static final Logger LOGGER = LogManager.getLogger(CimToSclMapper.class);

/**
* Top level mapping method to start the mapping of all known elements from Cgmes Model
Expand Down
23 changes: 23 additions & 0 deletions service/src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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>

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

0 comments on commit bb04738

Please sign in to comment.