diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2023-08-17 07:03:55 +0000 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2023-08-17 07:03:55 +0000 |
commit | c2a9ab935340303230cf66d64ecc0bf0418cc6f3 (patch) | |
tree | eb56515a0d6d2eebc7f7640ee4a87f996c75b9ca | |
parent | 56552b36e41b39325ea9f7df17af6a1c78cb790d (diff) |
Update history to Spring Boot 3
Issue-ID: PORTALNG-41
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: I777e5921dcb0860764d1959fbcbc4e070b5238f8
11 files changed, 26 insertions, 62 deletions
diff --git a/app/build.gradle b/app/build.gradle index 160f0c4..6bc77d9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,6 @@ plugins { id 'io.spring.dependency-management' id 'org.springframework.boot' id 'jacoco' - id 'org.sonarqube' id 'com.github.hierynomus.license' id 'com.gorylenko.gradle-git-properties' } @@ -19,14 +18,13 @@ configurations { } ext { - vavrVersion = '0.10.4' problemVersion = '0.27.1' problemSpringVersion = '0.27.0' - logbackVersion = '1.2.11' - logstashLogbackVersion = '7.2' - embedMongoVersion = '3.2.8' - embedMongoIntegrationVersion = '1.1.0-spring27x' - springCloudWiremockVersion = '3.1.0' + logbackVersion = '1.4.11' + logstashLogbackVersion = '7.4' + embedMongoVersion = '4.7.0' + embedMongoIntegrationVersion = '4.7.0' + springCloudWiremockVersion = '4.0.3' } dependencies { @@ -37,7 +35,6 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.springframework.boot:spring-boot-starter-validation' - implementation "io.vavr:vavr:$vavrVersion" implementation "org.zalando:problem:$problemVersion" implementation "org.zalando:jackson-datatype-problem:$problemVersion" implementation "org.zalando:problem-spring-webflux:$problemSpringVersion" @@ -57,7 +54,7 @@ dependencies { testImplementation 'io.rest-assured:rest-assured' testImplementation "org.springframework.cloud:spring-cloud-contract-wiremock:$springCloudWiremockVersion" testImplementation "de.flapdoodle.embed:de.flapdoodle.embed.mongo:$embedMongoVersion" - testImplementation "de.flapdoodle.embed:de.flapdoodle.embed.mongo.spring:$embedMongoIntegrationVersion" + testImplementation "de.flapdoodle.embed:de.flapdoodle.embed.mongo.spring30x:$embedMongoIntegrationVersion" testCompileOnly 'org.projectlombok:lombok' testAnnotationProcessor 'org.projectlombok:lombok' } diff --git a/app/src/main/java/org/onap/portal/history/configuration/PortalHistoryConfig.java b/app/src/main/java/org/onap/portal/history/configuration/PortalHistoryConfig.java index 85304b9..9a42214 100644 --- a/app/src/main/java/org/onap/portal/history/configuration/PortalHistoryConfig.java +++ b/app/src/main/java/org/onap/portal/history/configuration/PortalHistoryConfig.java @@ -23,12 +23,10 @@ package org.onap.portal.history.configuration; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.ConstructorBinding; -import javax.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotBlank; @Data -@ConstructorBinding @ConfigurationProperties("portal-history") public class PortalHistoryConfig { diff --git a/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java b/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java index 529cbc3..2295a5f 100644 --- a/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java +++ b/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java @@ -24,7 +24,6 @@ package org.onap.portal.history.configuration; import org.onap.portal.history.services.ActionsService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -37,7 +36,6 @@ public class SchedulerConfig { private final ActionsService actionsService; private final PortalHistoryConfig portalHistoryConfig; - @Autowired public SchedulerConfig(ActionsService actionsService, PortalHistoryConfig portalHistoryConfig){ this.actionsService = actionsService; this.portalHistoryConfig = portalHistoryConfig; diff --git a/app/src/main/java/org/onap/portal/history/configuration/package-info.java b/app/src/main/java/org/onap/portal/history/configuration/package-info.java deleted file mode 100644 index ccaa303..0000000 --- a/app/src/main/java/org/onap/portal/history/configuration/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * - * Copyright (c) 2022. Deutsche Telekom AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * - * - */ - -@ParametersAreNonnullByDefault -package org.onap.portal.history.configuration; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/app/src/main/java/org/onap/portal/history/controller/ActionsController.java b/app/src/main/java/org/onap/portal/history/controller/ActionsController.java index ab59806..8339d65 100644 --- a/app/src/main/java/org/onap/portal/history/controller/ActionsController.java +++ b/app/src/main/java/org/onap/portal/history/controller/ActionsController.java @@ -23,10 +23,6 @@ package org.onap.portal.history.controller; import java.util.Optional; -import javax.validation.Valid; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; - import org.onap.portal.history.configuration.PortalHistoryConfig; import org.onap.portal.history.openapi.api.ActionsApi; import org.onap.portal.history.openapi.model.ActionResponse; diff --git a/app/src/main/java/org/onap/portal/history/util/Logger.java b/app/src/main/java/org/onap/portal/history/util/Logger.java index 4cb3420..01b159c 100644 --- a/app/src/main/java/org/onap/portal/history/util/Logger.java +++ b/app/src/main/java/org/onap/portal/history/util/Logger.java @@ -24,6 +24,7 @@ package org.onap.portal.history.util; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import java.net.URI; @@ -47,8 +48,8 @@ public class Logger { * @param xRequestId from the request header * @param code http status of the response */ - public static void responseLog(String xRequestId, HttpStatus code) { - log.info("Portal-history - response - X-Request-Id {} {}", xRequestId, code); + public static void responseLog(String xRequestId, HttpStatusCode httpStatusCode) { + log.info("Portal-history - response - X-Request-Id {} {}", xRequestId, httpStatusCode); } /** diff --git a/app/src/test/java/org/onap/portal/history/BaseIntegrationTest.java b/app/src/test/java/org/onap/portal/history/BaseIntegrationTest.java index e00b770..866ce33 100644 --- a/app/src/test/java/org/onap/portal/history/BaseIntegrationTest.java +++ b/app/src/test/java/org/onap/portal/history/BaseIntegrationTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.BeforeEach; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.http.MediaType; diff --git a/app/src/test/resources/application.yml b/app/src/test/resources/application.yml index 521befe..df38a79 100644 --- a/app/src/test/resources/application.yml +++ b/app/src/test/resources/application.yml @@ -3,9 +3,6 @@ server: address: 0.0.0.0 spring: - mongodb: - embedded: - version: 3.2.8 jackson: serialization: # needed for serializing objects of type object @@ -16,6 +13,12 @@ spring: jwt: jwk-set-uri: http://localhost:${wiremock.server.port}/auth/realms/ONAP/protocol/openid-connect/certs #Keycloak Endpoint +de: + flapdoodle: + mongodb: + embedded: + version: 5.0.15 + portal-history: realm: ONAP save-interval: 72 diff --git a/buildSrc/src/main/groovy/org.onap.portal.history.java-common-conventions.gradle b/buildSrc/src/main/groovy/org.onap.portal.history.java-common-conventions.gradle index 16cf302..ee5af57 100644 --- a/buildSrc/src/main/groovy/org.onap.portal.history.java-common-conventions.gradle +++ b/buildSrc/src/main/groovy/org.onap.portal.history.java-common-conventions.gradle @@ -16,7 +16,7 @@ maven { } dependencies { - implementation 'org.springframework.boot:spring-boot-starter-webflux:2.5.5' + implementation 'org.springframework.boot:spring-boot-starter-webflux:3.1.2' // Use JUnit Jupiter for testing. testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2' diff --git a/openapi/build.gradle b/openapi/build.gradle index 63c32b5..7ec2657 100644 --- a/openapi/build.gradle +++ b/openapi/build.gradle @@ -4,18 +4,14 @@ plugins { } ext { - openapiVersion = '6.6.0' + openapiVersion = '7.0.0-beta' } dependencies { implementation "org.openapitools:openapi-generator:$openapiVersion" - constraints { - implementation('io.swagger.core.v3:swagger-annotations:2.2.5') { - because 'there is a dependency conflict between swagger-parser versions 2 and 3 (https://github.com/OpenAPITools/openapi-generator/issues/14901)' - } - implementation('javax.validation:validation-api:2.0.1.Final') { - because 'because min max validation wouldnt work with older version of dependency' + implementation('jakarta.validation:jakarta.validation-api:3.0.2') { + because 'because min max validation wouldnt work with older versions of dependency' } } } @@ -34,7 +30,8 @@ openApiGenerate { interfaceOnly: "true", useTags: "true", useOptional: "true", - reactive: "true" + reactive: "true", + useSpringBoot3: "true" ] generateApiTests = false generateApiDocumentation = false diff --git a/settings.gradle b/settings.gradle index 45322ff..40bf5ee 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,11 +2,10 @@ // https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_version_management pluginManagement { plugins { - id 'org.springframework.boot' version '2.7.3' - id 'io.spring.dependency-management' version '1.0.13.RELEASE' - id 'org.sonarqube' version '3.4.0.2513' + id 'org.springframework.boot' version '3.1.2' + id 'io.spring.dependency-management' version '1.1.2' id 'com.github.hierynomus.license' version '0.16.1' - id 'org.openapi.generator' version '6.6.0' + id 'org.openapi.generator' version '7.0.0-beta' id 'com.gorylenko.gradle-git-properties' version '2.4.1' } // https://docs.gradle.org/current/userguide/plugins.html#sec:custom_plugin_repositories |