diff options
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/client')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpServerTest.java | 33 | ||||
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpsServerTest.java | 54 |
2 files changed, 46 insertions, 41 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpServerTest.java b/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpServerTest.java index 18b4089b5..b30cf5f32 100644 --- a/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpServerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpServerTest.java @@ -20,31 +20,32 @@ package org.onap.vid.client; +import static com.xebialabs.restito.builder.stub.StubHttp.whenHttp; +import static com.xebialabs.restito.builder.verify.VerifyHttp.verifyHttp; +import static com.xebialabs.restito.semantics.Action.contentType; +import static com.xebialabs.restito.semantics.Action.ok; +import static com.xebialabs.restito.semantics.Action.status; +import static com.xebialabs.restito.semantics.Action.stringContent; +import static org.mockito.Mockito.mock; +import static org.testng.Assert.assertEquals; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableMap; +import com.xebialabs.restito.semantics.Action; import com.xebialabs.restito.semantics.Condition; import com.xebialabs.restito.server.StubServer; import io.joshworks.restclient.http.HttpResponse; import io.joshworks.restclient.http.JsonNode; +import java.util.Collections; +import java.util.Map; +import org.glassfish.grizzly.http.Method; import org.glassfish.grizzly.http.util.HttpStatus; -import com.xebialabs.restito.semantics.Action; -import org.testng.annotations.BeforeMethod; +import org.onap.vid.utils.Logging; import org.testng.annotations.AfterMethod; -import org.glassfish.grizzly.http.Method; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.util.Collections; -import java.util.Map; - -import static com.xebialabs.restito.builder.verify.VerifyHttp.verifyHttp; -import static com.xebialabs.restito.builder.stub.StubHttp.whenHttp; -import static com.xebialabs.restito.semantics.Action.stringContent; -import static com.xebialabs.restito.semantics.Action.contentType; -import static com.xebialabs.restito.semantics.Action.status; -import static com.xebialabs.restito.semantics.Action.ok; -import static org.testng.Assert.assertEquals; - public class SyncRestClientForHttpServerTest { private static final SyncRestClientModel.TestModel testObject = new SyncRestClientModel.TestModel(1, "test"); @@ -53,12 +54,14 @@ public class SyncRestClientForHttpServerTest { private StubServer stubServer; private ObjectMapper objectMapper = new ObjectMapper(); private SyncRestClient syncRestClient; + private Logging mockLoggingService; @BeforeMethod public void setUp() { stubServer = new StubServer(); stubServer.run(); - syncRestClient = new SyncRestClient(); + mockLoggingService = mock(Logging.class); + syncRestClient = new SyncRestClient(mockLoggingService); } @AfterMethod diff --git a/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpsServerTest.java b/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpsServerTest.java index a1297bd7c..758dd070b 100644 --- a/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpsServerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/client/SyncRestClientForHttpsServerTest.java @@ -20,40 +20,40 @@ package org.onap.vid.client; +import static com.xebialabs.restito.builder.stub.StubHttp.whenHttp; +import static com.xebialabs.restito.builder.verify.VerifyHttp.verifyHttp; +import static com.xebialabs.restito.semantics.Action.contentType; +import static com.xebialabs.restito.semantics.Action.ok; +import static com.xebialabs.restito.semantics.Action.stringContent; +import static org.apache.http.client.config.RequestConfig.custom; +import static org.mockito.Mockito.mock; +import static org.testng.Assert.assertEquals; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.xebialabs.restito.semantics.Action; +import com.xebialabs.restito.semantics.Condition; +import com.xebialabs.restito.server.StubServer; import io.joshworks.restclient.http.HttpResponse; import io.joshworks.restclient.http.JsonNode; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import java.security.GeneralSecurityException; +import java.util.Collections; +import javax.net.ssl.SSLContext; +import org.apache.http.config.Registry; +import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import com.fasterxml.jackson.core.JsonProcessingException; +import org.apache.http.conn.ssl.SSLContextBuilder; import org.apache.http.conn.ssl.TrustSelfSignedStrategy; -import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.conn.ssl.SSLContextBuilder; -import com.xebialabs.restito.semantics.Condition; -import com.xebialabs.restito.server.StubServer; -import com.xebialabs.restito.semantics.Action; -import org.apache.http.config.RegistryBuilder; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.AfterMethod; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.glassfish.grizzly.http.Method; -import org.apache.http.client.HttpClient; -import org.apache.http.config.Registry; +import org.onap.vid.utils.Logging; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.security.GeneralSecurityException; -import javax.net.ssl.SSLContext; -import java.util.Collections; - -import static com.xebialabs.restito.builder.verify.VerifyHttp.verifyHttp; -import static com.xebialabs.restito.builder.stub.StubHttp.whenHttp; -import static com.xebialabs.restito.semantics.Action.stringContent; -import static com.xebialabs.restito.semantics.Action.contentType; -import static org.apache.http.client.config.RequestConfig.custom; -import static com.xebialabs.restito.semantics.Action.ok; -import static org.testng.Assert.assertEquals; - public class SyncRestClientForHttpsServerTest { private static final SyncRestClientModel.TestModel testObject = new SyncRestClientModel.TestModel(1, "test"); @@ -62,12 +62,14 @@ public class SyncRestClientForHttpsServerTest { private ObjectMapper objectMapper = new ObjectMapper(); private SyncRestClient syncRestClient; + private Logging mockLoggingService; @BeforeMethod public void setUp() throws GeneralSecurityException { stubServer = new StubServer(); stubServer.secured().run(); - syncRestClient = new SyncRestClient(createNaiveHttpClient()); + mockLoggingService = mock(Logging.class); + syncRestClient = new SyncRestClient(createNaiveHttpClient(), mockLoggingService); } @AfterMethod |