diff options
author | Amichai Hemli <ah0398@intl.att.com> | 2018-10-09 11:23:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-09 11:23:31 +0000 |
commit | 14c0e1ba34802d3baa76eb360964bd8a11030cc0 (patch) | |
tree | 8fed45c1e6642940a7ab6483bfd52b57fbc53eff /vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java | |
parent | 66962852e3a62ea7b14f2ac2d5af53fe77177306 (diff) | |
parent | 08f41afcbd8222e9376ab6d3873899999590b7cd (diff) |
Merge "Correct flow for ScaleOut"
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java index e8f556999..c81fa16fd 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java @@ -20,11 +20,13 @@ import java.util.function.BiFunction; import java.util.function.Function; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; + import org.glassfish.grizzly.http.Method; import org.glassfish.grizzly.http.util.HttpStatus; import org.json.JSONObject; import org.junit.Assert; import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.vid.changeManagement.RequestDetailsWrapper; import org.onap.vid.mso.MsoResponseWrapper; class MsoRestClientTestUtil implements AutoCloseable { @@ -60,6 +62,21 @@ class MsoRestClientTestUtil implements AutoCloseable { verifyServer(server, endpoint, Method.POST); } + void executePostCall(String jsonPayload, BiFunction<RequestDetailsWrapper, String, MsoResponseWrapper> func) throws IOException { + whenHttp(server) + .match(post(endpoint)) + .then(status(expectedStatus), jsonContent(responsePayload), contentType(MediaType.APPLICATION_JSON)); + + RequestDetailsWrapper sampleRequestDetails = + new ObjectMapper().readValue(jsonPayload, RequestDetailsWrapper.class); + + MsoResponseWrapper response = func.apply(sampleRequestDetails, endpoint); + JSONObject actualJson = new JSONObject(response.getEntity()); + + Assert.assertEquals(expectedStatus.getStatusCode(), response.getStatus()); + Assert.assertEquals(expectedResponseStr, actualJson.toString()); + verifyServer(server, endpoint, Method.POST); + } void executeDelete(String jsonPayload, BiFunction<RequestDetails, String, MsoResponseWrapper> func) throws IOException { |