diff options
16 files changed, 40 insertions, 41 deletions
diff --git a/app/build.gradle b/app/build.gradle index 8faa791..7ad65cd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,10 +42,9 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' - implementation "org.zalando:problem:$problemVersion" - implementation "org.zalando:jackson-datatype-problem:$problemVersion" implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml' implementation "org.zalando:problem-spring-webflux:$problemSpringVersion" + implementation "org.zalando:jackson-datatype-problem:$problemVersion" implementation "org.mapstruct:mapstruct:$mapStructVersion" annotationProcessor "org.mapstruct:mapstruct-processor:$mapStructVersion" diff --git a/build.gradle b/build.gradle index e4eda6f..4ca21a3 100644 --- a/build.gradle +++ b/build.gradle @@ -7,12 +7,12 @@ allprojects { ext { // app + lib problemVersion = '0.27.1' - problemSpringVersion = '0.27.0' - mapStructVersion = '1.5.2.Final' - mapStructExtensionsVersion = '0.1.2' - logbackVersion = '7.2' + problemSpringVersion = '0.29.1' + mapStructVersion = '1.5.5.Final' + mapStructExtensionsVersion = '1.0.2' + logbackVersion = '7.4' lombokVersion = '1.18.28' // app - wiremockVersion = '3.1.3' + wiremockVersion = '4.0.4' }
\ No newline at end of file diff --git a/lib/build.gradle b/lib/build.gradle index 48997c3..76b1d42 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -8,7 +8,7 @@ plugins { id 'com.github.spotbugs' // bug linting that can be picked up by IDE } -group 'org.onap.portalng' +group 'org.onap.portal-ng' version rootProject.file('version').text.trim() dependencies { @@ -23,7 +23,6 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' - implementation "org.zalando:problem:$problemVersion" implementation "org.zalando:jackson-datatype-problem:$problemVersion" implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml' implementation "org.zalando:problem-spring-webflux:$problemSpringVersion" diff --git a/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java index 0a78da1..7e773ed 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java @@ -21,14 +21,13 @@ package org.onap.portalng.bff.config; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import java.util.List; import java.util.Map; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.ConstructorBinding; import org.zalando.problem.Problem; import org.zalando.problem.Status; import reactor.core.publisher.Mono; @@ -38,7 +37,6 @@ import reactor.core.publisher.Mono; * urls. */ @Valid -@ConstructorBinding @ConfigurationProperties("bff") @Data public class BffConfig { diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/AbstractClientConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/AbstractClientConfig.java index 75dce3d..8856298 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/AbstractClientConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/AbstractClientConfig.java @@ -26,7 +26,7 @@ import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.http.client.reactive.ClientHttpConnector; import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.web.reactive.function.client.ExchangeFilterFunction; @@ -56,7 +56,7 @@ public abstract class AbstractClientConfig<E> { } protected abstract DownstreamApiProblemException mapException( - E errorResponse, HttpStatus httpStatus); + E errorResponse, HttpStatusCode httpStatusCode); protected ClientHttpConnector getClientHttpConnector() { // ConnectionTimeouts introduced due to diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java index d96db71..9880ef7 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java @@ -34,7 +34,7 @@ import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.http.client.reactive.ClientHttpConnector; import org.springframework.web.reactive.function.client.ExchangeFilterFunction; import org.springframework.web.reactive.function.client.WebClient; @@ -78,18 +78,18 @@ public class KeycloakConfig extends AbstractClientConfig<ErrorResponseKeycloakDt @Override protected DownstreamApiProblemException mapException( - ErrorResponseKeycloakDto errorResponse, HttpStatus httpStatus) { + ErrorResponseKeycloakDto errorResponse, HttpStatusCode httpStatusCode) { String errorDetail = errorResponse.getErrorMessage() != null ? errorResponse.getErrorMessage() : errorResponse.getError(); return DownstreamApiProblemException.builder() - .title(httpStatus.toString()) + .title(httpStatusCode.toString()) .detail(errorDetail) .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.KEYCLOAK.toString()) .downstreamMessageId("not set by downstream system") - .downstreamStatus(httpStatus.value()) + .downstreamStatus(httpStatusCode.value()) .build(); } diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java index 00cda73..e6904b1 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java @@ -38,7 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.web.reactive.function.client.ExchangeFilterFunction; import org.springframework.web.reactive.function.client.WebClient; @@ -85,13 +85,13 @@ public class PortalHistoryConfig extends AbstractClientConfig<ProblemPortalHisto @Override protected DownstreamApiProblemException mapException( - ProblemPortalHistoryDto errorResponse, HttpStatus httpStatus) { + ProblemPortalHistoryDto errorResponse, HttpStatusCode httpStatusCode) { return DownstreamApiProblemException.builder() - .title(httpStatus.toString()) + .title(httpStatusCode.toString()) .detail(errorResponse.getDetail()) .downstreamMessageId(errorResponse.getType()) .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.PORTAL_HISTORY.toString()) - .downstreamStatus(httpStatus.value()) + .downstreamStatus(httpStatusCode.value()) .build(); } } diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java index c1aacbe..8c2eba4 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java @@ -37,7 +37,7 @@ import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.web.reactive.function.client.ExchangeFilterFunction; import org.springframework.web.reactive.function.client.WebClient; @@ -84,13 +84,13 @@ public class PortalPrefsConfig extends AbstractClientConfig<ProblemPortalPrefsDt @Override protected DownstreamApiProblemException mapException( - ProblemPortalPrefsDto errorResponse, HttpStatus httpStatus) { + ProblemPortalPrefsDto errorResponse, HttpStatusCode httpStatusCode) { return DownstreamApiProblemException.builder() - .title(httpStatus.toString()) + .title(httpStatusCode.toString()) .detail(errorResponse.getDetail()) .downstreamMessageId(errorResponse.getType()) .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.PORTAL_PREFS.toString()) - .downstreamStatus(httpStatus.value()) + .downstreamStatus(httpStatusCode.value()) .build(); } } diff --git a/lib/src/main/java/org/onap/portalng/bff/controller/PreferencesController.java b/lib/src/main/java/org/onap/portalng/bff/controller/PreferencesController.java index c43b4c2..af665db 100644 --- a/lib/src/main/java/org/onap/portalng/bff/controller/PreferencesController.java +++ b/lib/src/main/java/org/onap/portalng/bff/controller/PreferencesController.java @@ -21,7 +21,7 @@ package org.onap.portalng.bff.controller; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.onap.portalng.bff.config.BffConfig; import org.onap.portalng.bff.openapi.server.api.PreferencesApi; import org.onap.portalng.bff.openapi.server.model.CreatePreferencesRequestApiDto; diff --git a/lib/src/main/java/org/onap/portalng/bff/utils/ErrorHandler.java b/lib/src/main/java/org/onap/portalng/bff/utils/ErrorHandler.java index 0b198ac..919f3b8 100644 --- a/lib/src/main/java/org/onap/portalng/bff/utils/ErrorHandler.java +++ b/lib/src/main/java/org/onap/portalng/bff/utils/ErrorHandler.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.Objects; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; -import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; public class ErrorHandler { /** @@ -44,7 +44,7 @@ public class ErrorHandler { } public static DownstreamApiProblemException getDownstreamApiProblemException( - HttpStatus httpStatus, + HttpStatusCode httpStatusCode, List<String> variables, String text, String messageId, @@ -55,11 +55,11 @@ public class ErrorHandler { : null; return DownstreamApiProblemException.builder() - .title(httpStatus.toString()) + .title(httpStatusCode.toString()) .detail(errorDetail) .downstreamMessageId(Objects.requireNonNullElse(messageId, "not set by downstream system")) .downstreamSystem(downStreamSystem.toString()) - .downstreamStatus(httpStatus.value()) + .downstreamStatus(httpStatusCode.value()) .build(); } } diff --git a/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java b/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java index 3c431fb..c20cd49 100644 --- a/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java +++ b/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java @@ -24,7 +24,7 @@ package org.onap.portalng.bff.utils; import java.net.URI; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; @Slf4j public class Logger { @@ -39,8 +39,8 @@ public class Logger { log.info("bff - request - X-Request-Id {} {} {}", xRequestId, methode, path); } - public static void responseLog(String xRequestId, HttpStatus code) { - log.info("bff - response - X-Request-Id {} {}", xRequestId, code); + public static void responseLog(String xRequestId, HttpStatusCode httpStatusCode) { + log.info("bff - response - X-Request-Id {} {}", xRequestId, httpStatusCode); } public static void errorLog(String xRequestId, String msg, String id, String app) { diff --git a/openapi/client-portal-history/build.gradle b/openapi/client-portal-history/build.gradle index 4420d80..a087be9 100644 --- a/openapi/client-portal-history/build.gradle +++ b/openapi/client-portal-history/build.gradle @@ -19,7 +19,8 @@ openApiGenerate { configOptions = [ openApiNullable : "false", dateLibrary : "java8", - serializationLibrary: "jackson" + serializationLibrary: "jackson", + useJakartaEe : "true", ] typeMappings = [ "File": "org.springframework.core.io.buffer.DataBuffer" diff --git a/openapi/client-portal-keycloak/build.gradle b/openapi/client-portal-keycloak/build.gradle index d7984db..22da1f2 100644 --- a/openapi/client-portal-keycloak/build.gradle +++ b/openapi/client-portal-keycloak/build.gradle @@ -19,7 +19,8 @@ openApiGenerate { configOptions = [ openApiNullable : "false", dateLibrary : "java8", - serializationLibrary: "jackson" + serializationLibrary: "jackson", + useJakartaEe : "true", ] typeMappings = [ "File": "org.springframework.core.io.buffer.DataBuffer" diff --git a/openapi/client-portal-prefs/build.gradle b/openapi/client-portal-prefs/build.gradle index 3229244..9eaa4b0 100644 --- a/openapi/client-portal-prefs/build.gradle +++ b/openapi/client-portal-prefs/build.gradle @@ -19,7 +19,8 @@ openApiGenerate { configOptions = [ openApiNullable : "false", dateLibrary : "java8", - serializationLibrary: "jackson" + serializationLibrary: "jackson", + useJakartaEe : "true", ] typeMappings = [ "File": "org.springframework.core.io.buffer.DataBuffer" diff --git a/openapi/server/build.gradle b/openapi/server/build.gradle index 017a618..99e401b 100644 --- a/openapi/server/build.gradle +++ b/openapi/server/build.gradle @@ -31,6 +31,7 @@ openApiGenerate { interfaceOnly: "true", useTags: "true", reactive: "true", + useSpringBoot3: "true", ] generateApiTests = false generateApiDocumentation = true diff --git a/settings.gradle b/settings.gradle index 263c125..6044422 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,10 +3,9 @@ pluginManagement { // https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_version_management plugins { id 'io.spring.dependency-management' version '1.1.2' - id 'org.springframework.boot' version '2.7.14' + id 'org.springframework.boot' version '3.1.2' id 'org.openapi.generator' version '7.0.0-beta' id 'com.github.johnrengelman.shadow' version '7.1.2' - id 'com.github.hierynomus.license' version '0.16.1' id 'com.gorylenko.gradle-git-properties' version '2.4.1' id 'com.diffplug.spotless' version '6.20.0' id 'com.github.spotbugs' version '5.0.14' |