aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuji7 <lu.ji3@zte.com.cn>2017-11-14 17:17:30 +0800
committerLuji7 <lu.ji3@zte.com.cn>2017-11-14 17:17:34 +0800
commitfb78e0fdda1f851a6642fcc84ba8bf53205f0a87 (patch)
treebdd42521d93a710fa6537abb4177e22bc0fa7620
parent3c12720b82416c44c1bc2937fe43707a46d6d42c (diff)
Fix delete service issue.v1.1.01.0.0-ONAP1.0.0-Amsterdam
Change-Id: I1ce03b0ff48cc3b72b280de99f70416b019373f9 Issue-id: USECASEUI-55 Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java4
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java5
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmControllerTest.java5
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmServiceTest.java14
7 files changed, 19 insertions, 15 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java
index 9e6a690a..c79e1dca 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java
@@ -59,7 +59,7 @@ public class ServiceLcmController {
@ResponseBody
@RequestMapping(value = {"/uui-lcm/services/{serviceId}"}, method = RequestMethod.DELETE , produces = "application/json")
- public DeleteOperationRsp terminateService(@PathVariable(value = "serviceId") String serviceId){
- return serviceLcmService.terminateService(serviceId);
+ public DeleteOperationRsp terminateService(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request){
+ return serviceLcmService.terminateService(serviceId, request);
}
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java
index 60efbbb9..68e89ca8 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java
@@ -27,5 +27,5 @@ public interface ServiceLcmService {
OperationProgressInformation queryOperationProgress(String serviceId, String operationId);
- DeleteOperationRsp terminateService(String serviceId);
+ DeleteOperationRsp terminateService(String serviceId, HttpServletRequest request);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java
index cb8c4c8e..d5f4ed5a 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java
@@ -43,5 +43,5 @@ public interface SOService {
"Accept: application/json"
})
@DELETE("/ecomp/mso/infra/e2eServiceInstances/v3/{serviceId}")
- Call<DeleteOperationRsp> terminateService(@Path("serviceId") String serviceId);
+ Call<DeleteOperationRsp> terminateService(@Path("serviceId") String serviceId, @Body RequestBody body);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java
index d569970f..2e8ba8d9 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java
@@ -30,7 +30,7 @@ public interface VfcService {
@POST("/api/catalog/v1/vnfpackages")
Call<Job> distributeVnfPackage(@Body Csar csar);
- @GET("/api/nslcm/v1/jobs/{jobId}")
+ @GET("/api/catalog/v1/jobs/{jobId}")
Call<JobStatus> getJobStatus(@Path("jobId") String jobId, @Query("responseId") String responseId);
@DELETE("/api/catalog/v1/nspackages/{csarId}")
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java
index eef13e89..d1afe6ca 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java
@@ -84,9 +84,10 @@ public class DefaultServiceLcmService implements ServiceLcmService {
}
@Override
- public DeleteOperationRsp terminateService(String serviceId) {
+ public DeleteOperationRsp terminateService(String serviceId, HttpServletRequest request) {
try {
- Response<DeleteOperationRsp> response = soService.terminateService(serviceId).execute();
+ RequestBody requestBody = extractBody(request);
+ Response<DeleteOperationRsp> response = soService.terminateService(serviceId, requestBody).execute();
if (response.isSuccessful()) {
return response.body();
} else {
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmControllerTest.java
index 67182ece..0fc9e500 100644
--- a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmControllerTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmControllerTest.java
@@ -55,9 +55,10 @@ public class ServiceLcmControllerTest {
@Test
public void testTerminateService() throws Exception {
String serviceId = "1";
- controller.terminateService(serviceId);
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ controller.terminateService(serviceId, request);
- verify(service, times(1)).terminateService(serviceId);
+ verify(service, times(1)).terminateService(serviceId, request);
}
} \ No newline at end of file
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmServiceTest.java
index 5031d247..a823bc2c 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmServiceTest.java
@@ -95,27 +95,29 @@ public class DefaultServiceLcmServiceTest {
}
@Test
- public void itCanTerminateService() {
+ public void itCanTerminateService() throws IOException {
SOService soService = mock(SOService.class);
String serviceId = "1";
DeleteOperationRsp rsp = new DeleteOperationRsp();
rsp.setOperationId("1");
- when(soService.terminateService(serviceId)).thenReturn(successfulCall(rsp));
+ when(soService.terminateService(serviceId, anyObject())).thenReturn(successfulCall(rsp));
+ HttpServletRequest request = mockRequest();
ServiceLcmService service = new DefaultServiceLcmService(soService);
- Assert.assertSame(rsp, service.terminateService(serviceId));
+ Assert.assertSame(rsp, service.terminateService(serviceId, request));
}
@Test(expected = SOException.class)
- public void terminateServiceWillThrowExceptionWhenSOIsNotAvailable() {
+ public void terminateServiceWillThrowExceptionWhenSOIsNotAvailable() throws IOException {
SOService soService = mock(SOService.class);
String serviceId = "1";
- when(soService.terminateService(serviceId)).thenReturn(failedCall("SO is not available!"));
+ when(soService.terminateService(serviceId, anyObject())).thenReturn(failedCall("SO is not available!"));
+ HttpServletRequest request = mockRequest();
ServiceLcmService service = new DefaultServiceLcmService(soService);
- service.terminateService(serviceId);
+ service.terminateService(serviceId, request);
}
@Test