summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-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
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java2
4 files changed, 17 insertions, 4 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(),
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
index e30fe660c3..2636aec4a7 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
@@ -60,12 +60,13 @@ public class SdnCommonTasksTest{
@Test
public void validateSDNResponseTest() throws BadResponseException {
+ String jsonResponse = "{\"output\":{\"response-code\":\"0\",\"response-message\":\"success\"}}";
LinkedHashMap<String, Object> responseMap = new LinkedHashMap<>();
LinkedHashMap<String, Object> output = new LinkedHashMap<>();
output.put("response-code", "0");
output.put("response-message", "success");
responseMap.put("output", output);
- assertEquals("success", sdnCommonTasks.validateSDNResponse(responseMap));
+ assertEquals(jsonResponse, sdnCommonTasks.validateSDNResponse(responseMap));
}
@Test
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 cc1c5c5329..9117b8ea64 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
@@ -77,6 +77,6 @@ public class SDNCClientIT extends BaseIntegrationTest {
.withHeader("Content-Type", "application/json").withBody(responseJson)));
String response = SPY_sdncClient.post("", SDNCTopology.NETWORK);
- JSONAssert.assertEquals("", response, false);
+ JSONAssert.assertEquals(responseJson, response, true);
}
}