From 407d5aa873d9554c89aa6e24dd4410766b1605d4 Mon Sep 17 00:00:00 2001 From: Yulian Han Date: Wed, 23 May 2018 10:33:07 +0800 Subject: use space character instead tab characters Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f0643f8 Issue-ID: SO-632 Signed-off-by: Yulian Han --- .../org/openecomp/mso/adapters/vfc/VfcManager.java | 118 ++++++++++----------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java index 57d3bf5bb2..01e4c718d2 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java @@ -345,65 +345,65 @@ public class VfcManager { * @return * @since ONAP Amsterdam Release */ - public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException { - - ValidateUtil.assertObjectNotNull(jobId); - // Step 1: query the current resource operation status - ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus( - nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - - // Step 2: start query - LOGGER.info("query ns status -> begin"); - String url = getUrl(jobId, CommonConstant.Step.QUERY); - String methodType = CommonConstant.MethodType.GET; - // prepare restful parameters and options - RestfulResponse rsp = RestfulUtil.send(url, methodType, ""); - ValidateUtil.assertObjectNotNull(rsp); - LOGGER.info("query ns progress response status is : {}", rsp.getStatus()); - LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent()); - // Step 3:check the response staus - if (!HttpCode.isSucess(rsp.getStatus())) { - LOGGER.info("fail to query job status"); - nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); - } - // Step 4: Process Network Service Instantiate Response - NsProgressStatus nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class); - ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor(); - // Step 5: update segment operation progress - - nsOperInfo.setProgress(rspDesc.getProgress()); - nsOperInfo.setStatusDescription(rspDesc.getStatusDescription()); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - - // Step 6: update segment operation status - if (RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress()) - && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) { - LOGGER.info("job result is succeeded, operType is {}", nsOperInfo.getOperType()); - nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); - String operType = nsOperInfo.getOperType(); - if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType) - || "createInstance".equalsIgnoreCase(operType)) { - nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED); - } - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - } else if (RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) { - LOGGER.error("job result is failed, operType is {}", nsOperInfo.getOperType()); - nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR); - } else { - LOGGER.error("unexcepted response status"); - } - LOGGER.info("query ns status -> end"); - - return rsp; - } + public RestfulResponse getNsProgress (NsOperationKey nsOperationKey, String jobId) throws ApplicationException { + + ValidateUtil.assertObjectNotNull (jobId); + // Step 1: query the current resource operation status + ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance ()).getResourceOperationStatus ( + nsOperationKey.getServiceId (), nsOperationKey.getOperationId (), nsOperationKey.getNodeTemplateUUID ()); + + // Step 2: start query + LOGGER.info ("query ns status -> begin"); + String url = getUrl (jobId, CommonConstant.Step.QUERY); + String methodType = CommonConstant.MethodType.GET; + // prepare restful parameters and options + RestfulResponse rsp = RestfulUtil.send (url, methodType, ""); + ValidateUtil.assertObjectNotNull (rsp); + LOGGER.info ("query ns progress response status is : {}", rsp.getStatus ()); + LOGGER.info ("query ns progress response content is : {}", rsp.getResponseContent ()); + // Step 3:check the response staus + if (!HttpCode.isSucess (rsp.getStatus ())) { + LOGGER.info ("fail to query job status"); + nsOperInfo.setErrorCode (String.valueOf (rsp.getStatus ())); + nsOperInfo.setStatus (RequestsDbConstant.Status.ERROR); + nsOperInfo.setStatusDescription (CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); + (RequestsDatabase.getInstance ()).updateResOperStatus (nsOperInfo); + throw new ApplicationException (HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); + } + // Step 4: Process Network Service Instantiate Response + NsProgressStatus nsProgress = JsonUtil.unMarshal (rsp.getResponseContent (), NsProgressStatus.class); + ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor (); + // Step 5: update segment operation progress + + nsOperInfo.setProgress (rspDesc.getProgress ()); + nsOperInfo.setStatusDescription (rspDesc.getStatusDescription ()); + (RequestsDatabase.getInstance ()).updateResOperStatus (nsOperInfo); + + // Step 6: update segment operation status + if (RequestsDbConstant.Progress.ONE_HUNDRED.equals (rspDesc.getProgress ()) + && RequestsDbConstant.Status.FINISHED.equals (rspDesc.getStatus ())) { + LOGGER.info ("job result is succeeded, operType is {}", nsOperInfo.getOperType ()); + nsOperInfo.setErrorCode (String.valueOf (rsp.getStatus ())); + String operType = nsOperInfo.getOperType (); + if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase (operType) + || "createInstance".equalsIgnoreCase (operType)) { + nsOperInfo.setStatus (RequestsDbConstant.Status.FINISHED); + } + (RequestsDatabase.getInstance ()).updateResOperStatus (nsOperInfo); + } else if (RequestsDbConstant.Status.ERROR.equals (rspDesc.getStatus ())) { + LOGGER.error ("job result is failed, operType is {}", nsOperInfo.getOperType ()); + nsOperInfo.setErrorCode (String.valueOf (rsp.getStatus ())); + nsOperInfo.setStatusDescription (CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); + nsOperInfo.setStatus (RequestsDbConstant.Status.ERROR); + (RequestsDatabase.getInstance ()).updateResOperStatus (nsOperInfo); + throw new ApplicationException (HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR); + } else { + LOGGER.error ("unexcepted response status"); + } + LOGGER.info ("query ns status -> end"); + + return rsp; + } /** * Scale NS instance -- cgit 1.2.3-korg