diff options
author | 2023-08-11 15:10:44 +0100 | |
---|---|---|
committer | 2023-09-25 13:40:52 +0100 | |
commit | 4407ea6948a060734a4f2836b11bd2d5c6ea6194 (patch) | |
tree | 6a6e482126ec3d8e830faf80a392b2161ced6de0 /participant/participant-impl/participant-impl-acelement/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-acelement/src/test')
3 files changed, 31 insertions, 32 deletions
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 index 1d19b1a17..1ffe7d11d 100644..100755 --- 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 index c37bca3aa..5ccee7b31 100644..100755 --- 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 index 022925dab..1b43e607f 100644..100755 --- 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; |