aboutsummaryrefslogtreecommitdiffstats
path: root/lib/src/main
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-08-22 16:04:30 +0200
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-08-22 16:04:30 +0200
commit7348ffad6bb027b2e815b2081a9d9a827a84836e (patch)
tree2e692ee17ac0b4d831e1c645f0724df43bb6b2cb /lib/src/main
parenta42b5abcbb1bea0b20374500a2a294f31de1927a (diff)
Update to spring boot 3
Issue-ID: PORTALNG-48 Change-Id: I8e8a410bd4ea399550975fc509a9d34bb2fe9c92 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'lib/src/main')
-rw-r--r--lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java8
-rw-r--r--lib/src/main/java/org/onap/portalng/bff/config/clients/AbstractClientConfig.java4
-rw-r--r--lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java8
-rw-r--r--lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java8
-rw-r--r--lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java8
-rw-r--r--lib/src/main/java/org/onap/portalng/bff/controller/PreferencesController.java2
-rw-r--r--lib/src/main/java/org/onap/portalng/bff/utils/ErrorHandler.java8
-rw-r--r--lib/src/main/java/org/onap/portalng/bff/utils/Logger.java6
8 files changed, 25 insertions, 27 deletions
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) {