From 1ec3dde2067e0181faa8e5098219c93126638aef Mon Sep 17 00:00:00 2001 From: vasraz Date: Mon, 6 Jul 2020 17:08:08 +0100 Subject: Support for defining attributes on a node_type This commit aims to add support of attributes on node_type. It is first of several commits to cover all support. It includes: - new classes: AttributeDefinition ComponentInstanceAttribute IAttributeInputCommon IAttributeInputCommon AttributeDataDefinition MapAttributesDataDefinition - support of 'Import of VFC with attributes' - TCs fix for changed code Next commit(s) will cover: - support of "Onboarding packages with attributes" - support of "Download TOSCA Artifacts - Tosca Model" - support of "Import onboarded VSP" Change-Id: I0167abc58e8aeef3d631833cc323e466f8e71492 Signed-off-by: Vasyl Razinkov Issue-ID: SDC-3200 --- .../sdc/be/model/CapabilityDefinitionTest.java | 26 -- .../sdc/be/model/CapabilityTypeDefinitionTest.java | 21 -- .../model/ComponentInstanceInterfaceBeanTest.java | 15 +- .../org/openecomp/sdc/be/model/ResourceTest.java | 102 +----- .../jsonjanusgraph/datamodel/NodeTypeTest.java | 161 +-------- .../datamodel/TopologyTemplateTest.java | 378 --------------------- 6 files changed, 7 insertions(+), 696 deletions(-) (limited to 'catalog-model/src/test/java') diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java index 41de118272..569691869f 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java @@ -21,12 +21,7 @@ */ package org.openecomp.sdc.be.model; -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEqualsFor; -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCodeFor; -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToStringFor; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; import java.util.ArrayList; import java.util.HashMap; @@ -45,27 +40,6 @@ public class CapabilityDefinitionTest { private static final String PROPERTIES = "properties"; private static final String VALUE = "VALUE"; - @Test - public void hasValidGettersAndSettersTest() { - assertThat(CapabilityDefinition.class, - hasValidGettersAndSettersExcluding("empty", "ownerIdIfEmpty", "version")); - } - - @Test - public void shouldHaveValidToString() { - assertThat(CapabilityDefinition.class, hasValidBeanToStringFor(PROPERTIES)); - } - - @Test - public void shouldHaveEquals() { - assertThat(CapabilityDefinition.class, hasValidBeanEqualsFor(PROPERTIES)); - } - - @Test - public void shouldHaveHashCode() { - assertThat(CapabilityDefinition.class, hasValidBeanHashCodeFor(PROPERTIES)); - } - @Test public void testParamConstructor() { EqualConstraint equalConstraint = new EqualConstraint(EQ); diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java index 2a90d937dc..cf3bbf53a2 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java @@ -22,11 +22,8 @@ package org.openecomp.sdc.be.model; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import java.util.Collections; import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition.OwnerType; import org.openecomp.sdc.be.datatypes.elements.CapabilityTypeDataDefinition; @@ -41,24 +38,6 @@ public class CapabilityTypeDefinitionTest { private static final String DESCRIPTION = "DESCRIPTION"; private static final String UNIQUE_ID = "UNIQUE_ID"; - @Test - public void hasValidGettersAndSettersTest() { - assertThat(CapabilityTypeDefinition.class, - hasValidGettersAndSettersExcluding("empty", "ownerIdIfEmpty")); - } - - @Test - public void shouldHaveValidToString() { - CapabilityDefinition capabilityDefinition = new CapabilityDefinition( - new CapabilityTypeDefinition(), OWNER_NAME, NAME, RESOURCE); - capabilityDefinition.setProperties(Collections.emptyList()); - capabilityDefinition.setType(TYPE); - capabilityDefinition.setDescription(DESCRIPTION); - CapabilityTypeDefinition capabilityTypeDefinitionTest = new CapabilityTypeDefinition(capabilityDefinition); - String toStringRepr = capabilityTypeDefinitionTest.toString(); - assertEquals(toStringRepr, "CapabilityTypeDataDefinition [uniqueId=null, description=DESCRIPTION, type=TYPE, validSourceTypes=[], version=null, creationTime=null, modificationTime=null] [ derivedFrom=null, properties={} ]"); - } - @Test public void shouldCreateCapabilityTypeDefinitionFromCapabilityTypeData() { CapabilityTypeData capabilityTypeData = new CapabilityTypeData(); diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInterfaceBeanTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInterfaceBeanTest.java index 044e9e0c57..d0c1a666f4 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInterfaceBeanTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInterfaceBeanTest.java @@ -19,9 +19,7 @@ */ package org.openecomp.sdc.be.model; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; @@ -34,17 +32,6 @@ public class ComponentInstanceInterfaceBeanTest { private static final InterfaceInstanceDataDefinition INTERFACE_INSTANCE_DATA_DEFINITION = new InterfaceInstanceDataDefinition(); private static final String ID = "ID"; - @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(ComponentInstanceInterface.class, - hasValidGettersAndSettersExcluding( - "definition", - "ownerIdIfEmpty", - "empty", - "operationsMap", - "version")); - } - @Test public void verifyConstructors() { INTERFACE_DATA_DEFINITION.setUniqueId(ID); @@ -58,4 +45,4 @@ public class ComponentInstanceInterfaceBeanTest { assertEquals(componentInstanceInterface1.getUniqueId(), ID); assertEquals(componentInstanceInterface2.getInterfaceInstanceDataDefinition(), INTERFACE_INSTANCE_DATA_DEFINITION); } -} \ No newline at end of file +} diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java index cb50c9601c..447b053fea 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java @@ -29,6 +29,7 @@ import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.unittests.utils.ModelConfDependentTest; @@ -44,66 +45,6 @@ public class ResourceTest extends ModelConfDependentTest { new Resource(componentMetadataDefinition); } - @Test - public void testGetProperties() throws Exception { - Resource testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProperties(); - } - - @Test - public void testSetProperties() throws Exception { - Resource testSubject; - List properties = null; - - // default test - testSubject = createTestSubject(); - testSubject.setProperties(properties); - } - - @Test - public void testGetAttributes() throws Exception { - Resource testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAttributes(); - } - - @Test - public void testSetAttributes() throws Exception { - Resource testSubject; - List attributes = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAttributes(attributes); - } - - @Test - public void testGetInterfaces() throws Exception { - Resource testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInterfaces(); - } - - @Test - public void testSetInterfaces() throws Exception { - Resource testSubject; - Map interfaces = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInterfaces(interfaces); - } - @Test public void testIsAbstract() throws Exception { Resource testSubject; @@ -164,47 +105,6 @@ public class ResourceTest extends ModelConfDependentTest { testSubject.setLicenseType(licenseType); } - @Test - public void testHashCode() throws Exception { - Resource testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.hashCode(); - } - - @Test - public void testEquals() throws Exception { - Resource testSubject; - Object obj = null; - boolean result; - - // test 1 - testSubject = createTestSubject(); - result = testSubject.equals(obj); - Assert.assertEquals(false, result); - obj = new Object(); - result = testSubject.equals(obj); - Assert.assertEquals(false, result); - result = testSubject.equals(testSubject); - Assert.assertEquals(true, result); - - Resource testSubject2 = createTestSubject(); - result = testSubject.equals(testSubject2); - Assert.assertEquals(true, result); - } - - @Test - public void testToString() throws Exception { - Resource testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - @Test public void testGetToscaResourceName() throws Exception { Resource testSubject; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeTypeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeTypeTest.java index 011214a7c9..9473b1cd45 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeTypeTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeTypeTest.java @@ -20,16 +20,8 @@ package org.openecomp.sdc.be.model.jsonjanusgraph.datamodel; -import java.util.List; -import java.util.Map; - -import org.junit.Test; -import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; - +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class NodeTypeTest { @@ -37,157 +29,14 @@ public class NodeTypeTest { return new NodeType(); } - - @Test - public void testGetDerivedList() throws Exception { - NodeType testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDerivedList(); - } - - - @Test - public void testSetDerivedList() throws Exception { - NodeType testSubject; - List derivedList = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDerivedList(derivedList); - } - - - @Test - public void testGetDerivedFrom() throws Exception { - NodeType testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDerivedFrom(); - } - - - @Test - public void testSetDerivedFrom() throws Exception { - NodeType testSubject; - List derivedFrom = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDerivedFrom(derivedFrom); - } - - - @Test - public void testGetAttributes() throws Exception { - NodeType testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAttributes(); - } - - - @Test - public void testSetAttributes() throws Exception { - NodeType testSubject; - Map attributes = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAttributes(attributes); - } - - - @Test - public void testGetCapabilties() throws Exception { - NodeType testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCapabilities(); - } - - - @Test - public void testSetCapabilties() throws Exception { - NodeType testSubject; - Map capabilties = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCapabilities(capabilties); - } - - - @Test - public void testGetRequirements() throws Exception { - NodeType testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRequirements(); - } - - - @Test - public void testSetRequirements() throws Exception { - NodeType testSubject; - Map requirements = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRequirements(requirements); - } - - - @Test - public void testGetCapabiltiesProperties() throws Exception { - NodeType testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCapabilitiesProperties(); - } - - @Test - public void testSetCapabiltiesProperties() throws Exception { + public void testCTOR() throws Exception { NodeType testSubject; - Map capabiltiesProperties = null; // default test testSubject = createTestSubject(); - testSubject.setCapabilitiesProperties(capabiltiesProperties); + Assertions.assertNotNull(testSubject); + Assertions.assertEquals(ToscaElementTypeEnum.NODE_TYPE, testSubject.getToscaType()); } - - @Test - public void testGetInterfaceArtifacts() throws Exception { - NodeType testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInterfaceArtifacts(); - } - - - @Test - public void testSetInterfaceArtifacts() throws Exception { - NodeType testSubject; - Map interfaceArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInterfaceArtifacts(interfaceArtifacts); - } } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplateTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplateTest.java index 4ea05e5925..d9beb9d644 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplateTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/TopologyTemplateTest.java @@ -26,388 +26,12 @@ import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.*; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - public class TopologyTemplateTest { private TopologyTemplate createTestSubject() { return new TopologyTemplate(); } - - @Test - public void testGetInputs() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInputs(); - } - - - @Test - public void testSetInputs() throws Exception { - TopologyTemplate testSubject; - Map inputs = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInputs(inputs); - } - - - @Test - public void testGetInstInputs() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInstInputs(); - } - - - @Test - public void testSetInstInputs() throws Exception { - TopologyTemplate testSubject; - Map instInputs = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInstInputs(instInputs); - } - - - @Test - public void testGetHeatParameters() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHeatParameters(); - } - - - @Test - public void testSetHeatParameters() throws Exception { - TopologyTemplate testSubject; - Map heatParameters = null; - - // default test - testSubject = createTestSubject(); - testSubject.setHeatParameters(heatParameters); - } - - - @Test - public void testGetInstAttributes() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInstAttributes(); - } - - - @Test - public void testSetInstAttributes() throws Exception { - TopologyTemplate testSubject; - Map instAttributes = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInstAttributes(instAttributes); - } - - - @Test - public void testGetInstProperties() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInstProperties(); - } - - - @Test - public void testSetInstProperties() throws Exception { - TopologyTemplate testSubject; - Map instProperties = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInstProperties(instProperties); - } - - - @Test - public void testGetGroups() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getGroups(); - } - - - @Test - public void testSetGroups() throws Exception { - TopologyTemplate testSubject; - Map groups = null; - - // default test - testSubject = createTestSubject(); - testSubject.setGroups(groups); - } - - - @Test - public void testGetInstGroups() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInstGroups(); - } - - - @Test - public void testSetInstGroups() throws Exception { - TopologyTemplate testSubject; - Map instGroups = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInstGroups(instGroups); - } - - - @Test - public void testGetServiceApiArtifacts() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceApiArtifacts(); - } - - - @Test - public void testSetServiceApiArtifacts() throws Exception { - TopologyTemplate testSubject; - Map serviceApiArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceApiArtifacts(serviceApiArtifacts); - } - - - @Test - public void testGetCompositions() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCompositions(); - } - - - @Test - public void testSetCompositions() throws Exception { - TopologyTemplate testSubject; - Map compositions = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCompositions(compositions); - } - - - @Test - public void testGetCalculatedCapabilities() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCalculatedCapabilities(); - } - - - @Test - public void testSetCalculatedCapabilities() throws Exception { - TopologyTemplate testSubject; - Map calculatedCapabilities = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCalculatedCapabilities(calculatedCapabilities); - } - - - @Test - public void testGetCalculatedRequirements() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCalculatedRequirements(); - } - - - @Test - public void testSetCalculatedRequirements() throws Exception { - TopologyTemplate testSubject; - Map calculatedRequirements = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCalculatedRequirements(calculatedRequirements); - } - - - @Test - public void testGetFullfilledCapabilities() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getFullfilledCapabilities(); - } - - - @Test - public void testSetFullfilledCapabilities() throws Exception { - TopologyTemplate testSubject; - Map fullfilledCapabilities = null; - - // default test - testSubject = createTestSubject(); - testSubject.setFullfilledCapabilities(fullfilledCapabilities); - } - - - @Test - public void testGetFullfilledRequirements() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getFullfilledRequirements(); - } - - - @Test - public void testSetFullfilledRequirements() throws Exception { - TopologyTemplate testSubject; - Map fullfilledRequirements = null; - - // default test - testSubject = createTestSubject(); - testSubject.setFullfilledRequirements(fullfilledRequirements); - } - - - @Test - public void testGetInstDeploymentArtifacts() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInstDeploymentArtifacts(); - } - - - @Test - public void testSetInstDeploymentArtifacts() throws Exception { - TopologyTemplate testSubject; - Map instDeploymentArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInstDeploymentArtifacts(instDeploymentArtifacts); - } - - - @Test - public void testGetCalculatedCapabilitiesProperties() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCalculatedCapabilitiesProperties(); - } - - - @Test - public void testSetCalculatedCapabilitiesProperties() throws Exception { - TopologyTemplate testSubject; - Map calculatedCapabilitiesProperties = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCalculatedCapabilitiesProperties(calculatedCapabilitiesProperties); - } - - - @Test - public void testGetInstanceArtifacts() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInstanceArtifacts(); - } - - - @Test - public void testSetInstanceArtifacts() throws Exception { - TopologyTemplate testSubject; - Map instanceArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInstanceArtifacts(instanceArtifacts); - } - - - @Test - public void testGetDataTypes() throws Exception { - TopologyTemplate testSubject; - Map result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDataTypes(); - } - - - @Test - public void testSetDataTypes() throws Exception { - TopologyTemplate testSubject; - Map dataTypes = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDataTypes(dataTypes); - } - - @Test public void testGetComponentInstances() throws Exception { TopologyTemplate testSubject; @@ -418,7 +42,6 @@ public class TopologyTemplateTest { result = testSubject.getComponentInstances(); } - @Test public void testSetComponentInstances() throws Exception { TopologyTemplate testSubject; @@ -429,7 +52,6 @@ public class TopologyTemplateTest { testSubject.setComponentInstances(instances); } - @Test public void testGetRelations() throws Exception { TopologyTemplate testSubject; -- cgit 1.2.3-korg