use of org.onap.msb.sdk.discovery.common.RouteException in project so by onap.
the class AbstractSdncOperationTask method httpPost.
protected String httpPost(String url, HttpPost httpPost) throws RouteException {
logger.info("AbstractSdncOperationTask.httpPost begin!");
String result = null;
String errorMsg;
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost);
result = EntityUtils.toString(closeableHttpResponse.getEntity());
logger.info("result = {}", result);
if (closeableHttpResponse.getStatusLine().getStatusCode() != 200) {
logger.info("exception: fail for status code = {}", closeableHttpResponse.getStatusLine().getStatusCode());
throw new RouteException(result, "SERVICE_GET_ERR");
}
closeableHttpResponse.close();
} catch (IOException e) {
errorMsg = url + ":httpPostWithJSON connect faild";
logger.info("exception: POST_CONNECT_FAILD : {}", errorMsg);
throwsRouteException(errorMsg, e, "POST_CONNECT_FAILD");
}
logger.info("AbstractSdncOperationTask.httpPost end!");
return result;
}
use of org.onap.msb.sdk.discovery.common.RouteException in project so by onap.
the class SdncNetworkTopologyOperationTask method saveOutput.
private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws RouteException {
logger.info("SdncNetworkTopologyOperationTask.saveOutput begin!");
String responseCode = output.getOutput().getResponseCode();
if (!"200".equals(responseCode)) {
String processKey = getProcessKey(execution);
int errorCode = Integer.parseInt(responseCode);
String errorMessage = output.getOutput().getResponseMessage();
WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("SDNCA_SuccessIndicator", workflowException);
updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), "100", errorMessage);
logger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!");
throw new RouteException();
}
logger.info("SdncNetworkTopologyOperationTask.saveOutput end!");
}
use of org.onap.msb.sdk.discovery.common.RouteException in project so by onap.
the class SdncServiceTopologyOperationTask method saveOutput.
private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception {
logger.info("SdncServiceTopologyOperationTask.saveOutput begin!");
String responseCode = output.getOutput().getResponseCode();
if (!"200".equals(responseCode)) {
String processKey = getProcessKey(execution);
int errorCode = Integer.parseInt(responseCode);
String errorMessage = output.getOutput().getResponseMessage();
WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("SDNCA_SuccessIndicator", workflowException);
updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage);
logger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!");
throw new RouteException();
}
logger.info("SdncServiceTopologyOperationTask.saveOutput end!");
}
Aggregations