aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-common
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-09-21 07:37:43 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-21 07:37:43 +0000
commitbe96dc7c39eed6142430d8c0486b1140a5c3a921 (patch)
tree41d3baf233875215f7d89d26effc29e157aeb0fc /mso-api-handlers/mso-api-handler-common
parentae2f2da622b8bb4a6507d72829d5459535bae6e3 (diff)
parent6dc2a63d4ed8324058b4ee527ff438a6b97094d8 (diff)
Merge "added test case to ResponseHandlerTest.java"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
index 117c8a2c27..0d4778b5b6 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -17,7 +19,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.apihandler.common;
@@ -27,8 +29,6 @@ import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.ProtocolVersion;
@@ -38,13 +38,7 @@ import org.apache.http.message.BasicStatusLine;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.onap.so.apihandler.common.ErrorNumbers;
-import org.onap.so.apihandler.common.ResponseHandler;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.JsonMappingException;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
-import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
/**
@@ -68,13 +62,27 @@ public class ResponseHandlerTest{
HttpResponse response = createResponse (200, body, "application/json");
ResponseHandler respHandler = new ResponseHandler (response, 1);
-
+
int status = respHandler.getStatus ();
assertEquals (status, HttpStatus.SC_ACCEPTED);
assertEquals (respHandler.getResponse ().getMessage (), "Successfully started the process");
}
+
+ @Test
+ public void tesParseCamundaResponseForCamundaTaskType () throws ApiException {
+ String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 200,"
+ + "\"message\": \"Successfully started the process\"}";
+ HttpResponse response = createResponse (200, body, "application/json");
+
+ ResponseHandler respHandler = new ResponseHandler (response, 2);
+
+ int status = respHandler.getStatus ();
+ assertEquals (status, HttpStatus.SC_ACCEPTED);
+ assertEquals (respHandler.getResponseBody(), body);
+
+ }
@Test
public void tesParseBpelResponse () throws ApiException{
String body = "<test:service-response xmlns:test=\"http://org.onap/so/test\">"
@@ -99,7 +107,7 @@ public class ResponseHandlerTest{
thrown.expectMessage(startsWith("Cannot parse Camunda Response"));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_BAD_REQUEST)));
thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER)));
-
+
HttpResponse response = createResponse (HttpStatus.SC_NOT_FOUND, "<html>error</html>", "text/html");
ResponseHandler respHandler = new ResponseHandler (response, 1);