aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2018-12-07 11:37:19 -0500
committerKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2018-12-07 11:38:03 -0500
commit97c2d575107de9345ef0647e7d9b8739c7abc55f (patch)
tree9988b8c61eba8e85faa09f30fb013da0e9bfe9fb /bpmn/so-bpmn-tasks/src/main
parent3b56cf0c1763c45b7673a087107c5e1553dd4f40 (diff)
sdnc common tasks returns response
fix the post200Test by returning the correct response fix the unit test that expected the json response fixed the sdnc common tasks to return json response Change-Id: I80392cbd9aa90955c47661eeee6c605c213525e7 Issue-ID: SO-1296 Signed-off-by: Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java12
2 files changed, 14 insertions, 2 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index fedec4f732..58c6db109c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.jayway.jsonpath.JsonPath;
+import com.jayway.jsonpath.PathNotFoundException;
@Component
public class SDNCRequestTasks {
@@ -61,6 +62,9 @@ public class SDNCRequestTasks {
String response = sdncClient.post(request.getSDNCPayload(),request.getTopology());
String finalMessageIndicator = JsonPath.read(response, "$.output.ack-final-indicator");
execution.setVariable("isSDNCCompleted", convertIndicatorToBoolean(finalMessageIndicator));
+ } catch(PathNotFoundException e) {
+ logger.error("Error Parsing SDNC Response", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Error Parsing SDNC Response");
} catch (MapperException e) {
logger.error("Error Parsing SDNC Response", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Error Parsing SDNC Response");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
index 37e13fb8d8..13ba107576 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
@@ -105,12 +105,20 @@ public class SdnCommonTasks {
responseCode = (String) embeddedResponse.get(RESPONSE_CODE);
responseMessage = (String) embeddedResponse.get(RESPONSE_MESSAGE);
}
-
+ ObjectMapper objMapper = new ObjectMapper();
+ String jsonResponse;
+ try {
+ jsonResponse = objMapper.writeValueAsString(output);
+ msoLogger.debug(jsonResponse);
+ } catch (JsonProcessingException e) {
+ msoLogger.warnSimple("Could not convert SDNC Response to String", e);
+ jsonResponse = "";
+ }
msoLogger.info("ResponseCode: " + responseCode + " ResponseMessage: " + responseMessage);
int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0;
if (isHttpCodeSuccess(code)) {
msoLogger.info("Successful Response from SDNC");
- return responseMessage;
+ return jsonResponse;
} else {
String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, errorMessage, "BPMN", MsoLogger.getServiceName(),