Skip to content

Commit

Permalink
Merge pull request #77 from com-pas/develop
Browse files Browse the repository at this point in the history
New Release with refactoring
  • Loading branch information
Dennis Labordus authored Oct 5, 2021
2 parents e297ad9 + cb92e82 commit 947066f
Show file tree
Hide file tree
Showing 22 changed files with 72 additions and 84 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.11
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
distribution: 'zulu'
java-version: '11'
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v18
uses: whelk-io/maven-settings-xml-action@v20
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
- name: Set up JDK 1.11
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
distribution: 'zulu'
java-version: '11'
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v18
uses: whelk-io/maven-settings-xml-action@v20
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up JDK 1.11
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
distribution: 'zulu'
java-version: '11'
Expand All @@ -32,7 +32,7 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v18
uses: whelk-io/maven-settings-xml-action@v20
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
Expand Down
11 changes: 1 addition & 10 deletions rest-commons/pom.xml → jaxrs-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SPDX-License-Identifier: Apache-2.0
<version>local-SNAPSHOT</version>
</parent>

<artifactId>rest-commons</artifactId>
<artifactId>jaxrs-commons</artifactId>
<packaging>jar</packaging>

<dependencies>
Expand Down Expand Up @@ -74,13 +74,4 @@ SPDX-License-Identifier: Apache-2.0
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jboss.jandex</groupId>
<artifactId>jandex-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.jaxrs;

public class JaxrsConstants {
JaxrsConstants() {
throw new UnsupportedOperationException("JaxrsConstants class");
}

public static final String COMPAS_COMMONS_V1_NS_URI = "https://www.lfenergy.org/compas/commons/v1";
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.exception;
package org.lfenergy.compas.core.jaxrs.exception;

import org.lfenergy.compas.core.commons.exception.CompasException;
import org.lfenergy.compas.core.rest.model.ErrorResponse;
import org.lfenergy.compas.core.jaxrs.model.ErrorResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.exception;
package org.lfenergy.compas.core.jaxrs.exception;

import org.lfenergy.compas.core.rest.model.ErrorResponse;
import org.lfenergy.compas.core.jaxrs.model.ErrorResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.exception;
package org.lfenergy.compas.core.jaxrs.exception;

import org.lfenergy.compas.core.rest.model.ErrorResponse;
import org.lfenergy.compas.core.jaxrs.model.ErrorResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.model;
package org.lfenergy.compas.core.jaxrs.model;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;

import static org.lfenergy.compas.core.rest.RestConstants.COMPAS_REST_V1_NS_URI;
import static org.lfenergy.compas.core.jaxrs.JaxrsConstants.COMPAS_COMMONS_V1_NS_URI;

@XmlAccessorType(XmlAccessType.FIELD)
public class ErrorMessage {
@XmlElement(name = "Code", namespace = COMPAS_REST_V1_NS_URI, required = true)
@XmlElement(name = "Code", namespace = COMPAS_COMMONS_V1_NS_URI, required = true)
private String code;
@XmlElement(name = "Message", namespace = COMPAS_REST_V1_NS_URI, required = true)
@XmlElement(name = "Message", namespace = COMPAS_COMMONS_V1_NS_URI, required = true)
private String message;
@XmlElement(name = "Property", namespace = COMPAS_REST_V1_NS_URI, required = true)
@XmlElement(name = "Property", namespace = COMPAS_COMMONS_V1_NS_URI, required = true)
private String property;

public ErrorMessage() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.model;
package org.lfenergy.compas.core.jaxrs.model;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
Expand All @@ -10,12 +10,12 @@
import java.util.ArrayList;
import java.util.List;

import static org.lfenergy.compas.core.rest.RestConstants.COMPAS_REST_V1_NS_URI;
import static org.lfenergy.compas.core.jaxrs.JaxrsConstants.COMPAS_COMMONS_V1_NS_URI;

@XmlRootElement(name = "ErrorResponse", namespace = COMPAS_REST_V1_NS_URI)
@XmlRootElement(name = "ErrorResponse", namespace = COMPAS_COMMONS_V1_NS_URI)
@XmlAccessorType(XmlAccessType.FIELD)
public class ErrorResponse {
@XmlElement(name = "ErrorMessage", namespace = COMPAS_REST_V1_NS_URI, required = true)
@XmlElement(name = "ErrorMessage", namespace = COMPAS_COMMONS_V1_NS_URI, required = true)
private List<ErrorMessage> errorMessages = new ArrayList<>();

public void setErrorMessages(List<ErrorMessage> errorMessages) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
@XmlSchema(xmlns = {@XmlNs(prefix = "compas-commons", namespaceURI = COMPAS_COMMONS_V1_NS_URI)})
package org.lfenergy.compas.core.jaxrs.model;

import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlSchema;

import static org.lfenergy.compas.core.jaxrs.JaxrsConstants.COMPAS_COMMONS_V1_NS_URI;
11 changes: 11 additions & 0 deletions jaxrs-commons/src/main/resources/META-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Alliander N.V.
SPDX-License-Identifier: Apache-2.0
-->
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
bean-discovery-mode="annotated" version="2.0">
</beans>
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest;
package org.lfenergy.compas.core.jaxrs;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertThrows;

class RestConstantsTest {
class JaxrsConstantsTest {
@Test
void constructor_WhenConstructorCalled_ThenShouldThrowExceptionCauseForbidden() {
assertThrows(UnsupportedOperationException.class, RestConstants::new);
assertThrows(UnsupportedOperationException.class, JaxrsConstants::new);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.exception;
package org.lfenergy.compas.core.jaxrs.exception;

import org.junit.jupiter.api.Test;
import org.lfenergy.compas.core.commons.exception.CompasException;
import org.lfenergy.compas.core.rest.model.ErrorResponse;
import org.lfenergy.compas.core.jaxrs.model.ErrorResponse;

import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.exception;
package org.lfenergy.compas.core.jaxrs.exception;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.lfenergy.compas.core.rest.model.ErrorResponse;
import org.lfenergy.compas.core.jaxrs.model.ErrorResponse;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.exception;
package org.lfenergy.compas.core.jaxrs.exception;

import org.junit.jupiter.api.Test;
import org.lfenergy.compas.core.rest.model.ErrorResponse;
import org.lfenergy.compas.core.jaxrs.model.ErrorResponse;

import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.lfenergy.compas.core.commons.exception.CompasErrorCode.UNKNOWN_EXCEPTION_ERROR;
import static org.lfenergy.compas.core.rest.exception.GenericExceptionHandler.ERROR_MESSAGE;
import static org.lfenergy.compas.core.jaxrs.exception.GenericExceptionHandler.ERROR_MESSAGE;

class GenericExceptionHandlerTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.model;
package org.lfenergy.compas.core.jaxrs.model;

import com.openpojo.reflection.impl.PojoClassFactory;
import com.openpojo.validation.ValidatorBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.model;
package org.lfenergy.compas.core.jaxrs.model;

import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.rest.model;
package org.lfenergy.compas.core.jaxrs.model;

import org.junit.jupiter.api.Test;

Expand Down
22 changes: 4 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ SPDX-License-Identifier: Apache-2.0

<compas.scl.xsd.version>0.0.4</compas.scl.xsd.version>
<slf4j.version>1.7.32</slf4j.version>
<jackson.version>2.12.5</jackson.version>
<jackson.version>2.13.0</jackson.version>
<jaxb.bind.version>2.3.3</jaxb.bind.version>
<junit.jupiter.version>5.7.2</junit.jupiter.version>
<junit.jupiter.version>5.8.1</junit.jupiter.version>
<mockito-junit-jupiter.version>3.12.4</mockito-junit-jupiter.version>
<openpojo.version>0.9.1</openpojo.version>
</properties>
Expand All @@ -46,7 +46,7 @@ SPDX-License-Identifier: Apache-2.0

<modules>
<module>commons</module>
<module>rest-commons</module>
<module>jaxrs-commons</module>
<module>scl-extension</module>
<module>scl2003</module>
<module>scl2007b</module>
Expand Down Expand Up @@ -119,7 +119,7 @@ SPDX-License-Identifier: Apache-2.0
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-core</artifactId>
<version>4.7.1.Final</version>
<version>4.7.2.Final</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -214,20 +214,6 @@ SPDX-License-Identifier: Apache-2.0
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>

<plugin>
<groupId>org.jboss.jandex</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>make-index</id>
<goals>
<goal>jandex</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 947066f

Please sign in to comment.