diff options
author | mukesh.paliwal1@huawei.com <mukesh.paliwal1@huawei.com> | 2020-03-09 19:52:47 +0530 |
---|---|---|
committer | Mukesh Paliwal <mukesh.paliwal1@huawei.com> | 2020-03-10 04:40:57 +0000 |
commit | 8a58ace74a07b289cdaa2b5510e9239fc2cb0e46 (patch) | |
tree | 3a4cefcb0f5a9cd0fc871ff742155a8482d3199a | |
parent | 49c8bebba6183237a1bd0c0e8862e67660742754 (diff) |
UT for SOTN Eline in USECASEUI
Issue-ID: USECASEUI-378
Signed-off-by: mukesh.paliwal1@huawei.com <mukesh.paliwal1@huawei.com>
Change-Id: I789e70d23994cedbfd41c1edf82f8a5e114b6df8
16 files changed, 913 insertions, 2 deletions
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 1179314c..2015ae2c 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 @@ -79,7 +79,6 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic try { Object object = parser.parse(new FileReader(jsonPath)); - // System.out.println("mukesh"+object.toString()); ModelConfig modelInformation = mapper.readValue(object.toString(), new TypeReference<ModelConfig>() { }); @@ -100,7 +99,6 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic try { Object object = parser.parse(new FileReader(jsonPath)); - // System.out.println("mukesh"+object.toString()); ModelConfig modelInformation = mapper.readValue(object.toString(), new TypeReference<ModelConfig>() { }); diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/RelationshipDatumTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/RelationshipDatumTest.java new file mode 100644 index 00000000..911db63d --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/RelationshipDatumTest.java @@ -0,0 +1,48 @@ +/** + * 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.bean; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import static org.mockito.Matchers.anyObject; + +public class RelationshipDatumTest { + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetRelationshipDatum() throws Exception { + RelationshipDatum rd = new RelationshipDatum(); + rd.getAdditionalProperties(); + rd.getRelationshipKey(); + rd.getRelationshipValue(); + } + + @Test + public void testSetRelationshipDatum() throws Exception { + RelationshipDatum rd = new RelationshipDatum(); + rd.setAdditionalProperty("", anyObject()); + rd.setRelationshipKey(""); + rd.setRelationshipValue(""); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/ComplexObjTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/ComplexObjTest.java new file mode 100644 index 00000000..533b98f1 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/ComplexObjTest.java @@ -0,0 +1,69 @@ +/** + * 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.bean.activeEdge; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.usecaseui.server.bean.activateEdge.ComplexObj; +import org.onap.usecaseui.server.bean.activateEdge.RelationshipList; + +import static org.mockito.Matchers.anyObject; + +public class ComplexObjTest { + RelationshipList relationshipList; + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetComplexObj() throws Exception { + ComplexObj co = new ComplexObj(); + co.getCity(); + co.getPostalCode(); + co.getAdditionalProperties(); + co.getCountry(); + co.getLatitude(); + co.getLongitude(); + co.getPhysicalLocationId(); + co.getPhysicalLocationType(); + co.getRegion(); + co.getRelationshipList(); + co.getResourceVersion(); + co.getStreet1(); + } + + @Test + public void testSetComplexObj() throws Exception { + ComplexObj co = new ComplexObj(); + co.setCity(""); + co.setPostalCode(""); + co.setAdditionalProperty("", anyObject()); + co.setCountry(""); + co.setLatitude(""); + co.setLongitude(""); + co.setPhysicalLocationId(""); + co.setPhysicalLocationType(""); + co.setRegion(""); + co.setRelationshipList(relationshipList); + co.setResourceVersion(""); + co.setStreet1(""); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/RelationshipDatumTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/RelationshipDatumTest.java new file mode 100644 index 00000000..38d49418 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/RelationshipDatumTest.java @@ -0,0 +1,49 @@ +/** + * 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.bean.activeEdge; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.usecaseui.server.bean.activateEdge.RelationshipDatum; + +import static org.mockito.Matchers.anyObject; + +public class RelationshipDatumTest { + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetRelationshipDatumTest() throws Exception { + RelationshipDatum rd = new RelationshipDatum(); + rd.getAdditionalProperties(); + rd.getRelationshipKey(); + rd.getRelationshipValue(); + } + + @Test + public void testSetRelationshipDatumTest() throws Exception { + RelationshipDatum rd = new RelationshipDatum(); + rd.setAdditionalProperty("", anyObject()); + rd.setRelationshipKey(""); + rd.setRelationshipValue(""); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/RelationshipListTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/RelationshipListTest.java new file mode 100644 index 00000000..0235a464 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/RelationshipListTest.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.bean.activeEdge; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.usecaseui.server.bean.activateEdge.RelationshipList; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.Relationship; + +import java.lang.reflect.Array; +import java.util.List; + +import static org.mockito.Matchers.anyObject; + +public class RelationshipListTest { + + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetRelationshipList() throws Exception { + RelationshipList rl = new RelationshipList(); + rl.getRelationship(); + rl.getAdditionalProperties(); + } + + @Test + public void testSetRelationshipList() throws Exception { + RelationshipList rl = new RelationshipList(); + rl.setRelationship(null); + rl.setAdditionalProperty("", anyObject()); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/ServiceInstanceTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/ServiceInstanceTest.java new file mode 100644 index 00000000..17bebabe --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/ServiceInstanceTest.java @@ -0,0 +1,64 @@ +/** + * 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.bean.activeEdge; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.usecaseui.server.bean.activateEdge.ServiceInstance; + +import static org.mockito.Matchers.anyObject; + +public class ServiceInstanceTest { + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetServiceInstance() throws Exception { + ServiceInstance si = new ServiceInstance(); + si.getRelationshipList(); + si.getInputparameters(); + si.getServiceInstanceName(); + si.getServiceInstanceId(); + si.getAdditionalProperties(); + si.getOrchestrationstatus(); + si.getResourceVersion(); + si.getSelflink(); + si.getServiceRole(); + si.getServiceType(); + } + + @Test + public void testSetServiceInstance() throws Exception { + ServiceInstance si = new ServiceInstance(); + si.setRelationshipList(null); + si.setInputparameters(""); + si.setServiceInstanceName(""); + si.setServiceInstanceId(""); + si.setAdditionalProperty("", anyObject()); + si.setOrchestrationstatus(""); + si.setResourceVersion(""); + si.setSelflink(""); + si.setServiceRole(""); + si.setServiceType(""); + } + +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/SiteResourceTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/SiteResourceTest.java new file mode 100644 index 00000000..0680dc1b --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/SiteResourceTest.java @@ -0,0 +1,67 @@ +/** + * 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.bean.activeEdge; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.usecaseui.server.bean.activateEdge.SiteResource; + +import static org.mockito.Matchers.anyObject; + +public class SiteResourceTest { + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetSiteResource() throws Exception { + SiteResource sr = new SiteResource(); + sr.getDescription(); + sr.getRelationshipList(); + sr.getSiteResourceId(); + sr.getSiteResourceName(); + sr.getAdditionalProperties(); + sr.getCity(); + sr.getOperationalStatus(); + sr.getPostalcode(); + sr.getResourceVersion(); + sr.getRole(); + sr.getSelflink(); + sr.getType(); + } + + @Test + public void testSetSiteResource() throws Exception { + SiteResource sr = new SiteResource(); + sr.setDescription(""); + sr.setRelationshipList(null); + sr.setSiteResourceId(""); + sr.setSiteResourceName(""); + sr.setAdditionalProperty("", anyObject()); + sr.setCity(""); + sr.setOperationalStatus(""); + sr.setPostalcode(""); + sr.setResourceVersion(""); + sr.setRole(""); + sr.setSelflink(""); + sr.setType(""); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/customer/ServiceInstanceTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/customer/ServiceInstanceTest.java new file mode 100644 index 00000000..672cb4ed --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/customer/ServiceInstanceTest.java @@ -0,0 +1,64 @@ +/** + * 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.bean.customer; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.usecaseui.server.bean.activateEdge.ServiceInstance; + +import static org.mockito.Matchers.anyObject; + +public class ServiceInstanceTest { + + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetServiceInstance() throws Exception { + org.onap.usecaseui.server.bean.activateEdge.ServiceInstance si = new org.onap.usecaseui.server.bean.activateEdge.ServiceInstance(); + si.getRelationshipList(); + si.getInputparameters(); + si.getServiceInstanceName(); + si.getServiceInstanceId(); + si.getAdditionalProperties(); + si.getOrchestrationstatus(); + si.getResourceVersion(); + si.getSelflink(); + si.getServiceRole(); + si.getServiceType(); + } + + @Test + public void testSetServiceInstance() throws Exception { + org.onap.usecaseui.server.bean.activateEdge.ServiceInstance si = new ServiceInstance(); + si.setRelationshipList(null); + si.setInputparameters(""); + si.setServiceInstanceName(""); + si.setServiceInstanceId(""); + si.setAdditionalProperty("", anyObject()); + si.setOrchestrationstatus(""); + si.setResourceVersion(""); + si.setSelflink(""); + si.setServiceRole(""); + si.setServiceType(""); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/customer/ServiceInstancesTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/customer/ServiceInstancesTest.java new file mode 100644 index 00000000..28a94803 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/customer/ServiceInstancesTest.java @@ -0,0 +1,42 @@ +/** + * 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.bean.customer; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class ServiceInstancesTest { + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetServiceInstances() throws Exception { + ServiceInstances si = new ServiceInstances(); + si.getServiceInstances(); + } + + @Test + public void testSetServiceInstances() throws Exception { + ServiceInstances si = new ServiceInstances(); + si.setServiceInstances(null); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/customer/SubscriptionTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/customer/SubscriptionTest.java new file mode 100644 index 00000000..b366276a --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/customer/SubscriptionTest.java @@ -0,0 +1,46 @@ +/** + * 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.bean.customer; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SubscriptionTest { + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetSubscripion() throws Exception { + Subscription sc = new Subscription(); + sc.getAccountId(); + sc.getResourceVersion(); + sc.getServiceType(); + } + + @Test + public void testSetSubscripion() throws Exception { + Subscription sc = new Subscription(); + sc.setAccountId(""); + sc.setResourceVersion(""); + sc.setServiceType(""); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/customer/SubscriptionTypeTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/customer/SubscriptionTypeTest.java new file mode 100644 index 00000000..6cc2a8c9 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/customer/SubscriptionTypeTest.java @@ -0,0 +1,43 @@ +/** + * 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.bean.customer; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SubscriptionTypeTest { + + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetSubscriptionType() throws Exception { + SubscriptionType st = new SubscriptionType(); + st.getSubscriptions(); + } + + @Test + public void testSetSubscriptionType() throws Exception { + SubscriptionType st = new SubscriptionType(); + st.setSubscriptions(null); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/orderservice/ServiceEstimationTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/orderservice/ServiceEstimationTest.java new file mode 100644 index 00000000..39d2fedf --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/orderservice/ServiceEstimationTest.java @@ -0,0 +1,56 @@ +/** + * 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.bean.orderservice; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.List; + +public class ServiceEstimationTest { + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetServiceEstimation() throws Exception { + ServiceEstimationBean seb = new ServiceEstimationBean(); + seb.getBandWidth(); + seb.getBandwidthCost(); + seb.getCameraCost(); + seb.getServiceCost(); + seb.getVpnCost(); + seb.getVpnInformations(); + seb.getWlanAccess(); + } + + @Test + public void testSetServiceEstimation() throws Exception { + ServiceEstimationBean seb = new ServiceEstimationBean(); + seb.setBandWidth(""); + seb.setBandwidthCost(""); + seb.setCameraCost(""); + seb.setServiceCost(""); + seb.setVpnCost(""); + seb.setVpnInformations(null); + seb.setWlanAccess(null); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/orderservice/SiteTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/orderservice/SiteTest.java new file mode 100644 index 00000000..6030808a --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/orderservice/SiteTest.java @@ -0,0 +1,70 @@ +/** + * 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.bean.orderservice; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SiteTest { + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetSite() throws Exception { + Site site = new Site(); + site.getAddress(); + site.getCapacity(); + site.getDescription(); + site.getEmail(); + site.getIsCloudSite(); + site.getLocation(); + site.getPrice(); + site.getRole(); + site.getSiteId(); + site.getSiteinterface(); + site.getSiteName(); + site.getSiteStatus(); + site.getSubnet(); + site.getType(); + site.getZipCode(); + } + + @Test + public void testSetSite() throws Exception { + Site site = new Site(); + site.setAddress(""); + site.setCapacity(""); + site.setDescription(""); + site.setEmail(""); + site.setIsCloudSite(""); + site.setLocation(""); + site.setPrice(""); + site.setRole(""); + site.setSiteId(""); + site.setSiteinterface(""); + site.setSiteName(""); + site.setSiteStatus(""); + site.setSubnet(""); + site.setType(""); + site.setZipCode(""); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/orderservice/VpnInformationTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/orderservice/VpnInformationTest.java new file mode 100644 index 00000000..76eef6a4 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/bean/orderservice/VpnInformationTest.java @@ -0,0 +1,57 @@ +/** + * 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.bean.orderservice; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class VpnInformationTest { + + @Before + public void before() throws Exception { + } + + @After + public void after() throws Exception { + } + + @Test + public void testGetVpnInformation() throws Exception { + VpnInformation vpn = new VpnInformation(); + vpn.getCameras(); + vpn.getCost(); + vpn.getSites(); + vpn.getVpnBandwidth(); + vpn.getVpnId(); + vpn.getVpnName(); + vpn.getVpnThreshold(); + vpn.getVpnType(); + } + + @Test + public void testSetVpnInformation() throws Exception { + VpnInformation vpn = new VpnInformation(); + vpn.setCameras(""); + vpn.setCost(""); + vpn.setSites(null); + vpn.setVpnBandwidth(""); + vpn.setVpnId(""); + vpn.setVpnName(""); + vpn.setVpnThreshold(""); + vpn.setVpnType(""); + } +} diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImplTest.java new file mode 100644 index 00000000..3731ce01 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImplTest.java @@ -0,0 +1,47 @@ +/** + * 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.impl; + +import okhttp3.ResponseBody; +import org.junit.Test; +import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; + +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 SotnServiceQryServiceImplTest { + + AAIService aaiService = mock(AAIService.class); + + SotnServiceQryServiceImpl sotnServiceQryService = new SotnServiceQryServiceImpl(aaiService); + + @Test + public void getServiceInstancesTest() { + ResponseBody result=null; + when(aaiService.listServiceInstances("ISAAC","SOTN")).thenReturn(successfulCall(result)); + sotnServiceQryService.getServiceInstances("SOTN"); + } + + @Test + public void getServiceInstancesWithThrowException() { + ResponseBody result=null; + when(aaiService.listServiceInstances("ISAAC","SOTN")).thenReturn(failedCall("aai is not exist!")); + sotnServiceQryService.getServiceInstances("SOTN"); + } + +} diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImplTest.java new file mode 100644 index 00000000..defec3e7 --- /dev/null +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImplTest.java @@ -0,0 +1,139 @@ +/** + * 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.impl; + +import okhttp3.ResponseBody; +import org.junit.Before; +import org.junit.Test; +import org.onap.usecaseui.server.bean.lcm.sotne2eservice.E2EServiceInstanceRequest; +import org.onap.usecaseui.server.bean.lcm.sotne2eservice.ModelConfig; +import org.onap.usecaseui.server.service.lcm.SotnServiceTemplateService; +import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; +import org.onap.usecaseui.server.service.lcm.domain.so.SOService; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; +import org.onap.usecaseui.server.service.sotn.impl.SOTNServiceImpl; + +import java.util.HashMap; + +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; + +public class SotnServiceTemplateServiceImplTest { + + AAIService aaiService; + SOService soService; + ServiceOperation serviceOperation; + SotnServiceTemplateServiceImpl sotnServiceTemplateService; + @Before + public void before() throws Exception { + aaiService = mock(AAIService.class); + soService = mock(SOService.class); + sotnServiceTemplateService = new SotnServiceTemplateServiceImpl(); + } + + @Test + public void instantiate_CCVPN_ServiceTest() { + when(soService.instantiateSOTNService(new E2EServiceInstanceRequest())).thenReturn(successfulCall(serviceOperation)); + sotnServiceTemplateService.instantiate_CCVPN_Service(new HashMap<String, Object>()); + } + + @Test + public void instantiate_CCVPN_ServiceWithThrowException() { + when(soService.instantiateSOTNService(new E2EServiceInstanceRequest())).thenReturn(failedCall("failed to create Service")); + sotnServiceTemplateService.instantiate_CCVPN_Service(new HashMap<String, Object>()); + } + + @Test + public void createSotnServiceTest() { + when(soService.instantiateSOTNService(new E2EServiceInstanceRequest())).thenReturn(successfulCall(serviceOperation)); + sotnServiceTemplateService.createSotnService(new E2EServiceInstanceRequest()); + } + + @Test + public void createSotnServiceWithThrowException() { + when(soService.instantiateSOTNService(new E2EServiceInstanceRequest())).thenReturn(failedCall("failed to create Service")); + sotnServiceTemplateService.createSotnService(new E2EServiceInstanceRequest()); + } + + @Test + public void getServiceInstancesInfoTest() throws Exception { + ResponseBody result=null; + when(aaiService.getServiceInstancesForEdge("ISAAC","SOTN","ISAAC")).thenReturn(successfulCall(result)); + sotnServiceTemplateService.getServiceInstancesInfo("ISAAC","SOTN","ISAAC"); + } + + @Test + public void getServiceInstancesInfoWithThrowException() throws Exception { + when(aaiService.getServiceInstancesForEdge("ISAAC","SOTN","ISAAC")).thenReturn(failedCall("Failed to get Service Instance")); + sotnServiceTemplateService.getServiceInstancesInfo("ISAAC","SOTN","ISAAC"); + } + + @Test + public void getTerminationPointTest() throws Exception { + ResponseBody result = null; + when(aaiService.getTerminationPoint("SOTN","123")).thenReturn(successfulCall(result)); + sotnServiceTemplateService.getTerminationPoint("SOTN", "123"); + } + + @Test + public void getTerminationPointWithThrowException() throws Exception { + when(aaiService.getTerminationPoint("SOTN","123")).thenReturn(failedCall("Failed to get connectivity information.")); + sotnServiceTemplateService.getTerminationPoint("SOTN", "123"); + } + + @Test + public void getSOTNPinterfaceByVpnIdTest() throws Exception { + ResponseBody result = null; + when(aaiService.getPinterfaceByVpnId("1")).thenReturn(successfulCall(result)); + sotnServiceTemplateService.getSOTNPinterfaceByVpnId("1"); + } + + @Test + public void getSOTNPinterfaceByVpnIdWithThrowException() throws Exception { + when(aaiService.getPinterfaceByVpnId("1")).thenReturn(failedCall("failed to get VPN ID")); + sotnServiceTemplateService.getSOTNPinterfaceByVpnId("1"); + } + + @Test + public void getSOTNPnfTest() throws Exception { + ResponseBody result = null; + when(aaiService.getPnfInfo("test")).thenReturn(successfulCall(result)); + sotnServiceTemplateService.getSOTNPnf("test"); + } + + @Test + public void getSOTNPnfWithThrowException() throws Exception { + when(aaiService.getPnfInfo("test")).thenReturn(failedCall("Failed to get PNF info.")); + sotnServiceTemplateService.getSOTNPnf("test"); + } + + @Test + public void getSOTNLinkbyNameTest() throws Exception { + ResponseBody result = null; + when(aaiService.getSpecificLogicalLink("link")).thenReturn(successfulCall(result)); + sotnServiceTemplateService.getSOTNLinkbyName("link"); + } + + @Test + public void getSOTNLinkbyNameWithThrowException() throws Exception { + when(aaiService.getSpecificLogicalLink("link")).thenReturn(failedCall("Failed to get link info.")); + sotnServiceTemplateService.getSOTNLinkbyName("link"); + } +} |