From 728e24f8d47287eeb4994780706adbe7ec99d941 Mon Sep 17 00:00:00 2001 From: "Sonsino, Ofir (os0695)" Date: Mon, 19 Mar 2018 17:39:39 +0200 Subject: Unit tests Change-Id: I0834a2b68d61664a82492c8465fa82aee6c0f017 Issue-ID: VID-197 Signed-off-by: Sonsino, Ofir (os0695) --- .../org/onap/vid/services/AaiServiceImplTest.java | 351 +++++++++++++++++++++ .../services/CategoryParameterServiceImplTest.java | 80 +++++ 2 files changed, 431 insertions(+) create mode 100644 vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java (limited to 'vid-app-common/src/test/java/org/onap/vid/services') diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java new file mode 100644 index 00000000..ae6c2ccc --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java @@ -0,0 +1,351 @@ +package org.onap.vid.services; + +import java.util.Collection; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.vid.aai.AaiResponse; +import org.onap.vid.aai.SubscriberFilteredResults; +import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList; +import org.onap.vid.aai.model.AaiGetPnfs.Pnf; +import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse; +import org.onap.vid.model.SubscriberList; +import org.onap.vid.roles.RoleValidator; + +public class AaiServiceImplTest { + + private AaiServiceImpl createTestSubject() { + return new AaiServiceImpl(); + } + + @Test + public void testGetFullSubscriberList() throws Exception { + AaiServiceImpl testSubject; + RoleValidator roleValidator = null; + SubscriberFilteredResults result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getFullSubscriberList(roleValidator); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetOperationalEnvironments() throws Exception { + AaiServiceImpl testSubject; + String operationalEnvironmentType = ""; + String operationalEnvironmentStatus = ""; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getOperationalEnvironments(operationalEnvironmentType, operationalEnvironmentStatus); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetFullSubscriberList_1() throws Exception { + AaiServiceImpl testSubject; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getFullSubscriberList(); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetSubscriberData() throws Exception { + AaiServiceImpl testSubject; + String subscriberId = ""; + RoleValidator roleValidator = null; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getSubscriberData(subscriberId, roleValidator); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetServiceInstanceSearchResults() throws Exception { + AaiServiceImpl testSubject; + String subscriberId = ""; + String instanceIdentifier = ""; + RoleValidator roleValidator = null; + List owningEntities = null; + List projects = null; + AaiResponse result; + + // test 1 + testSubject = createTestSubject(); + subscriberId = null; + instanceIdentifier = null; + result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator, + owningEntities, projects); + Assert.assertNotEquals(null, result); + + /*/ test 2 + testSubject = createTestSubject(); + subscriberId = ""; + instanceIdentifier = null; + result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator, + owningEntities, projects); + Assert.assertNotEquals(null, result); + + // test 3 + testSubject = createTestSubject(); + instanceIdentifier = null; + subscriberId = null; + result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator, + owningEntities, projects); + Assert.assertEquals(null, result); + + // test 4 + testSubject = createTestSubject(); + instanceIdentifier = ""; + subscriberId = null; + result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator, + owningEntities, projects); + Assert.assertEquals(null, result); + + // test 5 + testSubject = createTestSubject(); + owningEntities = null; + result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator, + owningEntities, projects); + Assert.assertEquals(null, result); + + // test 6 + testSubject = createTestSubject(); + projects = null; + result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator, + owningEntities, projects); + Assert.assertEquals(null, result);*/ + } + + @Test + public void testGetVersionByInvariantId() throws Exception { + AaiServiceImpl testSubject; + List modelInvariantId = null; + + // default test + try { + testSubject = createTestSubject(); + testSubject.getVersionByInvariantId(modelInvariantId); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetSpecificPnf() throws Exception { + AaiServiceImpl testSubject; + String pnfId = ""; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getSpecificPnf(pnfId); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetPNFData() throws Exception { + AaiServiceImpl testSubject; + String globalCustomerId = ""; + String serviceType = ""; + String modelVersionId = ""; + String modelInvariantId = ""; + String cloudRegion = ""; + String equipVendor = ""; + String equipModel = ""; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getPNFData(globalCustomerId, serviceType, modelVersionId, modelInvariantId, + cloudRegion, equipVendor, equipModel); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetServices() throws Exception { + AaiServiceImpl testSubject; + RoleValidator roleValidator = null; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getServices(roleValidator); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetTenants() throws Exception { + AaiServiceImpl testSubject; + String globalCustomerId = ""; + String serviceType = ""; + RoleValidator roleValidator = null; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getTenants(globalCustomerId, serviceType, roleValidator); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetVNFData() throws Exception { + AaiServiceImpl testSubject; + String globalSubscriberId = ""; + String serviceType = ""; + String serviceInstanceId = ""; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getVNFData(globalSubscriberId, serviceType, serviceInstanceId); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetVNFData_1() throws Exception { + AaiServiceImpl testSubject; + String globalSubscriberId = ""; + String serviceType = ""; + + // default test + try { + testSubject = createTestSubject(); + testSubject.getVNFData(globalSubscriberId, serviceType); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetAaiZones() throws Exception { + AaiServiceImpl testSubject; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getAaiZones(); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetAicZoneForPnf() throws Exception { + AaiServiceImpl testSubject; + String globalCustomerId = ""; + String serviceType = ""; + String serviceId = ""; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getAicZoneForPnf(globalCustomerId, serviceType, serviceId); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetNodeTemplateInstances() throws Exception { + AaiServiceImpl testSubject; + String globalCustomerId = ""; + String serviceType = ""; + String modelVersionId = ""; + String modelInvariantId = ""; + String cloudRegion = ""; + AaiResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getNodeTemplateInstances(globalCustomerId, serviceType, modelVersionId, + modelInvariantId, cloudRegion); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetServicesByDistributionStatus() throws Exception { + AaiServiceImpl testSubject; + + // default test + try { + testSubject = createTestSubject(); + testSubject.getServicesByDistributionStatus(); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetServiceInstanceAssociatedPnfs() throws Exception { + AaiServiceImpl testSubject; + String globalCustomerId = ""; + String serviceType = ""; + String serviceInstanceId = ""; + List result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getServiceInstanceAssociatedPnfs(globalCustomerId, serviceType, serviceInstanceId); + } catch ( + + Exception e) { + } + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java new file mode 100644 index 00000000..440a2a7b --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java @@ -0,0 +1,80 @@ +package org.onap.vid.services; + +import org.junit.Test; +import org.onap.vid.category.AddCategoryOptionResponse; +import org.onap.vid.category.AddCategoryOptionsRequest; +import org.onap.vid.category.CategoryParameterOptionRep; +import org.onap.vid.category.CategoryParametersResponse; +import org.onap.vid.model.CategoryParameterOption; + +public class CategoryParameterServiceImplTest { + + private CategoryParameterServiceImpl createTestSubject() { + return new CategoryParameterServiceImpl(); + } + + @Test + public void testCreateCategoryParameterOptions() throws Exception { + CategoryParameterServiceImpl testSubject; + String categoryName = ""; + AddCategoryOptionsRequest optionsRequest = null; + AddCategoryOptionResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createCategoryParameterOptions(categoryName, optionsRequest); + } catch ( + + Exception e) { + } + } + + @Test + public void testDeleteCategoryOption() throws Exception { + CategoryParameterServiceImpl testSubject; + String categoryName = ""; + CategoryParameterOption option = null; + + // default test + try { + testSubject = createTestSubject(); + testSubject.deleteCategoryOption(categoryName, option); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetCategoryParameters() throws Exception { + CategoryParameterServiceImpl testSubject; + CategoryParametersResponse result; + + // default test + try { + testSubject = createTestSubject(); + testSubject.getCategoryParameters(null); + } catch ( + + Exception e) { + } + } + + @Test + public void testUpdateCategoryParameterOption() throws Exception { + CategoryParameterServiceImpl testSubject; + String categoryName = ""; + CategoryParameterOptionRep option = null; + AddCategoryOptionResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.updateCategoryParameterOption(categoryName, option); + } catch ( + + Exception e) { + } + } +} \ No newline at end of file -- cgit 1.2.3-korg