From 151d768e923994b3e81ade049d21bf65e931faac Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Mon, 5 Aug 2019 23:38:18 +0300 Subject: handle errors in change management and tenant isolation use more tolerance way for parsing responses from MSO so VID can handle error responses with html body Issue-ID: VID-378 Signed-off-by: Eylon Malin Change-Id: I72741ec1bf636a1200e8ecbd684ab1f3b2ab332a Signed-off-by: Ittay Stern Signed-off-by: Eylon Malin --- .../controller/OperationalEnvironmentController.java | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java') diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java b/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java index a6778ad0c..44bdc813b 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java @@ -33,6 +33,7 @@ import org.onap.vid.model.RequestReferencesContainer; import org.onap.vid.mso.MsoBusinessLogic; import org.onap.vid.mso.MsoInterface; import org.onap.vid.mso.MsoResponseWrapper2; +import org.onap.vid.mso.MsoUtil; import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo; import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo; import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails; @@ -80,9 +81,7 @@ public class OperationalEnvironmentController extends VidRestrictedBaseControlle RequestDetailsWrapper requestDetailsWrapper = msoBusinessLogic.convertParametersToRequestDetails(operationalEnvironment, userId); String path = msoBusinessLogic.getOperationalEnvironmentCreationPath(); - HttpResponse msoResponse = restMso.post(path, requestDetailsWrapper, RequestReferencesContainer.class); - debugEnd(msoResponse); - return new MsoResponseWrapper2<>(msoResponse); + return MsoUtil.wrapResponse2(restMso.post(path, requestDetailsWrapper, String.class), RequestReferencesContainer.class); } @RequestMapping(value = "/activate", method = RequestMethod.POST) @@ -105,10 +104,7 @@ public class OperationalEnvironmentController extends VidRestrictedBaseControlle String path = msoBusinessLogic.getOperationalEnvironmentActivationPath(activateInfo); RequestDetailsWrapper requestDetailsWrapper = msoBusinessLogic.createOperationalEnvironmentActivationRequestDetails(activateInfo); - HttpResponse msoResponse = restMso.post(path, requestDetailsWrapper, RequestReferencesContainer.class); - - debugEnd(msoResponse); - return new MsoResponseWrapper2<>(msoResponse); + return MsoUtil.wrapResponse2(restMso.post(path, requestDetailsWrapper, String.class), RequestReferencesContainer.class); } @RequestMapping(value = "/deactivate", method = RequestMethod.POST) @@ -126,10 +122,7 @@ public class OperationalEnvironmentController extends VidRestrictedBaseControlle String path = msoBusinessLogic.getOperationalEnvironmentDeactivationPath(deactivateInfo); RequestDetailsWrapper requestDetailsWrapper = msoBusinessLogic.createOperationalEnvironmentDeactivationRequestDetails(deactivateInfo); - HttpResponse msoResponse = restMso.post(path, requestDetailsWrapper, RequestReferencesContainer.class); - - debugEnd(msoResponse); - return new MsoResponseWrapper2<>(msoResponse); + return MsoUtil.wrapResponse2(restMso.post(path, requestDetailsWrapper, String.class), RequestReferencesContainer.class); } @RequestMapping(value = "/requestStatus", method = RequestMethod.GET) @@ -140,10 +133,7 @@ public class OperationalEnvironmentController extends VidRestrictedBaseControlle verifyIsNotEmpty(requestId, "requestId"); String path = msoBusinessLogic.getCloudResourcesRequestsStatusPath(requestId); - HttpResponse msoResponse = restMso.get(path, HashMap.class); - - LOGGER.debug(EELFLoggerDelegate.debugLogger, "end {}() => {}", getMethodName(), msoResponse); - return new MsoResponseWrapper2<>(msoResponse); + return MsoUtil.wrapResponse2(restMso.get(path, String.class), HashMap.class); } @ExceptionHandler({ -- cgit 1.2.3-korg