aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java
diff options
context:
space:
mode:
authorWojciech Sliwka <wojciech.sliwka@nokia.com>2018-10-05 12:01:17 +0200
committerWojciech Sliwka <wojciech.sliwka@nokia.com>2018-10-09 10:48:34 +0200
commit08f41afcbd8222e9376ab6d3873899999590b7cd (patch)
tree79a78ddd1cf1a4e632882359182aec3140613967 /vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java
parentf1b3b34751a21e284bc7f39e71354459cf6b7154 (diff)
Correct flow for ScaleOut
Change-Id: I347fec1e15526fa9b43ab57612235b55dee3eeba Issue-ID: VID-321 Signed-off-by: Wojciech Sliwka <wojciech.sliwka@nokia.com>
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.java17
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 {