diff options
author | xu ran <xuranyjy@chinamobile.com> | 2020-03-11 12:54:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-11 12:54:06 +0000 |
commit | 5659ae42906a8043eb10e7bfab3babb59a3a19d7 (patch) | |
tree | 4dccad072ec00d78f42fad39baebf8eb99aa948e | |
parent | 3e83f2710cd06e28624dbe4246381c2c648030e8 (diff) | |
parent | 75e1abd2481bf53285cc4758b6f1fe4920c86333 (diff) |
Merge "UT Code for SOTN"
11 files changed, 490 insertions, 324 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/customer/impl/CcvpnCustomerServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/customer/impl/CcvpnCustomerServiceImpl.java index ae9f9bc1..c4cc848d 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/customer/impl/CcvpnCustomerServiceImpl.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/customer/impl/CcvpnCustomerServiceImpl.java @@ -91,8 +91,7 @@ public class CcvpnCustomerServiceImpl implements CcvpnCustomerService { logger.info("Execute get all service for customer : Failed"); } - } catch (Exception e) - { + } catch (Exception e) { logger.info("Execute get all service for customer : Failed"); } return null; @@ -131,9 +130,7 @@ public class CcvpnCustomerServiceImpl implements CcvpnCustomerService { } - - private Map<String, Model> readConfigToMap(ModelConfig modelConfig) - { + private Map<String, Model> readConfigToMap(ModelConfig modelConfig) { //ModelConfig modelConfig = readFile(); // Map<String, Model> modelinfo = modelConfig.getModels().stream() @@ -141,10 +138,10 @@ public class CcvpnCustomerServiceImpl implements CcvpnCustomerService { return null; } - public ModelConfig readFile() - { + public ModelConfig readFile() { JSONParser parser = new JSONParser(); - String jsonPath="/home/root1/Desktop/modelconfig.json"; + //String absolutepath = "/home/root1/Desktop/Subhosree/gerrit clone for ui backend";//configure absolute path as per systempath + String jsonPath = "/home/modelconfig.json"; String jsonString = null; ObjectMapper mapper = new ObjectMapper(); @@ -156,324 +153,11 @@ public class CcvpnCustomerServiceImpl implements CcvpnCustomerService { }); return modelInformation; - }catch (ParseException | IOException ex) - { - logger.error("Exception occured while reading configuration file:"+ex); - return null; - } - } - - -/* - @Override - public String getServiceInformation(String serviceInstanceId) throws Exception{ - //serviceInstanceId = "106"; - String result = ""; - ObjectMapper mapper = new ObjectMapper(); - List<SiteTopologyBean> beanList = new ArrayList<>(); - CostInformation costInformation = getCostInformation(); - List<SiteCost> siteCost = costInformation.getSiteCost(); - - String path ="/home/root1/Desktop/SystemConfiguration.json"; - StaticConfiguration staticConfig = ReadStaticConfiguration(path); - - String customerId = staticConfig.getSystemInformation().getCustomerName(); - String serviceType = staticConfig.getSystemInformation().getServiceType(); - - - - List<Relationship> perfectrelationship = new ArrayList<>(); - - ServiceInstance serviceInstance=null; - - //----------------------------- GET SERVICE INSTANCE INFORMATION FROM AAI : BEGIN --------------------------------------- - try{ - serviceInstance=getServiceInstancesForEdge(customerId, serviceType, serviceInstanceId); - if(serviceInstance == null) - return null; - }catch (Exception e) - { - logger.info("Query Service Instance information failed. No service information found for customer " - +customerId+" and Service Type "+serviceType); - return null; - } - //----------------------------- GET SERVICE INSTANCE INFORMATION FROM AAI : END ----------------------------------------- - - //----------------------------- Get the detailed information of Generic VNF from the service instance and filter the site resource : BEGIN --------------------------------------- - - RelationshipList genericvnfrelationshipList = serviceInstance.getRelationshipList(); - if(genericvnfrelationshipList == null) - { - logger.info("No VNF associated with the service instance : "+serviceInstanceId); - return null; - } - List<Relationship> genericRelationship = genericvnfrelationshipList.getRelationship(); - List<String> resourceurl = new ArrayList<>(); - for(Relationship tempRelation : genericRelationship) { - String relatedLink = tempRelation.getRelatedLink(); - resourceurl.add(tempRelation.getRelatedLink()); - } - - - // Need a code change here to identify VPN VNF and Site resource VNF. - - String vnfID = new String(resourceurl.get(0).substring(resourceurl.get(0).lastIndexOf("/")+1)); - - - - GenericVnf genericVnf = getGenericVnfInfo(vnfID); - - RelationshipList newrelationshipList = genericVnf.getRelationshipList(); - - perfectrelationship = newrelationshipList.getRelationship().stream().filter(x -> x.getRelatedTo() - .equalsIgnoreCase("site-resource") - || x.getRelatedTo().equalsIgnoreCase("device") - ||x.getRelatedTo().equalsIgnoreCase("edge-camera")).collect(Collectors.toList()); - - - - //----------------------------- Get the detailed information of Generic VNF from the service instance and filter the site resource : END --------------------------------------- - - - //----------------------------- Get the VNF information from the service instance and filter the site resource : END --------------------------------------- - - - for (Relationship relationship :perfectrelationship) - { - SiteTopologyBean bean = new SiteTopologyBean(); - bean.setEdgeStatus("Offline"); - //Relationship relationship = itr.next(); - if (relationship.getRelatedTo().equalsIgnoreCase("site-resource")) { - // String relatedLink = relationship.getRelatedLink(); - String siteResourceId = relationship.getRelationshipData().get(0).getRelationshipValue(); - Response<ResponseBody> rsp = this.aaiService.getSiteResourceInfo(siteResourceId).execute(); - if (rsp.isSuccessful()) { - result = new String(rsp.body().bytes()); - - SiteResource siteResource = mapper.readValue(result, SiteResource.class); - String siteResourceName = siteResource.getSiteResourceName(); - bean.setSiteStatus(siteResource.getOperationalStatus()); - String role = siteResource.getRole(); - bean.setRole(role); - String desc = siteResource.getDescription(); - bean.setDescription(desc); - bean.setSiteName(siteResourceName); - bean.setSiteId(siteResourceId); - bean.setZipCode(siteResource.getPostalcode()); - bean.setLocation(siteResource.getCity()); - /* - List<Relationship> rList = siteResource.getRelationshipList().getRelationship(); - ListIterator<Relationship> itr1 = rList.listIterator(); - while (itr1.hasNext()) { - Relationship relationship1 = itr1.next(); - if (relationship1.getRelatedTo().equalsIgnoreCase("complex")) { - String complexId = relationship1.getRelationshipData().get(0).getRelationshipValue(); - Response<ResponseBody> compResp = this.aaiService.getComplexObject(complexId).execute(); - if (compResp.isSuccessful()) { - result = new String(compResp.body().bytes()); - ComplexObj complexObj = mapper.readValue(result, ComplexObj.class); - String zipCode = complexObj.getPostalCode(); - bean.setZipCode(zipCode); - String location = complexObj.getCity(); - bean.setLocation(location); - } - } - } - */ - /*} - } - - if (relationship.getRelatedTo().equalsIgnoreCase("device")) { - String deviceId = relationship.getRelationshipData().get(0).getRelationshipValue(); - Map<String,String> resultMaps = getDeviceStatus(deviceId); - String deviceDesc = resultMaps.get("deviceDesc"); - String deviceName = resultMaps.get("deviceName"); - bean.setDeviceName(deviceName); - bean.setStatus(resultMaps.get("status")); - bean.setDeviceDesc(deviceDesc); - } - - if (relationship.getRelatedTo().equalsIgnoreCase("edge-camera")) { - String edgeCamId = relationship.getRelationshipData().get(0).getRelationshipValue(); - Response<ResponseBody> edgeRsp = this.aaiService.getEdgeInfo(edgeCamId).execute(); - if(edgeRsp.isSuccessful()) - { - result = new String(edgeRsp.body().bytes()); - EdgeCamera edgeInfo = mapper.readValue(result, EdgeCamera.class); - String edgeName = edgeInfo.getEdgeCameraName(); - String edgeIP = edgeInfo.getIpAddress(); - bean.setEdgeName(edgeName); - bean.setEdgeIP(edgeIP); - bean.setEdgeStatus("Online"); - } - } - if(bean.getStatus()!=null && bean.getEdgeStatus()!=null) { - Enum value = generateEnumValue(bean.getStatus(), bean.getEdgeStatus()); - String enumVal = value.name(); - bean.setStatEnum(enumVal); - } - - if(bean.getRole()!=null) { - if (bean.getRole().toLowerCase().contains("hub")) { - String price = siteCost.stream().filter(cost -> cost.getSiteType().equalsIgnoreCase("1")) - .map(SiteCost::getSiteCost).collect(Collectors.toList()).get(0); - bean.setPrice(price); - - } else { - String price = siteCost.stream().filter(cost -> cost.getSiteType().equalsIgnoreCase("0")) - .map(SiteCost::getSiteCost).collect(Collectors.toList()).get(0); - bean.setPrice(price); - } - bean.setSiteinterface(staticConfig.getSiteInformation().getSiteInterface()); - bean.setSubnet(staticConfig.getSiteInformation().getSubnetMask()); - beanList.add(bean); - } - } - return beanList.toString(); - } - - - public CostInformation getCostInformation() { - JSONParser parser = new JSONParser(); - String jsonPath = "/home/root1/Desktop/costconfig.json"; - String jsonString = null; - ObjectMapper mapper = new ObjectMapper(); - - try { - - Object object = parser.parse(new FileReader(jsonPath)); - //System.out.println(object.toString()); - CostInformation costInformation = mapper.readValue(object.toString(), new TypeReference<CostInformation>() { - }); - - return costInformation; } catch (ParseException | IOException ex) { - logger.error("getDataMonitorInfo exception occured:" + ex); + logger.error("Exception occured while reading configuration file:" + ex); return null; } } - public StaticConfiguration ReadStaticConfiguration(String path) - { - JSONParser parser = new JSONParser(); - - String jsonString = null; - ObjectMapper mapper = new ObjectMapper(); - - try { - - Object object = parser.parse(new FileReader(path)); - //System.out.println(object.toString()); - StaticConfiguration staticConfiguration = mapper.readValue(object.toString(), new TypeReference<StaticConfiguration>() { - }); - - return staticConfiguration; - }catch (ParseException | IOException ex) - { - logger.error("Reading static information from configuration file (StaticConfiguration.json) failed:"+ex.getMessage()); - return null; - } - } - - public ServiceInstance getServiceInstancesForEdge(String customerId, String serviceType, String serviceInstanceId) throws Exception - { - logger.info("Fire getServiceInstancesForEdge : Begin"); - ObjectMapper mapper = new ObjectMapper(); - - Response<ResponseBody> response = this.aaiService.getServiceInstancesForEdge(customerId, serviceType, serviceInstanceId).execute(); - if (response.isSuccessful()) { - logger.info("Fire getServiceInstancesForEdge : End"); - String result = new String(response.body().bytes()); - ServiceInstance serviceInstance = mapper.readValue(result, ServiceInstance.class); - return serviceInstance; - //System.out.println("Response received : "+response.body().bytes()); - } - else - { - logger.info("Fire getServiceInstancesForEdge : Failed"); - - } - - return null; - } - - public GenericVnf getGenericVnfInfo(String vnfID) throws Exception - { - ObjectMapper mapper = new ObjectMapper(); - logger.info("Fire GetGenericVnfInfo : Begin for vnfID"+vnfID); - Response<ResponseBody> deviceResponse = this.aaiService.getGenericVnfInformation(vnfID).execute(); - if (deviceResponse.isSuccessful()) { - String result = new String(deviceResponse.body().bytes()); - logger.info("Response received GetGenericVnfInfo"); - //result = result.substring(10, result.length() - 1); - GenericVnf genericVnf = mapper.readValue(result, new TypeReference<GenericVnf>() { - }); - return genericVnf; - - } else { - logger.info("Fire GetGenericVnfInfo : Failed"); - } - return null; - } - - private Map<String,String> getDeviceStatus(String deviceId) { - String result = ""; - String status = ""; - Map<String,String> resultMap = new HashMap<>(); - String deviceDesc = ""; - String deviceName = ""; - ObjectMapper mapper = new ObjectMapper(); - - try { - logger.info("aai getDeviceStatus is starting!"); - - Response<ResponseBody> response = this.aaiService.getDeviceInfo(deviceId).execute(); - - - logger.info("aai getDeviceStatus has finished!"); - if (response.isSuccessful()) { - result = new String(response.body().bytes()); - DeviceInfo deviceInfo = mapper.readValue(result, new TypeReference<DeviceInfo>() { - }); - status = deviceInfo.getOperationalStatus(); - deviceDesc = deviceInfo.getDescription(); - deviceName = deviceInfo.getDeviceName(); - if (status.isEmpty()) { - status = "activate"; - } - resultMap.put("status",status); - resultMap.put("deviceDesc",deviceDesc); - resultMap.put("deviceName",deviceName); - } else { - logger.info(String.format("Can not get getDeviceStatus[code=%s, message=%s]", response.code(), response.message())); - result = Constant.CONSTANT_FAILED; - } - } catch (IOException e) { - - logger.error("getDeviceStatus exception occured:" + e); - result = Constant.CONSTANT_FAILED; - } - return resultMap; - } - - private Enum generateEnumValue(String deviceStatus, String edgeStatus) { - StatusEnum value = null; - if(edgeStatus.equalsIgnoreCase("Online") && deviceStatus.equalsIgnoreCase("Online")) - { - value = StatusEnum.GREEN_GREEN; - } - else if(edgeStatus.equalsIgnoreCase("Offline") && deviceStatus.equalsIgnoreCase("Online")) - { - value = StatusEnum.GREEN_GREY; - } - else - { - value = StatusEnum.GREY_GREY; - } - return value; - } - - */ - -} +}
\ No newline at end of file diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImpl.java index 203a07d7..4dd78c02 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImpl.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImpl.java @@ -102,7 +102,9 @@ public class SotnServiceQryServiceImpl implements SotnServiceQryService { public ModelConfig readFile() { JSONParser parser = new JSONParser(); - String jsonPath = "/home/root1/Desktop/modelconfig.json"; + //String jsonPath = "/home/root1/Desktop/modelconfig.json"; + //String absolutepath = "/home/root1/Desktop/Subhosree/gerrit clone for ui backend";//configure absolute path as per systempath + String jsonPath = "/home/modelconfig.json"; String jsonString = null; ObjectMapper mapper = new ObjectMapper(); diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImpl.java index 2015ae2c..1e3411c6 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImpl.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImpl.java @@ -71,6 +71,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic public ModelConfig readFile() { JSONParser parser = new JSONParser(); + //String jsonPath = "/home/modelconfig.json"; String jsonPath = "/home/modelconfig.json"; String jsonPath_2 = ""; String jsonString = null; diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/SotnServiceLcmControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/SotnServiceLcmControllerTest.java new file mode 100644 index 00000000..2b6789b8 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/SotnServiceLcmControllerTest.java @@ -0,0 +1,87 @@ +/** + * Copyright (C) 2020 Huawei, 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.controller.lcm; + +import org.junit.Before; +import org.junit.Test; +import org.onap.usecaseui.server.service.lcm.ServiceTemplateService; +import org.onap.usecaseui.server.service.lcm.SotnServiceTemplateService; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import javax.servlet.http.HttpServletRequest; + +import java.util.HashMap; + +import static org.mockito.Mockito.*; + +public class SotnServiceLcmControllerTest { + + private SotnServiceTemplateService service; + private SotnServiceLcmController controller = new SotnServiceLcmController(); + + + + @Before + public void setUp() { + service = mock(SotnServiceTemplateService.class); + controller.setServiceLcmService(service); + } + + @Test + public void testinstantiateService_sotnunni() throws Exception { + HashMap<String, Object> mp = new HashMap(); + HttpServletRequest request =mock(HttpServletRequest.class); + controller.instantiateService_sotnunni(request, mp); + + verify(service, times(1)).instantiate_CCVPN_Service(mp); + + } + + @Test + public void testgetSiteInformationTopology() throws Exception + { + String servicetype = "ISAAC"; + String serviceInstanceId = "OS001"; + + controller.getSiteInformationTopology(servicetype,serviceInstanceId); + + verify(service, times(1)).getSOTNSiteInformationTopology(servicetype,serviceInstanceId); + } + + @Test + public void testgetSotnService() throws Exception{ + + String subscriptiontype = "SOTN"; + String instanceid = "123"; + + controller.getSotnService(subscriptiontype, instanceid); + + verify(service, times(1)).getService(subscriptiontype, instanceid); + } + + +// @Test +// public void testgetSotnServicestatus() throws Exception +// { +// String instanceid = "123"; +// controller.getSotnServicestatus(instanceid); +// +// verify(service, times(1)).getSOTNInstantiationstatus(instanceid); +// } + + +}
\ No newline at end of file diff --git a/server/src/test/java/org/onap/usecaseui/server/service/customer/CcvpnCustomerServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/customer/CcvpnCustomerServiceImplTest.java new file mode 100644 index 00000000..7257e29c --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/service/customer/CcvpnCustomerServiceImplTest.java @@ -0,0 +1,99 @@ +/** + * Copyright (C) 2020 Huawei, 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.customer; + +import okhttp3.ResponseBody; +import org.junit.Before; +import org.junit.Test; +import org.onap.usecaseui.server.service.customer.impl.CcvpnCustomerServiceImpl; +import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; +import org.onap.usecaseui.server.service.sotn.impl.SOTNServiceImpl; + +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; + +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; + + +public class CcvpnCustomerServiceImplTest { + + CcvpnCustomerServiceImpl dsts = null; + AAIService aaiService = null; + + + @Before + public void before() throws Exception { + aaiService= mock(AAIService.class); + dsts = new CcvpnCustomerServiceImpl(aaiService); + + + } + + private HttpServletRequest mockRequest() throws IOException { + HttpServletRequest request = mock(HttpServletRequest.class); + when(request.getContentLength()).thenReturn(0); + ServletInputStream inStream = new ServletInputStream() { + @Override + public boolean isFinished() { + return false; + } + + @Override + public boolean isReady() { + return false; + } + + @Override + public void setReadListener(ReadListener readListener) { + + } + + @Override + public int read() throws IOException { + return 0; + } + }; + when(request.getInputStream()).thenReturn(inStream); + return request; + } + + @Test + public void itCanGetAllServiceInformation(){ + ResponseBody result=null; + when(aaiService.getAllServiceInformation("abc", "123")).thenReturn(successfulCall(result)); + dsts.getAllServiceInstances("abc", "123"); + } + + @Test + public void getQuerySubscriptionWithThrowsEexception(){ + when(aaiService.getServiceSubscription("123")).thenReturn(failedCall("aai is not exist!")); + dsts.querySubscriptionType("123"); + } + + @Test + public void testgetServiceInstances () + { + + } + + +} diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIEsrNfvoTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIEsrNfvoTest.java new file mode 100644 index 00000000..a6581da6 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIEsrNfvoTest.java @@ -0,0 +1,59 @@ +/** + * Copyright 2020 Huawei Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.lcm.domain.aai.bean; + +/** + * Copyright (C) 2020 Huawei, 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. + */ +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class AAIEsrNfvoTest { + + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testAAIEsrNfvoTest() throws Exception { + AAIEsrNfvo aaiEsrNfvo = new AAIEsrNfvo("123", "123", "123", "123"); + + aaiEsrNfvo.getApiRoot(); + aaiEsrNfvo.getName(); + aaiEsrNfvo.getNfvoId(); + aaiEsrNfvo.getResourceVersion(); + aaiEsrNfvo.setName("123"); + + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/PInterfaceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/PInterfaceTest.java new file mode 100644 index 00000000..78d0eca9 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/PInterfaceTest.java @@ -0,0 +1,63 @@ +package org.onap.usecaseui.server.service.lcm.domain.aai.bean; + +import org.junit.After; +import org.junit.Before; + +/** + * Copyright (C) 2020 Huawei, 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. + */ + +public class PInterfaceTest { + + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + public void pinterface() throws Exception + { + PInterface pInterface = new PInterface(); + RelationshipList relationshipList = new RelationshipList(); + + pInterface.getInMaint(); + pInterface.getInterfaceName(); + pInterface.getInterfaceType(); + pInterface.getNetworkInterfaceType(); + pInterface.getOperationalStatus(); + pInterface.getNetworkRef(); + pInterface.getPortDescription(); + pInterface.getRelationshipList(); + pInterface.getResourceVersion(); + pInterface.getSpeedUnits(); + pInterface.getSpeedValue(); + + pInterface.setInMaint("123"); + pInterface.setInterfaceName("123"); + pInterface.setInterfaceType("123"); + pInterface.setNetworkInterfaceType("123"); + pInterface.setNetworkRef("123"); + pInterface.setOperationalStatus("123"); + pInterface.setRelationshipList(relationshipList); + pInterface.setPortDescription("123"); + pInterface.setSpeedValue("123"); + pInterface.setSpeedUnits("123"); + + + } + +} diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipDataTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipDataTest.java new file mode 100644 index 00000000..77b69dac --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipDataTest.java @@ -0,0 +1,41 @@ +package org.onap.usecaseui.server.service.lcm.domain.aai.bean; +/** + * Copyright (C) 2020 Huawei, 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. + */ + +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 { + } + + public void relationshipdatatest() throws Exception + { + RelationshipData relationshipData = new RelationshipData(); + + relationshipData.getRelationshipKey(); + relationshipData.getRelationshipValue(); + relationshipData.setRelationshipKey("123"); + relationshipData.setRelationshipValue("123"); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipListTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipListTest.java new file mode 100644 index 00000000..48a47a38 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipListTest.java @@ -0,0 +1,41 @@ +package org.onap.usecaseui.server.service.lcm.domain.aai.bean; + +import org.junit.After; +import org.junit.Before; + +/** + * Copyright (C) 2020 Huawei, 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. + */ +public class RelationshipListTest { + + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + public void relationshipListTest() throws Exception + { + RelationshipList relationshipList = new RelationshipList(); + + relationshipList.getRelationship(); + + } + +} + + diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipTest.java new file mode 100644 index 00000000..85847020 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipTest.java @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2020 Huawei, 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.lcm.domain.aai.bean; + +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 relationshiptest() throws Exception + { + Relationship relationship = new Relationship(); + + relationship.getRelatedLink(); + relationship.getRelatedTo(); + relationship.getRelationshipData(); + relationship.getRelationshipLabel(); + + relationship.setRelatedLink("123"); + relationship.setRelatedTo("123"); + relationship.setRelationshipLabel("123"); + + + } + +} + + diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/SaveOrUpdateOperationTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/SaveOrUpdateOperationTest.java new file mode 100644 index 00000000..14e5ed7e --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/SaveOrUpdateOperationTest.java @@ -0,0 +1,37 @@ +package org.onap.usecaseui.server.service.lcm.domain.so.bean; +/** + * Copyright (C) 2020 Huawei, 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. + */ +import org.junit.After; +import org.junit.Before; + +public class SaveOrUpdateOperationTest { + + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + public void saveorupdateoperation () throws Exception + { + SaveOrUpdateOperationRsp saveOrUpdateOperationRsp =new SaveOrUpdateOperationRsp(); + + saveOrUpdateOperationRsp.getOperationId(); + saveOrUpdateOperationRsp.setOperationId("abc"); + } +} |