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) --- .../ChangeManagementControllerTest.java | 161 +++++++++ .../onap/vid/controllers/PolicyControllerTest.java | 30 ++ .../controllers/RoleGeneratorControllerTest.java | 26 ++ .../src/test/java/org/onap/vid/model/NodeTest.java | 23 ++ .../java/org/onap/vid/model/ServiceModelTest.java | 329 +++++++++++------ .../onap/vid/mso/rest/MsoRestClientNewTest.java | 400 +++++++++++++++++++++ .../org/onap/vid/services/AaiServiceImplTest.java | 351 ++++++++++++++++++ .../services/CategoryParameterServiceImplTest.java | 80 +++++ 8 files changed, 1288 insertions(+), 112 deletions(-) create mode 100644 vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controllers/PolicyControllerTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/controllers/RoleGeneratorControllerTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/model/NodeTest.java create mode 100644 vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java 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') diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java new file mode 100644 index 000000000..2e2bc11e6 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java @@ -0,0 +1,161 @@ +package org.onap.vid.controllers; + +import java.util.Collection; + +import javax.servlet.http.HttpServletRequest; + +import org.codehaus.jackson.map.ObjectMapper; +import org.json.simple.JSONArray; +import org.junit.Test; +import org.onap.vid.changeManagement.ChangeManagementRequest; +import org.onap.vid.changeManagement.GetVnfWorkflowRelationRequest; +import org.onap.vid.changeManagement.VnfWorkflowRelationRequest; +import org.onap.vid.mso.MsoResponseWrapperInterface; +import org.onap.vid.services.ChangeManagementService; +import org.onap.vid.services.ChangeManagementServiceImpl; +import org.onap.vid.services.WorkflowService; +import org.onap.vid.services.WorkflowServiceImpl; +import org.springframework.http.ResponseEntity; +import org.springframework.web.multipart.MultipartFile; + +public class ChangeManagementControllerTest { + + private ChangeManagementController createTestSubject() { + return new ChangeManagementController(new WorkflowServiceImpl(), new ChangeManagementServiceImpl(null, null), + null); + } + + @Test + public void testGetWorkflow() throws Exception { + ChangeManagementController testSubject; + Collection vnfs = null; + ResponseEntity> result; + + // default test + testSubject = createTestSubject(); + try { + result = testSubject.getWorkflow(vnfs); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetMSOChangeManagements() throws Exception { + ChangeManagementController testSubject; + + // default test + testSubject = createTestSubject(); + try { + testSubject.getMSOChangeManagements(); + } catch ( + + Exception e) { + } + } + + @Test + public void testChangeManagement() throws Exception { + ChangeManagementController testSubject; + String vnfName = ""; + HttpServletRequest request = null; + ChangeManagementRequest changeManagmentRequest = null; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.changeManagement(vnfName, request, changeManagmentRequest); + } + + @Test + public void testUploadConfigUpdateFile() throws Exception { + ChangeManagementController testSubject; + MultipartFile file = null; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.uploadConfigUpdateFile(file); + } + + @Test + public void testGetSchedulerChangeManagements() throws Exception { + ChangeManagementController testSubject; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSchedulerChangeManagements(); + } + + @Test + public void testDeleteSchedule() throws Exception { + ChangeManagementController testSubject; + String scheduleId = ""; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteSchedule(scheduleId); + } + + @Test + public void testGetWorkflows() throws Exception { + ChangeManagementController testSubject; + GetVnfWorkflowRelationRequest getVnfWorkflowRelationRequest = null; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getWorkflows(getVnfWorkflowRelationRequest); + } + + @Test + public void testCreateWorkflowRelation() throws Exception { + ChangeManagementController testSubject; + VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.createWorkflowRelation(vnfWorkflowRelationRequest); + } + + @Test + public void testGetAllWorkflowRelation() throws Exception { + ChangeManagementController testSubject; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllWorkflowRelation(); + } + + @Test + public void testDeleteWorkflowRelation() throws Exception { + ChangeManagementController testSubject; + VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null; + ResponseEntity result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteWorkflowRelation(vnfWorkflowRelationRequest); + } + + @Test + public void testClientDerivedExceptionAsBadRequest() throws Exception { + ChangeManagementController testSubject; + Exception e = null; + MsoResponseWrapperInterface result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.clientDerivedExceptionAsBadRequest(e); + } catch ( + + Exception ex) { + } + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/PolicyControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/PolicyControllerTest.java new file mode 100644 index 000000000..33bed45ec --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/PolicyControllerTest.java @@ -0,0 +1,30 @@ +package org.onap.vid.controllers; + +import javax.servlet.http.HttpServletRequest; + +import org.json.simple.JSONObject; +import org.junit.Test; +import org.onap.vid.policy.PolicyResponseWrapper; +import org.springframework.http.ResponseEntity; + +public class PolicyControllerTest { + + private PolicyController createTestSubject() { + return new PolicyController(); + } + + @Test + public void testGetPolicyInfo() throws Exception { + PolicyController testSubject; + HttpServletRequest request = null; + JSONObject policy_request = null; + ResponseEntity result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getPolicyInfo(request, policy_request); + }catch(Exception e){} + } + +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/RoleGeneratorControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/RoleGeneratorControllerTest.java new file mode 100644 index 000000000..11ab2fccc --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/RoleGeneratorControllerTest.java @@ -0,0 +1,26 @@ +package org.onap.vid.controllers; + +import org.junit.Test; +import org.springframework.http.ResponseEntity; + +public class RoleGeneratorControllerTest { + + private RoleGeneratorController createTestSubject() { + return new RoleGeneratorController(); + } + + @Test + public void testGenerateRoleScript() throws Exception { + RoleGeneratorController testSubject; + boolean firstRun = false; + ResponseEntity result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.generateRoleScript(firstRun); + } catch (Exception e) { + + } + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/model/NodeTest.java b/vid-app-common/src/test/java/org/onap/vid/model/NodeTest.java new file mode 100644 index 000000000..3329c78aa --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/model/NodeTest.java @@ -0,0 +1,23 @@ +package org.onap.vid.model; + +import org.junit.Test; +import org.onap.vid.asdc.beans.tosca.NodeTemplate; +import org.onap.vid.asdc.beans.tosca.ToscaMetadata; + +public class NodeTest { + + private Node createTestSubject() { + return new Node(); + } + + @Test + public void testExtractNode() throws Exception { + Node testSubject; + NodeTemplate nodeTemplate = new NodeTemplate(); + nodeTemplate.setMetadata(new ToscaMetadata()); + + // default test + testSubject = createTestSubject(); + testSubject.extractNode(nodeTemplate); + } +} \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/model/ServiceModelTest.java b/vid-app-common/src/test/java/org/onap/vid/model/ServiceModelTest.java index 27aa468c1..ae08ee786 100644 --- a/vid-app-common/src/test/java/org/onap/vid/model/ServiceModelTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/model/ServiceModelTest.java @@ -5,119 +5,224 @@ import java.util.Map; import org.junit.Test; import org.onap.vid.asdc.beans.tosca.ToscaModel; import org.onap.vid.model.Service; +import java.util.*; +import org.junit.Assert; public class ServiceModelTest { - private ServiceModel createTestSubject() { - return new ServiceModel(); - } - - @Test - public void testGetService() throws Exception { - ServiceModel testSubject; - Service result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getService(); - } - - @Test - public void testGetVnfs() throws Exception { - ServiceModel testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVnfs(); - } - - @Test - public void testGetNetworks() throws Exception { - ServiceModel testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getNetworks(); - } - - @Test - public void testSetService() throws Exception { - ServiceModel testSubject; - Service service = null; - - // default test - testSubject = createTestSubject(); - testSubject.setService(service); - } - - @Test - public void testSetVnfs() throws Exception { - ServiceModel testSubject; - Map vnfs = null; - - // default test - testSubject = createTestSubject(); - testSubject.setVnfs(vnfs); - } - - @Test - public void testSetNetworks() throws Exception { - ServiceModel testSubject; - Map networks = null; - - // default test - testSubject = createTestSubject(); - testSubject.setNetworks(networks); - } - - @Test - public void testGetVfModules() throws Exception { - ServiceModel testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVfModules(); - } - - @Test - public void testGetVolumeGroups() throws Exception { - ServiceModel testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVolumeGroups(); - } - - @Test - public void testSetVfModules() throws Exception { - ServiceModel testSubject; - Map vfModules = null; - - // default test - testSubject = createTestSubject(); - testSubject.setVfModules(vfModules); - } - - @Test - public void testSetVolumeGroups() throws Exception { - ServiceModel testSubject; - Map volumeGroups = null; - - // default test - testSubject = createTestSubject(); - testSubject.setVolumeGroups(volumeGroups); - } - - @Test - public void testAssociateGroups() throws Exception { - ServiceModel testSubject; - - // default test - testSubject = createTestSubject(); - testSubject.associateGroups(); - } + private ServiceModel createTestSubject() { + return new ServiceModel(); + } + + @Test + public void testGetService() throws Exception { + ServiceModel testSubject; + Service result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getService(); + } + + @Test + public void testGetVnfs() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVnfs(); + } + + @Test + public void testGetNetworks() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNetworks(); + } + + @Test + public void testSetService() throws Exception { + ServiceModel testSubject; + Service service = null; + + // default test + testSubject = createTestSubject(); + testSubject.setService(service); + } + + @Test + public void testSetVnfs() throws Exception { + ServiceModel testSubject; + Map vnfs = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVnfs(vnfs); + } + + @Test + public void testSetNetworks() throws Exception { + ServiceModel testSubject; + Map networks = null; + + // default test + testSubject = createTestSubject(); + testSubject.setNetworks(networks); + } + + @Test + public void testGetVfModules() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModules(); + } + + @Test + public void testGetVolumeGroups() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVolumeGroups(); + } + + @Test + public void testSetVfModules() throws Exception { + ServiceModel testSubject; + Map vfModules = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModules(vfModules); + } + + @Test + public void testSetVolumeGroups() throws Exception { + ServiceModel testSubject; + Map volumeGroups = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVolumeGroups(volumeGroups); + } + + @Test + public void testAssociateGroups() throws Exception { + ServiceModel testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.associateGroups(); + } + + @Test + public void testSetServiceProxies() throws Exception { + ServiceModel testSubject; + Map serviceProxies = null; + + // default test + try { + testSubject = createTestSubject(); + testSubject.setServiceProxies(serviceProxies); + } catch (Exception e) { + } + } + + @Test + public void testSetPnfs() throws Exception { + ServiceModel testSubject; + Map pnfs = null; + + // default test + try { + testSubject = createTestSubject(); + testSubject.setPnfs(pnfs); + } catch (Exception e) { + } + } + + @Test + public void testSetConfigurations() throws Exception { + ServiceModel testSubject; + Map configurations = null; + + // default test + try { + testSubject = createTestSubject(); + testSubject.setConfigurations(configurations); + } catch (Exception e) { + } + } + + @Test + public void testGetServiceProxies() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getServiceProxies(); + } catch (Exception e) { + } + } + + @Test + public void testGetPnfs() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getPnfs(); + } catch (Exception e) { + } + } + + @Test + public void testGetConfigurations() throws Exception { + ServiceModel testSubject; + Map result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getConfigurations(); + } catch (Exception e) { + } + } + + @Test + public void testExtractService() throws Exception { + ToscaModel serviceToscaModel = null; + org.onap.vid.asdc.beans.Service asdcServiceMetadata = null; + Service result; + + // default test + try { + result = ServiceModel.extractService(serviceToscaModel, asdcServiceMetadata); + } catch (Exception e) { + } + } + + @Test + public void testExtractGroups() throws Exception { + ToscaModel serviceToscaModel = null; + ServiceModel serviceModel = null; + + // default test + try { + ServiceModel.extractGroups(serviceToscaModel, serviceModel); + } catch (Exception e) { + } + } } \ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java new file mode 100644 index 000000000..01d1e9b57 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java @@ -0,0 +1,400 @@ +package org.onap.vid.mso.rest; + +import org.junit.Test; +import org.onap.vid.changeManagement.RequestDetailsWrapper; +import org.onap.vid.mso.MsoResponseWrapper; +import org.onap.vid.mso.MsoResponseWrapperInterface; +import org.onap.vid.mso.RestObject; + +public class MsoRestClientNewTest { + + private MsoRestClientNew createTestSubject() { + return new MsoRestClientNew(); + } + + @Test + public void testCreateSvcInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createSvcInstance(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testCreateVnf() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createVnf(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testCreateNwInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createNwInstance(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testCreateVolumeGroupInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createVolumeGroupInstance(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testCreateVfModuleInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createVfModuleInstance(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testCreateConfigurationInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createConfigurationInstance(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testDeleteSvcInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteSvcInstance(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testDeleteVnf() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteVnf(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testDeleteVfModule() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteVfModule(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testDeleteVolumeGroupInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteVolumeGroupInstance(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testDeleteNwInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteNwInstance(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testGetOrchestrationRequest() throws Exception { + MsoRestClientNew testSubject; + String t = ""; + String sourceId = ""; + String endpoint = ""; + RestObject restObject = null; + + // default test + try { + testSubject = createTestSubject(); + testSubject.getOrchestrationRequest(t, sourceId, endpoint, restObject); + } catch (Exception e) { + } + } + + @Test + public void testGetManualTasks() throws Exception { + MsoRestClientNew testSubject; + String t = ""; + String sourceId = ""; + String endpoint = ""; + RestObject restObject = null; + + // default test + try { + testSubject = createTestSubject(); + testSubject.getManualTasks(t, sourceId, endpoint, restObject); + } catch (Exception e) { + } + } + + @Test + public void testCreateInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails request = null; + String path = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createInstance(request, path); + } catch (Exception e) { + } + } + + @Test + public void testDeleteInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails request = null; + String path = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteInstance(request, path); + } catch (Exception e) { + } + } + + @Test + public void testGetOrchestrationRequestsForDashboard() throws Exception { + MsoRestClientNew testSubject; + String t = ""; + String sourceId = ""; + String endpoint = ""; + RestObject restObject = null; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getOrchestrationRequestsForDashboard(t, sourceId, endpoint, restObject); + } catch (Exception e) { + } + } + + @Test + public void testGetManualTasksByRequestId() throws Exception { + MsoRestClientNew testSubject; + String t = ""; + String sourceId = ""; + String endpoint = ""; + RestObject restObject = null; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getManualTasksByRequestId(t, sourceId, endpoint, restObject); + } catch (Exception e) { + } + } + + @Test + public void testCompleteManualTask() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String t = ""; + String sourceId = ""; + String endpoint = ""; + RestObject restObject = null; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.completeManualTask(requestDetails, t, sourceId, endpoint, restObject); + } catch (Exception e) { + } + } + + @Test + public void testDeleteConfiguration() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String pmc_endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteConfiguration(requestDetails, pmc_endpoint); + } catch (Exception e) { + } + } + + @Test + public void testSetConfigurationActiveStatus() throws Exception { + MsoRestClientNew testSubject; + RequestDetails request = null; + String path = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.setConfigurationActiveStatus(request, path); + } catch (Exception e) { + } + } + + @Test + public void testSetPortOnConfigurationStatus() throws Exception { + MsoRestClientNew testSubject; + RequestDetails request = null; + String path = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.setPortOnConfigurationStatus(request, path); + } catch (Exception e) { + } + } + + @Test + public void testChangeManagementUpdate() throws Exception { + MsoRestClientNew testSubject; + RequestDetailsWrapper requestDetails = null; + String endpoint = ""; + MsoResponseWrapperInterface result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.changeManagementUpdate(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testSetServiceInstanceStatus() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String t = ""; + String sourceId = ""; + String endpoint = ""; + RestObject restObject = null; + + // default test + try { + testSubject = createTestSubject(); + testSubject.setServiceInstanceStatus(requestDetails, t, sourceId, endpoint, restObject); + } catch (Exception e) { + } + } + + @Test + public void testRemoveRelationshipFromServiceInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String endpoint = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.removeRelationshipFromServiceInstance(requestDetails, endpoint); + } catch (Exception e) { + } + } + + @Test + public void testAddRelationshipToServiceInstance() throws Exception { + MsoRestClientNew testSubject; + RequestDetails requestDetails = null; + String addRelationshipsPath = ""; + MsoResponseWrapper result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.addRelationshipToServiceInstance(requestDetails, addRelationshipsPath); + } catch (Exception e) { + } + } +} \ No newline at end of file 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 000000000..ae6c2ccca --- /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 000000000..440a2a7bf --- /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