diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2023-08-11 15:10:44 +0100 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2023-09-25 13:40:52 +0100 |
commit | 4407ea6948a060734a4f2836b11bd2d5c6ea6194 (patch) | |
tree | 6a6e482126ec3d8e830faf80a392b2161ced6de0 /participant/participant-impl/participant-impl-kubernetes/src/test | |
parent | c4b3c527882610afc3f08c0efd73e2f7841e9fe5 (diff) |
Upgrade Java 17
Issue-ID: POLICY-4673
Change-Id: I01fd3677687b5d2e065d0cc131b338ed841d7e99
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test')
5 files changed, 25 insertions, 28 deletions
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 index 2e17be06b..9436e3587 100644..100755 --- 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<ConstraintViolation<ParticipantK8sParameters>> violations = validatorFactory.getValidator() .validate(participantParameters); - assertThat(violations.size()).isEqualTo(1); + assertThat(violations).hasSize(1); } @Test @@ -69,7 +69,7 @@ class ParticipantK8sParametersTest { participantParameters.setInfoFileName(""); Set<ConstraintViolation<ParticipantK8sParameters>> 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 index 35c8f7cc6..b5b18c5cb 100644..100755 --- 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<ChartInfo> 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 index 23f591f0f..2176478f0 100644..100755 --- 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); } } |