aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhekeguang <hekeguang@chinamobile.com>2022-02-22 10:41:44 +0800
committerhekeguang <hekeguang@chinamobile.com>2022-02-22 10:42:02 +0800
commit4df512519f875158b0bcb1cb5b63bf32df74d726 (patch)
treef66b963f22c3e4795446647e283e53f60a376115
parenta2818f5ee563ef2f15419fdfd8b6ddf653f11605 (diff)
Add test code to meet the goal of test coverage.
Issue-ID: USECASEUI-643 Change-Id: Ie8b04e2d89f85c7a9b1ef5a7358b2a6da49f726a Signed-off-by: hekeguang <hekeguang@chinamobile.com>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImpl.java2
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvertTest.java33
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImplTest.java7
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvertTest.java15
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvertTest.java62
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImplTest.java90
6 files changed, 203 insertions, 6 deletions
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 5a1fa7a3..af861ef6 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
@@ -69,7 +69,7 @@ public class TaskMgtServiceImpl implements TaskMgtService {
private static final Logger logger = LoggerFactory.getLogger(TaskMgtServiceImpl.class);
@Resource(name = "TaskMgtConvertService")
- private TaskMgtServiceConvert taskMgtServiceConvert;
+ protected TaskMgtServiceConvert taskMgtServiceConvert;
private SOSliceService soSliceService;
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
index aea0cbbb..8dc8e834 100644
--- 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
@@ -38,12 +38,14 @@ 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.BusinessDemandInfo;
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.AAIServiceProfiles;
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;
@@ -125,6 +127,22 @@ public class ResourceMgtServiceConvertTest {
@Test
public void itCanGetNstInfoByBusiness() {
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);
+
NstInfo nstInfo = new NstInfo();
String nsiId = "1234-ty23-rt56-oiu9";
@@ -217,6 +235,21 @@ public class ResourceMgtServiceConvertTest {
}
@Test
+ public void itConvertServiceProfilesToBusinessDemandInfo() {
+ BusinessDemandInfo businessDemandInfo = new BusinessDemandInfo();
+ AAIServiceProfiles aaiServiceProfiles = new AAIServiceProfiles();
+ try {
+ resourceMgtServiceConvert.convertServiceProfilesToBusinessDemandInfo(businessDemandInfo, aaiServiceProfiles);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+
+ @Test
public void itCanConvertHostedNsiList() {
NsiServiceInstanceList nsiServiceInstanceList = new NsiServiceInstanceList();
AAIServiceRsp aAIServiceRsp = new AAIServiceRsp();
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
index c5cfb76b..2c80dc4a 100644
--- 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
@@ -41,10 +41,12 @@ import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscript
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.aai.bean.connection.NetworkInfo;
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;
+import retrofit2.Response;
public class ResourceMgtServiceImplTest {
@@ -138,6 +140,11 @@ public class ResourceMgtServiceImplTest {
when(aaiSliceService
.listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, businessId))
.thenReturn(successfulCall(object));
+ NetworkInfo networkInfo = new NetworkInfo();
+ when(aaiSliceService
+ .getServiceNetworkInstance(businessId))
+ .thenReturn(successfulCall(networkInfo));
+
resourceMgtService.querySlicingBusinessDetails(businessId);
}
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
index ab8eb990..13869751 100644
--- 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
@@ -24,6 +24,7 @@ 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.SlicingKpiReqInfo;
import org.onap.usecaseui.server.bean.nsmf.monitor.TrafficReqInfo;
import org.onap.usecaseui.server.bean.nsmf.monitor.UsageTrafficInfo;
import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth;
@@ -85,6 +86,13 @@ public class ResourceMonitorServiceConvertTest {
userNumbers.setUserNumber(1);
userNumbers.setTimeStamp("2019-12-23 11:31:19");
userNumbersList.add(userNumbers);
+
+ SlicingKpiReqInfo slicingKpiReqInfo = new SlicingKpiReqInfo();
+ slicingKpiReqInfo.setTimeStamp("2019-12-23 11:31:19");
+ slicingKpiReqInfo.setId("112233");
+ slicingKpiReqInfo.setHours(4);
+ kpiUserNumber.setRequest(slicingKpiReqInfo);
+
kpiUserNumber.setResult(userNumbersList);
try {
@@ -110,6 +118,13 @@ public class ResourceMonitorServiceConvertTest {
totalBandwidthList.add(totalBandwidth);
kpiTotalBandwidth.setResult(totalBandwidthList);
+
+ SlicingKpiReqInfo slicingKpiReqInfo = new SlicingKpiReqInfo();
+ slicingKpiReqInfo.setTimeStamp("2019-12-23 11:31:19");
+ slicingKpiReqInfo.setId("112233");
+ slicingKpiReqInfo.setHours(4);
+ kpiTotalBandwidth.setRequest(slicingKpiReqInfo);
+
try {
resourceMonitorServiceConvert
.convertServiceTotalBandwidthInfo(serviceTotalBandwidthInfo, kpiTotalBandwidth);
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
index 55b38bf7..225dcce4 100644
--- 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
@@ -16,11 +16,16 @@
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.service.nsmf.impl.TaskMgtServiceImplTest.readJsonFile;
+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.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
import org.junit.Before;
import org.junit.Test;
import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceInfo;
@@ -32,6 +37,9 @@ 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.aai.bean.connection.ConnectionLink;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.ConnectionLinkList;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.RelationshipList;
import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.AnSliceTaskInfo;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.CnSliceTaskInfo;
@@ -68,8 +76,10 @@ public class TaskMgtServiceConvertTest {
SOTask soTask = new SOTask();
SliceTaskParams sliceTaskParams = new SliceTaskParams();
ServiceProfile serviceProfile = new ServiceProfile();
+ serviceProfile.setSNSSAI("111222");
sliceTaskParams.setServiceProfile(serviceProfile);
soTask.setSliceTaskParams(sliceTaskParams);
+ soTask.setParams(getParams());
task.add(soTask);
soTaskRsp.setTask(task);
@@ -82,6 +92,29 @@ public class TaskMgtServiceConvertTest {
}
}
+ String getParams(){
+ Properties properties = System.getProperties();
+ String relativelyPath = properties.getProperty("user.dir");
+ String jsonFilePath = relativelyPath+"/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/json/params.json";
+ String params = readJsonFile(jsonFilePath);
+ return params;
+ }
+
+ @Test
+ public void convertSlicingTaskListWithThrowsException() {
+ when(aaiSliceService.getConnectionLinks()).thenReturn(failedCall("so is not exist!"));
+ SlicingTaskList targetSlicingTaskList = new SlicingTaskList();
+ SOTaskRsp soTaskRsp = new SOTaskRsp();
+ soTaskRsp.setTask(null);
+ try {
+ taskMgtServiceConvert.convertSlicingTaskList(targetSlicingTaskList, soTaskRsp, 1, 100);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
@Test
public void itCanConvertTaskAuditInfo() {
SlicingTaskAuditInfo targetSlicingTaskAuditInfo = new SlicingTaskAuditInfo();
@@ -100,6 +133,7 @@ public class TaskMgtServiceConvertTest {
sliceTaskParams.setCnSliceTaskInfo(cnSliceTaskInfo);
sliceTaskParams.setServiceProfile(serviceProfile);
sliceTaskParams.setSuggestNsiName("123");
+ sourceSoTaskInfo.setParams(getParams());
sourceSoTaskInfo.setSliceTaskParams(sliceTaskParams);
taskMgtServiceConvert.convertTaskAuditInfo(targetSlicingTaskAuditInfo, sourceSoTaskInfo);
@@ -179,6 +213,8 @@ public class TaskMgtServiceConvertTest {
nsiAndSubNssiInfo.setAn5qi("er4");
nsiAndSubNssiInfo.setAnScriptName("scriptTest");
sourceSlicingTaskAuditInfoSuc.setNsiAndSubNssiInfo(nsiAndSubNssiInfo);
+
+ targetSoTaskInfo.setParams(getParams());
taskMgtServiceConvert.convertTaskAuditToSoTask(targetSoTaskInfo, sourceSlicingTaskAuditInfoSuc);
}
@@ -211,6 +247,7 @@ public class TaskMgtServiceConvertTest {
sliceTaskParams.setCnSliceTaskInfo(cnSliceTaskInfo);
sliceTaskParams.setServiceProfile(serviceProfile);
sourceSoTaskInfo.setSliceTaskParams(sliceTaskParams);
+ sourceSoTaskInfo.setParams(getParams());
taskMgtServiceConvert.convertTaskCreationInfo(slicingTaskCreationInfo, sourceSoTaskInfo);
}
@@ -229,8 +266,31 @@ public class TaskMgtServiceConvertTest {
sliceTaskParams.setAnSliceTaskInfo(anSliceTaskInfo);
sliceTaskParams.setTnBHSliceTaskInfo(tnBHSliceTaskInfo);
sliceTaskParams.setCnSliceTaskInfo(cnSliceTaskInfo);
- soTask.setSliceTaskParams(sliceTaskParams);
+ soTaskSuc.setSliceTaskParams(sliceTaskParams);
+ soTaskSuc.setParams(getParams());
taskMgtServiceConvert.convertTaskCreationProgress(slicingTaskCreationProgress, soTaskSuc);
}
+ @Test
+ public void itCanQueryEndPointId() {
+ ConnectionLinkList connectionLinkList = new ConnectionLinkList();
+ List<ConnectionLink> logicalLink = new ArrayList<>();
+ ConnectionLink connectionLink = new ConnectionLink();
+ connectionLink.setLinkName("name1");
+ connectionLink.setLinkName2("name2");
+ connectionLink.setLinkId("123");
+ RelationshipList relationshipList = new RelationshipList();
+ connectionLink.setRelationshipList(relationshipList);
+ logicalLink.add(connectionLink);
+ connectionLinkList.setLogicalLink(logicalLink);
+
+ when(aaiSliceService.getConnectionLinks()).thenReturn(successfulCall(connectionLinkList));
+ taskMgtServiceConvert.queryEndPointId("123");
+ }
+
+ @Test
+ public void queryEndPointIdWithThrowsException() {
+ when(aaiSliceService.getConnectionLinks()).thenReturn(failedCall("so is not exist!"));
+ taskMgtServiceConvert.queryEndPointId("123");
+ }
}
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
index abf90755..137392e7 100644
--- 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
@@ -20,38 +20,56 @@ 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.JSON;
import com.alibaba.fastjson.JSONArray;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
import javax.annotation.Nullable;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import okio.BufferedSink;
+import okio.BufferedSource;
+import org.apache.commons.io.FileUtils;
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.aai.bean.connection.ConnectionLink;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.EndPointInfoList;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.Relationship;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.RelationshipData;
+import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.RelationshipList;
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;
import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.ConnectionLinkList;
+import retrofit2.Response;
public class TaskMgtServiceImplTest {
TaskMgtServiceImpl taskMgtService = null;
SOSliceService soSliceService = null;
AAISliceService aaiSliceService = null;
+ TaskMgtServiceConvert taskMgtServiceConvert = null;
@Before
public void before() throws Exception {
soSliceService = mock(SOSliceService.class);
aaiSliceService = mock(AAISliceService.class);
taskMgtService = new TaskMgtServiceImpl(soSliceService,aaiSliceService);
+ taskMgtServiceConvert = mock(TaskMgtServiceConvert.class);
+ taskMgtService.taskMgtServiceConvert = taskMgtServiceConvert;
}
@Test
@@ -101,7 +119,14 @@ public class TaskMgtServiceImplTest {
public void itCanUpdateTaskAuditInfo() {
SlicingTaskAuditInfo slicingTaskAuditInfo = new SlicingTaskAuditInfo();
String taskId = "we23-3456-rte4-er43";
- RequestBody requestBody = new RequestBody() {
+ slicingTaskAuditInfo.setTaskId(taskId);
+
+ Properties properties = System.getProperties();
+ String relativelyPath = properties.getProperty("user.dir");
+ String jsonFilePath = relativelyPath+"/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/json/params.json";
+ String params = readJsonFile(jsonFilePath);
+
+ ResponseBody responseBody = new ResponseBody() {
@Nullable
@Override
public MediaType contentType() {
@@ -109,13 +134,22 @@ public class TaskMgtServiceImplTest {
}
@Override
- public void writeTo(BufferedSink bufferedSink) throws IOException {
+ public long contentLength() {
+ return 0;
+ }
+ @Override
+ public BufferedSource source() {
+ return null;
}
};
-
- ResponseBody responseBody = null;
+ SOTask soTask = new SOTask();
+ soTask.setParams(params);
+ String jsonstr = JSON.toJSONString(soTask);
+ RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr);
+ when(soSliceService.getTaskById(taskId)).thenReturn(successfulCall(soTask));
when(soSliceService.updateService(taskId, requestBody)).thenReturn(successfulCall(responseBody));
+
taskMgtService.updateTaskAuditInfo(slicingTaskAuditInfo);
}
@@ -181,9 +215,57 @@ public class TaskMgtServiceImplTest {
public void itCanqueryConnectionLinks() {
String taskId = "we23-345r-45ty-5687";
ConnectionLinkList connectionLinkList = new ConnectionLinkList();
+ List<ConnectionLink> connectionLinks = new ArrayList<>();
+ ConnectionLink connectionLink = new ConnectionLink();
+ connectionLink.setLinkType("TsciConnectionLink");
+ connectionLink.setLinkId(taskId);
+ connectionLink.setLinkName2("name2");
+ connectionLink.setLinkName("name1");
+ RelationshipList relationshipList = new RelationshipList();
+ List<Relationship> relationships = new ArrayList<>();
+ Relationship relationship1 = new Relationship();
+ List<RelationshipData> relationshipDataList = new ArrayList<>();
+ relationship1.setRelationshipDataList(relationshipDataList);
+ relationships.add(relationship1);
+ relationshipList.setRelationship(relationships);
+
+ connectionLink.setRelationshipList(relationshipList);
+ connectionLink.setServiceFunction("servicefunction");
+ connectionLink.setResourceVersion("resouceversion");
+ connectionLinks.add(connectionLink);
+ connectionLinkList.setLogicalLink(connectionLinks);
+ String name1 = "name1";
+ String name2 = "name2";
+ EndPointInfoList endPointInfoList = new EndPointInfoList();
+
when(aaiSliceService.getConnectionLinks()).thenReturn(successfulCall(connectionLinkList));
+ when(aaiSliceService.getEndpointByLinkName(name1)).thenReturn(successfulCall(endPointInfoList));
+ when(aaiSliceService.getEndpointByLinkName2(name2)).thenReturn(successfulCall(endPointInfoList));
+ when(aaiSliceService.getAllottedResource(taskId, taskId)).thenReturn(successfulCall(connectionLink));
+
taskMgtService.queryConnectionLinks(3,5);
}
+ //read json file
+ public static String readJsonFile(String fileName) {
+ String jsonStr = "";
+ try {
+ File jsonFile = new File(fileName);
+ FileReader fileReader = new FileReader(jsonFile);
+ Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8");
+ int ch = 0;
+ StringBuffer sb = new StringBuffer();
+ while ((ch = reader.read()) != -1) {
+ sb.append((char) ch);
+ }
+ fileReader.close();
+ reader.close();
+ jsonStr = sb.toString();
+ return jsonStr;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
}