Skip to content

Commit

Permalink
Merge pull request #14 from apupier/11-UpgradeToQuarkus3.0
Browse files Browse the repository at this point in the history
Upgrade to Quarkus 3.0
  • Loading branch information
pascalwilbrink authored Oct 5, 2023
2 parents 38e1541 + 29ec9c9 commit 3d0ce12
Show file tree
Hide file tree
Showing 28 changed files with 101 additions and 79 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.lfenergy.compas.sitipe.rest.exception;

import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

import java.util.HashMap;
import java.util.Map;

@Provider
public class WebApplicationExceptionHandler implements ExceptionMapper<WebApplicationException> {
@Override
public Response toResponse(WebApplicationException e) {
final Map<String, String> response = new HashMap<>();
response.put("message", e.getMessage());
return Response.status(e.getResponse().getStatus())
.entity(response)
.build();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Liveness;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

@Liveness
@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Readiness;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

@Readiness
@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import org.lfenergy.compas.sitipe.rest.v1.model.BayTypicalResponse;
import org.lfenergy.compas.sitipe.service.BayTypicalService;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import java.util.stream.Collectors;

@Authenticated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.lfenergy.compas.sitipe.dto.BayTypicalDTO;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.List;

import static org.lfenergy.compas.sitipe.Constants.SITIPE_SERVICE_V1_NS_URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import org.lfenergy.compas.sitipe.service.ImportedComponentService;
import org.lfenergy.compas.sitipe.dto.ImportedDataDTO;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import java.util.List;

@Authenticated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import org.lfenergy.compas.sitipe.dto.BayTypicalDTO;
import org.lfenergy.compas.sitipe.service.BayTypicalService;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import java.util.List;

@Authenticated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.junit.jupiter.api.AfterEach;
import org.lfenergy.compas.sitipe.helper.DatabaseCleaner;

import javax.inject.Inject;
import jakarta.inject.Inject;

public class BaseIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package org.lfenergy.compas.sitipe.helper;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.DeflaterOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import org.lfenergy.compas.sitipe.data.repository.ImportedComponentRepository;
import org.lfenergy.compas.sitipe.data.repository.SystemVersionRepository;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;

@ApplicationScoped
public class DatabaseCleaner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import org.lfenergy.compas.sitipe.data.repository.ImportedComponentRepository;
import org.lfenergy.compas.sitipe.data.repository.SystemVersionRepository;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;
import java.io.IOException;
import java.util.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.lfenergy.compas.sitipe.data.entity.SystemVersion;
import org.lfenergy.compas.sitipe.helper.SystemVersionHelper;

import javax.inject.Inject;
import jakarta.inject.Inject;

import static io.restassured.RestAssured.given;
import static java.util.Arrays.asList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.lfenergy.compas.sitipe.data.entity.ImportedComponent;
import org.lfenergy.compas.sitipe.helper.SystemVersionHelper;

import javax.inject.Inject;
import jakarta.inject.Inject;


import java.io.IOException;
Expand Down Expand Up @@ -95,12 +95,13 @@ void itShouldThrowErrorWhenImportedComponentNotFound() {
var response = given()
.when().get("/imported/{id}", 10)
.then()
.statusCode(500)
.statusCode(404)
.extract()
.response();


JsonPath jsonPath = response.jsonPath();

assertEquals("CORE-9999", ((LinkedHashMap<String, ?>)((ArrayList)((LinkedHashMap<String, ?>)jsonPath.get()).get("errorMessages")).get(0)).get("code"));
assertEquals("Imported BT Component not found", jsonPath.getString("message"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import org.lfenergy.compas.sitipe.dto.BTComponentDTO;
import org.lfenergy.compas.sitipe.helper.SystemVersionHelper;

import javax.inject.Inject;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import jakarta.inject.Inject;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down
15 changes: 4 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ SPDX-License-Identifier: Apache-2.0
<surefire-plugin.version>3.0.0-M9</surefire-plugin.version>
<sonarqube-plugin.version>3.2.0</sonarqube-plugin.version>

<compas.core.version>0.12.0</compas.core.version>
<quarkus.platform.version>2.16.3.Final</quarkus.platform.version>
<compas.core.version>0.16.0</compas.core.version>
<quarkus.platform.version>3.0.4.Final</quarkus.platform.version>

<jaxb-impl.version>2.3.8</jaxb-impl.version>
<microprofile-openapi-api.version>3.1</microprofile-openapi-api.version>
<log4j2.version>2.20.0</log4j2.version>
<openpojo.version>0.9.1</openpojo.version>
Expand Down Expand Up @@ -57,8 +56,8 @@ SPDX-License-Identifier: Apache-2.0
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-universe-bom</artifactId>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
Expand Down Expand Up @@ -91,12 +90,6 @@ SPDX-License-Identifier: Apache-2.0
<version>${compas.core.version}</version>
</dependency>

<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb-impl.version}</version>
</dependency>

<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

package org.lfenergy.compas.sitipe.data.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Entity
@Table(name = "BTComponents_")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

package org.lfenergy.compas.sitipe.data.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Entity
@Table(name = "BayTypicals_LIST_")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package org.lfenergy.compas.sitipe.data.entity;

import javax.persistence.*;
import jakarta.persistence.*;

@Entity
@Table(name = "Imported_")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

package org.lfenergy.compas.sitipe.data.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Entity()
@Table(name = "SYSTEM_VERSION_LIST_")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.quarkus.hibernate.orm.panache.PanacheRepository;
import org.lfenergy.compas.sitipe.data.entity.BTComponent;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;
import java.util.List;

@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.quarkus.hibernate.orm.panache.PanacheRepository;
import org.lfenergy.compas.sitipe.data.entity.BayTypical;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;
import java.util.List;

@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import org.lfenergy.compas.sitipe.data.entity.ImportedComponent;

import javax.enterprise.context.ApplicationScoped;
import javax.persistence.LockModeType;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.persistence.LockModeType;
import java.util.List;

@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.quarkus.hibernate.orm.panache.PanacheRepository;
import org.lfenergy.compas.sitipe.data.entity.SystemVersion;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;
import java.util.List;

@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.mockito.ArgumentCaptor;
import org.mockito.junit.jupiter.MockitoExtension;

import javax.persistence.LockModeType;
import jakarta.persistence.LockModeType;
import java.util.List;
import java.util.UUID;

Expand Down
6 changes: 3 additions & 3 deletions service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ SPDX-License-Identifier: Apache-2.0
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

package org.lfenergy.compas.sitipe.service;

import jakarta.transaction.Transactional;
import org.lfenergy.compas.sitipe.data.repository.BTComponentRepository;
import org.lfenergy.compas.sitipe.dto.BTComponentDTO;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.List;

@ApplicationScoped
Expand All @@ -23,6 +24,7 @@ public BTComponentService(
this.btComponentRepository = btComponentRepository;
}

@Transactional
public List<BTComponentDTO> getBTComponentsByBayTypicalAccessId(final String accessId) {
return btComponentRepository.findBayTypicalComponentsByTypicalAccessId(accessId)
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

package org.lfenergy.compas.sitipe.service;

import jakarta.transaction.Transactional;
import org.lfenergy.compas.sitipe.SitipeProperties;
import org.lfenergy.compas.sitipe.data.repository.BayTypicalRepository;
import org.lfenergy.compas.sitipe.data.repository.SystemVersionRepository;
import org.lfenergy.compas.sitipe.dto.BayTypicalDTO;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
Expand All @@ -33,6 +34,7 @@ public BayTypicalService(final SystemVersionRepository systemVersionRepository,
this.sitipeProperties = sitipeProperties;
}

@Transactional
public List<BayTypicalDTO> getAssignedBayTypicals() {
return this.systemVersionRepository.findByVersion(sitipeProperties.version())
.stream()
Expand Down
Loading

0 comments on commit 3d0ce12

Please sign in to comment.