use of com.centurylink.mdw.designer.utils.ValidationException in project mdw-designer by CenturyLinkCloud.
the class TestCaseRun method validateEngineCallResponse.
protected JSONObject validateEngineCallResponse(String response) throws ValidationException, XmlException, JSONException {
MDWStatusMessageDocument statusMessageDoc;
if (response.startsWith("{")) {
StatusMessage statusMessage = new StatusMessage(new JSONObject(response));
statusMessageDoc = statusMessage.getStatusDocument();
} else {
statusMessageDoc = MDWStatusMessageDocument.Factory.parse(response, Compatibility.namespaceOptions());
}
MDWStatusMessage statusMessage = statusMessageDoc.getMDWStatusMessage();
if (statusMessage.getStatusCode() == -3) {
// event handler not registered
throw new ValidationException("No event handler is registered for regression test actions");
} else if (statusMessage.getStatusCode() != 0) {
throw new ValidationException("Error response from server: " + statusMessage.getStatusMessage());
}
if (statusMessage.getStatusMessage().startsWith("{"))
return new JSONObject(statusMessage.getStatusMessage());
else
return null;
}
Aggregations