From fda871b58091fbd962d52ecac3b2aae6f3556274 Mon Sep 17 00:00:00 2001 From: Sumapriya Date: Wed, 21 Mar 2018 14:29:56 +0530 Subject: Adding Junit Adding Junit for: 1.AllotedResource.java 2.ConfigResource.java 3.Configuration.java 4.Customer.java 5.HomingSolution.java 6.License.java 7.ModelInfo.java 8.ModuleResource.java 9.NetworkResource.java 10.OwningEntity.java 11.Project.java 12.Request.java 13.ResourceDecomposition.java 14.Resource.java 15.ServiceDecomposition.java 16.ServiceInstance.java 17.Subscriber.java 18.TunnelConnect.java 19.VnfResource.java Sonar Link: https://sonar.onap.org/code?id=org.onap.so%3Aso&selected=org.onap.so%3AMSOCoreBPMN%3Asrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fmso%2Fbpmn%2Fcore%2Fdomain Change-Id: I94c96ef50a0549ab20ea482db0c17e94c106b5d0 Issue-ID: SO-509 Signed-off-by: Sumapriya --- .../mso/bpmn/core/domain/AllottedResourceTest.java | 57 ++++++++++++++ .../mso/bpmn/core/domain/ConfigResourceTest.java | 39 ++++++++++ .../mso/bpmn/core/domain/ConfigurationTest.java | 47 ++++++++++++ .../mso/bpmn/core/domain/CustomerTest.java | 38 +++++++++ .../mso/bpmn/core/domain/HomingSolutionTest.java | 58 ++++++++++++++ .../mso/bpmn/core/domain/LicenseTest.java | 89 ++++++++++++++++++++++ .../mso/bpmn/core/domain/ModelInfoTest.java | 47 ++++++++++++ .../mso/bpmn/core/domain/ModuleResourceTest.java | 48 ++++++++++++ .../mso/bpmn/core/domain/NetworkResourceTest.java | 42 ++++++++++ .../mso/bpmn/core/domain/OwningEntityTest.java | 39 ++++++++++ .../mso/bpmn/core/domain/ProjectTest.java | 36 +++++++++ .../mso/bpmn/core/domain/RequestTest.java | 44 +++++++++++ .../core/domain/ResourceDecompositionTest.java | 50 ++++++++++++ .../mso/bpmn/core/domain/ResourceTest.java | 68 +++++++++++++++++ .../bpmn/core/domain/ServiceDecompositionTest.java | 83 ++++++++++++++++++++ .../mso/bpmn/core/domain/ServiceInstanceTest.java | 61 +++++++++++++++ .../mso/bpmn/core/domain/SubscriberTest.java | 41 ++++++++++ .../mso/bpmn/core/domain/TunnelConnectTest.java | 44 +++++++++++ .../mso/bpmn/core/domain/VnfResourceTest.java | 55 +++++++++++++ 19 files changed, 986 insertions(+) create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java (limited to 'bpmn/MSOCoreBPMN') diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java new file mode 100644 index 0000000000..09720be9b9 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java @@ -0,0 +1,57 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class AllottedResourceTest { + private AllottedResource ar = new AllottedResource(); + TunnelConnect tc = new TunnelConnect(); + + @Test + public void testAllottedResource() { + ar.setAllottedResourceType("allottedResourceType"); + ar.setAllottedResourceRole("allottedResourceRole"); + ar.setProvidingServiceModelName("providingServiceModelName"); + ar.setProvidingServiceModelInvariantUuid("providingServiceModelInvariantUuid"); + ar.setProvidingServiceModelUuid("providingServiceModelUuid"); + ar.setNfFunction("nfFunction"); + ar.setNfType("nfType"); + ar.setNfRole("nfRole"); + ar.setNfNamingCode("nfNamingCode"); + ar.setOrchestrationStatus("orchestrationStatus"); + ar.setTunnelConnect(tc); + assertEquals(ar.getAllottedResourceType(), "allottedResourceType"); + assertEquals(ar.getAllottedResourceRole(), "allottedResourceRole"); + assertEquals(ar.getProvidingServiceModelName(), "providingServiceModelName"); + assertEquals(ar.getProvidingServiceModelInvariantUuid(), "providingServiceModelInvariantUuid"); + assertEquals(ar.getProvidingServiceModelUuid(), "providingServiceModelUuid"); + assertEquals(ar.getNfFunction(), "nfFunction"); + assertEquals(ar.getNfType(), "nfType"); + assertEquals(ar.getNfRole(), "nfRole"); + assertEquals(ar.getNfNamingCode(), "nfNamingCode"); + assertEquals(ar.getOrchestrationStatus(), "orchestrationStatus"); + assertEquals(ar.getTunnelConnect(), tc); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java new file mode 100644 index 0000000000..ecaf601c90 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java @@ -0,0 +1,39 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ConfigResourceTest { + private ConfigResource configresource = new ConfigResource();{ + configresource.resourceType = ResourceType.CONFIGURATION; + } + + @Test + public void testConfigResource() { + configresource.setToscaNodeType("toscaNodeType"); + assertEquals(configresource.getToscaNodeType(), "toscaNodeType"); + + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java new file mode 100644 index 0000000000..df8440addf --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java @@ -0,0 +1,47 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ConfigurationTest { + private Configuration configuration = new Configuration(); + + @Test + public void testConfigurationTest() { + configuration.setId("id"); + configuration.setName("name"); + configuration.setType("type"); + configuration.setOrchestrationStatus("orchestrationStatus"); + configuration.setTunnelBandwidth("tunnelBandwidth"); + configuration.setVendorAllowedMaxBandwidth("vendorAllowedMaxBandwidth"); + configuration.setResourceVersion("resourceVersion"); + assertEquals(configuration.getId(), "id"); + assertEquals(configuration.getName(), "name"); + assertEquals(configuration.getType(), "type"); + assertEquals(configuration.getOrchestrationStatus(), "orchestrationStatus"); + assertEquals(configuration.getTunnelBandwidth(), "tunnelBandwidth"); + assertEquals(configuration.getVendorAllowedMaxBandwidth(), "vendorAllowedMaxBandwidth"); + assertEquals(configuration.getResourceVersion(), "resourceVersion"); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java new file mode 100644 index 0000000000..1a4e0898ee --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java @@ -0,0 +1,38 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class CustomerTest { + private Customer customer = new Customer(); + + @Test + public void testCustomer() { + customer.setSubscriptionServiceType("subscriptionServiceType"); + customer.setGlobalSubscriberId("globalSubscriberId"); + assertEquals(customer.getSubscriptionServiceType(), "subscriptionServiceType"); + assertEquals(customer.getGlobalSubscriberId(), "globalSubscriberId"); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java new file mode 100644 index 0000000000..e334348b5d --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java @@ -0,0 +1,58 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class HomingSolutionTest { + + private HomingSolution homingsolution = new HomingSolution(); + InventoryType inventory = InventoryType.cloud; + VnfResource vnfresource = new VnfResource(); + License license = new License(); + + @Test + public void testHomingSolution() { + homingsolution.setInventoryType(inventory); + homingsolution.setRehome(true); + homingsolution.setServiceInstanceId("serviceInstanceId"); + homingsolution.setCloudOwner("cloudOwner"); + homingsolution.setCloudRegionId("cloudRegionId"); + homingsolution.setAicClli("aicClli"); + homingsolution.setAicVersion("aicVersion"); + homingsolution.setTenant("tenant"); + homingsolution.setVnf(vnfresource); + homingsolution.setLicense(license); + assertEquals(homingsolution.getInventoryType(), inventory); + assertEquals(homingsolution.isRehome(), true); + assertEquals(homingsolution.getServiceInstanceId(), "serviceInstanceId"); + assertEquals(homingsolution.getCloudOwner(), "cloudOwner"); + assertEquals(homingsolution.getCloudRegionId(), "cloudRegionId"); + assertEquals(homingsolution.getAicClli(), "aicClli"); + assertEquals(homingsolution.getAicVersion(), "aicVersion"); + assertEquals(homingsolution.getTenant(), "tenant"); + assertEquals(homingsolution.getVnf(), vnfresource); + assertEquals(homingsolution.getLicense(), license); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java new file mode 100644 index 0000000000..9ed194c455 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java @@ -0,0 +1,89 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.BDDMockito.Then; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + + +//@RunWith(PowerMockRunner.class) +//@PrepareForTest({License.class}) +public class LicenseTest { + + //@Mock + private License license= new License(); + //@InjectMocks + //private LicenseTest licenceTest; + List entitlementPoolList = new ArrayList(); + private List licenseKeyGroupList = new ArrayList(); + //JSONArray array = new JSONArray(entitlementPoolList); + //JSONArray array1 = new JSONArray(licenseKeyGroupList); + //@PrepareForTest({License.class}) + Long serialVersionUID = 333L; + + @Test + public void testLicense() { + license.setEntitlementPoolList(entitlementPoolList); + license.setLicenseKeyGroupList(licenseKeyGroupList); + //license.addEntitlementPool("entitlementPoolUuid"); + license.addLicenseKeyGroup("licenseKeyGroupUuid"); + assertEquals(license.getEntitlementPoolList(), entitlementPoolList); + assertEquals(license.getLicenseKeyGroupList(), licenseKeyGroupList); + assert(license.getEntitlementPoolListAsString()!= null); + assert(license.getLicenseKeyGroupListAsString()!=null); + license.addEntitlementPool("entitlementPoolUuid"); + //assertEquals(license.getSerialversionuid(), serialVersionUID); + //assertArrayEquals(license.getSerialversionuid(), serialVersionUID); + //assert + + /*PowerMockito.mockStatic(License.class); + Mockito.when(License.getSerialversionuid()).thenReturn(getserial()); + assertEquals(License.getSerialversionuid(),"abc");*/ + + } + // @Before + // public void mocksetUp() { +// Long serialVersionUID = 333L; +// PowerMockito.mockStatic(License.class); +// expect (license.getSerialversionuid()).andReturn(serialVersionUID); +// //PowerMockito.when(license.getSerialversionuid(). +// //PowerMockito.when(MathUtil.addInteger(2, 2)).thenReturn(1); +// } + + /*private Long getserial() { + + return abc; + }*/ + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java new file mode 100644 index 0000000000..90eb230a4c --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java @@ -0,0 +1,47 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ModelInfoTest { + private ModelInfo modelinfo = new ModelInfo(); + + @Test + public void testModelInfo() { + modelinfo.setModelName("modelName"); + modelinfo.setModelUuid("modelUuid"); + modelinfo.setModelInvariantUuid("modelInvariantUuid"); + modelinfo.setModelVersion("modelVersion"); + modelinfo.setModelCustomizationUuid("modelCustomizationUuid"); + modelinfo.setModelInstanceName("modelInstanceName"); + modelinfo.setModelType("modelType"); + assertEquals(modelinfo.getModelName(), "modelName"); + assertEquals(modelinfo.getModelUuid(), "modelUuid"); + assertEquals(modelinfo.getModelInvariantUuid(), "modelInvariantUuid"); + assertEquals(modelinfo.getModelVersion(), "modelVersion"); + assertEquals(modelinfo.getModelCustomizationUuid(), "modelCustomizationUuid"); + assertEquals(modelinfo.getModelInstanceName(), "modelInstanceName"); + assertEquals(modelinfo.getModelType(), "modelType"); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java new file mode 100644 index 0000000000..58cd45c3f1 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java @@ -0,0 +1,48 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ModuleResourceTest { + private ModuleResource moduleresource = new ModuleResource(); + + @Test + public void testModuleResource() { + + moduleresource.setVfModuleName("vfModuleName"); + moduleresource.setHeatStackId("heatStackId"); + moduleresource.setIsBase(true); + moduleresource.setVfModuleLabel("vfModuleLabel"); + moduleresource.setInitialCount(0); + moduleresource.setVfModuleType("vfModuleType"); + moduleresource.setHasVolumeGroup(true); + assertEquals(moduleresource.getVfModuleName(), "vfModuleName"); + assertEquals(moduleresource.getHeatStackId(), "heatStackId"); + assertEquals(moduleresource.getIsBase(), true); + assertEquals(moduleresource.getVfModuleLabel(), "vfModuleLabel"); + assertEquals(moduleresource.getInitialCount(), 0); + assertEquals(moduleresource.getVfModuleType(), "vfModuleType"); + assertEquals(moduleresource.isHasVolumeGroup(), true); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java new file mode 100644 index 0000000000..22e62663c9 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java @@ -0,0 +1,42 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class NetworkResourceTest { + private NetworkResource nr = new NetworkResource(); + + @Test + public void testNetworkResource() { + nr.setNetworkType("networkType"); + nr.setNetworkRole("networkRole"); + nr.setNetworkTechnology("networkTechnology"); + nr.setNetworkScope("networkScope"); + assertEquals(nr.getNetworkType(), "networkType"); + assertEquals(nr.getNetworkRole(), "networkRole"); + assertEquals(nr.getNetworkTechnology(), "networkTechnology"); + assertEquals(nr.getNetworkScope(), "networkScope"); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java new file mode 100644 index 0000000000..215fa3cff9 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java @@ -0,0 +1,39 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class OwningEntityTest { + private OwningEntity oe = new OwningEntity(); + + @Test + public void testOwingEntity() { + oe.setOwningEntityId("owningEntityId"); + oe.setOwningEntityName("owningEntityName"); + assertEquals(oe.getOwningEntityId(), "owningEntityId"); + assertEquals(oe.getOwningEntityName(), "owningEntityName"); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java new file mode 100644 index 0000000000..3a9a53f743 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java @@ -0,0 +1,36 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ProjectTest { + + private Project project = new Project(); + + @Test + public void testProject() { + project.setProjectName("projectName"); + assertEquals(project.getProjectName(), "projectName"); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java new file mode 100644 index 0000000000..9a9d41567a --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java @@ -0,0 +1,44 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class RequestTest { + + private Request request = new Request(); + ModelInfo model = new ModelInfo(); + + @Test + public void testRequest() { + request.setSdncRequestId("sdncRequestId"); + request.setRequestId("requestId"); + request.setModelInfo(model); + request.setProductFamilyId("productFamilyId"); + assertEquals(request.getSdncRequestId(), "sdncRequestId"); + assertEquals(request.getRequestId(), "requestId"); + assertEquals(request.getModelInfo(), model); + assertEquals(request.getProductFamilyId(), "productFamilyId"); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java new file mode 100644 index 0000000000..5eaa60260b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java @@ -0,0 +1,50 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ResourceDecompositionTest { + + private ResourceDecomposition rd = new ResourceDecomposition() { + private static final long serialVersionUID = 1L; + }; + ModelInfo model = new ModelInfo(); + ResourceInstance ri = new ResourceInstance(); + + + + @Test + public void testResourceDecomposition() { + rd.setModelInfo(model); + rd.setInstanceData(ri); + rd.setResourceType("resourceType"); + rd.setResourceInstanceId("newInstanceId"); + rd.setResourceInstanceName("newInstanceName"); + assertEquals(rd.getResourceModel(), model); + assertEquals(rd.getModelInfo(), model); + assertEquals(rd.getInstanceData(), ri); + assertEquals(rd.getResourceInstanceId(), "newInstanceId"); + assertEquals(rd.getResourceInstanceName(), "newInstanceName"); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java new file mode 100644 index 0000000000..8d6b61f4aa --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java @@ -0,0 +1,68 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ResourceTest { + private Resource resource = new Resource() { + private static final long serialVersionUID = 1L; + + + }; + ModelInfo model = new ModelInfo(); + ResourceInstance ri = new ResourceInstance(); + HomingSolution hs = new HomingSolution(); + ResourceType rt = ResourceType.VNF; + public long concurrencyCounter = 1L; + long initval = resource.getConcurrencyCounter(); + + @Test + public void testResource() { + resource.setResourceId("resourceId"); + resource.setModelInfo(model); + resource.setResourceInstance(ri); + resource.setHomingSolution(hs); + resource.setCurrentHomingSolution(hs); + resource.setResourceType(rt); + resource.setToscaNodeType("toscaNodeType"); + resource.setResourceInstanceId("newInstanceId"); + resource.setResourceInstanceName("newInstanceName"); + resource.incrementConcurrencyCounter(); + assertEquals(resource.getResourceId(), "resourceId"); + assertEquals(resource.getModelInfo(), model); + assertEquals(resource.getResourceInstance(), ri); + assertEquals(resource.getHomingSolution(), hs); + assertEquals(resource.getCurrentHomingSolution(), hs); + assertEquals(resource.getResourceType(), rt); + assertEquals(resource.getToscaNodeType(), "toscaNodeType"); + assertEquals(resource.getResourceInstanceId(), "newInstanceId"); + assertEquals(resource.getResourceInstanceName(), "newInstanceName"); + assertEquals(resource.getConcurrencyCounter(), initval+1); + + + + + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java new file mode 100644 index 0000000000..58548db23b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java @@ -0,0 +1,83 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import java.util.List; + +import org.junit.Test; + +public class ServiceDecompositionTest { + private ServiceDecomposition sd = new ServiceDecomposition(); + ModelInfo model= new ModelInfo(); + ServiceInstance si= new ServiceInstance(); + Project project= new Project(); + OwningEntity oe= new OwningEntity(); + //VnfResource vnf = new VnfResource(); + List vnfResources; + List networkResources; + List configResources; + List allottedResources; + Request request= new Request(); + Customer customer= new Customer(); + + + @Test + public void testServiceDecomposition() { + sd.setModelInfo(model); + sd.setServiceInstance(si); + sd.setProject(project); + sd.setOwningEntity(oe); + sd.setServiceVnfs(vnfResources); + sd.setServiceConfigs(configResources); + sd.setServiceNetworks(networkResources); + sd.setServiceAllottedResources(allottedResources); + sd.setServiceConfigResources(configResources); + sd.setServiceType("serviceType"); + sd.setServiceRole("serviceRole"); + sd.setRequest(request); + sd.setCustomer(customer); + sd.setCallbackURN("callbackURN"); + sd.setSdncVersion("sdncVersion"); + assertEquals(sd.getModelInfo(), model); + assertEquals(sd.getServiceInstance(), si); + assertEquals(sd.getProject(), project); + assertEquals(sd.getOwningEntity(), oe); + assertEquals(sd.getServiceVnfs(), vnfResources); + assertEquals(sd.getServiceConfigs(), configResources); + assertEquals(sd.getServiceNetworks(), networkResources); + assertEquals(sd.getServiceAllottedResources(), allottedResources); + assertEquals(sd.getServiceConfigResources(), configResources); + assertEquals(sd.getRequest(), request); + assertEquals(sd.getCustomer(), customer); + assertEquals(sd.getCallbackURN(), "callbackURN"); + assertEquals(sd.getSdncVersion(), "sdncVersion"); + + + + + + + + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java new file mode 100644 index 0000000000..b600fef3fd --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java @@ -0,0 +1,61 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import java.util.Map; + +import org.junit.Test; + +public class ServiceInstanceTest { + + private ServiceInstance si= new ServiceInstance(); + Map serviceParams; + Configuration config= new Configuration(); + ModelInfo model= new ModelInfo(); + + @Test + public void testServiceInstance() { + si.setServiceType("serviceType"); + si.setServiceId("serviceId"); + si.setServiceParams(serviceParams); + si.setInstanceId("instanceId"); + si.setInstanceName("instanceName"); + si.setOrchestrationStatus("orchestrationStatus"); + si.setConfiguration(config); + si.setModelInfo(model); + si.setEnvironmentContext("environmentContext"); + si.setWorkloadContext("workloadContext"); + assertEquals(si.getServiceType(), "serviceType"); + assertEquals(si.getServiceId(), "serviceId"); + assertEquals(si.getServiceParams(), serviceParams); + assertEquals(si.getInstanceId(), "instanceId"); + assertEquals(si.getInstanceName(), "instanceName"); + assertEquals(si.getOrchestrationStatus(), "orchestrationStatus"); + assertEquals(si.getConfiguration(), config); + assertEquals(si.getModelInfo(), model); + assertEquals(si.getEnvironmentContext(), "environmentContext"); + assertEquals(si.getWorkloadContext(), "workloadContext"); + + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java new file mode 100644 index 0000000000..7e9aef29a6 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java @@ -0,0 +1,41 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class SubscriberTest { + Subscriber subscriber= new Subscriber("globalId", "name", "commonSiteId"); + + @Test + public void testSubscriber() { + subscriber.setGlobalId("globalId"); + subscriber.setName("name"); + subscriber.setCommonSiteId("commonSiteId"); + assertEquals(subscriber.getGlobalId(), "globalId"); + assertEquals(subscriber.getName(), "name"); + assertEquals(subscriber.getCommonSiteId(), "commonSiteId"); + + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java new file mode 100644 index 0000000000..2a5639f0ff --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java @@ -0,0 +1,44 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class TunnelConnectTest { + private TunnelConnect tc= new TunnelConnect(); + + @Test + public void testTunnelConnect() { + tc.setId("id"); + tc.setUpBandwidth("upBandwidth"); + tc.setDownBandwidth("downBandwidth"); + tc.setUpBandwidth2("upBandwidth2"); + tc.setDownBandwidth2("downBandwidth2"); + assertEquals(tc.getId(), "id"); + assertEquals(tc.getUpBandwidth(), "upBandwidth"); + assertEquals(tc.getDownBandwidth(), "downBandwidth"); + assertEquals(tc.getUpBandwidth2(), "upBandwidth2"); + assertEquals(tc.getDownBandwidth2(), "downBandwidth2"); + + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java new file mode 100644 index 0000000000..e476ef9fd5 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java @@ -0,0 +1,55 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package org.openecomp.mso.bpmn.core.domain; + +import static org.junit.Assert.*; + +import java.util.List; + +import org.junit.Test; + +public class VnfResourceTest { + + private VnfResource vnf= new VnfResource(); + List moduleResources; + + @Test + public void testVnfResource() { + vnf.setModules(moduleResources); + vnf.setVnfHostname("vnfHostname"); + vnf.setVnfType("vnfType"); + vnf.setNfFunction("nfFunction"); + vnf.setNfType("nfType"); + vnf.setNfRole("nfRole"); + vnf.setNfNamingCode("nfNamingCode"); + vnf.setMultiStageDesign("multiStageDesign"); + assertEquals(vnf.getVfModules(), moduleResources); + assertEquals(vnf.getVnfHostname(), "vnfHostname"); + assertEquals(vnf.getVnfType(), "vnfType"); + assertEquals(vnf.getNfFunction(), "nfFunction"); + assertEquals(vnf.getNfType(), "nfType"); + assertEquals(vnf.getNfRole(), "nfRole"); + assertEquals(vnf.getNfNamingCode(), "nfNamingCode"); + assertEquals(vnf.getMultiStageDesign(), "multiStageDesign"); + + + } + +} -- cgit 1.2.3-korg