From b2533e5f96d5341693df7e6aba5d78a58c10af8c Mon Sep 17 00:00:00 2001 From: Tal Gitelman Date: Wed, 6 Jun 2018 14:46:07 +0300 Subject: new unit tests for sdc-dao Change-Id: Iea7efb56bb8125cc9e236f726fe67c9832b85fec Issue-ID: SDC-1333 Signed-off-by: Tal Gitelman --- .../sdc/be/model/LifeCycleTransitionEnumTest.java | 25 ++- .../org/openecomp/sdc/be/model/OperationTest.java | 61 ++++++ .../sdc/be/model/ParsedToscaYamlInfoTest.java | 82 ++++++++ .../java/org/openecomp/sdc/be/model/PointTest.java | 4 + .../sdc/be/model/PolicyDefinitionTest.java | 33 +++ .../org/openecomp/sdc/be/model/ProductTest.java | 4 + .../openecomp/sdc/be/model/PropertyScopeTest.java | 67 ++++++ .../sdc/be/model/RelationshipInfoTest.java | 232 +++++++++++++++++++++ .../model/ResourceInstanceHeatParameterTest.java | 4 + .../org/openecomp/sdc/be/model/ResourceTest.java | 18 +- .../org/openecomp/sdc/be/model/ServiceTest.java | 6 + .../java/org/openecomp/sdc/be/model/TagTest.java | 68 ++++++ .../sdc/be/model/TargetCapabilityRelDefTest.java | 98 +++++++++ .../be/model/UploadComponentInstanceInfoTest.java | 153 ++++++++++++++ .../sdc/be/model/jsontitan/utils/IdMapperTest.java | 2 - .../model/jsontitan/utils/InterfaceUtilsTest.java | 2 - .../impl/ComponentInstanceOperationTest.java | 10 - .../tosca/constraints/ConstraintUtilTest.java | 3 - .../converters/DataTypePropertyConverterTest.java | 15 +- .../tosca/converters/LowerCaseConverterTest.java | 3 - .../tosca/converters/ToscaFloatConverterTest.java | 8 +- .../converters/ToscaMapValueConverterTest.java | 6 - .../model/tosca/validators/MapValidatorTest.java | 4 +- .../validators/ToscaBooleanValidatorTest.java | 3 - .../sdc/be/unittests/utils/FactoryUtilsTest.java | 2 - .../be/unittests/utils/ModelConfDependentTest.java | 13 ++ 26 files changed, 873 insertions(+), 53 deletions(-) create mode 100644 catalog-model/src/test/java/org/openecomp/sdc/be/model/OperationTest.java create mode 100644 catalog-model/src/test/java/org/openecomp/sdc/be/model/ParsedToscaYamlInfoTest.java create mode 100644 catalog-model/src/test/java/org/openecomp/sdc/be/model/PolicyDefinitionTest.java create mode 100644 catalog-model/src/test/java/org/openecomp/sdc/be/model/PropertyScopeTest.java create mode 100644 catalog-model/src/test/java/org/openecomp/sdc/be/model/RelationshipInfoTest.java create mode 100644 catalog-model/src/test/java/org/openecomp/sdc/be/model/TagTest.java create mode 100644 catalog-model/src/test/java/org/openecomp/sdc/be/model/TargetCapabilityRelDefTest.java create mode 100644 catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadComponentInstanceInfoTest.java create mode 100644 catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/ModelConfDependentTest.java (limited to 'catalog-model/src/test/java') diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/LifeCycleTransitionEnumTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/LifeCycleTransitionEnumTest.java index 43fac12509..d5fcff5cfb 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/LifeCycleTransitionEnumTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/LifeCycleTransitionEnumTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Test; public class LifeCycleTransitionEnumTest { @@ -10,7 +8,6 @@ public class LifeCycleTransitionEnumTest { return LifeCycleTransitionEnum.CERTIFY; } - @Test public void testGetDisplayName() throws Exception { LifeCycleTransitionEnum testSubject; @@ -21,17 +18,31 @@ public class LifeCycleTransitionEnumTest { result = testSubject.getDisplayName(); } - @Test public void testGetFromDisplayName() throws Exception { - String name = LifeCycleTransitionEnum.CHECKIN.getDisplayName() ; + String name = LifeCycleTransitionEnum.CHECKIN.getDisplayName(); + LifeCycleTransitionEnum result; + + // default test + for (LifeCycleTransitionEnum iterable_element : LifeCycleTransitionEnum.values()) { + result = LifeCycleTransitionEnum.getFromDisplayName(iterable_element.getDisplayName()); + } + } + + @Test + public void testGetFromDisplayNameException() throws Exception { + String name = LifeCycleTransitionEnum.CHECKIN.getDisplayName(); LifeCycleTransitionEnum result; // default test - result = LifeCycleTransitionEnum.getFromDisplayName(name); + try { + result = LifeCycleTransitionEnum.getFromDisplayName("mock"); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } - @Test public void testValuesAsString() throws Exception { String result; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/OperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/OperationTest.java new file mode 100644 index 0000000000..8ff412960e --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/OperationTest.java @@ -0,0 +1,61 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; + +public class OperationTest { + + private Operation createTestSubject() { + return new Operation(); + } + + @Test + public void testCtor() throws Exception { + new Operation(new OperationDataDefinition()); + new Operation(new ArtifactDataDefinition(), "mock", new ListDataDefinition<>()); + } + + @Test + public void testIsDefinition() throws Exception { + Operation testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isDefinition(); + } + + @Test + public void testSetDefinition() throws Exception { + Operation testSubject; + boolean definition = false; + + // default test + testSubject = createTestSubject(); + testSubject.setDefinition(definition); + } + + @Test + public void testToString() throws Exception { + Operation testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + @Test + public void testGetImplementationArtifact() throws Exception { + Operation testSubject; + ArtifactDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getImplementationArtifact(); + testSubject.setImplementation(new ArtifactDataDefinition()); + result = testSubject.getImplementationArtifact(); + } +} \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ParsedToscaYamlInfoTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ParsedToscaYamlInfoTest.java new file mode 100644 index 0000000000..cec44b402e --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ParsedToscaYamlInfoTest.java @@ -0,0 +1,82 @@ +package org.openecomp.sdc.be.model; + +import java.util.Map; + +import org.junit.Test; + +public class ParsedToscaYamlInfoTest { + + private ParsedToscaYamlInfo createTestSubject() { + return new ParsedToscaYamlInfo(); + } + + @Test + public void testGetInstances() throws Exception { + ParsedToscaYamlInfo testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInstances(); + } + + @Test + public void testSetInstances() throws Exception { + ParsedToscaYamlInfo testSubject; + Map instances = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInstances(instances); + } + + @Test + public void testGetGroups() throws Exception { + ParsedToscaYamlInfo testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroups(); + } + + @Test + public void testSetGroups() throws Exception { + ParsedToscaYamlInfo testSubject; + Map groups = null; + + // default test + testSubject = createTestSubject(); + testSubject.setGroups(groups); + } + + @Test + public void testGetInputs() throws Exception { + ParsedToscaYamlInfo testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInputs(); + } + + @Test + public void testSetInputs() throws Exception { + ParsedToscaYamlInfo testSubject; + Map inputs = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInputs(inputs); + } + + @Test + public void testToString() throws Exception { + ParsedToscaYamlInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +} \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/PointTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/PointTest.java index f528375b33..edf7f52fe0 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/PointTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/PointTest.java @@ -9,6 +9,10 @@ public class PointTest { return new Point(); } + @Test + public void testCtor() throws Exception { + new Point("mock", "mock"); + } @Test public void testGetX() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/PolicyDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/PolicyDefinitionTest.java new file mode 100644 index 0000000000..c7a21b844a --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/PolicyDefinitionTest.java @@ -0,0 +1,33 @@ +package org.openecomp.sdc.be.model; + +import java.util.HashMap; +import java.util.LinkedList; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition; + +public class PolicyDefinitionTest { + + private PolicyDefinition createTestSubject() { + return new PolicyDefinition(); + } + + @Test + public void testCtor() throws Exception { + new PolicyDefinition(new HashMap<>()); + new PolicyDefinition(new PolicyDataDefinition()); + PolicyTypeDefinition policyType = new PolicyTypeDefinition(); + policyType.setProperties(new LinkedList<>()); + new PolicyDefinition(policyType); + } + + @Test + public void testGetNormalizedName() throws Exception { + PolicyDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNormalizedName(); + } +} \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ProductTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ProductTest.java index 23f1ca48b3..021e044f34 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ProductTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ProductTest.java @@ -11,6 +11,10 @@ public class ProductTest { return new Product(); } + @Test + public void testCtor() throws Exception { + new Product(new ProductMetadataDefinition()); + } @Test public void testGetFullName() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/PropertyScopeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/PropertyScopeTest.java new file mode 100644 index 0000000000..825473d8ef --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/PropertyScopeTest.java @@ -0,0 +1,67 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Assert; +import org.junit.Test; + +public class PropertyScopeTest { + + private PropertyScope createTestSubject() { + return new PropertyScope(); + } + + @Test + public void testGetName() throws Exception { + PropertyScope testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + PropertyScope testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testHashCode() throws Exception { + PropertyScope testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + @Test + public void testEquals() throws Exception { + PropertyScope 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); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(false, result); + testSubject.setName("mock"); + PropertyScope createTestSubject2 = createTestSubject(); + result = testSubject.equals(createTestSubject2); + Assert.assertEquals(false, result); + createTestSubject2.setName("mock"); + result = testSubject.equals(createTestSubject2); + Assert.assertEquals(true, result); + } +} \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/RelationshipInfoTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/RelationshipInfoTest.java new file mode 100644 index 0000000000..1a606f5bb7 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/RelationshipInfoTest.java @@ -0,0 +1,232 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition; + +public class RelationshipInfoTest { + + private RelationshipInfo createTestSubject() { + return new RelationshipInfo(); + } + + @Test + public void testCtor() throws Exception { + new RelationshipInfo("mock", new RelationshipImpl()); + new RelationshipInfo("mock", new RelationshipImpl(), "mock"); + } + + @Test + public void testGetRequirement() throws Exception { + RelationshipInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirement(); + } + + @Test + public void testSetRequirement() throws Exception { + RelationshipInfo testSubject; + String requirement = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirement(requirement); + } + + @Test + public void testGetCapabilityOwnerId() throws Exception { + RelationshipInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilityOwnerId(); + } + + @Test + public void testSetCapabilityOwnerId() throws Exception { + RelationshipInfo testSubject; + String capabilityOwnerId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilityOwnerId(capabilityOwnerId); + } + + @Test + public void testGetRequirementOwnerId() throws Exception { + RelationshipInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirementOwnerId(); + } + + @Test + public void testSetRequirementOwnerId() throws Exception { + RelationshipInfo testSubject; + String requirementOwnerId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirementOwnerId(requirementOwnerId); + } + + @Test + public void testGetRelationship() throws Exception { + RelationshipInfo testSubject; + RelationshipImpl result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelationship(); + } + + @Test + public void testSetRelationships() throws Exception { + RelationshipInfo testSubject; + RelationshipImpl relationship = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRelationships(relationship); + } + + @Test + public void testGetCapability() throws Exception { + RelationshipInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapability(); + } + + @Test + public void testSetCapability() throws Exception { + RelationshipInfo testSubject; + String capability = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCapability(capability); + } + + @Test + public void testGetCapabilityUid() throws Exception { + RelationshipInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilityUid(); + } + + @Test + public void testSetCapabilityUid() throws Exception { + RelationshipInfo testSubject; + String capabilityUid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilityUid(capabilityUid); + } + + @Test + public void testGetRequirementUid() throws Exception { + RelationshipInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirementUid(); + } + + @Test + public void testSetRequirementUid() throws Exception { + RelationshipInfo testSubject; + String requirementUid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirementUid(requirementUid); + } + + @Test + public void testGetId() throws Exception { + RelationshipInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getId(); + } + + @Test + public void testSetId() throws Exception { + RelationshipInfo testSubject; + String id = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setId(id); + } + + @Test + public void testToString() throws Exception { + RelationshipInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + @Test + public void testEqualsTo() throws Exception { + RelationshipInfo testSubject; + RelationshipInstDataDefinition savedRelation = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + result = testSubject.equalsTo(savedRelation); + Assert.assertEquals(false, result); + savedRelation = new RelationshipInstDataDefinition(); + RelationshipImpl relationship = new RelationshipImpl(); + savedRelation.setType("mock"); + testSubject.setRelationships(relationship); + result = testSubject.equalsTo(savedRelation); + Assert.assertEquals(false, result); + relationship.setType("mock"); + savedRelation.setCapabilityOwnerId("mock"); + result = testSubject.equalsTo(savedRelation); + Assert.assertEquals(false, result); + testSubject.setCapabilityOwnerId("mock"); + savedRelation.setRequirementOwnerId("mock"); + result = testSubject.equalsTo(savedRelation); + Assert.assertEquals(false, result); + savedRelation.setRequirementOwnerId("mock"); + result = testSubject.equalsTo(savedRelation); + Assert.assertEquals(false, result); + testSubject.setRequirementOwnerId("mock"); + savedRelation.setRequirementId("mock"); + result = testSubject.equalsTo(savedRelation); + Assert.assertEquals(false, result); + testSubject.setRequirementUid("mock"); + savedRelation.setCapabilityId("mock"); + result = testSubject.equalsTo(savedRelation); + Assert.assertEquals(false, result); + testSubject.setCapabilityUid("mock"); + savedRelation.setRequirement("mock"); + result = testSubject.equalsTo(savedRelation); + Assert.assertEquals(false, result); + testSubject.setRequirement("mock"); + result = testSubject.equalsTo(savedRelation); + Assert.assertEquals(true, result); + } +} \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceInstanceHeatParameterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceInstanceHeatParameterTest.java index 95b314604a..d1882cc372 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceInstanceHeatParameterTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceInstanceHeatParameterTest.java @@ -9,6 +9,10 @@ public class ResourceInstanceHeatParameterTest { return new ResourceInstanceHeatParameter(); } + @Test + public void testCtor() throws Exception { + new ResourceInstanceHeatParameter(new HeatParameterDefinition(), "mock"); + } @Test public void testGetValueUniqueId() throws Exception { 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 c2623ebda5..e9976834b8 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 @@ -7,13 +7,19 @@ import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.InterfaceOperationDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.unittests.utils.ModelConfDependentTest; -public class ResourceTest { +public class ResourceTest extends ModelConfDependentTest{ private Resource createTestSubject() { return new Resource(); } + @Test + public void testCtor() throws Exception { + ComponentMetadataDefinition componentMetadataDefinition = new ComponentMetadataDefinition(); + new Resource(componentMetadataDefinition); + } @Test public void testGetDerivedFrom() throws Exception { @@ -254,9 +260,17 @@ public class ResourceTest { // test 1 testSubject = createTestSubject(); - obj = null; 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); } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ServiceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ServiceTest.java index 3d0c8a1d28..7dafe7d1dc 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ServiceTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ServiceTest.java @@ -11,6 +11,11 @@ public class ServiceTest { return new Service(); } + @Test + public void testCtor() throws Exception { + new Service(new ComponentMetadataDefinition()); + } + @Test public void testGetServiceApiArtifacts() throws Exception { Service testSubject; @@ -109,6 +114,7 @@ public class ServiceTest { testSubject = createTestSubject(); distributionStatus = null; testSubject.setDistributionStatus(distributionStatus); + testSubject.setDistributionStatus(DistributionStatusEnum.DISTRIBUTED); } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/TagTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/TagTest.java new file mode 100644 index 0000000000..ac4475e8ae --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/TagTest.java @@ -0,0 +1,68 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Assert; +import org.junit.Test; + +public class TagTest { + + private Tag createTestSubject() { + return new Tag(); + } + + @Test + public void testGetName() throws Exception { + Tag testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + Tag testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testHashCode() throws Exception { + Tag testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + @Test + public void testEquals() throws Exception { + Tag 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); + + Tag createTestSubject = createTestSubject(); + result = testSubject.equals(createTestSubject); + Assert.assertEquals(false, result); + testSubject.setName("mock"); + result = testSubject.equals(createTestSubject); + Assert.assertEquals(false, result); + createTestSubject.setName("mock"); + result = testSubject.equals(createTestSubject); + Assert.assertEquals(true, result); + } +} \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/TargetCapabilityRelDefTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/TargetCapabilityRelDefTest.java new file mode 100644 index 0000000000..ab610116f1 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/TargetCapabilityRelDefTest.java @@ -0,0 +1,98 @@ +package org.openecomp.sdc.be.model; + +import java.util.LinkedList; +import java.util.List; + +import org.junit.Test; + +public class TargetCapabilityRelDefTest { + + private TargetCapabilityRelDef createTestSubject() { + return new TargetCapabilityRelDef(); + } + + @Test + public void testCtor() throws Exception { + new TargetCapabilityRelDef("mock", new LinkedList<>()); + } + + @Test + public void testGetToNode() throws Exception { + TargetCapabilityRelDef testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToNode(); + } + + @Test + public void testSetToNode() throws Exception { + TargetCapabilityRelDef testSubject; + String toNode = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToNode(toNode); + } + + @Test + public void testGetRelationships() throws Exception { + TargetCapabilityRelDef testSubject; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelationships(); + } + + @Test + public void testResolveSingleRelationship() throws Exception { + TargetCapabilityRelDef testSubject; + CapabilityRequirementRelationship result; + + // default test + testSubject = createTestSubject(); + result = testSubject.resolveSingleRelationship(); + } + + @Test + public void testGetUid() throws Exception { + TargetCapabilityRelDef testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUid(); + } + + @Test + public void testSetUid() throws Exception { + TargetCapabilityRelDef testSubject; + String uid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUid(uid); + } + + @Test + public void testSetRelationships() throws Exception { + TargetCapabilityRelDef testSubject; + List relationships = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRelationships(relationships); + } + + @Test + public void testToString() throws Exception { + TargetCapabilityRelDef testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +} \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadComponentInstanceInfoTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadComponentInstanceInfoTest.java new file mode 100644 index 0000000000..f23e04bfec --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadComponentInstanceInfoTest.java @@ -0,0 +1,153 @@ +package org.openecomp.sdc.be.model; + +import java.util.List; +import java.util.Map; + +import org.junit.Test; + +public class UploadComponentInstanceInfoTest { + + private UploadComponentInstanceInfo createTestSubject() { + return new UploadComponentInstanceInfo(); + } + + @Test + public void testGetProperties() throws Exception { + UploadComponentInstanceInfo testSubject; + Map> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + @Test + public void testSetProperties() throws Exception { + UploadComponentInstanceInfo testSubject; + Map> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + @Test + public void testGetName() throws Exception { + UploadComponentInstanceInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + UploadComponentInstanceInfo testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testGetType() throws Exception { + UploadComponentInstanceInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + @Test + public void testSetType() throws Exception { + UploadComponentInstanceInfo testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + @Test + public void testGetCapabilities() throws Exception { + UploadComponentInstanceInfo testSubject; + Map> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilities(); + } + + @Test + public void testSetCapabilities() throws Exception { + UploadComponentInstanceInfo testSubject; + Map> capabilities = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilities(capabilities); + } + + @Test + public void testGetRequirements() throws Exception { + UploadComponentInstanceInfo testSubject; + Map> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirements(); + } + + @Test + public void testSetRequirements() throws Exception { + UploadComponentInstanceInfo testSubject; + Map> requirements = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirements(requirements); + } + + @Test + public void testGetCapabilitiesNamesToUpdate() throws Exception { + UploadComponentInstanceInfo testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilitiesNamesToUpdate(); + } + + @Test + public void testSetCapabilitiesNamesToUpdate() throws Exception { + UploadComponentInstanceInfo testSubject; + Map capabilitiesNamesToUpdate = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilitiesNamesToUpdate(capabilitiesNamesToUpdate); + } + + @Test + public void testGetRequirementsNamesToUpdate() throws Exception { + UploadComponentInstanceInfo testSubject; + Map result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirementsNamesToUpdate(); + } + + @Test + public void testSetRequirementsNamesToUpdate() throws Exception { + UploadComponentInstanceInfo testSubject; + Map requirementsNamesToUpdate = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirementsNamesToUpdate(requirementsNamesToUpdate); + } +} \ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java index 3429f1ea49..39ea68c3fe 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model.jsontitan.utils; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtilsTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtilsTest.java index 64c4cd792b..9a7ccc7f26 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtilsTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtilsTest.java @@ -6,8 +6,6 @@ import java.util.Map; import java.util.Optional; import org.junit.Test; -import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; -import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.Operation; import org.openecomp.sdc.be.model.Resource; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java index bfefd00994..40f692ca41 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java @@ -1,19 +1,9 @@ package org.openecomp.sdc.be.model.operations.impl; -import static org.junit.Assert.*; -import java.util.*; -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.resources.data.AttributeData; -import org.openecomp.sdc.be.resources.data.AttributeValueData; -import org.openecomp.sdc.be.resources.data.ComponentInstanceData; import fj.data.Either; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtilTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtilTest.java index 877c7c40eb..c6df4f726e 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtilTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtilTest.java @@ -1,10 +1,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.tosca.ToscaType; -import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil.ConstraintInformation; public class ConstraintUtilTest { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverterTest.java index 500ecfc497..d5425504e6 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverterTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverterTest.java @@ -1,18 +1,19 @@ package org.openecomp.sdc.be.model.tosca.converters; -import com.google.gson.JsonObject; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; -import org.openecomp.sdc.be.model.PropertyDefinition; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; + +import com.google.gson.JsonObject; public class DataTypePropertyConverterTest { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/LowerCaseConverterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/LowerCaseConverterTest.java index d86f7f43f7..fe37d3e8c7 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/LowerCaseConverterTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/LowerCaseConverterTest.java @@ -2,9 +2,6 @@ package org.openecomp.sdc.be.model.tosca.converters; import java.util.Map; -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.model.DataTypeDefinition; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaFloatConverterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaFloatConverterTest.java index 7e9388ee1b..00ac26312d 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaFloatConverterTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaFloatConverterTest.java @@ -1,13 +1,13 @@ package org.openecomp.sdc.be.model.tosca.converters; -import org.junit.Test; - -import java.util.Collections; - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.junit.Assert.assertNull; +import java.util.Collections; + +import org.junit.Test; + public class ToscaFloatConverterTest { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverterTest.java index 02d8ed6632..9819e3f6e8 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverterTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverterTest.java @@ -1,12 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import static org.junit.Assert.*; -import java.util.*; -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; - -import com.google.gson.JsonElement; public class ToscaMapValueConverterTest { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/MapValidatorTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/MapValidatorTest.java index 6f33b19de3..c82894fe5e 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/MapValidatorTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/MapValidatorTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.model.tosca.validators; -import org.junit.Test; +import static org.junit.Assert.assertFalse; import java.util.Collections; -import static org.junit.Assert.*; +import org.junit.Test; public class MapValidatorTest { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/ToscaBooleanValidatorTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/ToscaBooleanValidatorTest.java index c1a99e754a..3070c3df4e 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/ToscaBooleanValidatorTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/ToscaBooleanValidatorTest.java @@ -2,9 +2,6 @@ package org.openecomp.sdc.be.model.tosca.validators; import java.util.Map; -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.model.DataTypeDefinition; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/FactoryUtilsTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/FactoryUtilsTest.java index 380111dc77..53ed77638c 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/FactoryUtilsTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/FactoryUtilsTest.java @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.unittests.utils; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; import org.openecomp.sdc.be.model.CapabilityDefinition; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/ModelConfDependentTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/ModelConfDependentTest.java new file mode 100644 index 0000000000..2135b668e6 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/ModelConfDependentTest.java @@ -0,0 +1,13 @@ +package org.openecomp.sdc.be.unittests.utils; + +import org.junit.BeforeClass; +import org.openecomp.sdc.common.test.BaseConfDependent; + +public class ModelConfDependentTest extends BaseConfDependent { + @BeforeClass + public static void setupBeforeClass() { + componentName = "catalog-model"; + confPath = "src/test/resources/config"; + setUp(); + } +} -- cgit 1.2.3-korg