aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhekeguang <hekeguang@chinamobile.com>2020-02-20 20:46:17 +0800
committerhekeguang <hekeguang@chinamobile.com>2020-02-20 20:47:47 +0800
commita74579806cfd480ca1c38147b71cfe1440a2f9c9 (patch)
tree60f0d82302a31927515c52c96f50a38017744195
parente3b45042535ce8d8880c349be82d5f7c6ff9b5dd (diff)
Add test code related to nsmf.
Issue-ID: USECASEUI-374 Change-Id: I6aacce2db8616631ddfeb1dd469b5487746de0d3 Signed-off-by: hekeguang <hekeguang@chinamobile.com>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/GeneralConvertImpl.java5
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvert.java11
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java7
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvert.java5
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImpl.java5
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvert.java10
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImpl.java5
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/csmf/impl/SlicingServiceImplTest.java186
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/GeneralConvertImplTest.java133
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvertTest.java532
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImplTest.java518
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvertTest.java118
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImplTest.java146
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvertTest.java223
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImplTest.java170
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceAndInstanceTest.java60
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceInstanceTest.java107
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceNSTTest.java45
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceProfilesTest.java75
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceRspTest.java43
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceTest.java62
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelatedToPropertyTest.java42
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelationshipDataTest.java42
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelationshipTest.java51
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/exception/AAIExceptionTest.java38
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiBeanTest.java45
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalBandwidthTest.java54
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalTrafficTest.java45
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiUserNumberTest.java57
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/ActivateServiceTest.java39
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOOperationTest.java39
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTaskTest.java52
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/exception/SOExceptionTest.java38
33 files changed, 3002 insertions, 6 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/GeneralConvertImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/GeneralConvertImpl.java
index df6c8be8..2767b339 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/GeneralConvertImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/GeneralConvertImpl.java
@@ -28,8 +28,13 @@ import org.onap.usecaseui.server.service.slicingdomain.aai.bean.RelationshipData
import org.onap.usecaseui.server.util.RestfulServices;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Service;
import retrofit2.Response;
+@Service("GeneralConvertService")
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
public class GeneralConvertImpl {
private static final Logger logger = LoggerFactory.getLogger(GeneralConvertImpl.class);
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvert.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvert.java
index df7c2d1b..ea318783 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvert.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvert.java
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.Resource;
import org.apache.commons.beanutils.BeanUtils;
import org.onap.usecaseui.server.bean.nsmf.common.PagedResult;
import org.onap.usecaseui.server.bean.nsmf.resource.HostedBusinessInfo;
@@ -59,12 +60,20 @@ import org.onap.usecaseui.server.util.RestfulServices;
import org.onap.usecaseui.server.util.nsmf.NsmfCommonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Service;
import retrofit2.Response;
+@Service("ResourceMgtConvertService")
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
public class ResourceMgtServiceConvert {
private static final Logger logger = LoggerFactory.getLogger(ResourceMgtServiceConvert.class);
- GeneralConvertImpl generalConvert = new GeneralConvertImpl();
+
+ @Resource(name = "GeneralConvertService")
+ private GeneralConvertImpl generalConvert;
+
private SOSliceService soSliceService;
private AAISliceService aaiSliceService;
Gson gson = new Gson();
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java
index abb15a54..8b99fba7 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java
@@ -72,8 +72,11 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
@Resource(name = "ServiceLcmService")
private ServiceLcmService serviceLcmService;
- private ResourceMgtServiceConvert resourceMgtServiceConvert = new ResourceMgtServiceConvert();
- GeneralConvertImpl generalConvert = new GeneralConvertImpl();
+ @Resource(name = "GeneralConvertService")
+ private GeneralConvertImpl generalConvert;
+
+ @Resource(name = "ResourceMgtConvertService")
+ private ResourceMgtServiceConvert resourceMgtServiceConvert;
private AAISliceService aaiSliceService;
private SOSliceService soSliceService;
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvert.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvert.java
index 98663b86..3b421a0c 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvert.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvert.java
@@ -37,7 +37,12 @@ import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiUserNumber.Us
import org.onap.usecaseui.server.util.nsmf.NsmfCommonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Service;
+@Service("ResourceMonitorConvertService")
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
public class ResourceMonitorServiceConvert {
private static final Logger logger = LoggerFactory.getLogger(ResourceMonitorServiceConvert.class);
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImpl.java
index 527d493c..18cd7175 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImpl.java
@@ -22,6 +22,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+import javax.annotation.Resource;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import org.onap.usecaseui.server.bean.nsmf.common.ResultHeader;
@@ -58,7 +59,9 @@ public class ResourceMonitorServiceImpl implements ResourceMonitorService {
private final static Logger logger = LoggerFactory.getLogger(ResourceMonitorServiceImpl.class);
- private ResourceMonitorServiceConvert resourceMonitorServiceConvert = new ResourceMonitorServiceConvert();
+ @Resource(name = "ResourceMonitorConvertService")
+ private ResourceMonitorServiceConvert resourceMonitorServiceConvert;
+
Gson gson = new Gson();
private KpiSliceService kpiSliceService;
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvert.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvert.java
index 6b007d19..95189c0b 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvert.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvert.java
@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONObject;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.Resource;
import org.apache.commons.beanutils.BeanUtils;
import org.onap.usecaseui.server.bean.nsmf.common.PagedResult;
import org.onap.usecaseui.server.bean.nsmf.task.BusinessDemandInfo;
@@ -37,12 +38,19 @@ import org.onap.usecaseui.server.util.RestfulServices;
import org.onap.usecaseui.server.util.nsmf.NsmfCommonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Service;
+@Service("TaskMgtConvertService")
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
public class TaskMgtServiceConvert {
private static final Logger logger = LoggerFactory.getLogger(TaskMgtServiceConvert.class);
- private GeneralConvertImpl generalConvert = new GeneralConvertImpl();
+ @Resource(name = "GeneralConvertService")
+ private GeneralConvertImpl generalConvert;
+
private AAISliceService aaiSliceService;
public TaskMgtServiceConvert() {
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImpl.java
index 6c2a10fb..eec8ab0c 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImpl.java
@@ -23,6 +23,7 @@ import com.alibaba.fastjson.JSONArray;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
+import javax.annotation.Resource;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
@@ -51,7 +52,9 @@ import retrofit2.Response;
public class TaskMgtServiceImpl implements TaskMgtService {
private static final Logger logger = LoggerFactory.getLogger(TaskMgtServiceImpl.class);
- private TaskMgtServiceConvert taskMgtServiceConvert = new TaskMgtServiceConvert();
+
+ @Resource(name = "TaskMgtConvertService")
+ private TaskMgtServiceConvert taskMgtServiceConvert;
private SOSliceService soSliceService;
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/csmf/impl/SlicingServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/csmf/impl/SlicingServiceImplTest.java
new file mode 100644
index 00000000..35928f7c
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/csmf/impl/SlicingServiceImplTest.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.csmf.impl;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.usecaseui.server.util.CallStub.emptyBodyCall;
+import static org.onap.usecaseui.server.util.CallStub.failedCall;
+import static org.onap.usecaseui.server.util.CallStub.successfulCall;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+import okhttp3.RequestBody;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.bean.csmf.CreateResponse;
+import org.onap.usecaseui.server.bean.csmf.OrderInfo;
+import org.onap.usecaseui.server.bean.csmf.OrderList;
+import org.onap.usecaseui.server.bean.csmf.SlicingOrder;
+import org.onap.usecaseui.server.bean.csmf.SlicingOrderDetail;
+import org.onap.usecaseui.server.constant.nsmf.NsmfParamConstant;
+import org.onap.usecaseui.server.service.nsmf.impl.ResourceMgtServiceImpl;
+import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.bean.ActivateService;
+import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOOperation;
+import org.onap.usecaseui.server.util.nsmf.NsmfCommonUtil;
+import retrofit2.Call;
+
+public class SlicingServiceImplTest {
+
+ SlicingServiceImpl slicingService = null;
+ SOSliceService soSliceService;
+ AAISliceService aaiSliceService;
+
+ @Before
+ public void before() throws Exception {
+ aaiSliceService = mock(AAISliceService.class);
+ soSliceService = mock(SOSliceService.class);
+ slicingService = new SlicingServiceImpl(aaiSliceService, soSliceService);
+ }
+
+ @Test
+ public void itCanCreateSlicingService() {
+ SlicingOrderDetail slicingOrderDetail = new SlicingOrderDetail();
+
+ slicingOrderDetail.setCoverageArea("sdfgdert");
+ slicingOrderDetail.setExpDataRateDL(100);
+ slicingOrderDetail.setExpDataRateUL(200);
+ slicingOrderDetail.setLatency(20);
+ slicingOrderDetail.setMaxNumberofUEs(200);
+ slicingOrderDetail.setUEMobilityLevel("share");
+ slicingOrderDetail.setName("csmf");
+ slicingOrderDetail.setResourceSharingLevel("share");
+ slicingOrderDetail.setUseInterval("20");
+
+ SlicingOrder slicingOrder = new SlicingOrder();
+ slicingOrder.setSlicing_order_info(slicingOrderDetail);
+
+ CreateResponse createResponse = new CreateResponse();
+ RequestBody requestBody = null;
+ when(soSliceService
+ .submitOrders(requestBody))
+ .thenReturn(successfulCall(createResponse));
+ slicingService.createSlicingService(slicingOrder);
+ }
+
+ @Test
+ public void createSlicingServiceWithThrowsException() {
+
+ SlicingOrder slicingOrder = new SlicingOrder();
+ RequestBody requestBody = null;
+ when(soSliceService
+ .submitOrders(requestBody))
+ .thenReturn(failedCall("so is not exist!"));
+ slicingService.createSlicingService(slicingOrder);
+ }
+
+ @Test
+ public void itCanQuerySlicingOrderList() {
+ JSONObject object = new JSONObject();
+ when(aaiSliceService
+ .listOrders(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G))
+ .thenReturn(successfulCall(object));
+ slicingService.querySlicingOrderList("processing", "1", "100");
+ }
+
+ @Test
+ public void querySlicingOrderListWithThrowsException() {
+ when(aaiSliceService
+ .listOrders(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G))
+ .thenReturn(failedCall("aai is not exist!"));
+ slicingService.querySlicingOrderList("processing", "1", "100");
+ }
+
+ @Test
+ public void emptyResponseWhenQuerySlicingOrderList() {
+ Call<JSONObject> call = emptyBodyCall();
+ when(aaiSliceService
+ .listOrders(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G)).thenReturn(call);
+ slicingService.querySlicingOrderList("processing", "1", "100");
+ }
+
+ @Test
+ public void itCanBuildOrderList() throws ParseException {
+
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("service-instance-id", "id001");
+ jsonObject.put("service-instance-name", "name001");
+ jsonObject.put("created-at", "2019-12-23 11:31:19");
+ jsonObject.put("service-type", "emBB");
+ jsonObject.put("environment-context", "cn");
+ jsonObject.put("orchestration-status", "activate");
+
+ List<OrderInfo> orderList = new ArrayList<>();
+ JSONArray array = new JSONArray();
+ array.add(jsonObject);
+ slicingService.buildOrderList(orderList, array);
+ }
+
+ @Test
+ public void itCanAddProgressToOrder() {
+ OrderInfo orderInfo = new OrderInfo();
+ orderInfo.setOrder_creation_time("34562123");
+ orderInfo.setOrder_id("sde2345rr");
+ orderInfo.setOrder_status("creating");
+ orderInfo.setService_snssai("sdffg34-344");
+ orderInfo.setOrder_name("dfer-fgree");
+ orderInfo.setOrder_index("1");
+ orderInfo.setLast_operation_type("activate");
+ orderInfo.setLast_operation_progress("79");
+ List<OrderInfo> slicing_order_list = new ArrayList<>();
+ slicing_order_list.add(orderInfo);
+
+ OrderList orderList = new OrderList();
+ orderList.setRecord_number(3);
+ orderList.setSlicing_order_list(slicing_order_list);
+
+ SOOperation soOperation = new SOOperation();
+ RequestBody requestBody = null;
+ String businessId = "test123";
+ String operationId = "opera123";
+ when(soSliceService.queryOperationProgress(businessId, operationId))
+ .thenReturn(successfulCall(soOperation));
+ slicingService.addProgressToOrder(orderList);
+ }
+
+ @Test
+ public void addProgressToOrderWithThrowsException() {
+
+ OrderInfo orderInfo = new OrderInfo();
+ orderInfo.setOrder_creation_time("34562123");
+ orderInfo.setOrder_id("sde2345rr");
+ orderInfo.setOrder_status("creating");
+ orderInfo.setService_snssai("sdffg34-344");
+ orderInfo.setOrder_name("dfer-fgree");
+ orderInfo.setOrder_index("1");
+ orderInfo.setLast_operation_type("activate");
+ orderInfo.setLast_operation_progress("79");
+
+ OrderList orderList = new OrderList();
+ orderList.setRecord_number(3);
+
+ String businessId = "test123";
+ String operationId = "opera123";
+ when(soSliceService.queryOperationProgress(businessId, operationId))
+ .thenReturn(failedCall("so is not exist!"));
+ slicingService.addProgressToOrder(orderList);
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/GeneralConvertImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/GeneralConvertImplTest.java
new file mode 100644
index 00000000..7aa16aad
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/GeneralConvertImplTest.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.nsmf.impl;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.usecaseui.server.util.CallStub.failedCall;
+import static org.onap.usecaseui.server.util.CallStub.successfulCall;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.JSONArray;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.constant.nsmf.NsmfParamConstant;
+import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceAndInstance;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.Relationship;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.RelationshipData;
+
+public class GeneralConvertImplTest {
+
+ GeneralConvertImpl generalConvert = null;
+ AAISliceService aaiSliceService = null;
+
+ @Before
+ public void before() throws Exception {
+ aaiSliceService = mock(AAISliceService.class);
+ generalConvert = new GeneralConvertImpl(aaiSliceService);
+ }
+
+ @Test
+ public void itCanQueryServiceUtil() {
+ JSONObject object = new JSONObject();
+ object.put("relationship-list", "jsonTest");
+ object.put("workload-context", "jsonTest");
+ JSONObject object1 = new JSONObject();
+ JSONObject object2 = new JSONObject();
+ JSONObject object3 = new JSONObject();
+
+ JSONArray jsonArrayrelationship_data = new JSONArray();
+ jsonArrayrelationship_data.add(object3);
+ object2.put("relationship-data", jsonArrayrelationship_data);
+
+ JSONArray jsonArray = new JSONArray();
+ jsonArray.add(object2);
+
+ object1.put("relationship", jsonArray);
+ object.put("relationship-list", object1);
+ generalConvert.queryServiceUtil(object);
+ }
+
+ @Test
+ public void itCanGetAreaTaList() {
+ String sourceCoverageAreaTAList = "gansu linxia | gansu lanzhou";
+ generalConvert.getAreaTaList(sourceCoverageAreaTAList);
+ }
+
+ @Test
+ public void itCanListServiceByIdUtil() {
+ JSONObject object = new JSONObject();
+ generalConvert.listServiceByIdUtil(object);
+ }
+
+ @Test
+ public void itCanGetUseInterval() {
+ JSONObject object = new JSONObject();
+ String globalCustomerId = NsmfParamConstant.CUSTOM_5G;
+ String serviceType = NsmfParamConstant.SERVICE_TYPE_5G;
+ String serviceInstanceId = "1234-ty23-rt56-oiu9";
+
+ when(aaiSliceService.queryOrderByService(globalCustomerId, serviceType, serviceInstanceId))
+ .thenReturn(successfulCall(object));
+
+ String orderId = "order123";
+ when(aaiSliceService
+ .queryOrderByOrderId(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, orderId))
+ .thenReturn(successfulCall(object));
+ generalConvert.getUseInterval(serviceInstanceId);
+ }
+
+ @Test
+ public void getUseIntervalWithThrowsException() throws IOException {
+ String globalCustomerId = NsmfParamConstant.CUSTOM_5G;
+ String serviceType = NsmfParamConstant.SERVICE_TYPE_5G;
+ String serviceInstanceId = "1234-ty23-rt56-oiu9";
+
+ when(aaiSliceService.queryOrderByService(globalCustomerId, serviceType, serviceInstanceId))
+ .thenReturn(failedCall("aai is not exist!"));
+
+ String orderId = "order123";
+ when(aaiSliceService
+ .queryOrderByOrderId(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, orderId))
+ .thenReturn(failedCall("aai is not exist!"));
+
+ generalConvert.getUseInterval(serviceInstanceId);
+ }
+
+ @Test
+ public void itCanGetOrderIdFromRelation() {
+ AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
+
+ List<Relationship> relationshipList = new ArrayList<>();
+ Relationship relationship = new Relationship();
+ List<RelationshipData> relationshipDataList = new ArrayList<>();
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipKey("service-instance.service-instance-id");
+ relationshipDataList.add(relationshipData);
+ relationship.setRelationshipData(relationshipDataList);
+ relationshipList.add(relationship);
+ aaiServiceAndInstance.setRelationshipList(relationshipList);
+
+ generalConvert.getOrderIdFromRelation(aaiServiceAndInstance);
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvertTest.java b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvertTest.java
new file mode 100644
index 00000000..aea0cbbb
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvertTest.java
@@ -0,0 +1,532 @@
+/*
+ * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.nsmf.impl;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.usecaseui.server.util.CallStub.failedCall;
+import static org.onap.usecaseui.server.util.CallStub.successfulCall;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.bean.nsmf.resource.HostedBusinessInfo;
+import org.onap.usecaseui.server.bean.nsmf.resource.HostedNsiList;
+import org.onap.usecaseui.server.bean.nsmf.resource.IncludedNssiInfo;
+import org.onap.usecaseui.server.bean.nsmf.resource.NsiDetailList;
+import org.onap.usecaseui.server.bean.nsmf.resource.NsiInfo;
+import org.onap.usecaseui.server.bean.nsmf.resource.NsiRelatedNssiInfo;
+import org.onap.usecaseui.server.bean.nsmf.resource.NsiServiceInstanceList;
+import org.onap.usecaseui.server.bean.nsmf.resource.NssiServiceInstanceList;
+import org.onap.usecaseui.server.bean.nsmf.resource.SlicingBusinessDetails;
+import org.onap.usecaseui.server.bean.nsmf.resource.SlicingBusinessList;
+import org.onap.usecaseui.server.bean.nsmf.task.NstInfo;
+import org.onap.usecaseui.server.constant.nsmf.NsmfParamConstant;
+import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIService;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceAndInstance;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceNST;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceRsp;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.Relationship;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.RelationshipData;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+
+public class ResourceMgtServiceConvertTest {
+
+ ResourceMgtServiceConvert resourceMgtServiceConvert = null;
+ SOSliceService soSliceService = null;
+ AAISliceService aaiSliceService = null;
+
+ @Before
+ public void before() throws Exception {
+ aaiSliceService = mock(AAISliceService.class);
+ soSliceService = mock(SOSliceService.class);
+ resourceMgtServiceConvert = new ResourceMgtServiceConvert(soSliceService, aaiSliceService);
+ }
+
+ @Test
+ public void itCanConvertSlicingBusinessList() {
+ SlicingBusinessList slicingBusinessList = new SlicingBusinessList();
+ AAIServiceRsp aAIServiceRsp = new AAIServiceRsp();
+ List<AAIService> aAIService = new ArrayList<>();
+ AAIService aaiService = new AAIService();
+ aAIService.add(aaiService);
+ aAIServiceRsp.setaAIService(aAIService);
+
+ AAIServiceRsp aAIServiceRspNull = new AAIServiceRsp();
+ try {
+ resourceMgtServiceConvert.convertSlicingBusinessList(slicingBusinessList, aAIServiceRsp, 1, 10);
+ resourceMgtServiceConvert.convertSlicingBusinessList(slicingBusinessList, aAIServiceRspNull, 1, 10);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void itCanConvertBusinessDetails() {
+ SlicingBusinessDetails slicingBusinessDetails = new SlicingBusinessDetails();
+ AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
+ String businessId = "iu89-iu87-iu78-tr67";
+ try {
+ resourceMgtServiceConvert.convertBusinessDetails(businessId, slicingBusinessDetails, aaiServiceAndInstance);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanGetNsiInfoByBusiness() {
+ JSONObject object = new JSONObject();
+ NsiInfo nsiInfo = new NsiInfo();
+ String nsiId = "1234-ty23-rt56-oiu9";
+
+ when(aaiSliceService.listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nsiId))
+ .thenReturn(successfulCall(object));
+ resourceMgtServiceConvert.getNsiInfoByBusiness(nsiInfo, nsiId);
+ }
+
+ @Test
+ public void getNsiInfoByBusinessWithThrowsException() {
+ NsiInfo nsiInfo = new NsiInfo();
+ String nsiId = "1234-ty23-rt56-oiu9";
+
+ when(aaiSliceService.listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nsiId))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtServiceConvert.getNsiInfoByBusiness(nsiInfo, nsiId);
+ }
+
+ @Test
+ public void itCanGetNstInfoByBusiness() {
+ JSONObject object = new JSONObject();
+ NstInfo nstInfo = new NstInfo();
+ String nsiId = "1234-ty23-rt56-oiu9";
+
+ when(aaiSliceService
+ .querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nsiId))
+ .thenReturn(successfulCall(object));
+
+ String modelInvariantId = "120i-98er-67ty-87yt";
+ String modelVersionId = "v00001";
+
+ AAIServiceNST aaiServiceNST = new AAIServiceNST();
+ when(aaiSliceService.queryServiceNST(modelInvariantId, modelVersionId))
+ .thenReturn(successfulCall(aaiServiceNST));
+
+ try {
+ resourceMgtServiceConvert.getNstInfoByBusiness(nstInfo, nsiId);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void getNstInfoByBusinessWithThrowsException() {
+ NstInfo nstInfo = new NstInfo();
+ String nsiId = "1234-ty23-rt56-oiu9";
+
+ when(aaiSliceService
+ .querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nsiId))
+ .thenReturn(failedCall("aai is not exist!"));
+
+ String modelInvariantId = "120i-98er-67ty-87yt";
+ String modelVersionId = "v00001";
+
+ AAIServiceNST aaiServiceNST = new AAIServiceNST();
+ when(aaiSliceService.queryServiceNST(modelInvariantId, modelVersionId))
+ .thenReturn(failedCall("aai is not exist!"));
+
+ try {
+ resourceMgtServiceConvert.getNstInfoByBusiness(nstInfo, nsiId);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanGetNsiIdByBusiness() {
+ JSONObject object = new JSONObject();
+ String businessId = "1234-ty23-rt56-oiu9";
+
+ when(aaiSliceService.queryAllottedResources(NsmfParamConstant.CUSTOM_5G,
+ NsmfParamConstant.SERVICE_TYPE_5G, businessId))
+ .thenReturn(successfulCall(object));
+ try {
+ resourceMgtServiceConvert.getNsiIdByBusiness(businessId);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void getNsiIdByBusinessWithThrowsException() {
+ String businessId = "1234-ty23-rt56-oiu9";
+
+ when(aaiSliceService
+ .queryAllottedResources(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, businessId))
+ .thenReturn(failedCall("aai is not exist!"));
+ try {
+ resourceMgtServiceConvert.getNsiIdByBusiness(businessId);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanConvertBusinessProfileDetails() {
+ JSONObject object = new JSONObject();
+ String businessId = "1234-ty23-rt56-oiu9";
+ SlicingBusinessDetails slicingBusinessDetails = new SlicingBusinessDetails();
+ AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
+
+ when(aaiSliceService.getServiceProfiles(NsmfParamConstant.CUSTOM_5G,
+ NsmfParamConstant.SERVICE_TYPE_5G, businessId))
+ .thenReturn(successfulCall(object));
+ try {
+ resourceMgtServiceConvert
+ .convertBusinessProfileDetails(businessId, slicingBusinessDetails, aaiServiceAndInstance);
+ } catch (IOException | InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanConvertHostedNsiList() {
+ NsiServiceInstanceList nsiServiceInstanceList = new NsiServiceInstanceList();
+ AAIServiceRsp aAIServiceRsp = new AAIServiceRsp();
+ List<AAIService> aaiServiceList = new ArrayList<>();
+ AAIService aaiService = new AAIService();
+ aaiServiceList.add(aaiService);
+ aAIServiceRsp.setaAIService(aaiServiceList);
+
+ AAIServiceRsp aAIServiceRspNull = new AAIServiceRsp();
+
+ try {
+ resourceMgtServiceConvert.convertHostedNsiList(nsiServiceInstanceList, aAIServiceRsp, 1, 10);
+ resourceMgtServiceConvert.convertHostedNsiList(nsiServiceInstanceList, aAIServiceRspNull, 1, 10);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanConvertNsiDetailList() {
+ NsiDetailList nsiDetailList = new NsiDetailList();
+ AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
+
+ try {
+ resourceMgtServiceConvert.convertNsiDetailList(nsiDetailList, aaiServiceAndInstance);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanGetIncludedNssiInfoList() {
+ List<IncludedNssiInfo> includedNssiInfoList = new ArrayList<>();
+ List<String> nssiIdList = new ArrayList<>();
+ String nssiId = "nssiTest01";
+ nssiIdList.add(nssiId);
+ JSONObject object = new JSONObject();
+
+ when(aaiSliceService
+ .listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nssiId))
+ .thenReturn(successfulCall(object));
+
+ try {
+ resourceMgtServiceConvert.getIncludedNssiInfoList(includedNssiInfoList, nssiIdList);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void getIncludedNssiInfoListWithThrowsException() {
+ List<IncludedNssiInfo> includedNssiInfoList = new ArrayList<>();
+ List<String> nssiIdList = new ArrayList<>();
+ String nssiId = "nssiTest01";
+ nssiIdList.add(nssiId);
+
+ when(aaiSliceService
+ .listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nssiId))
+ .thenReturn(failedCall("aai is not exist!"));
+
+ try {
+ resourceMgtServiceConvert.getIncludedNssiInfoList(includedNssiInfoList, nssiIdList);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanGetHostedBusinessInfoList() {
+ List<HostedBusinessInfo> hostedBusinessInfoList = new ArrayList<>();
+ List<String> businessIdList = new ArrayList<>();
+ String businessId = "busiId001";
+ businessIdList.add(businessId);
+ JSONObject object = new JSONObject();
+
+ when(aaiSliceService
+ .listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, businessId))
+ .thenReturn(successfulCall(object));
+ try {
+ resourceMgtServiceConvert.getHostedBusinessInfoList(hostedBusinessInfoList, businessIdList);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void getHostedBusinessInfoListWithThrowsException() {
+ List<HostedBusinessInfo> hostedBusinessInfoList = new ArrayList<>();
+ List<String> businessIdList = new ArrayList<>();
+ String businessId = "busiId001";
+ businessIdList.add(businessId);
+
+ when(aaiSliceService
+ .listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, businessId))
+ .thenReturn(failedCall("aai is not exist!"));
+ try {
+ resourceMgtServiceConvert.getHostedBusinessInfoList(hostedBusinessInfoList, businessIdList);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanGetBusinessAndNssiIds() {
+ AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
+ List<Relationship> relationshipList = new ArrayList<>();
+ Relationship relationship = new Relationship();
+ relationship.setRelatedTo(NsmfParamConstant.ALLOTTED_RESOURCE);
+ List<RelationshipData> relationshipDataList = new ArrayList<>();
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipKey(NsmfParamConstant.SERVICE_INSTANCE_SERVICE_INSTANCE_ID);
+ relationshipDataList.add(relationshipData);
+ relationship.setRelationshipData(relationshipDataList);
+ relationshipList.add(relationship);
+
+ Relationship relationship1 = new Relationship();
+ relationship1.setRelatedTo(NsmfParamConstant.SERVICE_INSTANCE);
+ List<RelationshipData> relationshipDataList1 = new ArrayList<>();
+ RelationshipData relationshipData1 = new RelationshipData();
+ relationshipData1.setRelationshipKey(NsmfParamConstant.SERVICE_INSTANCE_SERVICE_INSTANCE_ID);
+ relationshipDataList1.add(relationshipData1);
+ relationship1.setRelationshipData(relationshipDataList1);
+ relationshipList.add(relationship1);
+
+ aaiServiceAndInstance.setRelationshipList(relationshipList);
+
+ List<String> businessIdList = new ArrayList<>();
+ List<String> nssiIdList = new ArrayList<>();
+
+ resourceMgtServiceConvert.getBusinessAndNssiIds(aaiServiceAndInstance, businessIdList, nssiIdList);
+ }
+
+ @Test
+ public void itCanConvertNsiRelatedNssiInfo() {
+ NsiRelatedNssiInfo nsiRelatedNssiInfo = new NsiRelatedNssiInfo();
+ AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
+
+ try {
+ resourceMgtServiceConvert.convertNsiRelatedNssiInfo(nsiRelatedNssiInfo, aaiServiceAndInstance);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanGetNsiRelatedNssiInfo() {
+
+ NsiRelatedNssiInfo nsiRelatedNssiInfo = new NsiRelatedNssiInfo();
+ List<IncludedNssiInfo> includedNssiInfoList = new ArrayList<>();
+ IncludedNssiInfo includedNssiInfo1 = new IncludedNssiInfo();
+ includedNssiInfo1.setEnvironmentContext(NsmfParamConstant.AN_NAME);
+
+ IncludedNssiInfo includedNssiInfo2 = new IncludedNssiInfo();
+ includedNssiInfo2.setEnvironmentContext(NsmfParamConstant.TN_NAME);
+
+ IncludedNssiInfo includedNssiInfo3 = new IncludedNssiInfo();
+ includedNssiInfo3.setEnvironmentContext(NsmfParamConstant.CN_NAME);
+
+ includedNssiInfoList.add(includedNssiInfo1);
+ includedNssiInfoList.add(includedNssiInfo2);
+ includedNssiInfoList.add(includedNssiInfo3);
+
+ resourceMgtServiceConvert.getNsiRelatedNssiInfo(nsiRelatedNssiInfo, includedNssiInfoList);
+ }
+
+ @Test
+ public void itCanConvertNssiServiceInstanceList() {
+
+ NssiServiceInstanceList nssiServiceInstanceList = new NssiServiceInstanceList();
+ AAIServiceRsp aAIServiceRsp = new AAIServiceRsp();
+
+ List<AAIService> aAIService = new ArrayList<>();
+ AAIService aaiService = new AAIService();
+ aAIService.add(aaiService);
+ aAIServiceRsp.setaAIService(aAIService);
+
+ AAIServiceRsp aAIServiceRsp1 = new AAIServiceRsp();
+
+ try {
+ resourceMgtServiceConvert.convertNssiServiceInstanceList(nssiServiceInstanceList, aAIServiceRsp, 1, 100);
+ resourceMgtServiceConvert.convertNssiServiceInstanceList(nssiServiceInstanceList, aAIServiceRsp1, 1, 100);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanConvertNssiDetails() {
+ JSONObject object = new JSONObject();
+ String nsiId = "1234-ty23-rt56-oiu9";
+
+ HostedNsiList hostedNsiList = new HostedNsiList();
+ AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
+
+ when(aaiSliceService.querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G,
+ NsmfParamConstant.SERVICE_TYPE_5G, nsiId))
+ .thenReturn(successfulCall(object));
+ try {
+ resourceMgtServiceConvert
+ .convertNssiDetails(hostedNsiList, aaiServiceAndInstance);
+ } catch (IOException | InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void convertNssiDetailsWithThrowsException() {
+ String nsiId = "1234-ty23-rt56-oiu9";
+ HostedNsiList hostedNsiList = new HostedNsiList();
+ AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
+
+ when(aaiSliceService
+ .querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nsiId))
+ .thenReturn(failedCall("aai is not exist!"));
+ try {
+ resourceMgtServiceConvert
+ .convertNssiDetails(hostedNsiList, aaiServiceAndInstance);
+ } catch (IOException | InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanBuildSubscriberInfo() {
+ resourceMgtServiceConvert.buildSubscriberInfo(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G);
+ }
+
+ @Test
+ public void itCanBuildAAIServiceRsp() {
+ AAIServiceRsp aAIServiceRsp = new AAIServiceRsp();
+ JSONArray array = new JSONArray();
+ JSONObject jsonObject = new JSONObject();
+ array.add(jsonObject);
+ resourceMgtServiceConvert.buildAAIServiceRsp(aAIServiceRsp, array);
+ }
+
+ @Test
+ public void itCanQueryNsiDetailsUtils() {
+ JSONObject object = new JSONObject();
+ object.put("relationship-list", "jsonTest");
+ object.put("workload-context", "jsonTest");
+ JSONObject object1 = new JSONObject();
+ JSONObject object2 = new JSONObject();
+ JSONObject object3 = new JSONObject();
+
+ JSONArray jsonArrayrelationship_data = new JSONArray();
+ jsonArrayrelationship_data.add(object3);
+ object2.put("relationship-data", jsonArrayrelationship_data);
+
+ JSONArray jsonArray = new JSONArray();
+ jsonArray.add(object2);
+
+ object1.put("relationship", jsonArray);
+ object.put("relationship-list", object1);
+
+ resourceMgtServiceConvert.queryNsiDetailsUtils(object);
+ }
+
+ @Test
+ public void itCanQueryAllottedResourceUtil() {
+ JSONObject object = new JSONObject();
+ object.put("relationship-list", "jsonTest");
+ object.put("workload-context", "jsonTest");
+ JSONObject object1 = new JSONObject();
+ JSONObject object2 = new JSONObject();
+ JSONObject object3 = new JSONObject();
+
+ JSONArray jsonArrayrelationship_data = new JSONArray();
+ jsonArrayrelationship_data.add(object3);
+ object2.put("relationship-data", jsonArrayrelationship_data);
+
+ JSONArray jsonArray = new JSONArray();
+ jsonArray.add(object2);
+
+ object1.put("relationship", jsonArray);
+ object.put("relationship-list", object1);
+
+ JSONObject objectAll = new JSONObject();
+ JSONArray jsonArrayAll = new JSONArray();
+ jsonArrayAll.add(object);
+ objectAll.put("allotted-resource", jsonArrayAll);
+ resourceMgtServiceConvert.queryAllottedResourceUtil(objectAll);
+ }
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImplTest.java
new file mode 100644
index 00000000..c5cfb76b
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImplTest.java
@@ -0,0 +1,518 @@
+/*
+ * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.nsmf.impl;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.usecaseui.server.util.CallStub.emptyBodyCall;
+import static org.onap.usecaseui.server.util.CallStub.failedCall;
+import static org.onap.usecaseui.server.util.CallStub.successfulCall;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import okhttp3.MediaType;
+import okhttp3.RequestBody;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.bean.nsmf.resource.NsiInfo;
+import org.onap.usecaseui.server.bean.nsmf.resource.SlicingBusinessInfo;
+import org.onap.usecaseui.server.bean.nsmf.resource.SlicingBusinessList;
+import org.onap.usecaseui.server.constant.nsmf.NsmfParamConstant;
+import org.onap.usecaseui.server.service.lcm.CustomerService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscription;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceSubscriptionRsp;
+import org.onap.usecaseui.server.service.lcm.impl.DefaultCustomerService;
+import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.bean.ActivateService;
+import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOOperation;
+import retrofit2.Call;
+
+public class ResourceMgtServiceImplTest {
+
+ ResourceMgtServiceImpl resourceMgtService = null;
+ SOSliceService soSliceService;
+ AAISliceService aaiSliceService;
+
+ @Before
+ public void before() throws Exception {
+ aaiSliceService = mock(AAISliceService.class);
+ soSliceService = mock(SOSliceService.class);
+ resourceMgtService = new ResourceMgtServiceImpl(aaiSliceService, soSliceService);
+ }
+
+ @Test
+ public void itCanQuerySlicingBusiness() {
+ JSONObject object = new JSONObject();
+
+ when(aaiSliceService
+ .listService(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.querySlicingBusiness(1, 100);
+ }
+
+ @Test
+ public void querySlicingBusinessWithThrowsException() {
+ JSONObject object = new JSONObject();
+
+ when(aaiSliceService
+ .listService(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.querySlicingBusiness(1, 100);
+ }
+
+ @Test
+ public void emptyResponseWhenQuerySlicingBusiness() {
+ Call<JSONObject> call = emptyBodyCall();
+ when(aaiSliceService
+ .listService(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G)).thenReturn(call);
+ resourceMgtService.querySlicingBusiness(1, 100);
+ }
+
+ @Test
+ public void itCanAddBusinessProgress() {
+ SOOperation soOperation = new SOOperation();
+ SlicingBusinessList slicingBusinessList = new SlicingBusinessList();
+ List<SlicingBusinessInfo> slicingBusinessInfoList = new ArrayList<>();
+ SlicingBusinessInfo slicingBusinessInfo = new SlicingBusinessInfo();
+ slicingBusinessInfoList.add(slicingBusinessInfo);
+ slicingBusinessList.setSlicingBusinessInfoList(slicingBusinessInfoList);
+ String businessId = "test001";
+ String operationId = "test001";
+ when(soSliceService.queryOperationProgress(businessId, operationId))
+ .thenReturn(successfulCall(soOperation));
+ resourceMgtService.addBusinessProgress(slicingBusinessList);
+
+ SlicingBusinessList slicingBusinessListNull = new SlicingBusinessList();
+ resourceMgtService.addBusinessProgress(slicingBusinessListNull);
+ }
+
+ @Test
+ public void itCanQuerySlicingBusinessByStatus() {
+ JSONObject object = new JSONObject();
+
+ when(aaiSliceService
+ .listServiceByStatus(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, "activated"))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.querySlicingBusinessByStatus("activated", 1, 100);
+ }
+
+ @Test
+ public void emptyResponseWhenQuerySlicingBusinessByStatus() {
+ Call<JSONObject> call = emptyBodyCall();
+ when(aaiSliceService
+ .listServiceByStatus(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, "activated")).thenReturn(call);
+ resourceMgtService.querySlicingBusinessByStatus("activated", 1, 100);
+ }
+
+ @Test
+ public void querySlicingBusinessByStatusWithThrowsException() {
+ when(aaiSliceService
+ .listServiceByStatus(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, "activated"))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.querySlicingBusinessByStatus("activated", 1, 100);
+ }
+
+ @Test
+ public void itCanQuerySlicingBusinessDetails() {
+ JSONObject object = new JSONObject();
+ String businessId = "23er-56ty-4567-rgdf5";
+ when(aaiSliceService
+ .listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, businessId))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.querySlicingBusinessDetails(businessId);
+ }
+
+ @Test
+ public void querySlicingBusinessDetailsWithThrowsException() {
+
+ String businessId = "23er-56ty-4567-rgdf5";
+ when(aaiSliceService
+ .listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, businessId))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.querySlicingBusinessDetails(businessId);
+ }
+
+ @Test
+ public void emptyResponseWhenQuerySlicingBusinessDetails() {
+ String businessId = "23er-56ty-4567-rgdf5";
+ Call<JSONObject> call = emptyBodyCall();
+ when(aaiSliceService
+ .listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, businessId)).thenReturn(call);
+ resourceMgtService.querySlicingBusinessDetails(businessId);
+ }
+
+ @Test
+ public void itCanQueryNsiInstances() {
+ JSONObject object = new JSONObject();
+
+ when(aaiSliceService
+ .listServiceNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.queryNsiInstances(1, 100);
+ }
+
+ @Test
+ public void queryNsiInstancesWithThrowsException() {
+
+ when(aaiSliceService
+ .listServiceNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.queryNsiInstances(1, 100);
+ }
+
+ @Test
+ public void emptyResponseWhenQueryNsiInstances() {
+ Call<JSONObject> call = emptyBodyCall();
+ when(aaiSliceService
+ .listServiceNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G)).thenReturn(call);
+ resourceMgtService.queryNsiInstances(1, 100);
+ }
+
+ @Test
+ public void itCanQueryNsiInstancesByStatus() {
+ JSONObject object = new JSONObject();
+
+ when(aaiSliceService
+ .listServiceNSIByStatus(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, "activated"))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.queryNsiInstancesByStatus("activated", 1, 100);
+ }
+
+ @Test
+ public void queryNsiInstancesByStatusWithThrowsException() {
+
+ when(aaiSliceService
+ .listServiceNSIByStatus(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, "activated"))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.queryNsiInstancesByStatus("activated", 1, 100);
+ }
+
+ @Test
+ public void emptyResponseWhenQueryNsiInstancesByStatus() {
+ Call<JSONObject> call = emptyBodyCall();
+ when(aaiSliceService
+ .listServiceNSIByStatus(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, "activated")).thenReturn(call);
+ resourceMgtService.queryNsiInstancesByStatus("activated", 1, 100);
+ }
+
+ @Test
+ public void itCanQueryNsiDetails() {
+ JSONObject object = new JSONObject();
+ String serviceInstanceId = "23er-56ty-4567-rgdf5";
+ when(aaiSliceService
+ .querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, serviceInstanceId))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.queryNsiDetails(serviceInstanceId);
+ }
+
+ @Test
+ public void queryNsiDetailsWithThrowsException() {
+
+ String serviceInstanceId = "23er-56ty-4567-rgdf5";
+ when(aaiSliceService
+ .querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, serviceInstanceId))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.queryNsiDetails(serviceInstanceId);
+ }
+
+ @Test
+ public void emptyResponseWhenQueryNsiDetails() {
+ Call<JSONObject> call = emptyBodyCall();
+ String serviceInstanceId = "23er-56ty-4567-rgdf5";
+ when(aaiSliceService
+ .querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, serviceInstanceId)).thenReturn(call);
+ resourceMgtService.queryNsiDetails(serviceInstanceId);
+ }
+
+ @Test
+ public void itCanQueryNsiRelatedNssiInfo() {
+ JSONObject object = new JSONObject();
+ String nsiId = "23er-56ty-4567-rgdf5";
+ when(aaiSliceService
+ .querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nsiId))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.queryNsiRelatedNssiInfo(nsiId);
+ }
+
+ @Test
+ public void queryNsiRelatedNssiInfoWithThrowsException() {
+
+ String nsiId = "23er-56ty-4567-rgdf5";
+ when(aaiSliceService
+ .querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nsiId))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.queryNsiRelatedNssiInfo(nsiId);
+ }
+
+ @Test
+ public void emptyResponseWhenQuueryNsiRelatedNssiInfo() {
+ Call<JSONObject> call = emptyBodyCall();
+ String nsiId = "23er-56ty-4567-rgdf5";
+ when(aaiSliceService
+ .querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nsiId)).thenReturn(call);
+ resourceMgtService.queryNsiRelatedNssiInfo(nsiId);
+ }
+
+ @Test
+ public void itCanQueryNssiInstances() {
+ JSONObject object = new JSONObject();
+
+ when(aaiSliceService
+ .listServiceNSSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.queryNssiInstances(1, 100);
+ }
+
+ @Test
+ public void queryNssiInstancesWithThrowsException() {
+
+ when(aaiSliceService
+ .listServiceNSSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.queryNssiInstances(1, 100);
+ }
+
+ @Test
+ public void emptyResponseWhenQueryNssiInstances() {
+ Call<JSONObject> call = emptyBodyCall();
+ when(aaiSliceService
+ .listServiceNSSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G)).thenReturn(call);
+ resourceMgtService.queryNssiInstances(1, 100);
+ }
+
+ @Test
+ public void itCanQueryNssiInstancesByStatus() {
+ JSONObject object = new JSONObject();
+
+ when(aaiSliceService
+ .listServiceNSSIByStatus(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, "activated"))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.queryNssiInstancesByStatus("activated", 1, 100);
+ }
+
+ @Test
+ public void queryNssiInstancesByStatusWithThrowsException() {
+
+ when(aaiSliceService
+ .listServiceNSSIByStatus(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, "activated"))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.queryNssiInstancesByStatus("activated", 1, 100);
+ }
+
+ @Test
+ public void emptyResponseWhenQueryNssiInstancesByStatus() {
+ Call<JSONObject> call = emptyBodyCall();
+ when(aaiSliceService
+ .listServiceNSSIByStatus(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, "activated")).thenReturn(call);
+ resourceMgtService.queryNssiInstancesByStatus("activated", 1, 100);
+ }
+
+ @Test
+ public void itCanQueryNssiInstancesByEnvironment() {
+ JSONObject object = new JSONObject();
+ String environmentContext = "cn";
+ when(aaiSliceService
+ .listServiceNSSIByEnv(NsmfParamConstant.CUSTOM_5G,
+ NsmfParamConstant.SERVICE_TYPE_5G, environmentContext))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.queryNssiInstancesByEnvironment(environmentContext, 1, 100);
+ }
+
+ @Test
+ public void queryNssiInstancesByEnvironmentWithThrowsException() {
+ String environmentContext = "cn";
+ when(aaiSliceService
+ .listServiceNSSIByEnv(NsmfParamConstant.CUSTOM_5G,
+ NsmfParamConstant.SERVICE_TYPE_5G, environmentContext))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.queryNssiInstancesByEnvironment(environmentContext, 1, 100);
+ }
+
+ @Test
+ public void emptyResponseWhenQueryNssiInstancesByEnvironment() {
+ String environmentContext = "cn";
+ Call<JSONObject> call = emptyBodyCall();
+ when(aaiSliceService
+ .listServiceNSSIByEnv(NsmfParamConstant.CUSTOM_5G,
+ NsmfParamConstant.SERVICE_TYPE_5G, environmentContext)).thenReturn(call);
+ resourceMgtService.queryNssiInstancesByEnvironment(environmentContext, 1, 100);
+ }
+
+ @Test
+ public void itCanQueryNssiDetails() {
+ JSONObject object = new JSONObject();
+ String nssiId = "23er-56ty-4567-rgdf5";
+ when(aaiSliceService
+ .queryNSIByNSSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nssiId))
+ .thenReturn(successfulCall(object));
+ resourceMgtService.queryNssiDetails(nssiId);
+ }
+
+ @Test
+ public void queryNssiDetailsWithThrowsException() {
+
+ String nssiId = "23er-56ty-4567-rgdf5";
+ when(aaiSliceService
+ .queryNSIByNSSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nssiId))
+ .thenReturn(failedCall("aai is not exist!"));
+ resourceMgtService.queryNssiDetails(nssiId);
+ }
+
+ @Test
+ public void emptyResponseWhenQueryNssiDetails() {
+ String nssiId = "23er-56ty-4567-rgdf5";
+ Call<JSONObject> call = emptyBodyCall();
+ when(aaiSliceService
+ .queryNSIByNSSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nssiId)).thenReturn(call);
+ resourceMgtService.queryNssiDetails(nssiId);
+ }
+
+ @Test
+ public void itCanActivateSlicingService() {
+ String serviceId = "23er-56ty-4567-rgdf5";
+ String jsonstr = "testJson";
+ RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
+
+ ActivateService activateService = new ActivateService();
+ when(soSliceService.activeService(serviceId, requestBody))
+ .thenReturn(successfulCall(activateService));
+ resourceMgtService.activateSlicingService(serviceId);
+ }
+
+ @Test
+ public void activateSlicingServiceWithThrowsException() {
+
+ String serviceId = "23er-56ty-4567-rgdf5";
+ String jsonstr = "testJson";
+ RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
+ when(soSliceService.activeService(serviceId, requestBody))
+ .thenReturn(failedCall("so is not exist!"));
+ resourceMgtService.activateSlicingService(serviceId);
+ }
+
+ @Test
+ public void emptyResponseWhenActivateSlicingService() {
+ String serviceId = "23er-56ty-4567-rgdf5";
+ String jsonstr = "testJson";
+ RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
+ Call<ActivateService> call = emptyBodyCall();
+
+ when(soSliceService.activeService(serviceId, requestBody)).thenReturn(call);
+ resourceMgtService.activateSlicingService(serviceId);
+ }
+
+ @Test
+ public void itCanDeactivateSlicingService() {
+ String serviceId = "23er-56ty-4567-rgdf5";
+
+ ActivateService activateService = new ActivateService();
+ RequestBody requestBody = null;
+ when(soSliceService.deactiveService(serviceId, requestBody))
+ .thenReturn(successfulCall(activateService));
+ resourceMgtService.deactivateSlicingService(serviceId);
+ }
+
+ @Test
+ public void deactivateSlicingServiceWithThrowsException() {
+
+ String serviceId = "23er-56ty-4567-rgdf5";
+ RequestBody requestBody = null;
+ when(soSliceService.deactiveService(serviceId, requestBody))
+ .thenReturn(failedCall("so is not exist!"));
+ resourceMgtService.deactivateSlicingService(serviceId);
+ }
+
+ @Test
+ public void emptyResponseWhenDeactivateSlicingService() {
+ String serviceId = "23er-56ty-4567-rgdf5";
+ String jsonstr = "testJson";
+ RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
+ Call<ActivateService> call = emptyBodyCall();
+
+ when(soSliceService.deactiveService(serviceId, requestBody)).thenReturn(call);
+ resourceMgtService.deactivateSlicingService(serviceId);
+ }
+
+ @Test
+ public void itCanTerminateSlicingService() {
+ String serviceId = "23er-56ty-4567-rgdf5";
+
+ ActivateService activateService = new ActivateService();
+ RequestBody requestBody = null;
+ when(soSliceService.terminateService(serviceId, requestBody))
+ .thenReturn(successfulCall(activateService));
+ resourceMgtService.terminateSlicingService(serviceId);
+ }
+
+ @Test
+ public void terminateSlicingServiceWithThrowsException() {
+
+ String serviceId = "23er-56ty-4567-rgdf5";
+ RequestBody requestBody = null;
+ when(soSliceService.terminateService(serviceId, requestBody))
+ .thenReturn(failedCall("so is not exist!"));
+ resourceMgtService.terminateSlicingService(serviceId);
+ }
+
+ @Test
+ public void emptyResponseWhenTerminateSlicingService() {
+ String serviceId = "23er-56ty-4567-rgdf5";
+ String jsonstr = "testJson";
+ RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
+ Call<ActivateService> call = emptyBodyCall();
+
+ when(soSliceService.terminateService(serviceId, requestBody)).thenReturn(call);
+ resourceMgtService.terminateSlicingService(serviceId);
+ }
+
+ @Test
+ public void itCanQueryOperationProgress() {
+ String serviceId = "23er-56ty-4567-rgdf5";
+ String operationId = "2345-5675-3456-er45";
+ SOOperation soOperation = new SOOperation();
+
+ when(soSliceService.queryOperationProgress(serviceId, operationId))
+ .thenReturn(successfulCall(soOperation));
+ resourceMgtService.queryOperationProgress(serviceId);
+ }
+
+ @Test
+ public void queryOperationProgressWithThrowsException() {
+
+ String serviceId = "23er-56ty-4567-rgdf5";
+ String operationId = "2345-5675-3456-er45";
+
+ when(soSliceService.queryOperationProgress(serviceId, operationId))
+ .thenReturn(failedCall("so is not exist!"));
+ resourceMgtService.queryOperationProgress(serviceId);
+ }
+
+ @Test
+ public void emptyResponseWhenQueryOperationProgress() {
+ String serviceId = "23er-56ty-4567-rgdf5";
+ String operationId = "2345-5675-3456-er45";
+ Call<SOOperation> call = emptyBodyCall();
+
+ when(soSliceService.queryOperationProgress(serviceId, operationId)).thenReturn(call);
+ resourceMgtService.queryOperationProgress(serviceId);
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvertTest.java b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvertTest.java
new file mode 100644
index 00000000..bf92878f
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvertTest.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.nsmf.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceInfo;
+import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceOnlineUserInfo;
+import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceTotalBandwidthInfo;
+import org.onap.usecaseui.server.bean.nsmf.monitor.UsageTrafficInfo;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth.TotalBandwidth;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalTraffic;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiUserNumber;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiUserNumber.UserNumbers;
+
+public class ResourceMonitorServiceConvertTest {
+
+ ResourceMonitorServiceConvert resourceMonitorServiceConvert = null;
+
+ @Before
+ public void before() throws Exception {
+ resourceMonitorServiceConvert = new ResourceMonitorServiceConvert();
+ }
+
+ @Test
+ public void itCanBuildTrafficReqInfo() {
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setServiceId("23er-4567-rt56-rt54");
+ String queryTimestamp = "1577071879000";
+ resourceMonitorServiceConvert.buildTrafficReqInfo(serviceInfo, queryTimestamp);
+ }
+
+ @Test
+ public void itCanConvertUsageTrafficInfo() {
+ UsageTrafficInfo usageTrafficInfo = new UsageTrafficInfo();
+ usageTrafficInfo.setServiceId("sdse-3456-ee34-rt45");
+ usageTrafficInfo.setTrafficData("600");
+
+ KpiTotalTraffic kpiTotalTraffic = new KpiTotalTraffic();
+ kpiTotalTraffic.setId("1234-5678-rt45-3456");
+
+ resourceMonitorServiceConvert.convertUsageTrafficInfo(usageTrafficInfo, kpiTotalTraffic);
+ }
+
+ @Test
+ public void itCanBuildSlicingKpiReqInfo() {
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setServiceId("23er-4567-rt56-rt54");
+ String queryTimestamp = "1577071879000";
+
+ resourceMonitorServiceConvert.buildSlicingKpiReqInfo(serviceInfo, queryTimestamp, 4);
+ }
+
+ @Test
+ public void itCanConvertServiceOnlineUserInfo() {
+ ServiceOnlineUserInfo serviceOnlineUserInfo = new ServiceOnlineUserInfo();
+ KpiUserNumber kpiUserNumber = new KpiUserNumber();
+ List<UserNumbers> userNumbersList = new ArrayList<>();
+ UserNumbers userNumbers = new UserNumbers();
+ userNumbers.setUserNumber(1);
+ userNumbers.setTimeStamp("2019-12-23 11:31:19");
+ userNumbersList.add(userNumbers);
+ kpiUserNumber.setUserNumbers(userNumbersList);
+
+ try {
+ resourceMonitorServiceConvert.convertServiceOnlineUserInfo(serviceOnlineUserInfo, kpiUserNumber);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanConvertServiceTotalBandwidthInfo() {
+ ServiceTotalBandwidthInfo serviceTotalBandwidthInfo = new ServiceTotalBandwidthInfo();
+ KpiTotalBandwidth kpiTotalBandwidth = new KpiTotalBandwidth();
+
+ List<TotalBandwidth> totalBandwidthList = new ArrayList<>();
+ TotalBandwidth totalBandwidth = new TotalBandwidth();
+ totalBandwidth.setBandwidth(100);
+ totalBandwidth.setTimeStamp("2019-12-23 11:31:19");
+ totalBandwidthList.add(totalBandwidth);
+ kpiTotalBandwidth.setTotalBandwidth(totalBandwidthList);
+
+ try {
+ resourceMonitorServiceConvert
+ .convertServiceTotalBandwidthInfo(serviceTotalBandwidthInfo, kpiTotalBandwidth);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImplTest.java
new file mode 100644
index 00000000..19ca5dbb
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImplTest.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.nsmf.impl;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.usecaseui.server.util.CallStub.failedCall;
+import static org.onap.usecaseui.server.util.CallStub.successfulCall;
+
+import com.alibaba.fastjson.JSONObject;
+import java.util.ArrayList;
+import java.util.List;
+import okhttp3.RequestBody;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceInfo;
+import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceList;
+import org.onap.usecaseui.server.constant.nsmf.NsmfParamConstant;
+import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.KpiSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalTraffic;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiUserNumber;
+
+public class ResourceMonitorServiceImplTest {
+
+ ResourceMonitorServiceImpl resourceMonitorService = null;
+ KpiSliceService kpiSliceService = null;
+
+ @Before
+ public void before() throws Exception {
+ kpiSliceService = mock(KpiSliceService.class);
+ resourceMonitorService = new ResourceMonitorServiceImpl(kpiSliceService);
+ }
+
+ @Test
+ public void itCanInitConfig() {
+ resourceMonitorService.initConfig();
+ }
+
+ @Test
+ public void itCanQuerySlicingUsageTraffic() {
+ ServiceList serviceList = new ServiceList();
+ List<ServiceInfo> serviceInfoList = new ArrayList<>();
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setServiceId("123e-456t-567t-yui8");
+ serviceInfoList.add(serviceInfo);
+ serviceList.setServiceInfoList(serviceInfoList);
+ String queryTimestamp = "1577071879000";
+
+ KpiTotalTraffic kpiTotalTraffic = new KpiTotalTraffic();
+ RequestBody body = null;
+ when(kpiSliceService.listTotalTraffic(body)).thenReturn(successfulCall(kpiTotalTraffic));
+ resourceMonitorService.querySlicingUsageTraffic(queryTimestamp, serviceList);
+ }
+
+ @Test
+ public void querySlicingUsageTrafficWithThrowsException() {
+ ServiceList serviceList = new ServiceList();
+ List<ServiceInfo> serviceInfoList = new ArrayList<>();
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setServiceId("123e-456t-567t-yui8");
+ serviceInfoList.add(serviceInfo);
+ serviceList.setServiceInfoList(serviceInfoList);
+ String queryTimestamp = "1577071879000";
+
+ RequestBody body = null;
+ when(kpiSliceService.listTotalTraffic(body)).thenReturn(failedCall("kpi is not exist!"));
+ resourceMonitorService.querySlicingUsageTraffic(queryTimestamp, serviceList);
+ }
+
+ @Test
+ public void itCanQuerySlicingOnlineUserNumber() {
+ ServiceList serviceList = new ServiceList();
+ List<ServiceInfo> serviceInfoList = new ArrayList<>();
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setServiceId("123e-456t-567t-yui8");
+ serviceInfoList.add(serviceInfo);
+ serviceList.setServiceInfoList(serviceInfoList);
+ String queryTimestamp = "1577071879000";
+
+ KpiUserNumber kpiUserNumber = new KpiUserNumber();
+ RequestBody body = null;
+ when(kpiSliceService.listUserNumber(body)).thenReturn(successfulCall(kpiUserNumber));
+ resourceMonitorService.querySlicingOnlineUserNumber(queryTimestamp, serviceList);
+ }
+
+ @Test
+ public void querySlicingOnlineUserNumberWithThrowsException() {
+ ServiceList serviceList = new ServiceList();
+ List<ServiceInfo> serviceInfoList = new ArrayList<>();
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setServiceId("123e-456t-567t-yui8");
+ serviceInfoList.add(serviceInfo);
+ serviceList.setServiceInfoList(serviceInfoList);
+ String queryTimestamp = "1577071879000";
+
+ RequestBody body = null;
+ when(kpiSliceService.listUserNumber(body)).thenReturn(failedCall("kpi is not exist!"));
+ resourceMonitorService.querySlicingOnlineUserNumber(queryTimestamp, serviceList);
+ }
+
+ @Test
+ public void itCanQuerySlicingTotalBandwidth() {
+ ServiceList serviceList = new ServiceList();
+ List<ServiceInfo> serviceInfoList = new ArrayList<>();
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setServiceId("123e-456t-567t-yui8");
+ serviceInfoList.add(serviceInfo);
+ serviceList.setServiceInfoList(serviceInfoList);
+ String queryTimestamp = "1577071879000";
+
+ KpiTotalBandwidth kpiTotalBandwidth = new KpiTotalBandwidth();
+ RequestBody body = null;
+ when(kpiSliceService.listTotalBandwidth(body)).thenReturn(successfulCall(kpiTotalBandwidth));
+ resourceMonitorService.querySlicingTotalBandwidth(queryTimestamp, serviceList);
+ }
+
+ @Test
+ public void querySlicingTotalBandwidthWithThrowsException() {
+ ServiceList serviceList = new ServiceList();
+ List<ServiceInfo> serviceInfoList = new ArrayList<>();
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setServiceId("123e-456t-567t-yui8");
+ serviceInfoList.add(serviceInfo);
+ serviceList.setServiceInfoList(serviceInfoList);
+ String queryTimestamp = "1577071879000";
+
+ RequestBody body = null;
+ when(kpiSliceService.listTotalBandwidth(body)).thenReturn(failedCall("kpi is not exist!"));
+ resourceMonitorService.querySlicingTotalBandwidth(queryTimestamp, serviceList);
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvertTest.java b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvertTest.java
new file mode 100644
index 00000000..c2782ec4
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvertTest.java
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.nsmf.impl;
+
+import static org.mockito.Mockito.mock;
+
+import com.alibaba.fastjson.JSONObject;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceInfo;
+import org.onap.usecaseui.server.bean.nsmf.task.BusinessDemandInfo;
+import org.onap.usecaseui.server.bean.nsmf.task.NsiAndSubNssiInfo;
+import org.onap.usecaseui.server.bean.nsmf.task.NstInfo;
+import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskAuditInfo;
+import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskCreationInfo;
+import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskCreationProgress;
+import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskList;
+import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTask;
+import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTaskRsp;
+
+public class TaskMgtServiceConvertTest {
+
+ TaskMgtServiceConvert taskMgtServiceConvert = null;
+ AAISliceService aaiSliceService;
+
+ @Before
+ public void before() throws Exception {
+ aaiSliceService = mock(AAISliceService.class);
+ taskMgtServiceConvert = new TaskMgtServiceConvert(aaiSliceService);
+ }
+
+ @Test
+ public void itCanConvertSlicingTaskList() {
+ SlicingTaskList targetSlicingTaskList = new SlicingTaskList();
+ SOTaskRsp soTaskRsp = new SOTaskRsp();
+ SOTaskRsp soTaskRspSuc = new SOTaskRsp();
+ List<SOTask> task = new ArrayList<>();
+ SOTask soTask = new SOTask();
+ task.add(soTask);
+ soTaskRspSuc.setTask(task);
+
+ try {
+ taskMgtServiceConvert.convertSlicingTaskList(targetSlicingTaskList, soTaskRsp, 1, 100);
+ taskMgtServiceConvert.convertSlicingTaskList(targetSlicingTaskList, soTaskRspSuc, 1, 100);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void itCanConvertTaskAuditInfo() {
+ SlicingTaskAuditInfo targetSlicingTaskAuditInfo = new SlicingTaskAuditInfo();
+ SOTask sourceSoTaskInfo = new SOTask();
+ String params = "{\"globalSubscriberId\":\"5GCustomer\",\"serviceType\":\"5G\"}";
+ sourceSoTaskInfo.setParams(params);
+
+ taskMgtServiceConvert.convertTaskAuditInfo(targetSlicingTaskAuditInfo, sourceSoTaskInfo);
+ }
+
+ @Test
+ public void itCanConvertBusinessDemandInfo() {
+ BusinessDemandInfo targetBusinessDemandInfo = new BusinessDemandInfo();
+ JSONObject paramsObject = new JSONObject();
+
+ taskMgtServiceConvert.convertBusinessDemandInfo(targetBusinessDemandInfo, paramsObject);
+ }
+
+ @Test
+ public void itCanConvertNstInfo() {
+ NstInfo nstInfo = new NstInfo();
+ JSONObject paramsObject = new JSONObject();
+
+ taskMgtServiceConvert.convertNstInfo(nstInfo, paramsObject);
+ }
+
+ @Test
+ public void itCanConvertNsiAndSubNssiInfo() {
+ NsiAndSubNssiInfo nsiAndSubNssiInfo = new NsiAndSubNssiInfo();
+ JSONObject paramsObject = new JSONObject();
+
+ taskMgtServiceConvert.convertNsiAndSubNssiInfo(nsiAndSubNssiInfo, paramsObject);
+ }
+
+ @Test
+ public void itCanConvertTaskAuditToSoTask() {
+
+ SOTask targetSoTaskInfo = new SOTask();
+ SlicingTaskAuditInfo sourceSlicingTaskAuditInfo = new SlicingTaskAuditInfo();
+ taskMgtServiceConvert.convertTaskAuditToSoTask(targetSoTaskInfo, sourceSlicingTaskAuditInfo);
+
+ SlicingTaskAuditInfo sourceSlicingTaskAuditInfoSuc = new SlicingTaskAuditInfo();
+ NsiAndSubNssiInfo nsiAndSubNssiInfo = new NsiAndSubNssiInfo();
+ nsiAndSubNssiInfo.setSuggestNsiName("nsi01");
+ nsiAndSubNssiInfo.setSuggestNsiId("nsi01-0090-0987");
+
+ nsiAndSubNssiInfo.setTnSuggestNssiName("tn-nsi-01");
+ nsiAndSubNssiInfo.setTnSuggestNssiId("tn01-0987-iu87");
+ nsiAndSubNssiInfo.setTnLatency("60");
+ nsiAndSubNssiInfo.setTnBandwidth("1000");
+ nsiAndSubNssiInfo.setTnScriptName("scriptTest");
+
+ nsiAndSubNssiInfo.setCnUeMobilityLevel("stationary");
+ nsiAndSubNssiInfo.setCnServiceSnssai("1-10101");
+ nsiAndSubNssiInfo.setCnMaxNumberOfUes("1000");
+ nsiAndSubNssiInfo.setCnSuggestNssiName("cn-001");
+ nsiAndSubNssiInfo.setCnSuggestNssiId("0902-oi89-8923-iu34");
+ nsiAndSubNssiInfo.setCnResourceSharingLevel("shared");
+ nsiAndSubNssiInfo.setCnExpDataRateUl("300");
+ nsiAndSubNssiInfo.setCnExpDataRateDl("600");
+ nsiAndSubNssiInfo.setCnScriptName("scriptTest");
+
+ nsiAndSubNssiInfo.setAnSuggestNssiName("an-001");
+ nsiAndSubNssiInfo.setAnSuggestNssiId("0923-982-34fe-4553");
+ nsiAndSubNssiInfo.setAnLatency("300");
+ List<String> areaList = new ArrayList<>();
+ areaList.add("gansu");
+ areaList.add("linxia");
+ nsiAndSubNssiInfo.setAnCoverageAreaTaList(areaList);
+ nsiAndSubNssiInfo.setAn5qi("er4");
+ nsiAndSubNssiInfo.setAnScriptName("scriptTest");
+ sourceSlicingTaskAuditInfoSuc.setNsiAndSubNssiInfo(nsiAndSubNssiInfo);
+ targetSoTaskInfo.setParams("{\n"
+ + "\t\t\"ServiceId\": \"46da8cf8-0878-48ac-bea3-f2200959411a\",\n"
+ + "\t\t\"ServiceName\": \"eMBB E2EService\",\n"
+ + "\t\t\"NSTId\": \"46da8cf8-0878-48ac-bea3-f2200959411a\",\n"
+ + "\t\t\"NSTName\": \"eMBB NST\",\n"
+ + "\t\t\"AN.ScriptName\": \"an script\",\n"
+ + "\t\t\"TN.ScriptName\": \"tn script\",\n"
+ + "\t\t\"CN.ScriptName\": \"cn_script\",\n"
+ + "\t\t\"ServiceProfile.S-NSSAI\": \"1-010101\",\n"
+ + "\t\t\"ServiceProfile.sST\": \"eMBB\",\n"
+ + "\t\t\"ServiceProfile.nsMaxNumberofUEs\": \"100000\",\n"
+ + "\t\t\"ServiceProfile.nsCoverageAreaTAList\": \"xxxx;xxxxx;xxxxx\",\n"
+ + "\t\t\"ServiceProfile.nsLatency\": \"30\",\n"
+ + "\t\t\"ServiceProfile.nsUEMobilityLevel\": \"stageary\",\n"
+ + "\t\t\"ServiceProfile.nsResourceSharingLevel\": \"shared\",\n"
+ + "\t\t\"ServiceProfile.nsPerfReq.expDataRateDL\": \"300\",\n"
+ + "\t\t\"ServiceProfile.nsPerfReq.expDataRateUL\": \"300\",\n"
+ + "\t\t\"ServiceProfile.nsPerfReq.areaTrafficCapDL\": \"300\",\n"
+ + "\t\t\"ServiceProfile.nsPerfReq.areaTrafficCapUL\": \"300\",\n"
+ + "\t\t\"ServiceProfile.nsPerfReq.activityFactor\": \"60\",\n"
+ + "\t\t\"AN.progress\": 40,\n"
+ + "\t\t\"AN.status\": \"processing\",\n"
+ + "\t\t\"AN.statusDescription\": \"5QI instantiating\",\n"
+ + "\t\t\"TN.progress\": 30,\n"
+ + "\t\t\"TN.status\": \"processing\",\n"
+ + "\t\t\"TN.statusDescription\": \"L3VPN creating\",\n"
+ + "\t\t\"CN.progress\": 40,\n"
+ + "\t\t\"CN.status\": \"processing\",\n"
+ + "\t\t\"CN.statusDescription\": \"VNF processing\"\n"
+ + "\t}");
+ taskMgtServiceConvert.convertTaskAuditToSoTask(targetSoTaskInfo, sourceSlicingTaskAuditInfoSuc);
+ }
+
+ @Test
+ public void itCanGetAreaTaListString() {
+
+ List<String> anCoverageAreaTaList = new ArrayList<>();
+ anCoverageAreaTaList.add("Gansu");
+ anCoverageAreaTaList.add("Linxia");
+
+ taskMgtServiceConvert.getAreaTaListString(anCoverageAreaTaList, '|');
+ }
+
+ @Test
+ public void itCanConvertTaskCreationInfo() {
+
+ SlicingTaskCreationInfo slicingTaskCreationInfo = new SlicingTaskCreationInfo();
+ SOTask sourceSoTaskInfo = new SOTask();
+ String params = "{\"globalSubscriberId\":\"5GCustomer\",\"serviceType\":\"5G\"}";
+ sourceSoTaskInfo.setParams(params);
+ taskMgtServiceConvert.convertTaskCreationInfo(slicingTaskCreationInfo, sourceSoTaskInfo);
+ }
+
+ @Test
+ public void itCanConvertCreationBusinessDemandInfo() {
+
+ BusinessDemandInfo targetBusinessDemandInfo = new BusinessDemandInfo();
+ JSONObject paramsObject = new JSONObject();
+
+ taskMgtServiceConvert.convertCreationBusinessDemandInfo(targetBusinessDemandInfo, paramsObject);
+ }
+
+ @Test
+ public void itCanConvertTaskCreationProgress() {
+
+ SlicingTaskCreationProgress slicingTaskCreationProgress = new SlicingTaskCreationProgress();
+ SOTask soTask = new SOTask();
+ taskMgtServiceConvert.convertTaskCreationProgress(slicingTaskCreationProgress, soTask);
+
+ SOTask soTaskSuc = new SOTask();
+ soTaskSuc.setParams("{\n"
+ + "\t\"AN.progress\": \"99\",\n"
+ + "\t\"TN.progress\": \"99\",\n"
+ + "\t\"CN.progress\": \"2020-02-10T09:22:58.000+0000\",\n"
+ + "\t\"AN.status\": \"WaitingToConfirm\",\n"
+ + "\t\"TN.status\": \"WaitingToConfirm\",\n"
+ + "\t\"CN.status\": \"WaitingToConfirm\"\n"
+ + "}");
+ taskMgtServiceConvert.convertTaskCreationProgress(slicingTaskCreationProgress, soTaskSuc);
+ }
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImplTest.java
new file mode 100644
index 00000000..e0f4d460
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImplTest.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.nsmf.impl;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.usecaseui.server.util.CallStub.failedCall;
+import static org.onap.usecaseui.server.util.CallStub.successfulCall;
+
+import com.alibaba.fastjson.JSONArray;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Nullable;
+import okhttp3.MediaType;
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import okio.BufferedSink;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceInfo;
+import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceList;
+import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskAuditInfo;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.KpiSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalTraffic;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTask;
+
+public class TaskMgtServiceImplTest {
+
+ TaskMgtServiceImpl taskMgtService = null;
+ SOSliceService soSliceService = null;
+
+ @Before
+ public void before() throws Exception {
+ soSliceService = mock(SOSliceService.class);
+ taskMgtService = new TaskMgtServiceImpl(soSliceService);
+ }
+
+ @Test
+ public void itCanQuerySlicingTask() {
+ JSONArray jsonArray = new JSONArray();
+ when(soSliceService.listTask()).thenReturn(successfulCall(jsonArray));
+ taskMgtService.querySlicingTask(1, 100);
+ }
+
+ @Test
+ public void querySlicingTaskWithThrowsException() {
+ when(soSliceService.listTask()).thenReturn(failedCall("so is not exist!"));
+ taskMgtService.querySlicingTask(1, 100);
+ }
+
+ @Test
+ public void itCanQuerySlicingTaskByStatus() {
+ JSONArray jsonArray = new JSONArray();
+ String status = "Planning";
+ when(soSliceService.listTaskByStage(status)).thenReturn(successfulCall(jsonArray));
+ taskMgtService.querySlicingTaskByStatus(status, 1, 100);
+ }
+
+ @Test
+ public void querySlicingTaskByStatusWithThrowsException() {
+ String status = "Planning";
+ when(soSliceService.listTaskByStage(status)).thenReturn(failedCall("so is not exist!"));
+ taskMgtService.querySlicingTaskByStatus(status, 1, 100);
+ }
+
+ @Test
+ public void itCanQueryTaskAuditInfo() {
+ String taskId = "we23-345r-45ty-5687";
+ SOTask soTask = new SOTask();
+ when(soSliceService.getTaskById(taskId)).thenReturn(successfulCall(soTask));
+ taskMgtService.queryTaskAuditInfo(taskId);
+ }
+
+ @Test
+ public void queryTaskAuditInfoWithThrowsException() {
+ String taskId = "we23-345r-45ty-5687";
+ when(soSliceService.getTaskById(taskId)).thenReturn(failedCall("so is not exist!"));
+ taskMgtService.queryTaskAuditInfo(taskId);
+ }
+
+ @Test
+ public void itCanUpdateTaskAuditInfo() {
+ SlicingTaskAuditInfo slicingTaskAuditInfo = new SlicingTaskAuditInfo();
+ String taskId = "we23-3456-rte4-er43";
+ RequestBody requestBody = new RequestBody() {
+ @Nullable
+ @Override
+ public MediaType contentType() {
+ return null;
+ }
+
+ @Override
+ public void writeTo(BufferedSink bufferedSink) throws IOException {
+
+ }
+ };
+
+ ResponseBody responseBody = null;
+ when(soSliceService.updateService(taskId, requestBody)).thenReturn(successfulCall(responseBody));
+ taskMgtService.updateTaskAuditInfo(slicingTaskAuditInfo);
+ }
+
+ @Test
+ public void updateTaskAuditInfoWithThrowsException() {
+ SlicingTaskAuditInfo slicingTaskAuditInfo = new SlicingTaskAuditInfo();
+ String taskId = "we23-3456-rte4-er43";
+ RequestBody requestBody = new RequestBody() {
+ @Nullable
+ @Override
+ public MediaType contentType() {
+ return null;
+ }
+
+ @Override
+ public void writeTo(BufferedSink bufferedSink) throws IOException {
+
+ }
+ };
+
+ when(soSliceService.updateService(taskId, requestBody)).thenReturn(failedCall("so is not exist!"));
+ taskMgtService.updateTaskAuditInfo(slicingTaskAuditInfo);
+ }
+
+ @Test
+ public void itCanQueryTaskCreationInfo() {
+ String taskId = "we23-345r-45ty-5687";
+ SOTask soTask = new SOTask();
+ when(soSliceService.getTaskByIdD(taskId)).thenReturn(successfulCall(soTask));
+ taskMgtService.queryTaskCreationInfo(taskId);
+ }
+
+ @Test
+ public void queryTaskCreationInfoWithThrowsException() {
+ String taskId = "we23-345r-45ty-5687";
+ when(soSliceService.getTaskByIdD(taskId)).thenReturn(failedCall("so is not exist!"));
+ taskMgtService.queryTaskCreationInfo(taskId);
+ }
+
+ @Test
+ public void itCanQueryTaskCreationProgress() {
+ String taskId = "we23-345r-45ty-5687";
+ SOTask soTask = new SOTask();
+ when(soSliceService.getTaskByIdD(taskId)).thenReturn(successfulCall(soTask));
+ taskMgtService.queryTaskCreationProgress(taskId);
+ }
+
+ @Test
+ public void queryTaskCreationProgressWithThrowsException() {
+ String taskId = "we23-345r-45ty-5687";
+ when(soSliceService.getTaskByIdD(taskId)).thenReturn(failedCall("so is not exist!"));
+ taskMgtService.queryTaskCreationProgress(taskId);
+ }
+
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceAndInstanceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceAndInstanceTest.java
new file mode 100644
index 00000000..fc5ffe8f
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceAndInstanceTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.aai.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AAIServiceAndInstanceTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetAAIServiceAndInstance() throws Exception {
+ AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
+
+ List<Relationship> relationshipList = new ArrayList<>();
+ aaiServiceAndInstance.setRelationshipList(relationshipList);
+ aaiServiceAndInstance.setEnvironmentContext("cn");
+ aaiServiceAndInstance.setModelInvariantId("id001");
+ aaiServiceAndInstance.setModelVersionId("id001");
+ aaiServiceAndInstance.setOrchestrationStatus("processing");
+ aaiServiceAndInstance.setServiceInstanceId("id001");
+ aaiServiceAndInstance.setServiceInstanceName("name001");
+ aaiServiceAndInstance.setServiceType("eMbb");
+ aaiServiceAndInstance.setWorkloadContext("cn");
+
+ aaiServiceAndInstance.getRelationshipList();
+ aaiServiceAndInstance.getEnvironmentContext();
+ aaiServiceAndInstance.getModelInvariantId();
+ aaiServiceAndInstance.getModelVersionId();
+ aaiServiceAndInstance.getOrchestrationStatus();
+ aaiServiceAndInstance.getServiceInstanceId();
+ aaiServiceAndInstance.getServiceInstanceName();
+ aaiServiceAndInstance.getServiceType();
+ aaiServiceAndInstance.getWorkloadContext();
+
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceInstanceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceInstanceTest.java
new file mode 100644
index 00000000..7b1d5187
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceInstanceTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.aai.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceInstance.RelationshipList;
+
+public class AAIServiceInstanceTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetAAIServiceInstance() throws Exception {
+ AAIServiceInstance aaiServiceInstance = new AAIServiceInstance();
+ aaiServiceInstance.setServiceType("eMbb");
+ aaiServiceInstance.setServiceRole("role");
+ aaiServiceInstance.setServiceInstanceName("name001");
+ aaiServiceInstance.setServiceInstanceLocationId("id001");
+ aaiServiceInstance.setServiceInstanceId("id001");
+ aaiServiceInstance.setResourceVersion("ver001");
+
+ AAIServiceInstance.RelationshipList relationshipList;
+ aaiServiceInstance.setOrchestrationStatus("processing");
+ aaiServiceInstance.setModelVersionId("id0001");
+ aaiServiceInstance.setModelInvariantId("id001");
+ aaiServiceInstance.setEnvironmentContext("cn");
+ aaiServiceInstance.setDescription("des");
+
+ aaiServiceInstance.getDescription();
+ aaiServiceInstance.getEnvironmentContext();
+ aaiServiceInstance.getModelInvariantId();
+ aaiServiceInstance.getModelVersionId();
+ aaiServiceInstance.getOrchestrationStatus();
+ aaiServiceInstance.getRelationshipList();
+ aaiServiceInstance.getResourceVersion();
+ aaiServiceInstance.getServiceInstanceId();
+ aaiServiceInstance.getServiceInstanceLocationId();
+ aaiServiceInstance.getEnvironmentContext();
+ aaiServiceInstance.getServiceInstanceName();
+ aaiServiceInstance.getServiceRole();
+ aaiServiceInstance.getServiceType();
+ }
+
+ @Test
+ public void testSetAndGetRelationship() throws Exception {
+ Relationship relationship = new Relationship();
+ List<RelationshipData> relationshipDataList = new ArrayList<>();
+ List<RelatedToProperty> relatedToPropertyList = new ArrayList<>();
+ relationship.setRelationshipData(relationshipDataList);
+ relationship.setRelatedToProperty(relatedToPropertyList);
+ relationship.setRelatedTo("related");
+ relationship.setRelatedLink("link");
+ relationship.setRelationshipLabel("label");
+
+ relationship.getRelatedLink();
+ relationship.getRelatedTo();
+ relationship.getRelatedToProperty();
+ relationship.getRelationshipData();
+ relationship.getRelationshipLabel();
+
+ }
+
+ @Test
+ public void testSetAndGetRelationshipData() throws Exception {
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipKey("key");
+ relationshipData.setRelationshipValue("value");
+ relationshipData.getRelationshipKey();
+ relationshipData.getRelationshipValue();
+
+ }
+
+ @Test
+ public void testSetAndGetRelatedToProperty() throws Exception {
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ relatedToProperty.setPropertyKey("key");
+ relatedToProperty.setPropertyValue("value");
+
+ relatedToProperty.getPropertyValue();
+ relatedToProperty.getPropertyKey();
+
+ }
+
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceNSTTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceNSTTest.java
new file mode 100644
index 00000000..439b9393
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceNSTTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.aai.bean;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AAIServiceNSTTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetAAIServiceNST() throws Exception {
+ AAIServiceNST aaiServiceNST = new AAIServiceNST();
+ aaiServiceNST.setModelName("name001");
+ aaiServiceNST.setModelVersion("ver001");
+ aaiServiceNST.setModelVersionId("id001");
+ aaiServiceNST.setResourceVersion("res001");
+
+ aaiServiceNST.getModelName();
+ aaiServiceNST.getModelVersion();
+ aaiServiceNST.getModelVersionId();
+ aaiServiceNST.getResourceVersion();
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceProfilesTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceProfilesTest.java
new file mode 100644
index 00000000..79917ee3
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceProfilesTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.aai.bean;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AAIServiceProfilesTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetAAIServiceProfiles() throws Exception {
+ AAIServiceProfiles aaiServiceProfiles = new AAIServiceProfiles();
+ aaiServiceProfiles.setActivityFactor(100);
+ aaiServiceProfiles.setAreaTrafficCapDL(200);
+ aaiServiceProfiles.setAreaTrafficCapUL(200);
+ aaiServiceProfiles.setConnDensity(100);
+ aaiServiceProfiles.setCoverageAreaTAList("test");
+ aaiServiceProfiles.setCsAvailability(200);
+ aaiServiceProfiles.setExpDataRate(100);
+ aaiServiceProfiles.setExpDataRateDL(200);
+ aaiServiceProfiles.setExpDataRateUL(100);
+ aaiServiceProfiles.setJitter(20);
+ aaiServiceProfiles.setLatency(20);
+ aaiServiceProfiles.setMaxNumberOfUEs(20);
+ aaiServiceProfiles.setProfileId("profile");
+ aaiServiceProfiles.setReliability(200);
+ aaiServiceProfiles.setResourceSharingLevel("share");
+ aaiServiceProfiles.setResourceVersion("ver123");
+ aaiServiceProfiles.setSurvivalTime(200);
+ aaiServiceProfiles.setTrafficDensity(200);
+ aaiServiceProfiles.setUeMobilityLevel("mobile");
+
+ aaiServiceProfiles.getActivityFactor();
+ aaiServiceProfiles.getAreaTrafficCapDL();
+ aaiServiceProfiles.getAreaTrafficCapUL();
+ aaiServiceProfiles.getConnDensity();
+ aaiServiceProfiles.getCoverageAreaTAList();
+ aaiServiceProfiles.getCsAvailability();
+ aaiServiceProfiles.getExpDataRate();
+ aaiServiceProfiles.getExpDataRateUL();
+ aaiServiceProfiles.getExpDataRateDL();
+ aaiServiceProfiles.getJitter();
+ aaiServiceProfiles.getLatency();
+ aaiServiceProfiles.getMaxNumberOfUEs();
+ aaiServiceProfiles.getProfileId();
+ aaiServiceProfiles.getReliability();
+ aaiServiceProfiles.getResourceSharingLevel();
+ aaiServiceProfiles.getResourceVersion();
+ aaiServiceProfiles.getSurvivalTime();
+ aaiServiceProfiles.getTrafficDensity();
+ aaiServiceProfiles.getUeMobilityLevel();
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceRspTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceRspTest.java
new file mode 100644
index 00000000..20062612
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceRspTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.aai.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AAIServiceRspTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetAAIServiceRsp() throws Exception {
+ AAIServiceRsp aaiServiceRsp = new AAIServiceRsp();
+ List<AAIService> aAIService = new ArrayList<>();
+ aaiServiceRsp.setaAIService(aAIService);
+
+ aaiServiceRsp.getaAIService();
+ AAIServiceRsp.getSerialversionuid();
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceTest.java
new file mode 100644
index 00000000..55373023
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/AAIServiceTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.aai.bean;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.bean.csmf.SlicingOrderDetail;
+
+public class AAIServiceTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetAAIService() throws Exception {
+ AAIService aaiService = new AAIService();
+ aaiService.setDescription("des");
+ aaiService.setEnvironmentContext("cn");
+ aaiService.setModelInvariantId("id001");
+ aaiService.setModelVersionId("id001");
+ aaiService.setOrchestrationStatus("activate");
+ aaiService.setResourceVersion("ver001");
+ aaiService.setServiceInstanceId("id001");
+ aaiService.setServiceInstanceLocationId("loc001");
+ aaiService.setServiceInstanceName("name001");
+ aaiService.setServiceRole("role");
+ aaiService.setServiceType("embb");
+
+ aaiService.getDescription();
+ aaiService.getEnvironmentContext();
+ aaiService.getModelInvariantId();
+ aaiService.getModelVersionId();
+ aaiService.getOrchestrationStatus();
+ aaiService.getResourceVersion();
+ aaiService.getServiceInstanceId();
+ aaiService.getServiceInstanceLocationId();
+ aaiService.getServiceInstanceName();
+ aaiService.getServiceRole();
+ aaiService.getServiceType();
+ aaiService.getSerialversionuid();
+
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelatedToPropertyTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelatedToPropertyTest.java
new file mode 100644
index 00000000..97c942f3
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelatedToPropertyTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.aai.bean;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class RelatedToPropertyTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetRelatedToProperty() throws Exception {
+
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ relatedToProperty.setPropertyValue("value");
+ relatedToProperty.setPropertyKey("key");
+
+ relatedToProperty.getPropertyKey();
+ relatedToProperty.getPropertyValue();
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelationshipDataTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelationshipDataTest.java
new file mode 100644
index 00000000..ac4080ad
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelationshipDataTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.aai.bean;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class RelationshipDataTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetRelationshipData() throws Exception {
+
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipValue("value");
+ relationshipData.setRelationshipKey("key");
+
+ relationshipData.getRelationshipValue();
+ relationshipData.getRelationshipKey();
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelationshipTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelationshipTest.java
new file mode 100644
index 00000000..27196dc4
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/RelationshipTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.aai.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class RelationshipTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetRelationship() throws Exception {
+
+ Relationship relationship = new Relationship();
+ List<RelationshipData> relationshipDataList = new ArrayList<>();
+ List<RelatedToProperty> relatedToPropertyList = new ArrayList<>();
+ relationship.setRelationshipLabel("label");
+ relationship.setRelatedLink("link");
+ relationship.setRelatedTo("relateTo");
+ relationship.setRelatedToProperty(relatedToPropertyList);
+ relationship.setRelationshipData(relationshipDataList);
+
+ relationship.getRelationshipLabel();
+ relationship.getRelationshipData();
+ relationship.getRelatedToProperty();
+ relationship.getRelatedTo();
+ relationship.getRelatedLink();
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/exception/AAIExceptionTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/exception/AAIExceptionTest.java
new file mode 100644
index 00000000..22284f3b
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/aai/exception/AAIExceptionTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.aai.exception;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceNST;
+
+public class AAIExceptionTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetAAIException() throws Exception {
+ AAIException aaiException = new AAIException("exception", new Throwable());
+
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiBeanTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiBeanTest.java
new file mode 100644
index 00000000..982e9b9c
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiBeanTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.kpi.bean;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceNST;
+
+public class KpiBeanTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetKpiBean() throws Exception {
+ KpiBean kpiBean = new KpiBean();
+ kpiBean.setHours(4);
+ kpiBean.setId("id001");
+ kpiBean.setTimeStamp("1782736872");
+
+ kpiBean.getHours();
+ kpiBean.getId();
+ kpiBean.getTimeStamp();
+
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalBandwidthTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalBandwidthTest.java
new file mode 100644
index 00000000..7733f687
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalBandwidthTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.kpi.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth.TotalBandwidth;
+
+public class KpiTotalBandwidthTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetKpiTotalBandwidth() throws Exception {
+ KpiTotalBandwidth kpiTotalBandwidth = new KpiTotalBandwidth();
+ List<TotalBandwidth> totalBandwidthList = new ArrayList<>();
+ TotalBandwidth totalBandwidth = new TotalBandwidth();
+ totalBandwidth.setTimeStamp("12345634456");
+ totalBandwidth.setBandwidth(123);
+
+ totalBandwidth.getTimeStamp();
+ totalBandwidth.getBandwidth();
+ totalBandwidthList.add(totalBandwidth);
+ kpiTotalBandwidth.setTotalBandwidth(totalBandwidthList);
+ kpiTotalBandwidth.setId("id001");
+
+ kpiTotalBandwidth.getTotalBandwidth();
+ kpiTotalBandwidth.getId();
+
+ }
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalTrafficTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalTrafficTest.java
new file mode 100644
index 00000000..5267928c
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalTrafficTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.kpi.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth.TotalBandwidth;
+
+public class KpiTotalTrafficTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetKpiTotalTraffic() throws Exception {
+ KpiTotalTraffic kpiTotalTraffic = new KpiTotalTraffic();
+ kpiTotalTraffic.setId("id001");
+ kpiTotalTraffic.setTotalTraffic(1024);
+
+ kpiTotalTraffic.getId();
+ kpiTotalTraffic.getTotalTraffic();
+ }
+
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiUserNumberTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiUserNumberTest.java
new file mode 100644
index 00000000..95548b0c
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiUserNumberTest.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.kpi.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth.TotalBandwidth;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiUserNumber.UserNumbers;
+
+public class KpiUserNumberTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetKpiUserNumber() throws Exception {
+ KpiUserNumber kpiUserNumber = new KpiUserNumber();
+ List<UserNumbers> userNumbersList = new ArrayList<>();
+ kpiUserNumber.setUserNumbers(userNumbersList);
+ kpiUserNumber.setId("id001");
+
+ kpiUserNumber.getUserNumbers();
+ kpiUserNumber.getId();
+
+ }
+
+ @Test
+ public void testSetAndGetUserNumbers() throws Exception {
+ UserNumbers userNumbers = new UserNumbers();
+ userNumbers.setTimeStamp("1234786543");
+ userNumbers.setUserNumber(190);
+
+ userNumbers.getTimeStamp();
+ userNumbers.getUserNumber();
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/ActivateServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/ActivateServiceTest.java
new file mode 100644
index 00000000..4922190e
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/ActivateServiceTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.so.bean;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiBean;
+
+public class ActivateServiceTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetActivateService() throws Exception {
+ ActivateService activateService = new ActivateService();
+ activateService.setOperationId("id001");
+ activateService.getOperationId();
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOOperationTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOOperationTest.java
new file mode 100644
index 00000000..1774cec4
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOOperationTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.so.bean;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOOperation.Operation;
+
+public class SOOperationTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetSOOperation() throws Exception {
+ SOOperation soOperation = new SOOperation();
+ soOperation.getOperation();
+ soOperation.setOperation((Operation) new Object());
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTaskTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTaskTest.java
new file mode 100644
index 00000000..43d58eb0
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTaskTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.so.bean;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOOperation.Operation;
+
+public class SOTaskTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetSOTask() throws Exception {
+ SOTask soTask = new SOTask();
+ soTask.setParams("params");
+ soTask.setStatus("activate");
+ soTask.setTaskId("id001");
+ soTask.setRequestId("id001");
+ soTask.setName("name011");
+ soTask.setCreatedTime("182930493");
+ soTask.setIsManual("Manual");
+
+ soTask.getParams();
+ soTask.getCreatedTime();
+ soTask.getIsManual();
+ soTask.getName();
+ soTask.getRequestId();
+ soTask.getStatus();
+ soTask.getTaskId();
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/exception/SOExceptionTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/exception/SOExceptionTest.java
new file mode 100644
index 00000000..bd43e74e
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/exception/SOExceptionTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.slicingdomain.so.exception;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.service.slicingdomain.aai.exception.AAIException;
+
+public class SOExceptionTest {
+
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetAndGetSOException() throws Exception {
+ SOException soException = new SOException("exception", new Throwable());
+ SOException soException1 = new SOException("exception");
+ }
+}