diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2019-09-10 16:31:01 +0300 |
---|---|---|
committer | Eylon Malin <eylon.malin@intl.att.com> | 2019-09-12 08:51:25 +0300 |
commit | 2265215c803291e029add2db7912c7b1e25e0a8e (patch) | |
tree | 3082c232fa26483a0f1262efcc5c228d554280d1 /vid-app-common/src/test/java/org/onap/vid/asdc | |
parent | 77e77f77c89ca1bef622b12c71897ab1ab256216 (diff) |
make Logging a service and inject it to SyncRestClient
Issue-ID: VID-611
Change-Id: I120782884351c55b2e0d1b4ca8bae1e2479d1d0a
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/asdc')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java | 11 | ||||
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientTest.java | 10 |
2 files changed, 14 insertions, 7 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java index 589874d2a..fd946ebde 100644 --- a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java @@ -29,8 +29,12 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.matchesPattern; import static org.hamcrest.collection.IsIterableContainingInOrder.contains; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; import static org.onap.vid.client.SyncRestClientInterface.HEADERS.X_ECOMP_INSTANCE_ID; import static org.onap.vid.utils.Logging.REQUEST_ID_HEADER_KEY; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.xebialabs.restito.semantics.Call; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -55,8 +59,7 @@ import org.onap.vid.asdc.AsdcCatalogException; import org.onap.vid.asdc.beans.Service; import org.onap.vid.client.SyncRestClient; import org.onap.vid.testUtils.StubServerUtil; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.xebialabs.restito.semantics.Call; +import org.onap.vid.utils.Logging; public class SdcRestClientITTest { @@ -69,9 +72,9 @@ public class SdcRestClientITTest { public static void setUpClass() throws GeneralSecurityException { stubServer = new StubServerUtil(); stubServer.runSecuredServer(); - SyncRestClient syncRestClient = new SyncRestClient(createNaiveHttpClient()); + SyncRestClient syncRestClient = new SyncRestClient(createNaiveHttpClient(), mock(Logging.class)); String serverUrl = stubServer.constructTargetUrl("https", ""); - sdcRestClient = new SdcRestClient(serverUrl, "", syncRestClient); + sdcRestClient = new SdcRestClient(serverUrl, "", syncRestClient, mock(Logging.class)); } @AfterClass diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientTest.java index 13fe761c6..837be5332 100644 --- a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientTest.java @@ -52,6 +52,7 @@ import org.onap.vid.asdc.AsdcCatalogException; import org.onap.vid.asdc.AsdcClient; import org.onap.vid.asdc.beans.Service; import org.onap.vid.client.SyncRestClient; +import org.onap.vid.utils.Logging; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -80,6 +81,9 @@ public class SdcRestClientTest { @Mock private InputStream inputStream; + @Mock + private Logging loggingService; + private UUID randomId; private Service sampleService; @@ -92,7 +96,7 @@ public class SdcRestClientTest { MockitoAnnotations.initMocks(this); randomId = UUID.randomUUID(); sampleService = createTestService(); - restClient = new SdcRestClient(SAMPLE_BASE_URL, SAMPLE_AUTH, mockedSyncRestClient); + restClient = new SdcRestClient(SAMPLE_BASE_URL, SAMPLE_AUTH, mockedSyncRestClient, loggingService); } @@ -191,7 +195,7 @@ public class SdcRestClientTest { setupMocks.accept(syncRestClient); try { - new SdcRestClient(SAMPLE_BASE_URL, SAMPLE_AUTH, syncRestClient).getServiceToscaModel(UUID.randomUUID()); + new SdcRestClient(SAMPLE_BASE_URL, SAMPLE_AUTH, syncRestClient, loggingService).getServiceToscaModel(UUID.randomUUID()); } catch (Exception e) { assertThat("root cause incorrect for " + ExceptionUtils.getStackTrace(e), ExceptionUtils.getRootCause(e), instanceOf(expectedType)); return; //OK @@ -240,7 +244,7 @@ public class SdcRestClientTest { setupMocks.accept(mockResponse); try { - new SdcRestClient(SAMPLE_BASE_URL, SAMPLE_AUTH, syncRestClient).getServiceToscaModel(UUID.randomUUID()); + new SdcRestClient(SAMPLE_BASE_URL, SAMPLE_AUTH, syncRestClient, loggingService).getServiceToscaModel(UUID.randomUUID()); } catch (AsdcCatalogException e) { assertThat(e.getMessage(), containsString(String.valueOf(mockResponse.getStatus()))); assertThat(e.getMessage(), containsString(exceptedBody)); |