aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java54
1 files changed, 26 insertions, 28 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
index 70f196db8c..0b338bde1d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
@@ -25,11 +25,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
-
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.client.exception.BadResponseException;
@@ -38,43 +36,43 @@ import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.skyscreamer.jsonassert.JSONAssert;
public class SDNCClientIT extends BaseIntegrationTest {
- private final static String JSON_FILE_LOCATION = "src/test/resources/__files/";
-
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/";
+
@Test
public void getTest() throws BadResponseException, MapperException, IOException {
- String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientGetResponse.json")));
- String queryLink = "/topologyQuery";
-
- wireMockServer.stubFor(get(urlEqualTo(queryLink))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json").withBody(responseJson)));
+ String responseJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientGetResponse.json")));
+ String queryLink = "/topologyQuery";
+
+ wireMockServer.stubFor(get(urlEqualTo(queryLink)).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(responseJson)));
String response = SPY_sdncClient.get(queryLink);
JSONAssert.assertEquals(responseJson, response, false);
}
-
+
@Test(expected = BadResponseException.class)
public void post404Test() throws BadResponseException, MapperException, IOException {
- String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut404Response.json")));
-
- String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
-
- wireMockServer.stubFor(post(urlMatching(queryLink))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json").withBody(responseJson)));
-
+ String responseJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut404Response.json")));
+
+ String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
+
+ wireMockServer.stubFor(post(urlMatching(queryLink)).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(responseJson)));
+
SPY_sdncClient.post("", SDNCTopology.NETWORK);
}
-
+
@Test
public void post200Test() throws BadResponseException, MapperException, IOException {
- String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut200Response.json")));
-
- String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
-
- wireMockServer.stubFor(post(urlMatching(queryLink))
- .willReturn(aResponse().withStatus(200)
- .withHeader("Content-Type", "application/json").withBody(responseJson)));
-
+ String responseJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut200Response.json")));
+
+ String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
+
+ wireMockServer.stubFor(post(urlMatching(queryLink)).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(responseJson)));
+
String response = SPY_sdncClient.post("", SDNCTopology.NETWORK);
JSONAssert.assertEquals(responseJson, response, true);
}