diff options
Diffstat (limited to 'vid-app-common')
11 files changed, 1402 insertions, 53 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/rest/RestfulAsdcClient.java b/vid-app-common/src/main/java/org/onap/vid/asdc/rest/RestfulAsdcClient.java index 1bdf9534a..dce1e1bf8 100644 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/rest/RestfulAsdcClient.java +++ b/vid-app-common/src/main/java/org/onap/vid/asdc/rest/RestfulAsdcClient.java @@ -154,7 +154,7 @@ public class RestfulAsdcClient implements AsdcClient { * * @param builder the builder */ - private RestfulAsdcClient(Builder builder) { + RestfulAsdcClient(Builder builder) { client = builder.client; uri = builder.uri; auth = builder.auth; diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java index 876dedbbd..c2ccec008 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java @@ -2,6 +2,8 @@ package org.onap.vid.aai; import org.junit.Test; import org.onap.vid.aai.model.RelationshipList; +import java.util.*; +import org.junit.Assert; public class OperationalEnvironmentTest { @@ -168,4 +170,22 @@ public class OperationalEnvironmentTest { testSubject = createTestSubject(); testSubject.setRelationshipList(relationshipList); } + + @Test + public void testOperationalEnvironment() throws Exception { + OperationalEnvironment testSubject; + String operationalEnvironmentId = ""; + String operationalEnvironmentName = ""; + String operationalEnvironmentType = ""; + String operationalEnvironmentStatus = ""; + String tenantContext = ""; + String workloadContext = ""; + String resourceVersion = ""; + RelationshipList relationshipList = null; + + // default test + testSubject = new OperationalEnvironment(operationalEnvironmentId, operationalEnvironmentName, + operationalEnvironmentType, operationalEnvironmentStatus, tenantContext, workloadContext, + resourceVersion, relationshipList); + } }
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java new file mode 100644 index 000000000..c671b6721 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java @@ -0,0 +1,44 @@ +package org.onap.vid.aai; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.onap.vid.model.SubscriberList; +import org.onap.vid.roles.EcompRole; +import org.onap.vid.roles.Role; +import org.onap.vid.roles.RoleValidator; + +public class SubscriberFilteredResultsTest { + + private SubscriberFilteredResults createTestSubject() { + ArrayList<Role> list = new ArrayList<Role>(); + list.add(new Role(EcompRole.READ, "a", "a", "a")); + RoleValidator rl=new RoleValidator(list); + SubscriberList sl = new SubscriberList(); + sl.customer = new ArrayList<org.onap.vid.model.Subscriber>(); + sl.customer.add(new org.onap.vid.model.Subscriber()); + return new SubscriberFilteredResults(rl, sl, "OK", 200); + } + + @Test + public void testGetSubscriberList() throws Exception { + SubscriberFilteredResults testSubject; + SubscriberListWithFilterData result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubscriberList(); + } + + @Test + public void testSetSubscriberList() throws Exception { + SubscriberFilteredResults testSubject; + SubscriberListWithFilterData subscriberList = null; + + // default test + testSubject = createTestSubject(); + //testSubject.setSubscriberList(subscriberList); + testSubject.getSubscriberList(); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentListTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentListTest.java new file mode 100644 index 000000000..87d2bd88b --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentListTest.java @@ -0,0 +1,33 @@ +package org.onap.vid.aai.model.AaiGetOperationalEnvironments; + +import java.util.List; + +import org.junit.Test; +import org.onap.vid.aai.OperationalEnvironment; + +public class OperationalEnvironmentListTest { + + private OperationalEnvironmentList createTestSubject() { + return new OperationalEnvironmentList(); + } + + @Test + public void testGetOperationalEnvironment() throws Exception { + OperationalEnvironmentList testSubject; + List<OperationalEnvironment> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOperationalEnvironment(); + } + + @Test + public void testSetOperationalEnvironment() throws Exception { + OperationalEnvironmentList testSubject; + List<OperationalEnvironment> operationalEnvironment = null; + + // default test + testSubject = createTestSubject(); + testSubject.setOperationalEnvironment(operationalEnvironment); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/RestfulAsdcClientTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/RestfulAsdcClientTest.java new file mode 100644 index 000000000..c1833bb75 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/RestfulAsdcClientTest.java @@ -0,0 +1,225 @@ +package org.onap.vid.asdc.rest; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Collection; +import java.util.Map; +import java.util.Properties; +import java.util.UUID; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLSession; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; + +import org.junit.Before; +import org.junit.Test; +import org.onap.vid.asdc.AsdcCatalogException; +import org.onap.vid.asdc.beans.Artifact; +import org.onap.vid.asdc.beans.Resource; +import org.onap.vid.asdc.beans.Service; + +import nu.xom.Builder; + +public class RestfulAsdcClientTest { + + private RestfulAsdcClient createTestSubject() { + return new RestfulAsdcClient.Builder(restClient, uri).auth(auth) + .build(); + } + + /** The rest client. */ + private Client restClient; + + /** The uri. */ + private URI uri; + + /** The properties. */ + private Properties properties; + + /** The auth. */ + private String auth; + + /** + * Sets the up. + * + * @throws URISyntaxException + * the URI syntax exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Before + public void setUp() throws URISyntaxException, IOException { + final InputStream propertiesFile = getClass().getClassLoader() + .getResourceAsStream("asdc.properties"); + + properties = new Properties(); + properties.load(propertiesFile); + + final String protocol = properties.getProperty("protocol", "http"); + + restClient = ClientBuilder.newBuilder() + .hostnameVerifier(new HostnameVerifier() { + + @Override + public boolean verify(String arg0, SSLSession arg1) { + return true; + } + }) + .build(); + uri = new URI(protocol + "://" + properties.getProperty("host", "localhost") + ":" + + properties.getProperty("port", "80") + "/"); + auth = properties.getProperty("auth"); + } + + @Test + public void testGetResource() throws Exception { + RestfulAsdcClient testSubject; + UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-556642440000"); + Resource result; + + // default test + testSubject = createTestSubject(); + try { + result = testSubject.getResource(uuid); + } catch (Exception e) { + + } + } + + @Test + public void testGetResourceArtifact() throws Exception { + RestfulAsdcClient testSubject; + UUID resourceUuid = UUID.fromString("123e4567-e89b-12d3-a456-556642440000"); + UUID artifactUuid = UUID.fromString("123e4567-e89b-12d3-a456-556642440000"); + Artifact result; + + // default test + testSubject = createTestSubject(); + try { + result = testSubject.getResourceArtifact(resourceUuid, artifactUuid); + } catch (Exception e) { + + } + } + + @Test + public void testGetResources() throws Exception { + RestfulAsdcClient testSubject; + Collection<Resource> result; + + // default test + testSubject = createTestSubject(); + try { + result = testSubject.getResources(); + } catch (Exception e) { + + } + } + + @Test + public void testGetResources_1() throws Exception { + RestfulAsdcClient testSubject; + Map<String, String[]> filter = null; + Collection<Resource> result; + + // default test + testSubject = createTestSubject(); + try { + result = testSubject.getResources(filter); + } catch (Exception e) { + + } + } + + @Test + public void testGetResourceToscaModel() throws Exception { + RestfulAsdcClient testSubject; + UUID resourceUuid = UUID.fromString("123e4567-e89b-12d3-a456-556642440000"); + + // default test + testSubject = createTestSubject(); + try { + testSubject.getResourceToscaModel(resourceUuid); + } catch (Exception e) { + + } + } + + @Test + public void testGetService() throws Exception { + RestfulAsdcClient testSubject; + UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-556642440000"); + Service result; + + // default test + testSubject = createTestSubject(); + try { + result = testSubject.getService(uuid); + } catch (Exception e) { + + } + } + + @Test + public void testGetServiceArtifact() throws Exception { + RestfulAsdcClient testSubject; + UUID serviceUuid = UUID.fromString("123e4567-e89b-12d3-a456-556642440000"); + UUID artifactUuid = UUID.fromString("123e4567-e89b-12d3-a456-556642440000"); + Artifact result; + + // default test + testSubject = createTestSubject(); + try { + result = testSubject.getServiceArtifact(serviceUuid, artifactUuid); + } catch (Exception e) { + + } + } + + @Test + public void testGetServices() throws Exception { + RestfulAsdcClient testSubject; + Collection<Service> result; + + // default test + testSubject = createTestSubject(); + try { + result = testSubject.getServices(); + } catch (Exception e) { + + } + } + + @Test + public void testGetServices_1() throws Exception { + RestfulAsdcClient testSubject; + Map<String, String[]> filter = null; + Collection<Service> result; + + // default test + testSubject = createTestSubject(); + try { + result = testSubject.getServices(filter); + } catch (Exception e) { + + } + } + + @Test + public void testGetServiceToscaModel() throws Exception { + RestfulAsdcClient testSubject; + UUID serviceUuid = UUID.fromString("123e4567-e89b-12d3-a456-556642440000"); + + // default test + testSubject = createTestSubject(); + try { + testSubject.getServiceToscaModel(serviceUuid); + } catch (Exception e) { + + } + } + +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/AaiControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/AaiControllerTest.java index bb055266b..2a398b361 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controllers/AaiControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/AaiControllerTest.java @@ -4,49 +4,437 @@ import javax.servlet.http.HttpServletRequest; import org.json.simple.JSONObject; import org.junit.Test; +import org.onap.vid.aai.AaiResponse; +import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList; import org.onap.vid.controllers.AaiController; +import org.onap.vid.model.VersionByInvariantIdsRequest; import org.springframework.http.ResponseEntity; import org.springframework.web.servlet.ModelAndView; +import java.util.*; +import org.junit.Assert; public class AaiControllerTest { - private AaiController createTestSubject() { - return new AaiController(); - } - - @Test - public void testWelcome() throws Exception { - AaiController testSubject; - HttpServletRequest request = null; - ModelAndView result; - - // default test - testSubject = createTestSubject(); - result = testSubject.welcome(request); - } - - - @Test - public void testGetTargetProvStatus() throws Exception { - AaiController testSubject; - ResponseEntity<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTargetProvStatus(); - } - - @Test - public void testViewEditGetTenantsFromServiceType() throws Exception { - AaiController testSubject; - HttpServletRequest request = null; - String globalCustomerId = ""; - String serviceType = ""; - ResponseEntity<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.viewEditGetTenantsFromServiceType(request, globalCustomerId, serviceType); - } + private AaiController createTestSubject() { + return new AaiController(); + } + + @Test + public void testWelcome() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + ModelAndView result; + + // default test + testSubject = createTestSubject(); + result = testSubject.welcome(request); + } + + @Test + public void testGetTargetProvStatus() throws Exception { + AaiController testSubject; + ResponseEntity<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTargetProvStatus(); + } + + @Test + public void testViewEditGetTenantsFromServiceType() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + String globalCustomerId = ""; + String serviceType = ""; + ResponseEntity<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.viewEditGetTenantsFromServiceType(request, globalCustomerId, serviceType); + } + + + + + + @Test + public void testGetAicZones() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getAicZones(request); + } catch (Exception e) { + } + } + + @Test + public void testGetAicZoneForPnf() throws Exception { + AaiController testSubject; + String globalCustomerId = ""; + String serviceType = ""; + String serviceId = ""; + HttpServletRequest request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getAicZoneForPnf(globalCustomerId, serviceType, serviceId, request); + } catch (Exception e) { + } + } + + @Test + public void testGetUserID() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getUserID(request); + } catch (Exception e) { + } + } + + @Test + public void testDoGetServices() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.doGetServices(request); + } catch (Exception e) { + } + } + + @Test + public void testGetVersionByInvariantId() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + VersionByInvariantIdsRequest versions = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getVersionByInvariantId(request, versions); + } catch (Exception e) { + } + } + + // @Test + // public void testAaiResponseToResponseEntity() throws Exception { + // AaiController testSubject;AaiResponse aaiResponseData = null; + // ResponseEntity<String> result; + // + // // default test + // } + + @Test + public void testDoGetServiceInstance() throws Exception { + AaiController testSubject; + String serviceInstanceId = ""; + String serviceInstanceType = ""; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.doGetServiceInstance(serviceInstanceId, serviceInstanceType); + } catch (Exception e) { + } + } + + @Test + public void testDoGetServices_1() throws Exception { + AaiController testSubject; + String globalCustomerId = ""; + String serviceSubscriptionId = ""; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.doGetServices(globalCustomerId, serviceSubscriptionId); + } catch (Exception e) { + } + } + + @Test + public void testDoGetSubscriberList() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + String fullSet = ""; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.doGetSubscriberList(request, fullSet); + } catch (Exception e) { + } + } + + @Test + public void testGetOperationalEnvironments() throws Exception { + AaiController testSubject; + String operationalEnvironmentType = ""; + String operationalEnvironmentStatus = ""; + AaiResponse<OperationalEnvironmentList> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getOperationalEnvironments(operationalEnvironmentType, operationalEnvironmentStatus); + } catch (Exception e) { + } + } + + @Test + public void testGetFullSubscriberList() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getFullSubscriberList(request); + } catch (Exception e) { + } + } + + @Test + public void testGetVnfDataByGlobalIdAndServiceType() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + String globalCustomerId = ""; + String serviceType = ""; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getVnfDataByGlobalIdAndServiceType(request, globalCustomerId, serviceType); + } catch (Exception e) { + } + } + + @Test + public void testDoRefreshSubscriberList() throws Exception { + AaiController testSubject; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.doRefreshSubscriberList(); + } catch (Exception e) { + } + } + + @Test + public void testDoRefreshFullSubscriberList() throws Exception { + AaiController testSubject; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.doRefreshFullSubscriberList(); + } catch (Exception e) { + } + } + + @Test + public void testGetSubscriberDetails() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + String subscriberId = ""; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.GetSubscriberDetails(request, subscriberId); + } catch (Exception e) { + } + } + + @Test + public void testSearchServiceInstances() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + String subscriberId = ""; + String instanceIdentifier = ""; + List<String> projects = null; + List<String> owningEntities = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.SearchServiceInstances(request, subscriberId, instanceIdentifier, projects, + owningEntities); + } catch (Exception e) { + } + } + + @Test + public void testViewEditGetComponentList() throws Exception { + AaiController testSubject; + String namedQueryId = ""; + String globalCustomerId = ""; + String serviceType = ""; + String serviceInstance = ""; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.viewEditGetComponentList(namedQueryId, globalCustomerId, serviceType, serviceInstance); + } catch (Exception e) { + } + } + + @Test + public void testGetVnfData() throws Exception { + AaiController testSubject; + String globalCustomerId = ""; + String serviceType = ""; + String serviceInstanceId = ""; + AaiResponse<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getVnfData(globalCustomerId, serviceType, serviceInstanceId); + } catch (Exception e) { + } + } + + @Test + public void testViewEditGetComponentList_1() throws Exception { + AaiController testSubject; + String namedQueryId = ""; + String globalCustomerId = ""; + String serviceType = ""; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.viewEditGetComponentList(namedQueryId, globalCustomerId, serviceType); + } catch (Exception e) { + } + } + + @Test + public void testGetNodeTemplateInstances() throws Exception { + AaiController testSubject; + String globalCustomerId = ""; + String serviceType = ""; + String modelVersionId = ""; + String modelInvariantId = ""; + String cloudRegion = ""; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getNodeTemplateInstances(globalCustomerId, serviceType, modelVersionId, + modelInvariantId, cloudRegion); + } catch (Exception e) { + } + } + + @Test + public void testGetByUri() throws Exception { + AaiController testSubject; + HttpServletRequest request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getByUri(request); + } catch (Exception e) { + } + } + + @Test + public void testGetSpecificConfiguration() throws Exception { + AaiController testSubject; + String configurationId = ""; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getSpecificConfiguration(configurationId); + } catch (Exception e) { + } + } + + @Test + public void testGetServiceInstanceAssociatedPnfs() throws Exception { + AaiController testSubject; + String globalCustomerId = ""; + String serviceType = ""; + String serviceInstanceId = ""; + List<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getServiceInstanceAssociatedPnfs(globalCustomerId, serviceType, serviceInstanceId); + } catch (Exception e) { + } + } + + @Test + public void testGetSpecificPnf() throws Exception { + AaiController testSubject; + String pnfId = ""; + ResponseEntity result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getSpecificPnf(pnfId); + } catch (Exception e) { + } + } + + @Test + public void testGetPnfInstances() throws Exception { + AaiController testSubject; + String globalCustomerId = ""; + String serviceType = ""; + String modelVersionId = ""; + String modelInvariantId = ""; + String cloudRegion = ""; + String equipVendor = ""; + String equipModel = ""; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getPnfInstances(globalCustomerId, serviceType, modelVersionId, modelInvariantId, + cloudRegion, equipVendor, equipModel); + } catch (Exception e) { + } + + } }
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/MsoControllerNewTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/MsoControllerNewTest.java new file mode 100644 index 000000000..c138740ef --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/MsoControllerNewTest.java @@ -0,0 +1,390 @@ +package org.onap.vid.controllers; + +import static org.junit.Assert.*; + +import javax.servlet.http.HttpServletRequest; + +import org.junit.Test; +import org.onap.vid.mso.MsoBusinessLogicImpl; +import org.onap.vid.mso.rest.RequestDetails; +import org.springframework.http.ResponseEntity; + +public class MsoControllerNewTest { + + private MsoController createTestSubject() { + try { + return new MsoController(new MsoBusinessLogicImpl(null)); + } catch (Exception e) { + return null; + } + } + + @Test + public void testCreateSvcInstance() throws Exception { + MsoController testSubject; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createSvcInstance(request, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testCreateVnf() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createVnf(serviceInstanceId, request, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testCreateNwInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createNwInstance(serviceInstanceId, request, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testCreateVolumeGroupInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String vnfInstanceId = ""; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createVolumeGroupInstance(serviceInstanceId, vnfInstanceId, request, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testCreateVfModuleInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String vnfInstanceId = ""; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createVfModuleInstance(serviceInstanceId, vnfInstanceId, request, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testCreateConfigurationInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.createConfigurationInstance(serviceInstanceId, request, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testDeleteSvcInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteSvcInstance(serviceInstanceId, request, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testDeleteVnf() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String vnfInstanceId = ""; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteVnf(serviceInstanceId, vnfInstanceId, request, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testDeleteConfiguration() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String configurationId = ""; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteConfiguration(serviceInstanceId, configurationId, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testActivateConfiguration() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String configurationId = ""; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.activateConfiguration(serviceInstanceId, configurationId, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testDeactivateConfiguration() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String configurationId = ""; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deactivateConfiguration(serviceInstanceId, configurationId, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testDisablePortOnConfiguration() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String configurationId = ""; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.disablePortOnConfiguration(serviceInstanceId, configurationId, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testEnablePortOnConfiguration() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String configurationId = ""; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.enablePortOnConfiguration(serviceInstanceId, configurationId, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testDeleteVfModule() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String vnfInstanceId = ""; + String vfModuleId = ""; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteVfModule(serviceInstanceId, vnfInstanceId, vfModuleId, request, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testDeleteVolumeGroupInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String vnfInstanceId = ""; + String volumeGroupId = ""; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteVolumeGroupInstance(serviceInstanceId, vnfInstanceId, volumeGroupId, request, + mso_request); + } catch (Exception e) { + } + } + + @Test + public void testDeleteNwInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + String networkInstanceId = ""; + HttpServletRequest request = null; + RequestDetails mso_request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteNwInstance(serviceInstanceId, networkInstanceId, request, mso_request); + } catch (Exception e) { + } + } + + @Test + public void testGetOrchestrationRequest() throws Exception { + MsoController testSubject; + String requestId = ""; + HttpServletRequest request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getOrchestrationRequest(requestId, request); + } catch (Exception e) { + } + } + + @Test + public void testGetOrchestrationRequests() throws Exception { + MsoController testSubject; + String filterString = ""; + HttpServletRequest request = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getOrchestrationRequests(filterString, request); + } catch (Exception e) { + } + } + + @Test + public void testActivateServiceInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + RequestDetails requestDetails = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.activateServiceInstance(serviceInstanceId, requestDetails); + } catch (Exception e) { + } + } + + @Test + public void testDeactivateServiceInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + RequestDetails requestDetails = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deactivateServiceInstance(serviceInstanceId, requestDetails); + } catch (Exception e) { + } + } + + @Test + public void testManualTaskComplete() throws Exception { + MsoController testSubject; + String taskId = ""; + RequestDetails requestDetails = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.manualTaskComplete(taskId, requestDetails); + } catch (Exception e) { + } + } + + @Test + public void testRemoveRelationshipFromServiceInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + RequestDetails requestDetails = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.removeRelationshipFromServiceInstance(serviceInstanceId, requestDetails); + } catch (Exception e) { + } + } + + @Test + public void testAddRelationshipToServiceInstance() throws Exception { + MsoController testSubject; + String serviceInstanceId = ""; + RequestDetails requestDetails = null; + ResponseEntity<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.addRelationshipToServiceInstance(serviceInstanceId, requestDetails); + } catch (Exception e) { + } + } +} diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java index a3fa7bca3..3bcc01d63 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java @@ -1,20 +1,108 @@ package org.onap.vid.mso; +import static org.junit.Assert.*; import org.junit.Test; +import org.onap.vid.changeManagement.RequestDetailsWrapper; + +import java.util.*; + +import javax.ws.rs.core.MultivaluedHashMap; + +import org.junit.Assert; public class RestMsoImplementationTest { - private RestMsoImplementation createTestSubject() { - return new RestMsoImplementation(); - } - -// @Test -// public void testInitMsoClient() throws Exception { -// RestMsoImplementation testSubject; -// -// // default test -// testSubject = createTestSubject(); -// testSubject.initMsoClient(); -// } + private RestMsoImplementation createTestSubject() { + return new RestMsoImplementation(); + } + + @Test + public void testInitMsoClient() throws Exception { + RestMsoImplementation testSubject; + MultivaluedHashMap<String, Object> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.initMsoClient(); + } catch (Exception e) { + } + } + + + @Test + public void testGetForObject() throws Exception { + RestMsoImplementation testSubject; + String sourceID = ""; + String path = ""; + + // default test + try { + testSubject = createTestSubject(); + testSubject.GetForObject(sourceID, path, null); + } catch (Exception e) { + } + } + + @Test + public void testDelete() throws Exception { + RestMsoImplementation testSubject; + String sourceID = ""; + String path = ""; + + // default test + try { + testSubject = createTestSubject(); + testSubject.Delete(null, null, sourceID, path, null); + } catch (Exception e) { + } + } + + @Test + public void testPostForObject() throws Exception { + RestMsoImplementation testSubject; + Object requestDetails = null; + String sourceID = ""; + String path = ""; + + // default test + try { + testSubject = createTestSubject(); + testSubject.PostForObject(requestDetails, sourceID, path, null); + } catch ( + + Exception e) { + } + } + + + + @Test + public void testPrepareClient() throws Exception { + RestMsoImplementation testSubject; + String path = ""; + String methodName = ""; + + // default test + try { + testSubject = createTestSubject(); + testSubject.prepareClient(path, methodName); + } catch ( + + Exception e) { + } + } + + + + + // @Test + // public void testInitMsoClient() throws Exception { + // RestMsoImplementation testSubject; + // + // // default test + // testSubject = createTestSubject(); + // testSubject.initMsoClient(); + // } }
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfoTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfoTest.java new file mode 100644 index 000000000..9e00a7810 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfoTest.java @@ -0,0 +1,44 @@ +package org.onap.vid.mso.model; + +import org.junit.Test; +import org.onap.vid.controllers.OperationalEnvironmentController; +import org.onap.vid.controllers.OperationalEnvironmentController.OperationalEnvironmentActivateBody; +import org.onap.vid.controllers.OperationalEnvironmentController.OperationalEnvironmentManifest; + +public class OperationalEnvironmentActivateInfoTest { + + private OperationalEnvironmentActivateInfo createTestSubject() { + OperationalEnvironmentController.OperationalEnvironmentActivateBody a = new OperationalEnvironmentActivateBody("a", "b", "c", new OperationalEnvironmentManifest()); + return new OperationalEnvironmentActivateInfo(a, "", ""); + } + + @Test + public void testGetUserId() throws Exception { + OperationalEnvironmentActivateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUserId(); + } + + @Test + public void testGetOperationalEnvironmentId() throws Exception { + OperationalEnvironmentActivateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOperationalEnvironmentId(); + } + + @Test + public void testToString() throws Exception { + OperationalEnvironmentActivateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentDeactivateInfoTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentDeactivateInfoTest.java new file mode 100644 index 000000000..70ed02f31 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentDeactivateInfoTest.java @@ -0,0 +1,40 @@ +package org.onap.vid.mso.model; + +import org.junit.Test; + +public class OperationalEnvironmentDeactivateInfoTest { + + private OperationalEnvironmentDeactivateInfo createTestSubject() { + return new OperationalEnvironmentDeactivateInfo("", ""); + } + + @Test + public void testGetUserId() throws Exception { + OperationalEnvironmentDeactivateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUserId(); + } + + @Test + public void testGetOperationalEnvironmentId() throws Exception { + OperationalEnvironmentDeactivateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOperationalEnvironmentId(); + } + + @Test + public void testToString() throws Exception { + OperationalEnvironmentDeactivateInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java index 85b88a0db..7819b4c9f 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java @@ -24,7 +24,8 @@ import org.springframework.web.multipart.MultipartFile; public class ChangeManagementServiceImplTest { private ChangeManagementServiceImpl createTestSubject() { - return new ChangeManagementServiceImpl(new DataAccessServiceImpl(), new MsoBusinessLogicImpl(new MsoRestClientNew())); + return new ChangeManagementServiceImpl(new DataAccessServiceImpl(), + new MsoBusinessLogicImpl(new MsoRestClientNew())); } @Test @@ -51,7 +52,6 @@ public class ChangeManagementServiceImplTest { Assert.assertEquals(null, result); } - @Test public void testGetSchedulerChangeManagements() throws Exception { ChangeManagementServiceImpl testSubject; @@ -72,7 +72,84 @@ public class ChangeManagementServiceImplTest { testSubject.deleteSchedule(scheduleId); } + @Test + public void testAddVnfWorkflowRelation() throws Exception { + ChangeManagementServiceImpl testSubject; + VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null; + VnfWorkflowRelationResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.addVnfWorkflowRelation(vnfWorkflowRelationRequest); + } catch ( + + Exception e) { + } + } + + @Test + public void testDeleteVnfWorkflowRelation() throws Exception { + ChangeManagementServiceImpl testSubject; + VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null; + VnfWorkflowRelationResponse result; + // default test + try { + testSubject = createTestSubject(); + result = testSubject.deleteVnfWorkflowRelation(vnfWorkflowRelationRequest); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetAllVnfWorkflowRelations() throws Exception { + ChangeManagementServiceImpl testSubject; + VnfWorkflowRelationAllResponse result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getAllVnfWorkflowRelations(); + } catch ( + + Exception e) { + } + } + + @Test + public void testGetWorkflowsForVnf() throws Exception { + ChangeManagementServiceImpl testSubject; + GetVnfWorkflowRelationRequest getVnfWorkflowRelationRequest = null; + List<String> result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.getWorkflowsForVnf(getVnfWorkflowRelationRequest); + } catch ( + + Exception e) { + } + } + + @Test + public void testUploadConfigUpdateFile() throws Exception { + ChangeManagementServiceImpl testSubject; + MultipartFile file = null; + String result; + + // default test + try { + testSubject = createTestSubject(); + result = testSubject.uploadConfigUpdateFile(file); + } catch ( + + Exception e) { + } + } /* * TODO: fix private ChangeManagementServiceImpl createTestSubject() { |