From db377dde042b3cdf0f44d6be68ff273e623f9dc1 Mon Sep 17 00:00:00 2001 From: pwielebs Date: Tue, 4 Jun 2019 16:14:49 +0200 Subject: Fix attachment-point issue for Dublin release Change-Id: Ieb562cdf4ea8e085480615c238f384718ee2f074 Issue-ID: DCAEGEN2-1596 Signed-off-by: pwielebs --- prh-app-server/pom.xml | 4 +-- .../services/prh/tasks/BbsActionsTaskImpl.java | 5 +-- .../services/prh/tasks/BbsActionsTaskTest.java | 36 ++++++---------------- 3 files changed, 12 insertions(+), 33 deletions(-) (limited to 'prh-app-server') diff --git a/prh-app-server/pom.xml b/prh-app-server/pom.xml index ffab7cbf..cd71cb51 100644 --- a/prh-app-server/pom.xml +++ b/prh-app-server/pom.xml @@ -26,7 +26,7 @@ org.onap.dcaegen2.services prh - 1.2.3-SNAPSHOT + 1.2.4-SNAPSHOT org.onap.dcaegen2.services.prh @@ -173,7 +173,7 @@ org.onap.dcaegen2.services.prh prh-commons - 1.2.3-SNAPSHOT + 1.2.4-SNAPSHOT org.onap.dcaegen2.services.sdk.rest.services diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskImpl.java index 02691446..7b88e21b 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskImpl.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskImpl.java @@ -38,15 +38,12 @@ import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.RequestBody; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.RxHttpClient; import org.onap.dcaegen2.services.sdk.rest.services.uri.URI.URIBuilder; import org.onap.dcaegen2.services.sdk.security.ssl.SslFactory; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import reactor.core.publisher.Mono; - - import java.util.Arrays; import java.util.List; import java.util.function.Function; @@ -57,7 +54,7 @@ import static org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpMet public class BbsActionsTaskImpl implements BbsActionsTask { private static final Logger LOGGER = LoggerFactory.getLogger(BbsActionsTaskImpl.class); - private static final String ATTACHMENT_POINT = "attachmentPoint"; + private static final String ATTACHMENT_POINT = "attachment-point"; private static final String LOGICAL_LINK_URI = "/network/logical-links/logical-link/"; private static final String PNF_URI = "/network/pnfs/pnf/"; diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java index 5edf15a8..798b5ea3 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java @@ -20,23 +20,8 @@ package org.onap.dcaegen2.services.prh.tasks; -import static java.nio.charset.StandardCharsets.UTF_8; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; - -import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import io.netty.buffer.ByteBuf; import io.netty.handler.codec.http.HttpResponseStatus; -import java.io.InputStreamReader; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.onap.dcaegen2.services.prh.TestAppConfiguration; @@ -49,9 +34,15 @@ import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpRequest; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpResponse; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.ImmutableHttpResponse; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.RxHttpClient; -import org.reactivestreams.Publisher; import reactor.core.publisher.Mono; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.*; + class BbsActionsTaskTest { private static final String CORRECT_LOGICAL_LINK_JSON = "bbs_action/correct_logical_link.json"; @@ -99,7 +90,7 @@ class BbsActionsTaskTest { given(cbsConfiguration.getAaiClientConfiguration()).willReturn(aaiClientConfiguration); JsonObject additionalFields = new JsonObject(); - additionalFields.addProperty("attachmentPoint", "some-link"); + additionalFields.addProperty("attachment-point", "some-link"); ConsumerDmaapModel consumerDmaapModel = buildConsumerDmaapModel(additionalFields); given(httpClient.call(any())).willReturn(Mono.just(buildAaiResponse(HttpResponseStatus.OK))); @@ -118,7 +109,7 @@ class BbsActionsTaskTest { given(cbsConfiguration.getAaiClientConfiguration()).willReturn(aaiClientConfiguration); JsonObject additionalFields = new JsonObject(); - additionalFields.addProperty("attachmentPoint", "some-link"); + additionalFields.addProperty("attachment-point", "some-link"); ConsumerDmaapModel consumerDmaapModel = buildConsumerDmaapModel(additionalFields); given(httpClient.call(any())).willReturn(Mono.just(buildAaiResponse(HttpResponseStatus.INTERNAL_SERVER_ERROR))); @@ -159,13 +150,4 @@ class BbsActionsTaskTest { .rawBody("".getBytes()) .build(); } - - private void assertJsonEquals(Publisher requestBody, String path) { - JsonParser parser = new JsonParser(); - JsonElement result = parser.parse(Mono.from(requestBody).block().toString(UTF_8)); - JsonElement expected = parser - .parse(new InputStreamReader(getClass().getClassLoader().getResourceAsStream(path))); - - assertThat(result).isEqualTo(expected); - } } \ No newline at end of file -- cgit 1.2.3-korg