summaryrefslogtreecommitdiffstats
path: root/prh-dmaap-client/src/test
diff options
context:
space:
mode:
authorpwielebs <piotr.wielebski@nokia.com>2018-05-07 16:58:20 +0200
committerpwielebs <piotr.wielebski@nokia.com>2018-05-11 12:29:25 +0200
commita393ae34963a919b842127cc8943a94f2d7c1bc7 (patch)
tree666c78e8d10b0fd65e55494e2e27d52643cf92a2 /prh-dmaap-client/src/test
parent8c88efe7a0abe051e8a4c4d271c84eb8e68c29f0 (diff)
AAI client configuration & tasks changed
Change-Id: I86a2f2ed62565263f2be2c9078a092f993234a19 Issue-ID: DCAEGEN2-451 Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-dmaap-client/src/test')
-rw-r--r--prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/service/producer/ExtendedDmaapProducerHttpClientImplTest.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/service/producer/ExtendedDmaapProducerHttpClientImplTest.java b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/service/producer/ExtendedDmaapProducerHttpClientImplTest.java
index 3f64fd5f..6ca815ae 100644
--- a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/service/producer/ExtendedDmaapProducerHttpClientImplTest.java
+++ b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/service/producer/ExtendedDmaapProducerHttpClientImplTest.java
@@ -27,6 +27,8 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.onap.dcaegen2.services.config.DmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.model.ConsumerDmaapModel;
+import org.onap.dcaegen2.services.model.ConsumerDmaapModelForUnitTest;
import java.io.IOException;
import java.lang.reflect.Field;
@@ -43,10 +45,9 @@ public class ExtendedDmaapProducerHttpClientImplTest {
private static DmaapPublisherConfiguration configurationMock = mock(DmaapPublisherConfiguration.class);
private static CloseableHttpClient closeableHttpClientMock = mock(CloseableHttpClient.class);
- private static DmaapPublisherRequestDetails requestDetailsMock = mock(DmaapPublisherRequestDetails.class);
+ private static ConsumerDmaapModel consumerDmaapModel = new ConsumerDmaapModelForUnitTest();
private static Optional<String> expectedResult = Optional.empty();
- private static final String JSON_MESSAGE = "{ \"ipaddress-v4-oam\": \"11.22.33.44\" }";
private static final String RESPONSE_SUCCESS = "200";
private static final String RESPONSE_FAILURE = "404";
@@ -61,9 +62,6 @@ public class ExtendedDmaapProducerHttpClientImplTest {
when(configurationMock.dmaapContentType()).thenReturn("application/json");
when(configurationMock.dmaapTopicName()).thenReturn("pnfReady");
- when(requestDetailsMock.dmaapAPIPath()).thenReturn("events");
- when(requestDetailsMock.jsonBody()).thenReturn(JSON_MESSAGE);
-
objectUnderTest = new ExtendedDmaapProducerHttpClientImpl(configurationMock);
setField();
@@ -77,7 +75,7 @@ public class ExtendedDmaapProducerHttpClientImplTest {
when(closeableHttpClientMock.execute(any(HttpPost.class), any(ResponseHandler.class)))
.thenReturn(expectedResult);
- Optional<String> actualResult = objectUnderTest.getHttpProducerResponse(requestDetailsMock);
+ Optional<String> actualResult = objectUnderTest.getHttpProducerResponse(consumerDmaapModel);
Assertions.assertEquals(expectedResult.get(), actualResult.get());
}
@@ -87,7 +85,7 @@ public class ExtendedDmaapProducerHttpClientImplTest {
expectedResult = Optional.of(RESPONSE_FAILURE);
when(closeableHttpClientMock.execute(any(HttpPost.class), any(ResponseHandler.class)))
.thenReturn(Optional.empty());
- Optional<String> actualResult = objectUnderTest.getHttpProducerResponse(requestDetailsMock);
+ Optional<String> actualResult = objectUnderTest.getHttpProducerResponse(consumerDmaapModel);
Assertions.assertEquals(Optional.empty(), actualResult);
}