From 4407ea6948a060734a4f2836b11bd2d5c6ea6194 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Fri, 11 Aug 2023 15:10:44 +0100 Subject: Upgrade Java 17 Issue-ID: POLICY-4673 Change-Id: I01fd3677687b5d2e065d0cc131b338ed841d7e99 Signed-off-by: adheli.tavares --- .../participant-impl-a1pms/pom.xml | 2 +- .../participant/a1pms/config/SecurityConfig.java | 10 ++--- .../a1pms/exception/A1PolicyServiceException.java | 5 ++- .../AutomationCompositionElementHandler.java | 6 +-- .../a1pms/models/A1PolicyServiceEntity.java | 4 +- .../a1pms/models/ConfigurationEntity.java | 4 +- .../a1pms/parameters/A1PmsParameters.java | 2 +- .../parameters/A1PmsParticipantParameters.java | 4 +- .../participant/a1pms/webclient/AcA1PmsClient.java | 18 ++++---- .../a1pms/rest/ActuatorControllerTest.java | 19 ++++----- .../a1pms/utils/CommonActuatorController.java | 12 +++--- .../participant/a1pms/utils/MockRestEndpoint.java | 14 +++---- .../participant-impl-acelement/pom.xml | 6 ++- .../clamp/acm/element/config/SecurityConfig.java | 10 ++--- .../acm/element/handler/MessageActivator.java | 6 +-- .../clamp/acm/element/handler/MessageHandler.java | 10 ++--- .../acm/element/handler/MessagePublisher.java | 2 +- .../acm/element/main/parameters/AcElement.java | 4 +- .../main/rest/AcElementErrorController.java | 4 +- .../clamp/acm/element/service/ConfigService.java | 2 +- .../clamp/acm/element/service/SinkService.java | 2 +- .../clamp/acm/element/service/StarterService.java | 2 +- .../acm/element/rest/AcElementControllerTest.java | 2 +- .../acm/element/rest/ActuatorControllerTest.java | 49 +++++++++++----------- .../element/utils/CommonActuatorController.java | 12 +++--- .../participant-impl/participant-impl-cds/pom.xml | 2 +- .../participant-impl/participant-impl-http/pom.xml | 2 +- .../participant/http/config/SecurityConfig.java | 10 ++--- .../AutomationCompositionElementHandler.java | 7 ++-- .../http/main/models/ConfigRequest.java | 10 ++--- .../http/main/models/ConfigurationEntity.java | 4 +- .../participant/http/main/models/RestParams.java | 6 +-- .../http/main/webclient/AcHttpClient.java | 2 +- .../http/parameters/ParticipantHttpParameters.java | 4 +- .../http/rest/ActuatorControllerTest.java | 19 ++++----- .../http/utils/CommonActuatorController.java | 12 +++--- .../participant/http/utils/MockRestEndpoint.java | 12 +++--- .../participant-impl-kserve/pom.xml | 2 +- .../clamp/acm/participant/kserve/Application.java | 17 -------- .../participant/kserve/config/ApiClientConfig.java | 44 +++++++++++++++++++ .../participant/kserve/config/SecurityConfig.java | 13 +++--- .../kserve/exception/KserveException.java | 2 +- .../AutomationCompositionElementHandler.java | 4 +- .../acm/participant/kserve/k8s/KserveClient.java | 2 +- .../kserve/models/ConfigurationEntity.java | 4 +- .../kserve/models/KserveInferenceEntity.java | 2 +- .../CustomResourceDefinitionParameters.java | 2 +- .../parameters/KserveParticipantParameters.java | 4 +- .../src/main/resources/config/application.yaml | 4 +- .../kserve/rest/ActuatorControllerTest.java | 19 ++++----- .../kserve/utils/CommonActuatorController.java | 12 +++--- .../participant-impl-kubernetes/pom.xml | 6 ++- .../configurations/ParticipantConfig.java | 44 ------------------- .../kubernetes/configurations/SecurityConfig.java | 10 ++--- .../AutomationCompositionElementHandler.java | 4 +- .../parameters/ParticipantK8sParameters.java | 6 +-- .../src/main/resources/config/application.yaml | 6 +++ .../parameters/ParticipantK8sParametersTest.java | 10 ++--- .../kubernetes/rest/ActuatorControllerTest.java | 23 +++++----- .../kubernetes/service/ChartStoreTest.java | 2 +- .../kubernetes/utils/CommonActuatorController.java | 16 ++++--- .../participant/kubernetes/utils/TestUtils.java | 2 +- .../participant-impl-policy/pom.xml | 2 +- .../policy/client/AbstractHttpClient.java | 10 ++--- .../policy/client/PolicyApiHttpClient.java | 6 +-- .../policy/client/PolicyPapHttpClient.java | 24 ++++------- .../participant/policy/config/SecurityConfig.java | 10 ++--- .../AutomationCompositionElementHandler.java | 2 +- .../parameters/ParticipantPolicyParameters.java | 6 +-- .../participant/policy/client/HttpClientTest.java | 11 ++--- .../AutomationCompositionElementHandlerTest.java | 2 +- .../ParticipantPolicyParametersTest.java | 4 +- .../policy/main/rest/ActuatorControllerTest.java | 21 +++++----- .../main/utils/CommonActuatorController.java | 12 +++--- .../policy/main/utils/MockRestEndpoint.java | 10 ++--- .../participant-impl-simulator/pom.xml | 6 ++- .../acm/participant/sim/config/SecurityConfig.java | 10 ++--- .../sim/parameters/ParticipantSimParameters.java | 4 +- .../participant/sim/rest/SimulatorController.java | 4 +- .../parameters/ParticipantSimParametersTest.java | 4 +- .../sim/rest/ActuatorControllerTest.java | 19 ++++----- .../sim/utils/CommonActuatorController.java | 12 +++--- participant/participant-impl/pom.xml | 2 +- 83 files changed, 360 insertions(+), 382 deletions(-) mode change 100644 => 100755 participant/participant-impl/participant-impl-acelement/pom.xml mode change 100644 => 100755 participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java mode change 100644 => 100755 participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java mode change 100644 => 100755 participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/AcElement.java mode change 100644 => 100755 participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AcElementErrorController.java mode change 100644 => 100755 participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ConfigService.java mode change 100644 => 100755 participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java mode change 100644 => 100755 participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/AcElementControllerTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/utils/CommonActuatorController.java mode change 100644 => 100755 participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java mode change 100644 => 100755 participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java mode change 100644 => 100755 participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java mode change 100644 => 100755 participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java mode change 100644 => 100755 participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java mode change 100644 => 100755 participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/MockRestEndpoint.java create mode 100755 participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/config/ApiClientConfig.java mode change 100644 => 100755 participant/participant-impl/participant-impl-kubernetes/pom.xml delete mode 100644 participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/ParticipantConfig.java mode change 100644 => 100755 participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java mode change 100644 => 100755 participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParameters.java mode change 100644 => 100755 participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml mode change 100644 => 100755 participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/AbstractHttpClient.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyApiHttpClient.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyPapHttpClient.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParameters.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/client/HttpClientTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParametersTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/rest/ActuatorControllerTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/CommonActuatorController.java mode change 100644 => 100755 participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/MockRestEndpoint.java mode change 100644 => 100755 participant/participant-impl/participant-impl-simulator/pom.xml mode change 100644 => 100755 participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/parameters/ParticipantSimParameters.java mode change 100644 => 100755 participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/parameters/ParticipantSimParametersTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/rest/ActuatorControllerTest.java mode change 100644 => 100755 participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/utils/CommonActuatorController.java (limited to 'participant/participant-impl') diff --git a/participant/participant-impl/participant-impl-a1pms/pom.xml b/participant/participant-impl/participant-impl-a1pms/pom.xml index 4d88eff47..75e201fbc 100755 --- a/participant/participant-impl/participant-impl-a1pms/pom.xml +++ b/participant/participant-impl/participant-impl-a1pms/pom.xml @@ -25,7 +25,7 @@ org.onap.policy.clamp.participant policy-clamp-participant-impl - 7.0.0-SNAPSHOT + 7.0.1-SNAPSHOT policy-clamp-participant-impl-a1pms diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/config/SecurityConfig.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/config/SecurityConfig.java index 9a62e0b30..23ad3cded 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/config/SecurityConfig.java +++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/config/SecurityConfig.java @@ -20,7 +20,9 @@ package org.onap.policy.clamp.acm.participant.a1pms.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.web.SecurityFilterChain; /** @@ -37,11 +39,9 @@ public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http - .httpBasic() - .and() - .authorizeHttpRequests().anyRequest().authenticated() - .and() - .csrf().disable(); + .httpBasic(Customizer.withDefaults()) + .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated()) + .csrf(AbstractHttpConfigurer::disable); return http.build(); } } diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/exception/A1PolicyServiceException.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/exception/A1PolicyServiceException.java index b01e451c0..3491970ca 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/exception/A1PolicyServiceException.java +++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/exception/A1PolicyServiceException.java @@ -20,10 +20,13 @@ package org.onap.policy.clamp.acm.participant.a1pms.exception; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; +import java.io.Serial; import org.onap.policy.models.base.PfModelException; public class A1PolicyServiceException extends PfModelException { + + @Serial private static final long serialVersionUID = 6438746904567105054L; public A1PolicyServiceException(int statusCode, String message) { diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java index e2a5367f6..098f2cfe5 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java +++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java @@ -20,13 +20,13 @@ package org.onap.policy.clamp.acm.participant.a1pms.handler; +import jakarta.validation.Validation; +import jakarta.validation.ValidationException; import java.lang.invoke.MethodHandles; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import javax.validation.Validation; -import javax.validation.ValidationException; import lombok.AccessLevel; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -75,7 +75,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio * * @param automationCompositionId the ID of the automation composition * @param automationCompositionElementId the ID of the automation composition element - * @throws PfModelException in case of a model exception + * @throws A1PolicyServiceException in case of a model exception */ @Override public void undeploy(UUID automationCompositionId, UUID automationCompositionElementId) diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/models/A1PolicyServiceEntity.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/models/A1PolicyServiceEntity.java index 991cb926f..2f4b88c91 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/models/A1PolicyServiceEntity.java +++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/models/A1PolicyServiceEntity.java @@ -24,8 +24,8 @@ import com.fasterxml.jackson.annotation.JsonGetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.annotation.JsonNaming; -import javax.validation.constraints.NotNull; -import javax.ws.rs.DefaultValue; +import jakarta.validation.constraints.NotNull; +import jakarta.ws.rs.DefaultValue; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/models/ConfigurationEntity.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/models/ConfigurationEntity.java index 80715c27c..584b95590 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/models/ConfigurationEntity.java +++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/models/ConfigurationEntity.java @@ -20,9 +20,9 @@ package org.onap.policy.clamp.acm.participant.a1pms.models; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/parameters/A1PmsParameters.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/parameters/A1PmsParameters.java index 704ef4153..7f2ecf56a 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/parameters/A1PmsParameters.java +++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/parameters/A1PmsParameters.java @@ -20,8 +20,8 @@ package org.onap.policy.clamp.acm.participant.a1pms.parameters; +import jakarta.validation.constraints.NotNull; import java.util.Map; -import javax.validation.constraints.NotNull; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/parameters/A1PmsParticipantParameters.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/parameters/A1PmsParticipantParameters.java index b3e036041..8e4204b5a 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/parameters/A1PmsParticipantParameters.java +++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/parameters/A1PmsParticipantParameters.java @@ -20,8 +20,8 @@ package org.onap.policy.clamp.acm.participant.a1pms.parameters; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters; diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/webclient/AcA1PmsClient.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/webclient/AcA1PmsClient.java index 25fb67fb7..4099caa76 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/webclient/AcA1PmsClient.java +++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/webclient/AcA1PmsClient.java @@ -36,6 +36,7 @@ import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; +import org.springframework.web.reactive.function.client.WebClientResponseException; import reactor.core.publisher.Mono; @Component @@ -79,10 +80,6 @@ public class AcA1PmsClient { a1PolicyServiceEntity -> getPmsClient().method(HttpMethod.PUT) .uri(a1PmsParameters.getEndpoints().getServices()) .bodyValue(a1PolicyServiceEntity).retrieve() - .onStatus(HttpStatus::isError, - clientResponse -> Mono.error(new A1PolicyServiceException( - clientResponse.statusCode().value(), - "Error in creating policy service"))) .onStatus(Predicate.isEqual(HttpStatus.OK), clientResponse -> { LOGGER.warn("Client {} already exists and the configuration " @@ -91,6 +88,10 @@ public class AcA1PmsClient { return Mono.empty(); }) .toBodilessEntity() + .onErrorResume(WebClientResponseException.class, + clientResponse -> Mono.error(new A1PolicyServiceException( + clientResponse.getStatusCode().value(), + "Error in creating policy service"))) .block()); } @@ -105,12 +106,11 @@ public class AcA1PmsClient { .uri(a1PmsParameters.getEndpoints().getService(), a1PolicyServiceEntity.getClientId()) .bodyValue(a1PolicyServiceEntity).retrieve() - .onStatus(HttpStatus::isError, - clientResponse -> Mono.error( - new A1PolicyServiceException( - clientResponse.statusCode().value(), - "Error in deleting policy service"))) .toBodilessEntity() + .onErrorResume(WebClientResponseException.class, + clientResponse -> Mono.error(new A1PolicyServiceException( + clientResponse.getStatusCode().value(), + "Error in deleting policy service"))) .block()); } diff --git a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/rest/ActuatorControllerTest.java index 98d001e4a..b8f160057 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/rest/ActuatorControllerTest.java +++ b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/rest/ActuatorControllerTest.java @@ -22,20 +22,19 @@ package org.onap.policy.clamp.acm.participant.a1pms.rest; import static org.junit.jupiter.api.Assertions.assertEquals; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.onap.policy.clamp.acm.participant.a1pms.utils.CommonActuatorController; -import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics; +import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; -@AutoConfigureMetrics +@AutoConfigureObservability(tracing = false) @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @@ -70,22 +69,22 @@ class ActuatorControllerTest extends CommonActuatorController { @Test void testGetHealth() { - Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGetMetrics() { - Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGePrometheus() { - Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } diff --git a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonActuatorController.java index fc00f66b8..f2e150d92 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonActuatorController.java +++ b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonActuatorController.java @@ -22,12 +22,12 @@ package org.onap.policy.clamp.acm.participant.a1pms.utils; import static org.junit.Assert.assertEquals; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.onap.policy.common.gson.GsonMessageBodyHandler; diff --git a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/MockRestEndpoint.java b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/MockRestEndpoint.java index 9f8a28193..bbbc5abc3 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/MockRestEndpoint.java +++ b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/MockRestEndpoint.java @@ -20,13 +20,13 @@ package org.onap.policy.clamp.acm.participant.a1pms.utils; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Response; /** * The Class MockRestEndpoint creates rest server endpoints for simulating Rest calls. diff --git a/participant/participant-impl/participant-impl-acelement/pom.xml b/participant/participant-impl/participant-impl-acelement/pom.xml old mode 100644 new mode 100755 index b4a63406a..b82f9b501 --- a/participant/participant-impl/participant-impl-acelement/pom.xml +++ b/participant/participant-impl/participant-impl-acelement/pom.xml @@ -26,7 +26,7 @@ org.onap.policy.clamp.participant policy-clamp-participant-impl - 7.0.0-SNAPSHOT + 7.0.1-SNAPSHOT policy-clamp-acm-element-impl @@ -56,9 +56,10 @@ src/gen/java - java11 + java17 true true + true @@ -67,6 +68,7 @@ org.springframework.boot spring-boot-maven-plugin + ${version.springboot} diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/SecurityConfig.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/SecurityConfig.java index ecb127580..71b01dbdf 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/SecurityConfig.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/SecurityConfig.java @@ -22,7 +22,9 @@ package org.onap.policy.clamp.acm.element.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.web.SecurityFilterChain; /** @@ -39,11 +41,9 @@ public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http - .httpBasic() - .and() - .authorizeHttpRequests().anyRequest().authenticated() - .and() - .csrf().disable(); + .httpBasic(Customizer.withDefaults()) + .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated()) + .csrf(AbstractHttpConfigurer::disable); return http.build(); } } diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java index ac3c72e52..ef8ceb00f 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.util.List; import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessageType; import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher; import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; @@ -46,13 +45,12 @@ public class MessageActivator extends ServiceManagerContainer implements AutoClo private static final String[] MSG_TYPE_NAMES = { "messageType" }; // Topics from which the AC element receives and sends messages - private List topicSinks; private List topicSources; private final MessageListener listener; private final MessagePublisher publisher; - private MessageTypeDispatcher msgDispatcher; + private final MessageTypeDispatcher msgDispatcher; /** * Constructor. @@ -73,7 +71,7 @@ public class MessageActivator extends ServiceManagerContainer implements AutoClo * @param parameters TopicParameterGroup */ public void activate(final TopicParameterGroup parameters) { - topicSinks = TopicEndpointManager.getManager().addTopicSinks(parameters.getTopicSinks()); + var topicSinks = TopicEndpointManager.getManager().addTopicSinks(parameters.getTopicSinks()); topicSources = TopicEndpointManager.getManager().addTopicSources(parameters.getTopicSources()); // @formatter:off diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java old mode 100644 new mode 100755 index 906fc321c..c0ac329e0 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java @@ -21,10 +21,10 @@ package org.onap.policy.clamp.acm.element.handler; import io.micrometer.core.annotation.Timed; -import java.util.HashMap; +import jakarta.ws.rs.core.Response; +import java.util.EnumMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; import lombok.NonNull; import org.onap.policy.clamp.acm.element.main.parameters.AcElement; import org.onap.policy.clamp.acm.element.service.ElementService; @@ -39,9 +39,9 @@ import org.springframework.stereotype.Component; public class MessageHandler { private ElementType elementType; - private ToscaConceptIdentifier elementId; + private final ToscaConceptIdentifier elementId; - private Map map = new HashMap<>(); + private final Map map = new EnumMap<>(ElementType.class); /** * Constructor. @@ -51,7 +51,7 @@ public class MessageHandler { */ public MessageHandler(AcElement acElement, List elementServices) { elementId = acElement.getElementId(); - elementServices.stream().forEach(elementService -> map.put(elementService.getType(), elementService)); + elementServices.forEach(elementService -> map.put(elementService.getType(), elementService)); } /** diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java old mode 100644 new mode 100755 index 1b0c2234a..09c681d93 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java @@ -21,8 +21,8 @@ package org.onap.policy.clamp.acm.element.handler; import io.micrometer.core.annotation.Timed; +import jakarta.ws.rs.core.Response; import java.util.List; -import javax.ws.rs.core.Response; import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException; import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessage; import org.onap.policy.common.endpoints.event.comm.TopicSink; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/AcElement.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/AcElement.java old mode 100644 new mode 100755 index bb80cc638..a0df74c50 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/AcElement.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/AcElement.java @@ -21,8 +21,8 @@ package org.onap.policy.clamp.acm.element.main.parameters; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.NoArgsConstructor; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AcElementErrorController.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AcElementErrorController.java old mode 100644 new mode 100755 index 717390088..3442eedf6 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AcElementErrorController.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AcElementErrorController.java @@ -22,9 +22,9 @@ package org.onap.policy.clamp.acm.element.main.rest; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.http.HttpServletRequest; import java.util.Map; -import javax.servlet.RequestDispatcher; -import javax.servlet.http.HttpServletRequest; import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse; import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse; import org.springframework.beans.factory.annotation.Value; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ConfigService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ConfigService.java old mode 100644 new mode 100755 index ff07cef53..b3f662c86 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ConfigService.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ConfigService.java @@ -20,8 +20,8 @@ package org.onap.policy.clamp.acm.element.service; +import jakarta.ws.rs.core.Response; import java.util.List; -import javax.ws.rs.core.Response; import lombok.NonNull; import lombok.RequiredArgsConstructor; import org.onap.policy.clamp.acm.element.handler.MessageActivator; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java index 6de8255ba..c90643f39 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java @@ -36,7 +36,7 @@ public class SinkService extends AbstractElementService { @Override public void handleMessage(ElementMessage message) { - LOGGER.info("Cycle completed in sink service with the full message: " + message); + LOGGER.info("Cycle completed in sink service with the full message: {}", message); } @Override diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java old mode 100644 new mode 100755 index 479fa44b6..236ba502b --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java @@ -20,10 +20,10 @@ package org.onap.policy.clamp.acm.element.service; +import jakarta.ws.rs.core.Response; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import javax.ws.rs.core.Response; import org.onap.policy.clamp.acm.element.handler.MessagePublisher; import org.onap.policy.clamp.acm.element.main.parameters.AcElement; import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementStatus; diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/AcElementControllerTest.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/AcElementControllerTest.java old mode 100644 new mode 100755 index 1d19b1a17..1ffe7d11d --- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/AcElementControllerTest.java +++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/AcElementControllerTest.java @@ -30,10 +30,10 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import jakarta.ws.rs.core.Response; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; -import javax.ws.rs.core.Response; import org.apache.commons.io.FileUtils; import org.json.JSONObject; import org.junit.jupiter.api.BeforeAll; diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java old mode 100644 new mode 100755 index c37bca3aa..5ccee7b31 --- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java +++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java @@ -22,29 +22,28 @@ package org.onap.policy.clamp.acm.element.rest; import static org.junit.jupiter.api.Assertions.assertEquals; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.onap.policy.clamp.acm.element.utils.CommonActuatorController; -import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics; +import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; -@AutoConfigureMetrics +@AutoConfigureObservability(tracing = false) @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") +@ActiveProfiles({ "test", "default" }) class ActuatorControllerTest extends CommonActuatorController { - private static final String HEALTH_ENDPOINT = "onap/policy/clamp/acelement/v2/health/"; - private static final String METRICS_ENDPOINT = "onap/policy/clamp/acelement/v2/metrics/"; - private static final String PROMETHEUS_ENDPOINT = "onap/policy/clamp/acelement/v2/prometheus/"; - private static final String SWAGGER_ENDPOINT = "onap/policy/clamp/acelement/v2/v3/api-docs/"; + private static final String HEALTH_ENDPOINT = "onap/policy/clamp/acelement/v2/health"; + private static final String METRICS_ENDPOINT = "onap/policy/clamp/acelement/v2/metrics"; + private static final String PROMETHEUS_ENDPOINT = "onap/policy/clamp/acelement/v2/prometheus"; + private static final String SWAGGER_ENDPOINT = "onap/policy/clamp/acelement/v2/v3/api-docs"; @LocalServerPort private int randomServerPort; @@ -55,50 +54,50 @@ class ActuatorControllerTest extends CommonActuatorController { } @Test - void testGetHealth_Unauthorized() throws Exception { + void testGetHealth_Unauthorized() { assertUnauthorizedActGet(HEALTH_ENDPOINT); } @Test - void testGetMetrics_Unauthorized() throws Exception { + void testGetMetrics_Unauthorized() { assertUnauthorizedActGet(METRICS_ENDPOINT); } @Test - void testGetPrometheus_Unauthorized() throws Exception { + void testGetPrometheus_Unauthorized() { assertUnauthorizedActGet(PROMETHEUS_ENDPOINT); } @Test - void testGetSwagger_Unauthorized() throws Exception { + void testGetSwagger_Unauthorized() { assertUnauthorizedActGet(SWAGGER_ENDPOINT); } @Test - void testGetHealth() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + void testGetHealth() { + var invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test - void testGetMetrics() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + void testGetMetrics() { + var invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test - void testGetPrometheus() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + void testGetPrometheus() { + var invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test - void testGetSwagger() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(SWAGGER_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + void testGetSwagger() { + var invocationBuilder = super.sendActRequest(SWAGGER_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } } diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/utils/CommonActuatorController.java old mode 100644 new mode 100755 index 022925dab..1b43e607f --- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/utils/CommonActuatorController.java +++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/utils/CommonActuatorController.java @@ -22,12 +22,12 @@ package org.onap.policy.clamp.acm.element.utils; import static org.junit.Assert.assertEquals; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.onap.policy.common.gson.GsonMessageBodyHandler; diff --git a/participant/participant-impl/participant-impl-cds/pom.xml b/participant/participant-impl/participant-impl-cds/pom.xml index b56f7265f..49dc8d327 100644 --- a/participant/participant-impl/participant-impl-cds/pom.xml +++ b/participant/participant-impl/participant-impl-cds/pom.xml @@ -25,7 +25,7 @@ org.onap.policy.clamp.participant policy-clamp-participant-impl - 7.0.0-SNAPSHOT + 7.0.1-SNAPSHOT policy-clamp-participant-impl-cds diff --git a/participant/participant-impl/participant-impl-http/pom.xml b/participant/participant-impl/participant-impl-http/pom.xml index f75d1b5bf..52baa7cb5 100644 --- a/participant/participant-impl/participant-impl-http/pom.xml +++ b/participant/participant-impl/participant-impl-http/pom.xml @@ -25,7 +25,7 @@ org.onap.policy.clamp.participant policy-clamp-participant-impl - 7.0.0-SNAPSHOT + 7.0.1-SNAPSHOT policy-clamp-participant-impl-http diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/SecurityConfig.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/SecurityConfig.java index 631eb11d1..7cbf0eec3 100644 --- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/SecurityConfig.java +++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/SecurityConfig.java @@ -20,7 +20,9 @@ package org.onap.policy.clamp.acm.participant.http.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.web.SecurityFilterChain; /** @@ -37,11 +39,9 @@ public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http - .httpBasic() - .and() - .authorizeHttpRequests().anyRequest().authenticated() - .and() - .csrf().disable(); + .httpBasic(Customizer.withDefaults()) + .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated()) + .csrf(AbstractHttpConfigurer::disable); return http.build(); } } diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java old mode 100644 new mode 100755 index 9d4718bea..b1412fe19 --- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java +++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java @@ -20,13 +20,12 @@ package org.onap.policy.clamp.acm.participant.http.main.handler; +import jakarta.validation.Validation; +import jakarta.ws.rs.core.Response.Status; import java.lang.invoke.MethodHandles; import java.util.List; import java.util.Map; import java.util.UUID; -import java.util.stream.Collectors; -import javax.validation.Validation; -import javax.ws.rs.core.Response.Status; import lombok.RequiredArgsConstructor; import org.onap.policy.clamp.acm.participant.http.main.models.ConfigRequest; import org.onap.policy.clamp.acm.participant.http.main.webclient.AcHttpClient; @@ -91,7 +90,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio var restResponseMap = acHttpClient.run(configRequest); var failedResponseStatus = restResponseMap.values().stream() .filter(response -> !HttpStatus.valueOf(response.getKey()).is2xxSuccessful()) - .collect(Collectors.toList()); + .toList(); if (failedResponseStatus.isEmpty()) { intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Deployed"); diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java old mode 100644 new mode 100755 index c630b3c7c..7d8cfdeb9 --- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java +++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java @@ -20,13 +20,13 @@ package org.onap.policy.clamp.acm.participant.http.main.models; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.ws.rs.DefaultValue; import java.util.List; import java.util.Map; -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.ws.rs.DefaultValue; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java old mode 100644 new mode 100755 index 6ac2edb56..ee10fb9d3 --- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java +++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java @@ -20,9 +20,9 @@ package org.onap.policy.clamp.acm.participant.http.main.models; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Data; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java old mode 100644 new mode 100755 index 717131f5a..eb4d46bb5 --- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java +++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java @@ -20,10 +20,10 @@ package org.onap.policy.clamp.acm.participant.http.main.models; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; import java.util.Map; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Data; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/webclient/AcHttpClient.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/webclient/AcHttpClient.java index 66ca1b31a..8d7618db2 100644 --- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/webclient/AcHttpClient.java +++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/webclient/AcHttpClient.java @@ -73,7 +73,7 @@ public class AcHttpClient { // Iterate the sequence of http requests for (var request : configurationEntity.getRestSequence()) { try { - var httpMethod = Objects.requireNonNull(HttpMethod.resolve(request.getHttpMethod())); + var httpMethod = Objects.requireNonNull(HttpMethod.valueOf(request.getHttpMethod())); var uri = createUriString(request); LOGGER.info("Executing HTTP request: {} for the Rest request id: {}", httpMethod, request.getRestRequestId()); diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java old mode 100644 new mode 100755 index c0f3c6a7a..d32fc8afa --- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java +++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java @@ -21,8 +21,8 @@ package org.onap.policy.clamp.acm.participant.http.parameters; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters; diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java old mode 100644 new mode 100755 index 36c19fa78..f6c0c5a8a --- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java +++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java @@ -22,20 +22,19 @@ package org.onap.policy.clamp.acm.participant.http.rest; import static org.junit.jupiter.api.Assertions.assertEquals; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.onap.policy.clamp.acm.participant.http.utils.CommonActuatorController; -import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics; +import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; -@AutoConfigureMetrics +@AutoConfigureObservability(tracing = false) @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @@ -70,22 +69,22 @@ class ActuatorControllerTest extends CommonActuatorController { @Test void testGetHealth() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGetMetrics() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGePrometheus() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java old mode 100644 new mode 100755 index d6f558d61..0c595d6f2 --- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java +++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java @@ -22,12 +22,12 @@ package org.onap.policy.clamp.acm.participant.http.utils; import static org.junit.Assert.assertEquals; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.onap.policy.common.gson.GsonMessageBodyHandler; diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/MockRestEndpoint.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/MockRestEndpoint.java old mode 100644 new mode 100755 index 037e62986..19ee9603e --- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/MockRestEndpoint.java +++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/MockRestEndpoint.java @@ -20,13 +20,13 @@ package org.onap.policy.clamp.acm.participant.http.utils; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Response; import java.util.List; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; /** * The Class MockRestEndpoint creates rest server endpoints for simulating Rest calls. diff --git a/participant/participant-impl/participant-impl-kserve/pom.xml b/participant/participant-impl/participant-impl-kserve/pom.xml index 542069f70..1b1c7aa2e 100755 --- a/participant/participant-impl/participant-impl-kserve/pom.xml +++ b/participant/participant-impl/participant-impl-kserve/pom.xml @@ -25,7 +25,7 @@ org.onap.policy.clamp.participant policy-clamp-participant-impl - 7.0.0-SNAPSHOT + 7.0.1-SNAPSHOT policy-clamp-participant-impl-kserve diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/Application.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/Application.java index 04bfd36ad..e09110796 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/Application.java +++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/Application.java @@ -20,15 +20,10 @@ package org.onap.policy.clamp.acm.participant.kserve; -import io.kubernetes.client.openapi.ApiClient; -import io.kubernetes.client.util.Config; -import java.io.IOException; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.ConfigurationPropertiesScan; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Profile; /** * Starter. @@ -48,16 +43,4 @@ public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } - - /** - * Default Api Client bean creation. - * - * @return ApiClient - * @throws IOException exception - */ - @Profile("kubernetes") - @Bean - public ApiClient defaultApiClient() throws IOException { - return Config.fromCluster(); - } } diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/config/ApiClientConfig.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/config/ApiClientConfig.java new file mode 100755 index 000000000..5f1ab7168 --- /dev/null +++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/config/ApiClientConfig.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023 Nordix Foundation. + * ================================================================================ + * 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 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.acm.participant.kserve.config; + +import io.kubernetes.client.openapi.ApiClient; +import io.kubernetes.client.util.Config; +import java.io.IOException; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; + +@Configuration +public class ApiClientConfig { + + /** + * Default Api Client bean creation. + * + * @return ApiClient + * @throws IOException exception + */ + @Profile("kubernetes") + @Bean + public ApiClient defaultApiClient() throws IOException { + return Config.fromCluster(); + } +} diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/config/SecurityConfig.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/config/SecurityConfig.java index f9dbc08fc..06cb3a6d8 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/config/SecurityConfig.java +++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/config/SecurityConfig.java @@ -20,7 +20,9 @@ package org.onap.policy.clamp.acm.participant.kserve.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.web.SecurityFilterChain; @Configuration @@ -35,14 +37,9 @@ public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http - .httpBasic() - .and() - .authorizeHttpRequests() - .anyRequest() - .authenticated() - .and() - .csrf() - .disable(); + .httpBasic(Customizer.withDefaults()) + .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated()) + .csrf(AbstractHttpConfigurer::disable); return http.build(); } } diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/exception/KserveException.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/exception/KserveException.java index 952599c85..bec6c80be 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/exception/KserveException.java +++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/exception/KserveException.java @@ -20,7 +20,7 @@ package org.onap.policy.clamp.acm.participant.kserve.exception; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.onap.policy.models.base.PfModelException; public class KserveException extends PfModelException { diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java index 3a53a7aea..8036eb414 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java +++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java @@ -21,6 +21,8 @@ package org.onap.policy.clamp.acm.participant.kserve.handler; import io.kubernetes.client.openapi.ApiException; +import jakarta.validation.Validation; +import jakarta.validation.ValidationException; import java.io.IOException; import java.lang.invoke.MethodHandles; import java.util.List; @@ -31,8 +33,6 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import javax.validation.Validation; -import javax.validation.ValidationException; import lombok.AccessLevel; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/k8s/KserveClient.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/k8s/KserveClient.java index b5e7892eb..7777bf018 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/k8s/KserveClient.java +++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/k8s/KserveClient.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.kubernetes.client.openapi.ApiClient; import io.kubernetes.client.openapi.ApiException; import io.kubernetes.client.openapi.apis.CustomObjectsApi; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.lang.invoke.MethodHandles; -import javax.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import okhttp3.Response; import org.onap.policy.clamp.acm.participant.kserve.parameters.CustomResourceDefinitionParameters; diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/models/ConfigurationEntity.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/models/ConfigurationEntity.java index ab85b7c52..3e9645904 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/models/ConfigurationEntity.java +++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/models/ConfigurationEntity.java @@ -20,9 +20,9 @@ package org.onap.policy.clamp.acm.participant.kserve.models; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/models/KserveInferenceEntity.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/models/KserveInferenceEntity.java index 3717970c2..5d2c66d69 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/models/KserveInferenceEntity.java +++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/models/KserveInferenceEntity.java @@ -23,7 +23,7 @@ package org.onap.policy.clamp.acm.participant.kserve.models; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.annotation.JsonNaming; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Data; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/parameters/CustomResourceDefinitionParameters.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/parameters/CustomResourceDefinitionParameters.java index 69a7cb466..521d761f6 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/parameters/CustomResourceDefinitionParameters.java +++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/parameters/CustomResourceDefinitionParameters.java @@ -20,7 +20,7 @@ package org.onap.policy.clamp.acm.participant.kserve.parameters; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/parameters/KserveParticipantParameters.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/parameters/KserveParticipantParameters.java index 81582e1f0..786684049 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/parameters/KserveParticipantParameters.java +++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/parameters/KserveParticipantParameters.java @@ -20,8 +20,8 @@ package org.onap.policy.clamp.acm.participant.kserve.parameters; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters; diff --git a/participant/participant-impl/participant-impl-kserve/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-kserve/src/main/resources/config/application.yaml index 5ce1a7daf..37fe603e2 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-kserve/src/main/resources/config/application.yaml @@ -14,8 +14,8 @@ spring: - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration - - io.kubernetes.client.spring.extended.manifests.config.KubernetesManifestsAutoConfiguration - - io.kubernetes.client.spring.extended.network.config.KubernetesLoadBalancerAutoConfiguration +# - io.kubernetes.client.spring.extended.manifests.config.KubernetesManifestsAutoConfiguration +# - io.kubernetes.client.spring.extended.network.config.KubernetesLoadBalancerAutoConfiguration security: enable-csrf: false diff --git a/participant/participant-impl/participant-impl-kserve/src/test/java/org/onap/policy/clamp/acm/participant/kserve/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-kserve/src/test/java/org/onap/policy/clamp/acm/participant/kserve/rest/ActuatorControllerTest.java index 0cabac793..b7cc7b843 100755 --- a/participant/participant-impl/participant-impl-kserve/src/test/java/org/onap/policy/clamp/acm/participant/kserve/rest/ActuatorControllerTest.java +++ b/participant/participant-impl/participant-impl-kserve/src/test/java/org/onap/policy/clamp/acm/participant/kserve/rest/ActuatorControllerTest.java @@ -23,13 +23,12 @@ package org.onap.policy.clamp.acm.participant.kserve.rest; import static org.junit.jupiter.api.Assertions.assertEquals; import io.kubernetes.client.openapi.ApiClient; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.onap.policy.clamp.acm.participant.kserve.utils.CommonActuatorController; -import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics; +import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.mock.mockito.MockBean; @@ -37,7 +36,7 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; -@AutoConfigureMetrics +@AutoConfigureObservability(tracing = false) @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @@ -75,22 +74,22 @@ class ActuatorControllerTest extends CommonActuatorController { @Test void testGetHealth() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGetMetrics() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGePrometheus() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } diff --git a/participant/participant-impl/participant-impl-kserve/src/test/java/org/onap/policy/clamp/acm/participant/kserve/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-kserve/src/test/java/org/onap/policy/clamp/acm/participant/kserve/utils/CommonActuatorController.java index b83a13897..0c568e1b5 100755 --- a/participant/participant-impl/participant-impl-kserve/src/test/java/org/onap/policy/clamp/acm/participant/kserve/utils/CommonActuatorController.java +++ b/participant/participant-impl/participant-impl-kserve/src/test/java/org/onap/policy/clamp/acm/participant/kserve/utils/CommonActuatorController.java @@ -22,12 +22,12 @@ package org.onap.policy.clamp.acm.participant.kserve.utils; import static org.junit.Assert.assertEquals; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.onap.policy.common.gson.GsonMessageBodyHandler; diff --git a/participant/participant-impl/participant-impl-kubernetes/pom.xml b/participant/participant-impl/participant-impl-kubernetes/pom.xml old mode 100644 new mode 100755 index 207980547..c453369c7 --- a/participant/participant-impl/participant-impl-kubernetes/pom.xml +++ b/participant/participant-impl/participant-impl-kubernetes/pom.xml @@ -25,7 +25,7 @@ org.onap.policy.clamp.participant policy-clamp-participant-impl - 7.0.0-SNAPSHOT + 7.0.1-SNAPSHOT policy-clamp-participant-impl-kubernetes @@ -73,9 +73,10 @@ src/gen/java - java11 + java17 true true + true @@ -84,6 +85,7 @@ org.springframework.boot spring-boot-maven-plugin + ${version.springboot} diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/ParticipantConfig.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/ParticipantConfig.java deleted file mode 100644 index 428819be9..000000000 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/ParticipantConfig.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * Copyright (C) 2021 Nordix Foundation. All rights reserved. - * ====================================================================== - * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * ====================================================================== - * 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. - * ========================LICENSE_END=================================== - */ - -package org.onap.policy.clamp.acm.participant.kubernetes.configurations; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.multipart.MultipartResolver; -import org.springframework.web.multipart.commons.CommonsMultipartResolver; - -/** - * Bean Factory class for helm client. - */ -@Configuration -public class ParticipantConfig { - - /** - * Method to create multipartResolver bean. - * @return MultipartResolver - */ - @Bean(name = "multipartResolver") - public MultipartResolver multipartResolver() { - var multipartResolver = new CommonsMultipartResolver(); - multipartResolver.setMaxUploadSize(100000); - return multipartResolver; - } -} diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/SecurityConfig.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/SecurityConfig.java index 9d6662a9a..a42fb8c2a 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/SecurityConfig.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/configurations/SecurityConfig.java @@ -20,7 +20,9 @@ package org.onap.policy.clamp.acm.participant.kubernetes.configurations; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.web.SecurityFilterChain; /** @@ -37,11 +39,9 @@ public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http - .httpBasic() - .and() - .authorizeHttpRequests().anyRequest().authenticated() - .and() - .csrf().disable(); + .httpBasic(Customizer.withDefaults()) + .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated()) + .csrf(AbstractHttpConfigurer::disable); return http.build(); } } diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java old mode 100644 new mode 100755 index a0ea31673..778d0d10c --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java @@ -20,6 +20,8 @@ package org.onap.policy.clamp.acm.participant.kubernetes.handler; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import java.io.IOException; import java.lang.invoke.MethodHandles; import java.util.HashMap; @@ -27,8 +29,6 @@ import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import lombok.AccessLevel; import lombok.Getter; import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener; diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParameters.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParameters.java old mode 100644 new mode 100755 index b95756ec5..f9c2a9505 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParameters.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParameters.java @@ -20,9 +20,9 @@ package org.onap.policy.clamp.acm.participant.kubernetes.parameters; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters; diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml old mode 100644 new mode 100755 index d032d3512..45c82b1fe --- a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml @@ -9,10 +9,16 @@ spring: - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration + servlet: + multipart: + max-file-size: 128KB + max-request-size: 128KB + enabled: true security: enable-csrf: false + participant: localChartDirectory: /home/policy/local-charts infoFileName: CHART_INFO.json diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java old mode 100644 new mode 100755 index 2e17be06b..9436e3587 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/ParticipantK8sParametersTest.java @@ -23,10 +23,10 @@ package org.onap.policy.clamp.acm.participant.kubernetes.parameters; import static org.assertj.core.api.Assertions.assertThat; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validation; +import jakarta.validation.ValidatorFactory; import java.util.Set; -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.ValidatorFactory; import org.junit.jupiter.api.Test; class ParticipantK8sParametersTest { @@ -60,7 +60,7 @@ class ParticipantK8sParametersTest { participantParameters.setLocalChartDirectory(" "); Set> violations = validatorFactory.getValidator() .validate(participantParameters); - assertThat(violations.size()).isEqualTo(1); + assertThat(violations).hasSize(1); } @Test @@ -69,7 +69,7 @@ class ParticipantK8sParametersTest { participantParameters.setInfoFileName(""); Set> violations = validatorFactory.getValidator() .validate(participantParameters); - assertThat(violations.size()).isEqualTo(1); + assertThat(violations).hasSize(1); } @Test diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java old mode 100644 new mode 100755 index 35c8f7cc6..b5b18c5cb --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/rest/ActuatorControllerTest.java @@ -22,20 +22,19 @@ package org.onap.policy.clamp.acm.participant.kubernetes.rest; import static org.junit.jupiter.api.Assertions.assertEquals; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.onap.policy.clamp.acm.participant.kubernetes.utils.CommonActuatorController; -import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics; +import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; -@AutoConfigureMetrics +@AutoConfigureObservability(tracing = false) @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @@ -76,29 +75,29 @@ class ActuatorControllerTest extends CommonActuatorController { @Test void testGetHealth() { - Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGetMetrics() { - Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGetPrometheus() { - Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGetSwagger() { - Invocation.Builder invocationBuilder = super.sendActRequest(SWAGGER_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(SWAGGER_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } } diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java index 029db9994..70f80c8a7 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/service/ChartStoreTest.java @@ -137,7 +137,7 @@ class ChartStoreTest { } List retrievedChartList = chartStore.getAllCharts(); assertThat(retrievedChartList).isNotEmpty(); - assertThat(retrievedChartList.size()).isEqualTo(charts.size()); + assertThat(retrievedChartList).hasSameSizeAs(charts); } @Test diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java old mode 100644 new mode 100755 index 23f591f0f..2176478f0 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/CommonActuatorController.java @@ -22,12 +22,10 @@ package org.onap.policy.clamp.acm.participant.kubernetes.utils; import static org.junit.Assert.assertEquals; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.onap.policy.common.gson.GsonMessageBodyHandler; @@ -72,7 +70,7 @@ public class CommonActuatorController { * @return a request builder */ protected Invocation.Builder sendFqeRequest(final String fullyQualifiedEndpoint, boolean includeAuth) { - final Client client = ClientBuilder.newBuilder().build(); + final var client = ClientBuilder.newBuilder().build(); client.property(ClientProperties.METAINF_SERVICES_LOOKUP_DISABLE, "true"); client.register(GsonMessageBodyHandler.class); @@ -81,7 +79,7 @@ public class CommonActuatorController { client.register(HttpAuthenticationFeature.basic("participantUser", "zb!XztG34")); } - final WebTarget webTarget = client.target(fullyQualifiedEndpoint); + final var webTarget = client.target(fullyQualifiedEndpoint); return webTarget.request(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN); } @@ -92,7 +90,7 @@ public class CommonActuatorController { * @param endPoint the endpoint */ protected void assertUnauthorizedActGet(final String endPoint) { - Response rawresp = sendNoAuthActRequest(endPoint).buildGet().invoke(); + var rawresp = sendNoAuthActRequest(endPoint).buildGet().invoke(); assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus()); } diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java index c9b616fa0..518765266 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/utils/TestUtils.java @@ -38,7 +38,7 @@ public final class TestUtils { } private static ToscaServiceTemplate testAutomationCompositionYamlSerialization() { - String automationCompositionString = ResourceUtils.getResourceAsString(TestUtils.TOSCA_TEMPLATE_YAML); + var automationCompositionString = ResourceUtils.getResourceAsString(TestUtils.TOSCA_TEMPLATE_YAML); return yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class); } } diff --git a/participant/participant-impl/participant-impl-policy/pom.xml b/participant/participant-impl/participant-impl-policy/pom.xml index 8fc34ce48..3c87ff671 100644 --- a/participant/participant-impl/participant-impl-policy/pom.xml +++ b/participant/participant-impl/participant-impl-policy/pom.xml @@ -25,7 +25,7 @@ org.onap.policy.clamp.participant policy-clamp-participant-impl - 7.0.0-SNAPSHOT + 7.0.1-SNAPSHOT policy-clamp-participant-impl-policy diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/AbstractHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/AbstractHttpClient.java old mode 100644 new mode 100755 index 4920d6550..f0e0d65bb --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/AbstractHttpClient.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/AbstractHttpClient.java @@ -20,15 +20,15 @@ package org.onap.policy.clamp.acm.participant.policy.client; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import java.io.Closeable; import java.io.IOException; import java.util.Collections; import java.util.Map; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException; import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClient; diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyApiHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyApiHttpClient.java old mode 100644 new mode 100755 index bf1d24a74..d48028f74 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyApiHttpClient.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyApiHttpClient.java @@ -20,9 +20,9 @@ package org.onap.policy.clamp.acm.participant.policy.client; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.springframework.stereotype.Component; diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyPapHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyPapHttpClient.java old mode 100644 new mode 100755 index 584170ae4..8e4b59c35 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyPapHttpClient.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyPapHttpClient.java @@ -20,11 +20,10 @@ package org.onap.policy.clamp.acm.participant.policy.client; -import java.util.LinkedList; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.List; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters; import org.onap.policy.models.pdp.concepts.DeploymentGroup; import org.onap.policy.models.pdp.concepts.DeploymentGroups; @@ -61,24 +60,19 @@ public class PolicyPapHttpClient extends AbstractHttpClient { public Response handlePolicyDeployOrUndeploy(final String policyName, final String policyVersion, final DeploymentSubGroup.Action action) { - List policies = new LinkedList(); - policies.add(new ToscaConceptIdentifier(policyName, policyVersion)); + var policies = List.of(new ToscaConceptIdentifier(policyName, policyVersion)); - DeploymentSubGroup subGroup = new DeploymentSubGroup(); + var subGroup = new DeploymentSubGroup(); subGroup.setPolicies(policies); subGroup.setPdpType(pdpType); subGroup.setAction(action); - DeploymentGroup group = new DeploymentGroup(); - List subGroups = new LinkedList(); - subGroups.add(subGroup); - group.setDeploymentSubgroups(subGroups); + var group = new DeploymentGroup(); + group.setDeploymentSubgroups(List.of(subGroup)); group.setName(pdpGroup); - DeploymentGroups groups = new DeploymentGroups(); - List groupsArr = new LinkedList(); - groupsArr.add(group); - groups.setGroups(groupsArr); + var groups = new DeploymentGroups(); + groups.setGroups(List.of(group)); return executePost(PAP_URI + "pdps/deployments/batch", Entity.entity(groups, MediaType.APPLICATION_JSON)); } diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/SecurityConfig.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/SecurityConfig.java index e2f91134e..b5302cc84 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/SecurityConfig.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/SecurityConfig.java @@ -20,7 +20,9 @@ package org.onap.policy.clamp.acm.participant.policy.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.web.SecurityFilterChain; /** @@ -37,11 +39,9 @@ public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http - .httpBasic() - .and() - .authorizeHttpRequests().anyRequest().authenticated() - .and() - .csrf().disable(); + .httpBasic(Customizer.withDefaults()) + .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated()) + .csrf(AbstractHttpConfigurer::disable); return http.build(); } } diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java old mode 100644 new mode 100755 index 6b94a79ad..58ceffd10 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java @@ -22,12 +22,12 @@ package org.onap.policy.clamp.acm.participant.policy.main.handler; +import jakarta.ws.rs.core.Response.Status; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import javax.ws.rs.core.Response.Status; import lombok.RequiredArgsConstructor; import org.apache.http.HttpStatus; import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener; diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParameters.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParameters.java old mode 100644 new mode 100755 index a57198126..0d2851cd8 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParameters.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParameters.java @@ -20,9 +20,9 @@ package org.onap.policy.clamp.acm.participant.policy.main.parameters; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters; diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/client/HttpClientTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/client/HttpClientTest.java old mode 100644 new mode 100755 index 9f1343e67..57d6fe4c9 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/client/HttpClientTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/client/HttpClientTest.java @@ -24,10 +24,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertThrows; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.io.IOException; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters; @@ -41,7 +41,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; /** * Tests for api and pap http clients. */ -public class HttpClientTest { +class HttpClientTest { private static int mockServerPort; @@ -111,8 +111,9 @@ public class HttpClientTest { @Test void testInvalidClientParameter() { + var parameters = new ParticipantPolicyParameters(); assertThrows(AutomationCompositionRuntimeException.class, - () -> new PolicyApiHttpClient(new ParticipantPolicyParameters())); + () -> new PolicyApiHttpClient(parameters)); } diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java old mode 100644 new mode 100755 index 16530d69f..d211ab0d7 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java @@ -26,10 +26,10 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import jakarta.ws.rs.core.Response; import java.util.List; import java.util.Map; import java.util.UUID; -import javax.ws.rs.core.Response; import org.junit.jupiter.api.Test; import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi; import org.onap.policy.clamp.acm.participant.policy.client.PolicyApiHttpClient; diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParametersTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParametersTest.java old mode 100644 new mode 100755 index 8e822ea9a..0505d0f9a --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParametersTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParametersTest.java @@ -22,8 +22,8 @@ package org.onap.policy.clamp.acm.participant.policy.main.parameters; import static org.assertj.core.api.Assertions.assertThat; -import javax.validation.Validation; -import javax.validation.ValidatorFactory; +import jakarta.validation.Validation; +import jakarta.validation.ValidatorFactory; import org.junit.jupiter.api.Test; class ParticipantPolicyParametersTest { diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/rest/ActuatorControllerTest.java old mode 100644 new mode 100755 index 4faab95cc..b3fe2d3a5 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/rest/ActuatorControllerTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/rest/ActuatorControllerTest.java @@ -22,20 +22,20 @@ package org.onap.policy.clamp.acm.participant.policy.main.rest; import static org.junit.jupiter.api.Assertions.assertEquals; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.onap.policy.clamp.acm.participant.policy.main.utils.CommonActuatorController; -import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics; +import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; -@AutoConfigureMetrics +@AutoConfigureObservability(tracing = false) @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @@ -70,23 +70,22 @@ class ActuatorControllerTest extends CommonActuatorController { @Test void testGetHealth() { - Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGetMetrics() { - Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGePrometheus() { - Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } - } diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/CommonActuatorController.java old mode 100644 new mode 100755 index 41f091cbf..e5f5aece3 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/CommonActuatorController.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/CommonActuatorController.java @@ -22,12 +22,12 @@ package org.onap.policy.clamp.acm.participant.policy.main.utils; import static org.junit.Assert.assertEquals; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.onap.policy.common.gson.GsonMessageBodyHandler; diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/MockRestEndpoint.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/MockRestEndpoint.java old mode 100644 new mode 100755 index b7485c6ca..f032d37f9 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/MockRestEndpoint.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/MockRestEndpoint.java @@ -20,11 +20,11 @@ package org.onap.policy.clamp.acm.participant.policy.main.utils; -import javax.ws.rs.DELETE; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Response; import org.onap.policy.models.pdp.concepts.DeploymentGroups; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.springframework.web.bind.annotation.RequestBody; diff --git a/participant/participant-impl/participant-impl-simulator/pom.xml b/participant/participant-impl/participant-impl-simulator/pom.xml old mode 100644 new mode 100755 index 2fd8c3703..13b8ec302 --- a/participant/participant-impl/participant-impl-simulator/pom.xml +++ b/participant/participant-impl/participant-impl-simulator/pom.xml @@ -25,7 +25,7 @@ org.onap.policy.clamp.participant policy-clamp-participant-impl - 7.0.0-SNAPSHOT + 7.0.1-SNAPSHOT policy-clamp-participant-impl-simulator @@ -57,9 +57,10 @@ src/gen/java - java11 + java17 true true + true @@ -68,6 +69,7 @@ org.springframework.boot spring-boot-maven-plugin + ${version.springboot} diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/config/SecurityConfig.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/config/SecurityConfig.java index f15491c4d..9b6dc64a8 100644 --- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/config/SecurityConfig.java +++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/config/SecurityConfig.java @@ -22,7 +22,9 @@ package org.onap.policy.clamp.acm.participant.sim.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.web.SecurityFilterChain; /** @@ -39,11 +41,9 @@ public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http - .httpBasic() - .and() - .authorizeHttpRequests().anyRequest().authenticated() - .and() - .csrf().disable(); + .httpBasic(Customizer.withDefaults()) + .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated()) + .csrf(AbstractHttpConfigurer::disable); return http.build(); } } diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/parameters/ParticipantSimParameters.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/parameters/ParticipantSimParameters.java old mode 100644 new mode 100755 index b67a1ca6c..4c7845143 --- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/parameters/ParticipantSimParameters.java +++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/parameters/ParticipantSimParameters.java @@ -20,8 +20,8 @@ package org.onap.policy.clamp.acm.participant.sim.parameters; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters; diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/rest/SimulatorController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/rest/SimulatorController.java index db828414d..445a2a111 100755 --- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/rest/SimulatorController.java +++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/sim/rest/SimulatorController.java @@ -20,9 +20,9 @@ package org.onap.policy.clamp.acm.participant.sim.rest; +import jakarta.validation.Valid; +import jakarta.ws.rs.core.MediaType; import java.util.UUID; -import javax.validation.Valid; -import javax.ws.rs.core.MediaType; import lombok.RequiredArgsConstructor; import org.onap.policy.clamp.acm.participant.sim.controller.genapi.SimulatorParticipantControllerApi; import org.onap.policy.clamp.acm.participant.sim.main.handler.AutomationCompositionElementHandler; diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/parameters/ParticipantSimParametersTest.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/parameters/ParticipantSimParametersTest.java old mode 100644 new mode 100755 index 7e5df4c89..0f6e2d45b --- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/parameters/ParticipantSimParametersTest.java +++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/parameters/ParticipantSimParametersTest.java @@ -22,8 +22,8 @@ package org.onap.policy.clamp.acm.participant.sim.parameters; import static org.assertj.core.api.Assertions.assertThat; -import javax.validation.Validation; -import javax.validation.ValidatorFactory; +import jakarta.validation.Validation; +import jakarta.validation.ValidatorFactory; import org.junit.jupiter.api.Test; import org.onap.policy.clamp.acm.participant.sim.comm.CommonTestData; diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/rest/ActuatorControllerTest.java old mode 100644 new mode 100755 index 474d45cc5..08557f56d --- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/rest/ActuatorControllerTest.java +++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/rest/ActuatorControllerTest.java @@ -22,20 +22,19 @@ package org.onap.policy.clamp.acm.participant.sim.rest; import static org.junit.jupiter.api.Assertions.assertEquals; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.onap.policy.clamp.acm.participant.sim.utils.CommonActuatorController; -import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics; +import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; -@AutoConfigureMetrics +@AutoConfigureObservability(tracing = false) @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @@ -70,22 +69,22 @@ class ActuatorControllerTest extends CommonActuatorController { @Test void testGetHealth() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGetMetrics() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(METRICS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } @Test void testGePrometheus() throws Exception { - Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); } diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/utils/CommonActuatorController.java old mode 100644 new mode 100755 index 846e76349..b5e2ff618 --- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/utils/CommonActuatorController.java +++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/utils/CommonActuatorController.java @@ -22,12 +22,12 @@ package org.onap.policy.clamp.acm.participant.sim.utils; import static org.junit.Assert.assertEquals; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.onap.policy.common.gson.GsonMessageBodyHandler; diff --git a/participant/participant-impl/pom.xml b/participant/participant-impl/pom.xml index 7c91e0f02..236a0c130 100755 --- a/participant/participant-impl/pom.xml +++ b/participant/participant-impl/pom.xml @@ -27,7 +27,7 @@ org.onap.policy.clamp.participant policy-clamp-participant - 7.0.0-SNAPSHOT + 7.0.1-SNAPSHOT policy-clamp-participant-impl -- cgit 1.2.3-korg