From 2265215c803291e029add2db7912c7b1e25e0a8e Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Tue, 10 Sep 2019 16:31:01 +0300 Subject: make Logging a service and inject it to SyncRestClient Issue-ID: VID-611 Change-Id: I120782884351c55b2e0d1b4ca8bae1e2479d1d0a Signed-off-by: Eylon Malin --- .../onap/vid/aai/AaiOverTLSClientServerTest.java | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java') diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java index dd7b26c12..a9fe256c1 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java @@ -20,12 +20,17 @@ package org.onap.vid.aai; +import static org.mockito.Mockito.mock; +import static org.mockito.MockitoAnnotations.initMocks; + import com.fasterxml.jackson.core.JsonProcessingException; import com.xebialabs.restito.semantics.Action; import io.joshworks.restclient.http.HttpResponse; import io.joshworks.restclient.http.mapper.ObjectMapper; +import java.io.IOException; import org.assertj.core.api.Assertions; import org.glassfish.grizzly.http.util.HttpStatus; +import org.jetbrains.annotations.NotNull; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import org.mockito.Mock; @@ -33,15 +38,12 @@ import org.onap.vid.aai.model.ResourceType; import org.onap.vid.client.SyncRestClient; import org.onap.vid.model.SubscriberList; import org.onap.vid.testUtils.StubServerUtil; +import org.onap.vid.utils.Logging; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.io.IOException; - -import static org.mockito.MockitoAnnotations.initMocks; - public class AaiOverTLSClientServerTest { @Mock @@ -107,8 +109,7 @@ public class AaiOverTLSClientServerTest { @Test public void shouldSearchNodeTypeByName() throws IOException, ParseException { - ObjectMapper objectMapper = getFasterXmlObjectMapper(); - AaiOverTLSClient aaiOverTLSClient = new AaiOverTLSClient(new SyncRestClient(objectMapper), propertySupplier, serverUtil.constructTargetUrl("http", "")); + AaiOverTLSClient aaiOverTLSClient = createAaiOverTLSClient(); serverUtil.prepareGetCall("/nodes/generic-vnfs", new JSONParser().parse(searchNodesQueryResponsePayload), Action.status(HttpStatus.OK_200)); @@ -118,10 +119,19 @@ public class AaiOverTLSClientServerTest { Assertions.assertThat(aaiNodeQueryResponseHttpResponse).isEqualTo(true); } + @NotNull + private AaiOverTLSClient createAaiOverTLSClient() { + return new AaiOverTLSClient( + new SyncRestClient(getFasterXmlObjectMapper(), mock(Logging.class)), + propertySupplier, + serverUtil.constructTargetUrl("http", "") + ); + } + @Test public void shouldGetSubscribers() throws ParseException, JsonProcessingException { ObjectMapper objectMapper = getFasterXmlObjectMapper(); - AaiOverTLSClient aaiOverTLSClient = new AaiOverTLSClient(new SyncRestClient(objectMapper), propertySupplier, serverUtil.constructTargetUrl("http", "")); + AaiOverTLSClient aaiOverTLSClient = createAaiOverTLSClient(); serverUtil.prepareGetCall("/business/customers", new JSONParser().parse(subscribersResponsePayload), Action.status(HttpStatus.OK_200)); -- cgit 1.2.3-korg