summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuji7 <lu.ji3@zte.com.cn>2017-10-24 15:59:43 +0800
committerLuji7 <lu.ji3@zte.com.cn>2017-10-24 15:59:50 +0800
commit300c6385bda59a982703fe10fafe1ec53acb5fcf (patch)
tree9f3bbc269ca5731a3efd772a37e500d9645755d6
parente95ca1850bf09a99fd8854b3884984cac7cb40bd (diff)
Fix query operation progress issue.
Change-Id: I0e2739ade583b3c6177dee4c8da5ebe06f591868 Issue-id: USECASEUI-53 Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java3
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java3
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java9
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/DeleteOperationRsp.java32
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/Operation.java42
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgress.java112
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java13
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java17
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java5
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/wrapper/WebConfig.java31
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmServiceTest.java15
11 files changed, 258 insertions, 24 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 af6e1a46..2ef1c545 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
@@ -16,6 +16,7 @@
package org.onap.usecaseui.server.controller.lcm;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
+import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
import org.slf4j.Logger;
@@ -58,7 +59,7 @@ public class ServiceLcmController {
@ResponseBody
@RequestMapping(value = {"/uui-lcm/services/{serviceId}"}, method = RequestMethod.DELETE , produces = "application/json")
- public ServiceOperation terminateService(@PathVariable(value = "serviceId") String serviceId){
+ public DeleteOperationRsp terminateService(@PathVariable(value = "serviceId") String serviceId){
return serviceLcmService.terminateService(serviceId);
}
}
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 6ca22bea..60efbbb9 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
@@ -15,6 +15,7 @@
*/
package org.onap.usecaseui.server.service.lcm;
+import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
@@ -26,5 +27,5 @@ public interface ServiceLcmService {
OperationProgressInformation queryOperationProgress(String serviceId, String operationId);
- ServiceOperation terminateService(String serviceId);
+ DeleteOperationRsp terminateService(String serviceId);
}
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 917ec3f3..6e06e012 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
@@ -16,6 +16,7 @@
package org.onap.usecaseui.server.service.lcm.domain.so;
import okhttp3.RequestBody;
+import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
import retrofit2.Call;
@@ -23,12 +24,12 @@ import retrofit2.http.*;
public interface SOService {
- @POST("/api/so-e2eServiceInstances/v2")
+ @POST("/api/e2eServiceInstances/v3")
Call<ServiceOperation> instantiateService(@Body RequestBody body);
- @GET("/api/so-e2eServiceInstances/v2/{serviceId}/operations/{operationId}")
+ @GET("/api/e2eServiceInstances/v3/{serviceId}/operations/{operationId}")
Call<OperationProgressInformation> queryOperationProgress(@Path("serviceId") String serviceId, @Path("operationId") String operationId);
- @DELETE("/api/so-e2eServiceInstances/v2/{serviceId}")
- Call<ServiceOperation> terminateService(@Path("serviceId") String serviceId);
+ @DELETE("/api/e2eServiceInstances/v3/{serviceId}")
+ Call<DeleteOperationRsp> terminateService(@Path("serviceId") String serviceId);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/DeleteOperationRsp.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/DeleteOperationRsp.java
new file mode 100644
index 00000000..2c7cc11f
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/DeleteOperationRsp.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.so.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class DeleteOperationRsp {
+
+ private String operationId;
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/Operation.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/Operation.java
new file mode 100644
index 00000000..93b1421c
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/Operation.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.so.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class Operation {
+
+ private String serviceId;
+
+ private String operationId;
+
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgress.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgress.java
new file mode 100644
index 00000000..12e8e116
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgress.java
@@ -0,0 +1,112 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.so.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class OperationProgress {
+
+ private String operationId;
+
+ private String operation;
+
+ private String result;
+
+ private String reason;
+
+ private String userId;
+
+ private String operationContent;
+
+ private int progress;
+
+ private String operateAt;
+
+ private String finishedAt;
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getOperationContent() {
+ return operationContent;
+ }
+
+ public void setOperationContent(String operationContent) {
+ this.operationContent = operationContent;
+ }
+
+ public int getProgress() {
+ return progress;
+ }
+
+ public void setProgress(int progress) {
+ this.progress = progress;
+ }
+
+ public String getOperateAt() {
+ return operateAt;
+ }
+
+ public void setOperateAt(String operateAt) {
+ this.operateAt = operateAt;
+ }
+
+ public String getFinishedAt() {
+ return finishedAt;
+ }
+
+ public void setFinishedAt(String finishedAt) {
+ this.finishedAt = finishedAt;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java
index 3c70452e..2cf20ad0 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformation.java
@@ -15,5 +15,18 @@
*/
package org.onap.usecaseui.server.service.lcm.domain.so.bean;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonIgnoreProperties(ignoreUnknown=true)
public class OperationProgressInformation {
+
+ private OperationProgress operation;
+
+ public OperationProgress getOperation() {
+ return operation;
+ }
+
+ public void setOperation(OperationProgress operation) {
+ this.operation = operation;
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java
index 0a523416..8602040d 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperation.java
@@ -20,20 +20,13 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown=true)
public class ServiceOperation {
- private String serviceId;
+ private Operation service;
- private String operationId;
-
- public ServiceOperation(String serviceId, String operationId) {
- this.serviceId = serviceId;
- this.operationId = operationId;
- }
-
- public String getServiceId() {
- return serviceId;
+ public Operation getService() {
+ return service;
}
- public String getOperationId() {
- return operationId;
+ public void setService(Operation service) {
+ this.service = service;
}
}
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 d55712a5..eef13e89 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
@@ -18,6 +18,7 @@ package org.onap.usecaseui.server.service.lcm.impl;
import okhttp3.RequestBody;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
+import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException;
@@ -83,9 +84,9 @@ public class DefaultServiceLcmService implements ServiceLcmService {
}
@Override
- public ServiceOperation terminateService(String serviceId) {
+ public DeleteOperationRsp terminateService(String serviceId) {
try {
- Response<ServiceOperation> response = soService.terminateService(serviceId).execute();
+ Response<DeleteOperationRsp> response = soService.terminateService(serviceId).execute();
if (response.isSuccessful()) {
return response.body();
} else {
diff --git a/server/src/main/java/org/onap/usecaseui/server/wrapper/WebConfig.java b/server/src/main/java/org/onap/usecaseui/server/wrapper/WebConfig.java
new file mode 100644
index 00000000..f6475ccf
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/wrapper/WebConfig.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.wrapper;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+@EnableWebMvc
+public class WebConfig extends WebMvcConfigurerAdapter {
+
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**");
+ }
+}
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 e086dd4c..5031d247 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
@@ -19,6 +19,8 @@ import org.junit.Assert;
import org.junit.Test;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
+import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
+import org.onap.usecaseui.server.service.lcm.domain.so.bean.Operation;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException;
@@ -39,7 +41,11 @@ public class DefaultServiceLcmServiceTest {
@Test
public void itCanInstantiateService() throws IOException {
SOService soService = mock(SOService.class);
- ServiceOperation operation = new ServiceOperation("1", "1");
+ Operation op = new Operation();
+ op.setOperationId("1");
+ op.setServiceId("1");
+ ServiceOperation operation = new ServiceOperation();
+ operation.setService(op);
when(soService.instantiateService(anyObject())).thenReturn(successfulCall(operation));
HttpServletRequest request = mockRequest();
@@ -92,12 +98,13 @@ public class DefaultServiceLcmServiceTest {
public void itCanTerminateService() {
SOService soService = mock(SOService.class);
String serviceId = "1";
- ServiceOperation operation = new ServiceOperation("1", "1");
- when(soService.terminateService(serviceId)).thenReturn(successfulCall(operation));
+ DeleteOperationRsp rsp = new DeleteOperationRsp();
+ rsp.setOperationId("1");
+ when(soService.terminateService(serviceId)).thenReturn(successfulCall(rsp));
ServiceLcmService service = new DefaultServiceLcmService(soService);
- Assert.assertSame(operation, service.terminateService(serviceId));
+ Assert.assertSame(rsp, service.terminateService(serviceId));
}
@Test(expected = SOException.class)