aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2019-04-08 15:47:32 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2019-04-08 15:47:40 +0800
commitb6e75980322117dd69884de8b81be360b4ebfcd3 (patch)
tree05811f8a56440bf13c217fe892661ac91ab6de54
parentf82ca2930e2142f87a2d5c3686a753fec5334a5b (diff)
Enhancement of NS Instance Termination
Change-Id: I8a7b128e4434b4c77c6b3af65341359fb14df44c Issue-ID: USECASEUI-253 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java12
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java2
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);