diff options
2 files changed, 11 insertions, 3 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java index 3e314407..9ed16110 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java @@ -260,8 +260,16 @@ public class PackageDistributionController { } @RequestMapping(value = {"/uui-lcm/terminateNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json") - public String terminateNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id){ - return packageDistributionService.terminateNetworkServiceInstance(request,ns_instance_id); + public String terminateNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id) throws ParseException{ + String result = packageDistributionService.terminateNetworkServiceInstance(request,ns_instance_id); + String jobId = ""; + if(UuiCommonUtil.isNotNullOrEmpty(result)){ + JSONObject jobIdObject = JSONObject.parseObject(result); + jobId = jobIdObject.getString("jobId"); + } + ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.DELETING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); + serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera); + return result; } @RequestMapping(value = {"/uui-lcm/healNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json") diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java index 11e670ba..00a133d8 100644 --- a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java +++ b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java @@ -306,7 +306,7 @@ public class PackageDistributionControllerTest { } @Test - public void testTerminateNetworkServiceInstance() throws IOException { + public void testTerminateNetworkServiceInstance() throws Exception { String ns_instance_id="1"; HttpServletRequest request = mockRequest(); controller.terminateNetworkServiceInstance(request,ns_instance_id); |