diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-10-03 16:14:05 +0100 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2023-10-03 15:29:30 +0000 |
commit | ae980791d1996041592fd45a56cfdce7801cecfa (patch) | |
tree | a6dde540ff0e7c0d122eab83310787434d92dcb5 /runtime-acm | |
parent | bb8c570ba261dedbfc9972bfb08efccd41d130d2 (diff) |
Fix minor Sonar Issues for clamp/acm
Issue-ID: POLICY-4834
Change-Id: I17efea9b14bb39d7abbafa4f3b695b0451a08c68
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm')
3 files changed, 12 insertions, 15 deletions
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/ParticipantControllerStubTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/ParticipantControllerStubTest.java index a1ad82945..5af3ca2a1 100755 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/ParticipantControllerStubTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/ParticipantControllerStubTest.java @@ -37,7 +37,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles({ "test", "stub" }) -public class ParticipantControllerStubTest extends CommonRestController { +class ParticipantControllerStubTest extends CommonRestController { private static final String PARTICIPANT_ENDPOINT = "participants"; private static final String PARTICIPANT_ID = "101c62b3-8918-41b9-a747-d21eb79c6c03"; diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java index 87e00da93..06bedabde 100755 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java @@ -244,8 +244,6 @@ class SupervisionMessagesTest { publisher.active(List.of(topicSink)); var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML); - // serviceTemplate.setName("Name"); - // serviceTemplate.setVersion("1.0.0"); var acmDefinition = new AutomationCompositionDefinition(); acmDefinition.setCompositionId(UUID.randomUUID()); acmDefinition.setServiceTemplate(serviceTemplate); diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/rest/CommonRestController.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/rest/CommonRestController.java index fec0f216e..0df9719c2 100755 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/rest/CommonRestController.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/rest/CommonRestController.java @@ -20,13 +20,12 @@ package org.onap.policy.clamp.acm.runtime.util.rest; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import jakarta.ws.rs.client.Client; import jakarta.ws.rs.client.ClientBuilder; import jakarta.ws.rs.client.Entity; 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; @@ -53,10 +52,10 @@ public class CommonRestController { * @param endpoint the endpoint of interest */ protected void testSwagger(final String endpoint) { - // final Invocation.Builder invocationBuilder = sendActRequest("v3/api-docs"); - // final String resp = invocationBuilder.get(String.class); + final var invocationBuilder = sendActRequest("v3/api-docs"); + final var resp = invocationBuilder.get(String.class); - // assertThat(resp).contains(endpoint); + assertThat(resp).contains(endpoint); } /** @@ -107,7 +106,7 @@ public class CommonRestController { * @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); @@ -116,7 +115,7 @@ public class CommonRestController { client.register(HttpAuthenticationFeature.basic("runtimeUser", "zb!XztG34")); } - final WebTarget webTarget = client.target(fullyQualifiedEndpoint); + final var webTarget = client.target(fullyQualifiedEndpoint); return webTarget.request(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN); } @@ -128,7 +127,7 @@ public class CommonRestController { * @param entity the entity ofthe body */ protected void assertUnauthorizedPost(final String endPoint, final Entity<?> entity) { - Response rawresp = sendNoAuthRequest(endPoint).post(entity); + var rawresp = sendNoAuthRequest(endPoint).post(entity); assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus()); } @@ -139,7 +138,7 @@ public class CommonRestController { * @param entity the entity ofthe body */ protected void assertUnauthorizedPut(final String endPoint, final Entity<?> entity) { - Response rawresp = sendNoAuthRequest(endPoint).put(entity); + var rawresp = sendNoAuthRequest(endPoint).put(entity); assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus()); } @@ -149,7 +148,7 @@ public class CommonRestController { * @param endPoint the endpoint */ protected void assertUnauthorizedGet(final String endPoint) { - Response rawresp = sendNoAuthRequest(endPoint).buildGet().invoke(); + var rawresp = sendNoAuthRequest(endPoint).buildGet().invoke(); assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus()); } @@ -159,7 +158,7 @@ public class CommonRestController { * @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()); } @@ -169,7 +168,7 @@ public class CommonRestController { * @param endPoint the endpoint */ protected void assertUnauthorizedDelete(final String endPoint) { - Response rawresp = sendNoAuthRequest(endPoint).delete(); + var rawresp = sendNoAuthRequest(endPoint).delete(); assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus()); } |