diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2018-05-07 19:18:41 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-05-10 08:59:21 +0000 |
commit | f8694841d586cfb44c69a602d76bf19d1491e65a (patch) | |
tree | 3274a4d700902e388cb8bcbe52a164ad64919c17 /common-be/src | |
parent | 9597e97eddcc9b5ea3376fb8d49b02fe42f5d820 (diff) |
Raise JUnit coverage common-be
Change-Id: Ibb1bd666ea8e6815f56da6e4991846202239d351
Issue-ID: SDC-1298
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'common-be/src')
69 files changed, 3340 insertions, 116 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java index 9499529f03..a7f8152645 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java @@ -23,6 +23,7 @@ package org.openecomp.sdc.be.datatypes.components; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -159,13 +160,13 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio this.lastUpdateDate = other.getLastUpdateDate(); this.description = other.getDescription(); this.state = other.getState(); - this.tags = new ArrayList<>(other.getTags()); + this.tags = new ArrayList<>(other.getTags() != null ? other.getTags() : new LinkedList<>()); this.icon = other.getIcon(); this.contactId = other.getContactId(); this.UUID = other.getUUID(); this.normalizedName = other.getNormalizedName(); this.systemName = other.getSystemName(); - this.allVersions = new HashMap<>(other.getAllVersions()); + this.allVersions = new HashMap<>(other.getAllVersions() != null ? other.getAllVersions() : new HashMap<>()); this.isDeleted = other.isDeleted(); this.projectCode = other.getProjectCode(); this.csarUUID = other.getCsarUUID(); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java index c36c7f053d..7fbce574a9 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java @@ -172,7 +172,7 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti @Override public String getActualComponentType() { - return componentType.getValue(); + return componentType != null ? componentType.getValue() : ""; } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java index 57270f6eaa..384796b965 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java @@ -137,7 +137,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme } public void setName(String name) { - if (this.getInvariantName() == null) { + if (this.getInvariantName() == null && name != null) { this.setInvariantName(ValidationUtils.normalizeComponentInstanceName(name)); } setToscaPresentationValue(JsonPresentationFields.NAME, name); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java index 1ca067e047..66b51ed805 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java @@ -94,26 +94,32 @@ public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDa } @Override public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { - Map<String, T > collect = (Map<String, T >)mapToscaDataDefinition.entrySet().stream().filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue))); - - MapDataDefinition collectMap = new MapDataDefinition<>(collect); - - mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId())); - - return (T) collectMap; + if(mapToscaDataDefinition != null) { + Map<String, T > collect = (Map<String, T >)mapToscaDataDefinition.entrySet() + .stream() + .filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue))); + + MapDataDefinition collectMap = new MapDataDefinition<>(collect); + + mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId())); + + return (T) collectMap; + } + return (T) new MapDataDefinition(new HashMap<>()); } @Override public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) { Map<String, T > map = ((MapDataDefinition)other).getMapToscaDataDefinition(); - - map.entrySet().forEach(e ->{ - String key = e.getKey(); - if ( mapToscaDataDefinition.containsKey(key) ){ - e.getValue().mergeFunction(mapToscaDataDefinition.get(key), allowDefaultValueOverride); - } - }); + if(map != null) { + map.entrySet().forEach(e ->{ + String key = e.getKey(); + if ( mapToscaDataDefinition.containsKey(key) ){ + e.getValue().mergeFunction(mapToscaDataDefinition.get(key), allowDefaultValueOverride); + } + }); + } return other; } @Override diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java index 3cf8ce1266..d3637c25e5 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; - public enum PolicyTargetType { GROUPS("GROUPS"), diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java index d3855b5b1d..62ae62edab 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java @@ -126,6 +126,6 @@ public class ProductMetadataDataDefinition extends ComponentMetadataDataDefiniti @Override public String getActualComponentType() { - return getComponentType().getValue(); + return getComponentType() != null ? getComponentType().getValue() : null; } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java index 1092b8f24e..482933e399 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java @@ -402,7 +402,9 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria @Override public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride) { - if (this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && compareSchemaType(other)) { + if (this.getType() != null && + this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && + compareSchemaType(other)) { other.setOwnerId(getOwnerId()); if (allowDefaultValueOverride) { if (getDefaultValue() != null && !getDefaultValue().isEmpty()) { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java index e8bd775e78..e6c1469233 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java @@ -23,6 +23,7 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import java.io.Serializable; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -46,7 +47,7 @@ public class SchemaDefinition extends ToscaDataDefinition implements Serializabl public SchemaDefinition() { super(); - + properties = new HashMap<>(); } public SchemaDefinition(String derivedFrom, List<String> constraints, diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java index dbaab71c53..45fb003734 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java @@ -90,6 +90,10 @@ public enum ComponentTypeEnum { public static String findParamByType(ComponentTypeEnum type) { String ret = null; + if (type == null) { + return ret; + } + switch (type) { case RESOURCE: ret = RESOURCE_PARAM_NAME; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java index 38d297a893..f9bb92eade 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java @@ -42,6 +42,9 @@ public enum FilterKeyEnum { } public static List<String> getValidFiltersByAssetType(ComponentTypeEnum assetType) { + if(assetType == null) { + return null; + } switch (assetType) { case RESOURCE: return getAllFilters().subList(0, 3); diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java index b6eb5066f4..1c7e3e6765 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java @@ -11,7 +11,16 @@ public class CategoryDataDefinitionTest { private CategoryDataDefinition createTestSubject() { return new CategoryDataDefinition(); } + + @Test + public void testCopyConstructor() throws Exception { + CategoryDataDefinition testSubject; + String result; + // default test + testSubject = createTestSubject(); + CategoryDataDefinition categoryDataDefinition = new CategoryDataDefinition(testSubject); + } @Test public void testGetName() throws Exception { @@ -123,6 +132,10 @@ public class CategoryDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(new CategoryDataDefinition(testSubject)); + Assert.assertEquals(true, result); } diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinitionTest.java index 7eb64657d8..1d63447e79 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinitionTest.java @@ -10,6 +10,14 @@ public class GroupingDataDefinitionTest { return new GroupingDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + GroupingDataDefinition testSubject; + + // default test + testSubject = createTestSubject(); + GroupingDataDefinition groupingDataDefinition = new GroupingDataDefinition(testSubject); + } @Test public void testGetName() throws Exception { @@ -99,6 +107,10 @@ public class GroupingDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(new GroupingDataDefinition(testSubject)); + Assert.assertEquals(true, result); } diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinitionTest.java index 09a5574357..7ef3e26c63 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinitionTest.java @@ -12,6 +12,14 @@ public class SubCategoryDataDefinitionTest { return new SubCategoryDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + SubCategoryDataDefinition testSubject; + + // default test + testSubject = createTestSubject(); + SubCategoryDataDefinition subCategoryDataDefinition = new SubCategoryDataDefinition(testSubject); + } @Test public void testGetName() throws Exception { @@ -123,6 +131,10 @@ public class SubCategoryDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(new SubCategoryDataDefinition()); + Assert.assertEquals(true, result); } diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinitionTest.java index 2dd621bb32..e2374ff3c0 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinitionTest.java @@ -10,6 +10,15 @@ public class ResourceMetadataDataDefinitionTest { return new ResourceMetadataDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + ResourceMetadataDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + ResourceMetadataDataDefinition resourceMetadataDataDefinition = new ResourceMetadataDataDefinition(testSubject); + } @Test public void testGetVendorName() throws Exception { @@ -218,5 +227,18 @@ public class ResourceMetadataDataDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.equals(obj); + testSubject.equals(testSubject); + testSubject.equals(createTestSubject()); + } + + @Test + public void testGetActualComponentType() throws Exception { + ResourceMetadataDataDefinition testSubject; + Object obj = null; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getActualComponentType(); } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinitionTest.java index e4cb724953..97a8fc6cae 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinitionTest.java @@ -2,6 +2,7 @@ package org.openecomp.sdc.be.datatypes.components; import org.junit.Assert; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; public class ServiceMetadataDataDefinitionTest { @@ -10,6 +11,14 @@ public class ServiceMetadataDataDefinitionTest { return new ServiceMetadataDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + ServiceMetadataDataDefinition testSubject; + + // default test + testSubject = createTestSubject(); + ServiceMetadataDataDefinition serviceMetadataDataDefinition = new ServiceMetadataDataDefinition(testSubject); + } @Test public void testGetDistributionStatus() throws Exception { @@ -142,6 +151,17 @@ public class ServiceMetadataDataDefinitionTest { result = testSubject.hashCode(); } + @Test + public void testgetActualComponentType() throws Exception { + ServiceMetadataDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getActualComponentType(); + testSubject.setComponentType(ComponentTypeEnum.PRODUCT); + result = testSubject.getActualComponentType(); + } @Test public void testEquals() throws Exception { @@ -154,5 +174,9 @@ public class ServiceMetadataDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(new ServiceMetadataDataDefinition()); + Assert.assertEquals(true, result); } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinitionTest.java index 622361bb78..f73858e7b2 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinitionTest.java @@ -11,6 +11,15 @@ public class AdditionalInfoParameterDataDefinitionTest { return new AdditionalInfoParameterDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + AdditionalInfoParameterDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + AdditionalInfoParameterDataDefinition additionalInfoParameterDataDefinition = new AdditionalInfoParameterDataDefinition(testSubject); + } @Test public void testGetUniqueId() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfoTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfoTest.java new file mode 100644 index 0000000000..242d4f04c8 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfoTest.java @@ -0,0 +1,88 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import org.junit.Test; + +public class AdditionalInfoParameterInfoTest { + + private AdditionalInfoParameterInfo createTestSubject() { + return new AdditionalInfoParameterInfo(); + } + + @Test + public void testConstructors() throws Exception { + + // default test + new AdditionalInfoParameterInfo("stam", "stam"); + new AdditionalInfoParameterInfo("stam", "stam", "stam"); + } + + @Test + public void testGetUniqueId() throws Exception { + AdditionalInfoParameterInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + @Test + public void testSetUniqueId() throws Exception { + AdditionalInfoParameterInfo testSubject; + String uniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uniqueId); + } + + @Test + public void testGetKey() throws Exception { + AdditionalInfoParameterInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getKey(); + } + + @Test + public void testSetKey() throws Exception { + AdditionalInfoParameterInfo testSubject; + String key = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setKey(key); + } + + @Test + public void testGetValue() throws Exception { + AdditionalInfoParameterInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(); + } + + @Test + public void testSetValue() throws Exception { + AdditionalInfoParameterInfo testSubject; + String value = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setValue(value); + } + + @Test + public void testToString() throws Exception { + AdditionalInfoParameterInfo testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinitionTest.java index 4f58f02760..04e2461115 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinitionTest.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.be.datatypes.elements; +import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import org.junit.Assert; @@ -15,6 +17,15 @@ public class ArtifactDataDefinitionTest { @Test + public void testConstructors() throws Exception { + ArtifactDataDefinition artifactDataDefinition = new ArtifactDataDefinition(new HashMap<>()); + new ArtifactDataDefinition(artifactDataDefinition); + artifactDataDefinition.setRequiredArtifacts(new LinkedList<>()); + artifactDataDefinition.setHeatParameters(new LinkedList<>()); + new ArtifactDataDefinition(artifactDataDefinition); + } + + @Test public void testGetArtifactName() throws Exception { ArtifactDataDefinition testSubject; String result; @@ -730,5 +741,9 @@ public class ArtifactDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(new ArtifactDataDefinition(testSubject)); + Assert.assertEquals(true, result); } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinitionTest.java index 84f39609d9..72b1196234 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinitionTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.datatypes.elements; +import java.util.LinkedList; import java.util.List; import org.junit.Assert; @@ -12,6 +13,18 @@ public class CapabilityDataDefinitionTest { return new CapabilityDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + CapabilityDataDefinition testSubject; + + // default test + testSubject = createTestSubject(); + new CapabilityDataDefinition(testSubject); + testSubject.setValidSourceTypes(new LinkedList<>()); + testSubject.setCapabilitySources(new LinkedList<>()); + testSubject.setPath(new LinkedList<>()); + new CapabilityDataDefinition(testSubject); + } @Test public void testGetOwnerId() throws Exception { @@ -354,6 +367,10 @@ public class CapabilityDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); } diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinitionTest.java new file mode 100644 index 0000000000..ea2f205bac --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinitionTest.java @@ -0,0 +1,172 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.List; + +import org.junit.Test; + +public class CapabilityTypeDataDefinitionTest { + + private CapabilityTypeDataDefinition createTestSubject() { + return new CapabilityTypeDataDefinition(); + } + + @Test + public void testCopyConstructor() throws Exception { + CapabilityTypeDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new CapabilityTypeDataDefinition(testSubject); + } + + @Test + public void testGetUniqueId() throws Exception { + CapabilityTypeDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + @Test + public void testSetUniqueId() throws Exception { + CapabilityTypeDataDefinition testSubject; + String uniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uniqueId); + } + + @Test + public void testGetDescription() throws Exception { + CapabilityTypeDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + @Test + public void testSetDescription() throws Exception { + CapabilityTypeDataDefinition testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + @Test + public void testGetType() throws Exception { + CapabilityTypeDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + @Test + public void testSetType() throws Exception { + CapabilityTypeDataDefinition testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + @Test + public void testGetValidSourceTypes() throws Exception { + CapabilityTypeDataDefinition testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValidSourceTypes(); + } + + @Test + public void testSetValidSourceTypes() throws Exception { + CapabilityTypeDataDefinition testSubject; + List<String> validSourceTypes = null; + + // default test + testSubject = createTestSubject(); + testSubject.setValidSourceTypes(validSourceTypes); + } + + @Test + public void testGetVersion() throws Exception { + CapabilityTypeDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + @Test + public void testSetVersion() throws Exception { + CapabilityTypeDataDefinition testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + @Test + public void testGetCreationTime() throws Exception { + CapabilityTypeDataDefinition testSubject; + Long result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCreationTime(); + } + + @Test + public void testSetCreationTime() throws Exception { + CapabilityTypeDataDefinition testSubject; + Long creationTime = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCreationTime(creationTime); + } + + @Test + public void testGetModificationTime() throws Exception { + CapabilityTypeDataDefinition testSubject; + Long result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getModificationTime(); + } + + @Test + public void testSetModificationTime() throws Exception { + CapabilityTypeDataDefinition testSubject; + Long modificationTime = null; + + // default test + testSubject = createTestSubject(); + testSubject.setModificationTime(modificationTime); + } + + @Test + public void testToString() throws Exception { + CapabilityTypeDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinitionTest.java index fa7a3e2a19..87a1fa0b5f 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinitionTest.java @@ -3,14 +3,22 @@ package org.openecomp.sdc.be.datatypes.elements; import org.junit.Test; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; - public class ComponentInstanceDataDefinitionTest { private ComponentInstanceDataDefinition createTestSubject() { return new ComponentInstanceDataDefinition(); } - + @Test + public void testCopyConstructor() throws Exception { + ComponentInstanceDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new ComponentInstanceDataDefinition(testSubject); + } + @Test public void testGetIcon() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -21,7 +29,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getIcon(); } - @Test public void testSetIcon() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -32,7 +39,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setIcon(icon); } - @Test public void testGetUniqueId() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -43,7 +49,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getUniqueId(); } - @Test public void testSetUniqueId() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -54,7 +59,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setUniqueId(uniqueId); } - @Test public void testGetCreationTime() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -65,7 +69,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getCreationTime(); } - @Test public void testSetCreationTime() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -76,7 +79,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setCreationTime(creationTime); } - @Test public void testGetModificationTime() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -87,7 +89,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getModificationTime(); } - @Test public void testSetModificationTime() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -98,7 +99,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setModificationTime(modificationTime); } - @Test public void testGetDescription() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -109,7 +109,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getDescription(); } - @Test public void testSetDescription() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -120,7 +119,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setDescription(description); } - @Test public void testGetPosX() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -131,7 +129,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getPosX(); } - @Test public void testSetPosX() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -142,7 +139,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setPosX(posX); } - @Test public void testGetPosY() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -153,7 +149,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getPosY(); } - @Test public void testSetPosY() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -164,7 +159,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setPosY(posY); } - @Test public void testGetComponentUid() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -175,7 +169,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getComponentUid(); } - @Test public void testSetComponentUid() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -186,7 +179,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setComponentUid(resourceUid); } - @Test public void testGetName() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -197,7 +189,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getName(); } - @Test public void testSetName() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -208,7 +199,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setName(name); } - @Test public void testGetInvariantName() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -219,7 +209,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getInvariantName(); } - @Test public void testSetInvariantName() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -230,7 +219,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setInvariantName(invariantName); } - @Test public void testGetPropertyValueCounter() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -241,7 +229,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getPropertyValueCounter(); } - @Test public void testSetPropertyValueCounter() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -252,7 +239,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setPropertyValueCounter(propertyValueCounter); } - @Test public void testGetNormalizedName() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -263,7 +249,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getNormalizedName(); } - @Test public void testSetNormalizedName() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -274,7 +259,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setNormalizedName(normalizedName); } - @Test public void testGetOriginType() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -283,9 +267,10 @@ public class ComponentInstanceDataDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.getOriginType(); + testSubject.setOriginType(OriginTypeEnum.PRODUCT); + result = testSubject.getOriginType(); } - @Test public void testSetOriginType() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -295,9 +280,13 @@ public class ComponentInstanceDataDefinitionTest { testSubject = createTestSubject(); originType = null; testSubject.setOriginType(originType); + + // test 2 + testSubject = createTestSubject(); + originType = null; + testSubject.setOriginType(OriginTypeEnum.PRODUCT); } - @Test public void testGetAttributeValueCounter() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -308,7 +297,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getAttributeValueCounter(); } - @Test public void testSetAttributeValueCounter() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -319,7 +307,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setAttributeValueCounter(attributeValueCounter); } - @Test public void testGetInputValueCounter() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -330,7 +317,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getInputValueCounter(); } - @Test public void testSetInputValueCounter() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -341,7 +327,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setInputValueCounter(inputValueCounter); } - @Test public void testGetCustomizationUUID() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -352,7 +337,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getCustomizationUUID(); } - @Test public void testSetCustomizationUUID() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -363,7 +347,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setCustomizationUUID(customizationUUID); } - @Test public void testGetComponentName() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -374,7 +357,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getComponentName(); } - @Test public void testSetComponentName() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -385,7 +367,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setComponentName(resourceName); } - @Test public void testGetComponentVersion() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -396,7 +377,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getComponentVersion(); } - @Test public void testGetToscaComponentName() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -407,7 +387,6 @@ public class ComponentInstanceDataDefinitionTest { result = testSubject.getToscaComponentName(); } - @Test public void testSetToscaComponentName() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -418,7 +397,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setToscaComponentName(toscaComponentName); } - @Test public void testSetComponentVersion() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -429,7 +407,6 @@ public class ComponentInstanceDataDefinitionTest { testSubject.setComponentVersion(resourceVersion); } - @Test public void testToString() throws Exception { ComponentInstanceDataDefinition testSubject; @@ -439,4 +416,115 @@ public class ComponentInstanceDataDefinitionTest { testSubject = createTestSubject(); result = testSubject.toString(); } + + @Test + public void testSetSourceModelInvariant() throws Exception { + ComponentInstanceDataDefinition testSubject; + String targetModelInvariant = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSourceModelInvariant(targetModelInvariant); + } + + @Test + public void testSetSourceModelName() throws Exception { + ComponentInstanceDataDefinition testSubject; + String targetModelName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSourceModelName(targetModelName); + } + + @Test + public void testSetSourceModelUid() throws Exception { + ComponentInstanceDataDefinition testSubject; + String targetModelUid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSourceModelUid(targetModelUid); + } + + @Test + public void testSetSourceModelUuid() throws Exception { + ComponentInstanceDataDefinition testSubject; + String targetModelUuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSourceModelUuid(targetModelUuid); + } + + @Test + public void testGetIsProxy() throws Exception { + ComponentInstanceDataDefinition testSubject; + Boolean result; + + // default test 1 + testSubject = createTestSubject(); + result = testSubject.getIsProxy(); + } + + @Test + public void testGetSourceModelUuid() throws Exception { + ComponentInstanceDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSourceModelUuid(); + } + + @Test + public void testGetSourceModelUid() throws Exception { + ComponentInstanceDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSourceModelUid(); + } + + @Test + public void testGetSourceModelName() throws Exception { + ComponentInstanceDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSourceModelName(); + } + + @Test + public void testGetSourceModelInvariant() throws Exception { + ComponentInstanceDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSourceModelInvariant(); + } + + @Test + public void testSetIsProxy() throws Exception { + ComponentInstanceDataDefinition testSubject; + Boolean isProxy = null; + + // test 1 + testSubject = createTestSubject(); + isProxy = null; + testSubject.setIsProxy(isProxy); + } + + @Test + public void testGetIsProxy_1() throws Exception { + ComponentInstanceDataDefinition testSubject; + Boolean result; + + // default test 1 + testSubject = createTestSubject(); + result = testSubject.getIsProxy(); + } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java index bd9f4fff14..0776bb5ed6 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java @@ -10,6 +10,15 @@ public class ConsumerDataDefinitionTest { return new ConsumerDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + ConsumerDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new ConsumerDataDefinition(testSubject); + } @Test public void testGetConsumerName() throws Exception { @@ -176,5 +185,9 @@ public class ConsumerDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(new ConsumerDataDefinition(testSubject)); + Assert.assertEquals(true, result); } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinitionTest.java index 23022ee326..ccd2b54af3 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinitionTest.java @@ -9,6 +9,15 @@ public class DataTypeDataDefinitionTest { return new DataTypeDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + DataTypeDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new DataTypeDataDefinition(testSubject); + } @Test public void testGetName() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinitionTest.java new file mode 100644 index 0000000000..974b73e4bc --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinitionTest.java @@ -0,0 +1,161 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import org.junit.Test; + +public class ForwardingPathDataDefinitionTest { + + private ForwardingPathDataDefinition createTestSubject() { + return new ForwardingPathDataDefinition(); + } + + @Test + public void testConstructors() throws Exception { + ForwardingPathDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new ForwardingPathDataDefinition("mock"); + new ForwardingPathDataDefinition(testSubject); + } + + @Test + public void testGetName() throws Exception { + ForwardingPathDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + ForwardingPathDataDefinition testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testGetPathElements() throws Exception { + ForwardingPathDataDefinition testSubject; + ListDataDefinition<ForwardingPathElementDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getPathElements(); + } + + @Test + public void testSetPathElements() throws Exception { + ForwardingPathDataDefinition testSubject; + ListDataDefinition<ForwardingPathElementDataDefinition> pathElements = null; + + // default test + testSubject = createTestSubject(); + testSubject.setPathElements(pathElements); + } + + @Test + public void testGetUniqueId() throws Exception { + ForwardingPathDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + @Test + public void testSetUniqueId() throws Exception { + ForwardingPathDataDefinition testSubject; + String uid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uid); + } + + @Test + public void testGetProtocol() throws Exception { + ForwardingPathDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProtocol(); + } + + @Test + public void testSetProtocol() throws Exception { + ForwardingPathDataDefinition testSubject; + String protocol = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setProtocol(protocol); + } + + @Test + public void testGetDestinationPortNumber() throws Exception { + ForwardingPathDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDestinationPortNumber(); + } + + @Test + public void testSetDestinationPortNumber() throws Exception { + ForwardingPathDataDefinition testSubject; + String destinationPortNumber = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDestinationPortNumber(destinationPortNumber); + } + + @Test + public void testGetDescription() throws Exception { + ForwardingPathDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + @Test + public void testSetDescription() throws Exception { + ForwardingPathDataDefinition testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + @Test + public void testGetToscaResourceName() throws Exception { + ForwardingPathDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaResourceName(); + } + + @Test + public void testSetToscaResourceName() throws Exception { + ForwardingPathDataDefinition testSubject; + String toscaResourceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaResourceName(toscaResourceName); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinitionTest.java new file mode 100644 index 0000000000..ebed48ec5b --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinitionTest.java @@ -0,0 +1,178 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import org.junit.Assert; +import org.junit.Test; + +public class ForwardingPathElementDataDefinitionTest { + + private ForwardingPathElementDataDefinition createTestSubject() { + return new ForwardingPathElementDataDefinition(); + } + + @Test + public void testConstructors() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new ForwardingPathElementDataDefinition(testSubject); + new ForwardingPathElementDataDefinition("mock", "mock", "mock", "mock", "mock", "mock"); + } + + @Test + public void testGetFromNode() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getFromNode(); + } + + @Test + public void testSetFromNode() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String fromNode = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setFromNode(fromNode); + } + + @Test + public void testGetToNode() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToNode(); + } + + @Test + public void testSetToNode() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String toNode = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToNode(toNode); + } + + @Test + public void testGetFromCP() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getFromCP(); + } + + @Test + public void testSetFromCP() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String fromCP = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setFromCP(fromCP); + } + + @Test + public void testGetToCP() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToCP(); + } + + @Test + public void testSetToCP() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String toCP = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToCP(toCP); + } + + @Test + public void testGetToCPOriginId() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToCPOriginId(); + } + + @Test + public void testSetToCPOriginId() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String toCPOriginId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToCPOriginId(toCPOriginId); + } + + @Test + public void testGetFromCPOriginId() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getFromCPOriginId(); + } + + @Test + public void testSetFromCPOriginId() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String fromCPOriginId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setFromCPOriginId(fromCPOriginId); + } + + @Test + public void testEquals() throws Exception { + ForwardingPathElementDataDefinition testSubject; + Object o = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + result = testSubject.equals(o); + Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); + } + + @Test + public void testHashCode() throws Exception { + ForwardingPathElementDataDefinition testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + @Test + public void testToString() throws Exception { + ForwardingPathElementDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinitionTest.java index 718bde7851..bfc9749562 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinitionTest.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.be.datatypes.elements; +import java.util.HashMap; + import org.junit.Assert; import org.junit.Test; @@ -10,6 +12,15 @@ public class GetInputValueDataDefinitionTest { return new GetInputValueDataDefinition(); } + @Test + public void testConstructors() throws Exception { + GetInputValueDataDefinition testSubject; + + // default test + testSubject = createTestSubject(); + new GetInputValueDataDefinition(testSubject); + new GetInputValueDataDefinition(new HashMap<>()); + } @Test public void testGetPropName() throws Exception { @@ -176,5 +187,9 @@ public class GetInputValueDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinitionTest.java index 12b0293e83..c4b7045193 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinitionTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.datatypes.elements; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -12,6 +13,16 @@ public class GroupDataDefinitionTest { return new GroupDataDefinition(); } + @Test + public void testConstructors() throws Exception { + GroupDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new GroupDataDefinition(testSubject); + new GroupDataDefinition(new HashMap<>()); + } @Test public void testGetName() throws Exception { @@ -308,4 +319,14 @@ public class GroupDataDefinitionTest { testSubject = createTestSubject(); result = testSubject.toString(); } + + @Test + public void testContainsInstanceAsMember() throws Exception { + GroupDataDefinition testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.containsInstanceAsMember(""); + } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinitionTest.java index bd7a3a9280..3328f5e46b 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinitionTest.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.be.datatypes.elements; +import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import org.junit.Test; @@ -11,6 +13,22 @@ public class GroupInstanceDataDefinitionTest { return new GroupInstanceDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + GroupInstanceDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new GroupInstanceDataDefinition(testSubject); + testSubject.setArtifacts(new LinkedList<>()); + testSubject.setArtifactsUuid(new LinkedList<>()); + testSubject.setGroupInstanceArtifacts(new LinkedList<>()); + testSubject.setGroupInstanceArtifactsUuid(new LinkedList<>()); + testSubject.setProperties(new LinkedList<>()); + new GroupInstanceDataDefinition(testSubject); + new GroupInstanceDataDefinition(new HashMap<>()); + } @Test public void testGetUniqueId() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinitionTest.java index 01c7067733..ae62dbc339 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinitionTest.java @@ -12,6 +12,15 @@ public class GroupTypeDataDefinitionTest { return new GroupTypeDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + GroupTypeDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new GroupTypeDataDefinition(testSubject); + } @Test public void testGetType() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinitionTest.java index c8ef6afe2d..28c1958784 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinitionTest.java @@ -10,6 +10,15 @@ public class HeatParameterDataDefinitionTest { return new HeatParameterDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + HeatParameterDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new HeatParameterDataDefinition(testSubject); + } @Test public void testGetUniqueId() throws Exception { @@ -176,5 +185,9 @@ public class HeatParameterDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinitionTest.java index 83ff039e79..b8e0a1fd72 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinitionTest.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.be.datatypes.elements; +import java.util.HashMap; + import org.junit.Test; @@ -9,6 +11,17 @@ public class InputDataDefinitionTest { return new InputDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + InputDataDefinition testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + new InputDataDefinition(testSubject); + new InputDataDefinition(new HashMap<>()); + new InputDataDefinition(new PropertyDataDefinition()); + } @Test public void testIsHidden() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinitionTest.java index 5513ec6077..4b8d3651c1 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinitionTest.java @@ -6,9 +6,13 @@ import org.junit.Test; public class InputsValueDataDefinitionTest { private InputsValueDataDefinition createTestSubject() { - return new InputsValueDataDefinition("", ""); + return new InputsValueDataDefinition(); } + @Test + public void testOverloadConstructor() throws Exception { + new InputsValueDataDefinition("", ""); + } @Test public void testGetUniqueId() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java index 1bf03b15dd..63d4e0ded6 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java @@ -11,6 +11,18 @@ public class InterfaceDataDefinitionTest { return new InterfaceDataDefinition(); } + @Test + public void testOverloadConstructors() throws Exception { + InterfaceDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + + new InterfaceDataDefinition(testSubject); + new InterfaceDataDefinition("",""); + } @Test public void testGetUniqueId() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinitionTest.java new file mode 100644 index 0000000000..e0e07fd259 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinitionTest.java @@ -0,0 +1,159 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import org.junit.Test; + +public class InterfaceOperationDataDefinitionTest { + + private InterfaceOperationDataDefinition createTestSubject() { + return new InterfaceOperationDataDefinition(); + } + + @Test + public void testCopyConstructor() throws Exception { + InterfaceOperationDataDefinition testSubject; + + // default test + testSubject = createTestSubject(); + new InterfaceOperationDataDefinition(testSubject); + } + + @Test + public void testGetInputParams() throws Exception { + InterfaceOperationDataDefinition testSubject; + ListDataDefinition<InterfaceOperationParamDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInputParams(); + } + + @Test + public void testSetInputParams() throws Exception { + InterfaceOperationDataDefinition testSubject; + ListDataDefinition<InterfaceOperationParamDataDefinition> inputParams = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInputParams(inputParams); + } + + @Test + public void testGetOutputParams() throws Exception { + InterfaceOperationDataDefinition testSubject; + ListDataDefinition<InterfaceOperationParamDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOutputParams(); + } + + @Test + public void testSetOutputParams() throws Exception { + InterfaceOperationDataDefinition testSubject; + ListDataDefinition<InterfaceOperationParamDataDefinition> outputParams = null; + + // default test + testSubject = createTestSubject(); + testSubject.setOutputParams(outputParams); + } + + @Test + public void testGetUniqueId() throws Exception { + InterfaceOperationDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + @Test + public void testSetUniqueId() throws Exception { + InterfaceOperationDataDefinition testSubject; + String uid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uid); + } + + @Test + public void testGetDescription() throws Exception { + InterfaceOperationDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + @Test + public void testSetDescription() throws Exception { + InterfaceOperationDataDefinition testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + @Test + public void testGetOperationType() throws Exception { + InterfaceOperationDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOperationType(); + } + + @Test + public void testSetOperationType() throws Exception { + InterfaceOperationDataDefinition testSubject; + String operationType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setOperationType(operationType); + } + + @Test + public void testGetToscaResourceName() throws Exception { + InterfaceOperationDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaResourceName(); + } + + @Test + public void testSetToscaResourceName() throws Exception { + InterfaceOperationDataDefinition testSubject; + String toscaResourceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaResourceName(toscaResourceName); + } + + @Test + public void testGetArtifactUUID() throws Exception { + InterfaceOperationDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactUUID(); + } + + @Test + public void testSetArtifactUUID() throws Exception { + InterfaceOperationDataDefinition testSubject; + String artifactUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactUUID(artifactUUID); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java new file mode 100644 index 0000000000..d4f3161ed7 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java @@ -0,0 +1,61 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import org.junit.Test; + +public class InterfaceOperationParamDataDefinitionTest { + + private InterfaceOperationParamDataDefinition createTestSubject() { + return new InterfaceOperationParamDataDefinition(); + } + + @Test + public void testOverloadConstructor() throws Exception { + InterfaceOperationParamDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new InterfaceOperationParamDataDefinition(testSubject); + new InterfaceOperationParamDataDefinition("", ""); + } + + @Test + public void testGetParamName() throws Exception { + InterfaceOperationParamDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getParamName(); + } + + @Test + public void testSetParamName() throws Exception { + InterfaceOperationParamDataDefinition testSubject; + String paramName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setParamName(paramName); + } + + @Test + public void testGetParamId() throws Exception { + InterfaceOperationParamDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getParamId(); + } + + @Test + public void testSetParamId() throws Exception { + InterfaceOperationParamDataDefinition testSubject; + String paramId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setParamId(paramId); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinitionTest.java index fa7adbc2a2..848b553738 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinitionTest.java @@ -1,6 +1,6 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import org.junit.Test; @@ -9,10 +9,19 @@ import org.junit.Test; public class ListCapabilityDataDefinitionTest { private ListCapabilityDataDefinition createTestSubject() { - List list = new ArrayList<>(); - return new ListCapabilityDataDefinition(list); + return new ListCapabilityDataDefinition(); } + @Test + public void testOverloadConstructors() throws Exception { + ListCapabilityDataDefinition testSubject; + List<CapabilityDataDefinition> result; + + // default test + testSubject = createTestSubject(); + new ListCapabilityDataDefinition(testSubject); + new ListCapabilityDataDefinition(new LinkedList<>()); + } @Test public void testGetListToscaDataDefinition() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinitionTest.java index 15daeb15d3..5b9769ff0d 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinitionTest.java @@ -1,22 +1,26 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.ArrayList; import java.util.List; +import java.util.Set; import org.junit.Test; - +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class ListDataDefinitionTest { private ListDataDefinition createTestSubject() { - List list = new ArrayList<>(); - return new ListDataDefinition(list); + return new ListDataDefinition<AdditionalInfoParameterDataDefinition>(); } - - - + @Test + public void testCopyConstructor() throws Exception { + ListDataDefinition testSubject; + String ownerId = ""; + // default test + testSubject = createTestSubject(); + new ListDataDefinition<AdditionalInfoParameterDataDefinition>(testSubject); + } @Test public void testSetOwnerIdIfEmpty() throws Exception { @@ -28,10 +32,6 @@ public class ListDataDefinitionTest { testSubject.setOwnerIdIfEmpty(ownerId); } - - - - @Test public void testFindUidMatch() throws Exception { ListDataDefinition testSubject; @@ -42,4 +42,72 @@ public class ListDataDefinitionTest { testSubject = createTestSubject(); result = testSubject.findUidMatch(uid); } + + @Test + public void testGetListToscaDataDefinition() throws Exception { + ListDataDefinition testSubject; + List result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getListToscaDataDefinition(); + } + + @Test + public void testAdd() throws Exception { + ListDataDefinition testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.add(new AdditionalInfoParameterDataDefinition()); + } + + @Test + public void testDelete() throws Exception { + ListDataDefinition testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.delete(new AdditionalInfoParameterDataDefinition()); + } + + @Test + public void testMergeFunction() throws Exception { + ListDataDefinition testSubject; + boolean allowDefaultValueOverride = false; + + // default test + testSubject = createTestSubject(); + ToscaDataDefinition result = testSubject.mergeFunction(testSubject, allowDefaultValueOverride); + } + + @Test + public void testRemoveByOwnerId() throws Exception { + ListDataDefinition testSubject; + Set<String> ownerIdList = null; + + // default test + testSubject = createTestSubject(); + ToscaDataDefinition result = testSubject.removeByOwnerId(ownerIdList); + } + + @Test + public void testUpdateIfExist() throws Exception { + ListDataDefinition testSubject; + boolean allowDefaultValueOverride = false; + + // default test + testSubject = createTestSubject(); + ToscaDataDefinition result = testSubject.updateIfExist(testSubject, true); + } + + @Test + public void testIsEmpty() throws Exception { + ListDataDefinition testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isEmpty(); + } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinitionTest.java index 58586e787d..2939950386 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinitionTest.java @@ -1,6 +1,6 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import org.junit.Test; @@ -9,10 +9,19 @@ import org.junit.Test; public class ListMapPropertiesDataDefinitionTest { private ListMapPropertiesDataDefinition createTestSubject() { - List list = new ArrayList<>(); - return new ListMapPropertiesDataDefinition(list); + return new ListMapPropertiesDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + ListMapPropertiesDataDefinition testSubject; + List<MapPropertiesDataDefinition> result; + + // default test + testSubject = createTestSubject(); + new ListMapPropertiesDataDefinition(testSubject); + new ListMapPropertiesDataDefinition(new LinkedList<>()); + } @Test public void testGetListToscaDataDefinition() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinitionTest.java index 6831c0d06d..682c43cc8c 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinitionTest.java @@ -1,6 +1,6 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import org.junit.Test; @@ -9,10 +9,20 @@ import org.junit.Test; public class ListRequirementDataDefinitionTest { private ListRequirementDataDefinition createTestSubject() { - List list = new ArrayList<>(); - return new ListRequirementDataDefinition(list); + return new ListRequirementDataDefinition(); } + @Test + public void testOverloadConstructors() throws Exception { + ListRequirementDataDefinition testSubject; + List<RequirementDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getListToscaDataDefinition(); + new ListRequirementDataDefinition(testSubject); + new ListRequirementDataDefinition(new LinkedList<>()); + } @Test public void testGetListToscaDataDefinition() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinitionTest.java index 934bc2c2f7..0b2366080b 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinitionTest.java @@ -9,12 +9,19 @@ import org.junit.Test; public class MapArtifactDataDefinitionTest { private MapArtifactDataDefinition createTestSubject() { - - Map map = new HashMap<>(); - - return new MapArtifactDataDefinition(new MapDataDefinition(map), ""); + return new MapArtifactDataDefinition(); } + @Test + public void testOverloadConstructors() throws Exception { + MapArtifactDataDefinition testSubject; + Map<String, ArtifactDataDefinition> result; + + // default test + testSubject = createTestSubject(); + new MapArtifactDataDefinition(new HashMap<>()); + new MapArtifactDataDefinition(testSubject, ""); + } @Test public void testGetMapToscaDataDefinition() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabiltyPropertyTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabiltyPropertyTest.java new file mode 100644 index 0000000000..914dc11d46 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabiltyPropertyTest.java @@ -0,0 +1,43 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +public class MapCapabiltyPropertyTest { + + private MapCapabiltyProperty createTestSubject() { + return new MapCapabiltyProperty(); + } + + @Test + public void testOverloadConstructor() throws Exception { + MapCapabiltyProperty testSubject; + Map<String, MapPropertiesDataDefinition> result; + + // default test + testSubject = createTestSubject(); + new MapCapabiltyProperty(new HashMap<>()); + } + + @Test + public void testGetMapToscaDataDefinition() throws Exception { + MapCapabiltyProperty testSubject; + Map<String, MapPropertiesDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMapToscaDataDefinition(); + } + + @Test + public void testSetMapToscaDataDefinition() throws Exception { + MapCapabiltyProperty testSubject; + Map<String, MapPropertiesDataDefinition> mapToscaDataDefinition = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMapToscaDataDefinition(mapToscaDataDefinition); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefsTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefsTest.java new file mode 100644 index 0000000000..068ff77b17 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefsTest.java @@ -0,0 +1,81 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.List; +import java.util.Map; + +import org.junit.Test; + +public class MapComponentInstanceExternalRefsTest { + + private MapComponentInstanceExternalRefs createTestSubject() { + return new MapComponentInstanceExternalRefs(); + } + + @Test + public void testGetComponentInstanceExternalRefs() throws Exception { + MapComponentInstanceExternalRefs testSubject; + Map<String, List<String>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getComponentInstanceExternalRefs(); + } + + @Test + public void testGetExternalRefsByObjectType() throws Exception { + MapComponentInstanceExternalRefs testSubject; + String objectType = ""; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getExternalRefsByObjectType(objectType); + } + + @Test + public void testSetComponentInstanceExternalRefs() throws Exception { + MapComponentInstanceExternalRefs testSubject; + Map<String, List<String>> componentInstanceExternalRefs = null; + + // default test + testSubject = createTestSubject(); + testSubject.setComponentInstanceExternalRefs(componentInstanceExternalRefs); + } + + @Test + public void testAddExternalRef() throws Exception { + MapComponentInstanceExternalRefs testSubject; + String objectType = ""; + String ref = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.addExternalRef(objectType, ref); + } + + @Test + public void testDeleteExternalRef() throws Exception { + MapComponentInstanceExternalRefs testSubject; + String objectType = ""; + String ref = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteExternalRef(objectType, ref); + } + + @Test + public void testReplaceExternalRef() throws Exception { + MapComponentInstanceExternalRefs testSubject; + String objectType = ""; + String oldRef = ""; + String newRef = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.replaceExternalRef(objectType, oldRef, newRef); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinitionTest.java index 24461591c4..ae7f63c505 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinitionTest.java @@ -1,24 +1,22 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import org.junit.Test; - +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class MapDataDefinitionTest { private MapDataDefinition createTestSubject() { - Map myMap = new HashMap<>(); - return new MapDataDefinition(myMap); + return new MapDataDefinition(); } - - - - - - + @Test + public void testCopyConstructor() throws Exception { + new MapDataDefinition(createTestSubject()); + } @Test public void testDelete() throws Exception { @@ -30,10 +28,6 @@ public class MapDataDefinitionTest { testSubject.delete(key); } - - - - @Test public void testSetOwnerIdIfEmpty() throws Exception { MapDataDefinition testSubject; @@ -44,7 +38,6 @@ public class MapDataDefinitionTest { testSubject.setOwnerIdIfEmpty(ownerId); } - @Test public void testFindKeyByItemUidMatch() throws Exception { MapDataDefinition testSubject; @@ -55,4 +48,68 @@ public class MapDataDefinitionTest { testSubject = createTestSubject(); result = testSubject.findKeyByItemUidMatch(uid); } + + @Test + public void testGetMapToscaDataDefinition() throws Exception { + MapDataDefinition testSubject; + Map<String, MapDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMapToscaDataDefinition(); + } + + @Test + public void testPut() throws Exception { + MapDataDefinition testSubject; + String key = ""; + ToscaDataDefinition value = null; + + // default test + testSubject = createTestSubject(); + testSubject.put(key, value); + } + + @Test + public void testFindByKey() throws Exception { + MapDataDefinition testSubject; + String key = ""; + ToscaDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.findByKey(key); + } + + @Test + public void testRemoveByOwnerId() throws Exception { + MapDataDefinition testSubject; + ToscaDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.removeByOwnerId(new HashSet<>()); + } + + @Test + public void testUpdateIfExist() throws Exception { + MapDataDefinition testSubject; + ToscaDataDefinition other = null; + boolean allowDefaultValueOverride = true; + ToscaDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.updateIfExist(testSubject, allowDefaultValueOverride); + } + + @Test + public void testIsEmpty() throws Exception { + MapDataDefinition testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isEmpty(); + } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinitionTest.java new file mode 100644 index 0000000000..0784f6439a --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinitionTest.java @@ -0,0 +1,63 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.Map; + +import org.apache.commons.collections.map.HashedMap; +import org.junit.Test; + +public class MapGroupsDataDefinitionTest { + + private MapGroupsDataDefinition createTestSubject() { + return new MapGroupsDataDefinition(); + } + + @Test + public void testConstructors() throws Exception { + MapGroupsDataDefinition testSubject; + Map<String, GroupInstanceDataDefinition> result; + + // default test + new MapGroupsDataDefinition(new HashedMap()); + new MapGroupsDataDefinition(new MapDataDefinition<>(), ""); + } + + @Test + public void testGetMapToscaDataDefinition() throws Exception { + MapGroupsDataDefinition testSubject; + Map<String, GroupInstanceDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMapToscaDataDefinition(); + } + + @Test + public void testSetMapToscaDataDefinition() throws Exception { + MapGroupsDataDefinition testSubject; + Map<String, GroupInstanceDataDefinition> mapToscaDataDefinition = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMapToscaDataDefinition(mapToscaDataDefinition); + } + + @Test + public void testGetParentName() throws Exception { + MapGroupsDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getParentName(); + } + + @Test + public void testSetParentName() throws Exception { + MapGroupsDataDefinition testSubject; + String parentName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setParentName(parentName); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinitionTest.java index b931cbfa3b..f335c4a45b 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinitionTest.java @@ -1,18 +1,26 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.HashMap; import java.util.Map; +import org.apache.commons.collections.map.HashedMap; import org.junit.Test; public class MapListCapabiltyDataDefinitionTest { private MapListCapabiltyDataDefinition createTestSubject() { - Map map = new HashMap<>(); - return new MapListCapabiltyDataDefinition(map); + return new MapListCapabiltyDataDefinition(); } + @Test + public void testConstructors() throws Exception { + MapListCapabiltyDataDefinition testSubject; + Map<String, ListCapabilityDataDefinition> result; + + // default test + new MapListCapabiltyDataDefinition(new HashedMap()); + new MapListCapabiltyDataDefinition(createTestSubject()); + } @Test public void testGetMapToscaDataDefinition() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinitionTest.java index 1bbe8e6e13..56ea2baedb 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinitionTest.java @@ -9,10 +9,19 @@ import org.junit.Test; public class MapPropertiesDataDefinitionTest { private MapPropertiesDataDefinition createTestSubject() { - Map map = new HashMap<>(); - return new MapPropertiesDataDefinition(new MapDataDefinition(map), ""); + return new MapPropertiesDataDefinition(); } + @Test + public void testConstructors() throws Exception { + MapPropertiesDataDefinition testSubject; + Map<String, PropertyDataDefinition> result; + + // default test + testSubject = createTestSubject(); + new MapPropertiesDataDefinition(new HashMap<>()); + new MapPropertiesDataDefinition(testSubject); + } @Test public void testGetMapToscaDataDefinition() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinitionTest.java index 59fd79b731..f582940a7f 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinitionTest.java @@ -9,6 +9,16 @@ public class OperationDataDefinitionTest { return new OperationDataDefinition(); } + @Test + public void testConstructors() throws Exception { + OperationDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new OperationDataDefinition(testSubject); + new OperationDataDefinition("mock"); + } @Test public void testGetUniqueId() throws Exception { @@ -20,7 +30,6 @@ public class OperationDataDefinitionTest { result = testSubject.getUniqueId(); } - @Test public void testSetUniqueId() throws Exception { OperationDataDefinition testSubject; diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinitionTest.java new file mode 100644 index 0000000000..4dc0194f7b --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinitionTest.java @@ -0,0 +1,41 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import org.junit.Test; + +public class OperationInputDefinitionTest { + + private OperationInputDefinition createTestSubject() { + return new OperationInputDefinition(); + } + + @Test + public void testConstructors() throws Exception { + OperationInputDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new OperationInputDefinition("", ""); + new OperationInputDefinition("stam", testSubject); + } + + @Test + public void testGetLabel() throws Exception { + OperationInputDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLabel(); + } + + @Test + public void testSetLabel() throws Exception { + OperationInputDefinition testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLabel(name); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinitionTest.java new file mode 100644 index 0000000000..f3e4f29ae7 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinitionTest.java @@ -0,0 +1,316 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; + +public class PolicyDataDefinitionTest { + + private PolicyDataDefinition createTestSubject() { + return new PolicyDataDefinition(); + } + + @Test + public void testConstructors() throws Exception { + PolicyDataDefinition testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + new PolicyDataDefinition(new HashMap<>()); + new PolicyDataDefinition(testSubject); + } + + @Test + public void testGetIsFromCsar() throws Exception { + PolicyDataDefinition testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getIsFromCsar(); + } + + @Test + public void testGetComponentName() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getComponentName(); + } + + @Test + public void testSetComponentName() throws Exception { + PolicyDataDefinition testSubject; + String componentName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setComponentName(componentName); + } + + @Test + public void testGetInvariantName() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantName(); + } + + @Test + public void testSetInvariantName() throws Exception { + PolicyDataDefinition testSubject; + Object invariantName = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantName(invariantName); + } + + @Test + public void testGetName() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + PolicyDataDefinition testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testGetUniqueId() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + @Test + public void testSetUniqueId() throws Exception { + PolicyDataDefinition testSubject; + String uniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uniqueId); + } + + @Test + public void testGetPolicyTypeName() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getPolicyTypeName(); + } + + @Test + public void testSetPolicyTypeName() throws Exception { + PolicyDataDefinition testSubject; + String policyTypeName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setPolicyTypeName(policyTypeName); + } + + @Test + public void testGetPolicyTypeUid() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getPolicyTypeUid(); + } + + @Test + public void testSetPolicyTypeUid() throws Exception { + PolicyDataDefinition testSubject; + String policyTypeUid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setPolicyTypeUid(policyTypeUid); + } + + @Test + public void testGetVersion() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + @Test + public void testSetVersion() throws Exception { + PolicyDataDefinition testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + @Test + public void testGetDerivedFrom() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDerivedFrom(); + } + + @Test + public void testSetDerivedFrom() throws Exception { + PolicyDataDefinition testSubject; + String derivedFrom = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDerivedFrom(derivedFrom); + } + + @Test + public void testGetDescription() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + @Test + public void testSetDescription() throws Exception { + PolicyDataDefinition testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + @Test + public void testGetPolicyUUID() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getPolicyUUID(); + } + + @Test + public void testSetPolicyUUID() throws Exception { + PolicyDataDefinition testSubject; + String policyUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setPolicyUUID(policyUUID); + } + + @Test + public void testGetInvariantUUID() throws Exception { + PolicyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantUUID(); + } + + @Test + public void testSetInvariantUUID() throws Exception { + PolicyDataDefinition testSubject; + String invariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUUID(invariantUUID); + } + + @Test + public void testGetProperties() throws Exception { + PolicyDataDefinition testSubject; + List<PropertyDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + @Test + public void testSetProperties() throws Exception { + PolicyDataDefinition testSubject; + List<PropertyDataDefinition> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + @Test + public void testGetTargets() throws Exception { + PolicyDataDefinition testSubject; + Map<PolicyTargetType, List<String>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTargets(); + } + + @Test + public void testSetTargets() throws Exception { + PolicyDataDefinition testSubject; + Map<PolicyTargetType, List<String>> metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setTargets(metadata); + } + + @Test + public void testResolveComponentInstanceTargets() throws Exception { + PolicyDataDefinition testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.resolveComponentInstanceTargets(); + } + + @Test + public void testContainsCmptInstanceAsTarget() throws Exception { + PolicyDataDefinition testSubject; + String cmptInstId = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.containsCmptInstanceAsTarget(cmptInstId); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetTypeTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetTypeTest.java new file mode 100644 index 0000000000..61bdc1ab46 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetTypeTest.java @@ -0,0 +1,29 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import org.junit.Test; + +public class PolicyTargetTypeTest { + + private PolicyTargetType createTestSubject() { + return PolicyTargetType.COMPONENT_INSTANCES; + } + + @Test + public void testGetName() throws Exception { + PolicyTargetType testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testGetByNameIgnoreCase() throws Exception { + String name = ""; + PolicyTargetType result; + + // default test + result = PolicyTargetType.getByNameIgnoreCase(name); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinitionTest.java index cf71c36fed..e407229956 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinitionTest.java @@ -12,6 +12,15 @@ public class PolicyTypeDataDefinitionTest { return new PolicyTypeDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + PolicyTypeDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new PolicyTypeDataDefinition(testSubject); + } @Test public void testGetType() throws Exception { diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinitionTest.java index 354a4488ee..93bc5618de 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinitionTest.java @@ -126,5 +126,18 @@ public class ProductMetadataDataDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.equals(obj); + result = testSubject.equals(testSubject); + result = testSubject.equals(createTestSubject()); + } + + @Test + public void testGetActualComponentType() throws Exception { + ProductMetadataDataDefinition testSubject; + Object obj = null; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getActualComponentType(); } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java index 75858d2b56..9b067c9b80 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java @@ -12,6 +12,15 @@ public class PropertyDataDefinitionTest { return new PropertyDataDefinition(); } + @Test + public void testConstructor() throws Exception { + PropertyDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new PropertyDataDefinition(testSubject); + } @Test public void testGetInputPath() throws Exception { @@ -486,23 +495,38 @@ public class PropertyDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); } - - - + @Test + public void testConvertPropertyDataToInstancePropertyData() throws Exception { + PropertyDataDefinition testSubject; - + // default test + testSubject = createTestSubject(); + testSubject.convertPropertyDataToInstancePropertyData(); + } + @Test + public void testTypeEquals() throws Exception { + PropertyDataDefinition testSubject; - + // default test + testSubject = createTestSubject(); + testSubject.typeEquals(testSubject); + testSubject.typeEquals(null); + testSubject.typeEquals(createTestSubject()); + } @Test - public void testConvertPropertyDataToInstancePropertyData() throws Exception { + public void testMergeFunction() throws Exception { PropertyDataDefinition testSubject; // default test testSubject = createTestSubject(); - testSubject.convertPropertyDataToInstancePropertyData(); + testSubject.mergeFunction(createTestSubject(), false); } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyRuleTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyRuleTest.java new file mode 100644 index 0000000000..f65330e22a --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyRuleTest.java @@ -0,0 +1,128 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.LinkedList; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; + +public class PropertyRuleTest { + + private PropertyRule createTestSubject() { + return new PropertyRule(); + } + + @Test + public void testConstructor() throws Exception { + PropertyRule testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + new PropertyRule(new LinkedList<>(), ""); + } + + @Test + public void testGetRule() throws Exception { + PropertyRule testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRule(); + } + + @Test + public void testSetRule() throws Exception { + PropertyRule testSubject; + List<String> rule = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRule(rule); + } + + @Test + public void testGetValue() throws Exception { + PropertyRule testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(); + } + + @Test + public void testSetValue() throws Exception { + PropertyRule testSubject; + String value = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setValue(value); + } + + @Test + public void testGetFirstToken() throws Exception { + PropertyRule testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getFirstToken(); + } + + @Test + public void testGetToken() throws Exception { + PropertyRule testSubject; + int tokenNumber = 0; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToken(tokenNumber); + } + + @Test + public void testGetRuleSize() throws Exception { + PropertyRule testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRuleSize(); + } + + @Test + public void testToString() throws Exception { + PropertyRule testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + @Test + public void testCompareRule() throws Exception { + PropertyRule testSubject; + PropertyRule comparedPropertyRule = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + comparedPropertyRule = null; + result = testSubject.compareRule(comparedPropertyRule); + Assert.assertEquals(false, result); + } + + @Test + public void testReplaceFirstToken() throws Exception { + PropertyRule testSubject; + String token = ""; + + // default test + testSubject = createTestSubject(); + testSubject.replaceFirstToken(token); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinitionTest.java new file mode 100644 index 0000000000..7c1f18a603 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinitionTest.java @@ -0,0 +1,331 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.List; + +import org.junit.Test; + +public class RelationshipInstDataDefinitionTest { + + private RelationshipInstDataDefinition createTestSubject() { + return new RelationshipInstDataDefinition(); + } + + @Test + public void testCopyConstructor() throws Exception { + RelationshipInstDataDefinition testSubject; + + // default test + testSubject = createTestSubject(); + new RelationshipInstDataDefinition(testSubject); + } + + @Test + public void testSetRequirement() throws Exception { + RelationshipInstDataDefinition testSubject; + String requirement = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirement(requirement); + } + + @Test + public void testGetRequirement() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirement(); + } + + @Test + public void testSetCapability() throws Exception { + RelationshipInstDataDefinition testSubject; + String capability = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCapability(capability); + } + + @Test + public void testGetCapability() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapability(); + } + + @Test + public void testSetToId() throws Exception { + RelationshipInstDataDefinition testSubject; + Object toId = null; + + // default test + testSubject = createTestSubject(); + testSubject.setToId(toId); + } + + @Test + public void testSetFromId() throws Exception { + RelationshipInstDataDefinition testSubject; + Object fromId = null; + + // default test + testSubject = createTestSubject(); + testSubject.setFromId(fromId); + } + + @Test + public void testGetToId() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToId(); + } + + @Test + public void testGetFromId() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getFromId(); + } + + @Test + public void testSetRequirementId() throws Exception { + RelationshipInstDataDefinition testSubject; + Object requirementId = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirementId(requirementId); + } + + @Test + public void testSetCapabilityId() throws Exception { + RelationshipInstDataDefinition testSubject; + Object capabilityId = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilityId(capabilityId); + } + + @Test + public void testGetRequirementId() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirementId(); + } + + @Test + public void testGetCapabilityId() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilityId(); + } + + @Test + public void testSetRequirementOwnerId() throws Exception { + RelationshipInstDataDefinition testSubject; + Object requirementOwnerId = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirementOwnerId(requirementOwnerId); + } + + @Test + public void testGetRequirementOwnerId() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirementOwnerId(); + } + + @Test + public void testSetCapabilityOwnerId() throws Exception { + RelationshipInstDataDefinition testSubject; + Object capabilityOwnerId = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilityOwnerId(capabilityOwnerId); + } + + @Test + public void testGetCapabilityOwnerId() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilityOwnerId(); + } + + @Test + public void testGetUniqueId() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + @Test + public void testSetUniqueId() throws Exception { + RelationshipInstDataDefinition testSubject; + String uniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uniqueId); + } + + @Test + public void testGetDescription() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + @Test + public void testSetDescription() throws Exception { + RelationshipInstDataDefinition testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + @Test + public void testGetType() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + @Test + public void testSetType() throws Exception { + RelationshipInstDataDefinition testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + @Test + public void testGetValidSourceTypes() throws Exception { + RelationshipInstDataDefinition testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValidSourceTypes(); + } + + @Test + public void testSetValidSourceTypes() throws Exception { + RelationshipInstDataDefinition testSubject; + List<String> validSourceTypes = null; + + // default test + testSubject = createTestSubject(); + testSubject.setValidSourceTypes(validSourceTypes); + } + + @Test + public void testGetVersion() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + @Test + public void testSetVersion() throws Exception { + RelationshipInstDataDefinition testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + @Test + public void testGetCreationTime() throws Exception { + RelationshipInstDataDefinition testSubject; + Long result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCreationTime(); + } + + @Test + public void testSetCreationTime() throws Exception { + RelationshipInstDataDefinition testSubject; + Long creationTime = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCreationTime(creationTime); + } + + @Test + public void testGetModificationTime() throws Exception { + RelationshipInstDataDefinition testSubject; + Long result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getModificationTime(); + } + + @Test + public void testSetModificationTime() throws Exception { + RelationshipInstDataDefinition testSubject; + Long modificationTime = null; + + // default test + testSubject = createTestSubject(); + testSubject.setModificationTime(modificationTime); + } + + @Test + public void testToString() throws Exception { + RelationshipInstDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinitionTest.java index 47723df14f..2965e07f7e 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinitionTest.java @@ -12,6 +12,15 @@ public class RequirementDataDefinitionTest { return new RequirementDataDefinition(); } + @Test + public void testCopyConstructor() throws Exception { + RequirementDataDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new RequirementDataDefinition(testSubject); + } @Test public void testGetUniqueId() throws Exception { @@ -332,6 +341,10 @@ public class RequirementDataDefinitionTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); } diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinitionTest.java new file mode 100644 index 0000000000..53b9b8d6f9 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinitionTest.java @@ -0,0 +1,154 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.collections.map.HashedMap; +import org.junit.Assert; +import org.junit.Test; + +public class SchemaDefinitionTest { + + private SchemaDefinition createTestSubject() { + return new SchemaDefinition(); + } + + @Test + public void testConstructors() throws Exception { + SchemaDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + new SchemaDefinition("mock", new LinkedList<>(), new HashedMap()); + } + + @Test + public void testGetDerivedFrom() throws Exception { + SchemaDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDerivedFrom(); + } + + @Test + public void testSetProperty() throws Exception { + SchemaDefinition testSubject; + PropertyDataDefinition property = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperty(property); + } + + @Test + public void testGetProperty() throws Exception { + SchemaDefinition testSubject; + PropertyDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperty(); + } + + @Test + public void testSetDerivedFrom() throws Exception { + SchemaDefinition testSubject; + String derivedFrom = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDerivedFrom(derivedFrom); + } + + @Test + public void testGetConstraints() throws Exception { + SchemaDefinition testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getConstraints(); + } + + @Test + public void testSetConstraints() throws Exception { + SchemaDefinition testSubject; + List<String> constraints = null; + + // default test + testSubject = createTestSubject(); + testSubject.setConstraints(constraints); + } + + @Test + public void testGetProperties() throws Exception { + SchemaDefinition testSubject; + Map<String, PropertyDataDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + @Test + public void testSetProperties() throws Exception { + SchemaDefinition testSubject; + Map<String, PropertyDataDefinition> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + @Test + public void testAddProperty() throws Exception { + SchemaDefinition testSubject; + String key = ""; + PropertyDataDefinition property = new PropertyDataDefinition(); + + // default test + testSubject = createTestSubject(); + testSubject.addProperty("mock", property); + } + + @Test + public void testHashCode() throws Exception { + SchemaDefinition testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + @Test + public void testEquals() throws Exception { + SchemaDefinition testSubject; + Object obj = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + obj = null; + result = testSubject.equals(obj); + Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); + } + + @Test + public void testToString() throws Exception { + SchemaDefinition testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnumTest.java new file mode 100644 index 0000000000..b54f97fd8d --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnumTest.java @@ -0,0 +1,39 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import org.junit.Test; + +public class AssetTypeEnumTest { + + private AssetTypeEnum createTestSubject() { + return AssetTypeEnum.PRODUCTS; + } + + @Test + public void testGetValue() throws Exception { + AssetTypeEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(); + } + + @Test + public void testGetCorrespondingComponent() throws Exception { + AssetTypeEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCorrespondingComponent(); + } + + @Test + public void testConvertToComponentTypeEnum() throws Exception { + String assetType = "products"; + ComponentTypeEnum result; + + // default test + result = AssetTypeEnum.convertToComponentTypeEnum(assetType); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnumTest.java new file mode 100644 index 0000000000..ef02c72c91 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnumTest.java @@ -0,0 +1,32 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import javax.annotation.Generated; + +import org.junit.Test; + +public class ComponentFieldsEnumTest { + + private ComponentFieldsEnum createTestSubject() { + return ComponentFieldsEnum.ADDITIONAL_INFORMATION; + } + + @Test + public void testGetValue() throws Exception { + ComponentFieldsEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(); + } + + @Test + public void testFindByValue() throws Exception { + String value = "artifacts"; + ComponentFieldsEnum result; + + // default test + result = ComponentFieldsEnum.findByValue(value); + result = ComponentFieldsEnum.findByValue(""); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnumTest.java new file mode 100644 index 0000000000..a7e0f1fa29 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnumTest.java @@ -0,0 +1,57 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import org.junit.Test; + +public class ComponentTypeEnumTest { + + private ComponentTypeEnum createTestSubject() { + return ComponentTypeEnum.PRODUCT; + } + + @Test + public void testGetValue() throws Exception { + ComponentTypeEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(); + } + + @Test + public void testGetNodeType() throws Exception { + ComponentTypeEnum testSubject; + NodeTypeEnum result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNodeType(); + } + + @Test + public void testFindByValue() throws Exception { + String value = ""; + ComponentTypeEnum result; + + // default test + result = ComponentTypeEnum.findByValue(value); + } + + @Test + public void testFindByParamName() throws Exception { + String paramName = ""; + ComponentTypeEnum result; + + // default test + result = ComponentTypeEnum.findByParamName(paramName); + } + + @Test + public void testFindParamByType() throws Exception { + ComponentTypeEnum type = null; + String result; + + // default test + result = ComponentTypeEnum.findParamByType(type); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ConnectionPointEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ConnectionPointEnumTest.java new file mode 100644 index 0000000000..0aad06a16d --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ConnectionPointEnumTest.java @@ -0,0 +1,29 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import org.junit.Test; + +public class ConnectionPointEnumTest { + + private ConnectionPointEnum createTestSubject() { + return ConnectionPointEnum.CAPABILITY; + } + + @Test + public void testToString() throws Exception { + ConnectionPointEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + @Test + public void testGetConnectionPointEnum() throws Exception { + String data = ""; + ConnectionPointEnum result; + + // default test + result = ConnectionPointEnum.getConnectionPointEnum(data); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/EnvironmentStatusEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/EnvironmentStatusEnumTest.java new file mode 100644 index 0000000000..ba276d606e --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/EnvironmentStatusEnumTest.java @@ -0,0 +1,32 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import org.junit.Test; + +public class EnvironmentStatusEnumTest { + + private EnvironmentStatusEnum createTestSubject() { + return EnvironmentStatusEnum.COMPLETED; + } + + @Test + public void testGetName() throws Exception { + EnvironmentStatusEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testGetByName() throws Exception { + String name = ""; + EnvironmentStatusEnum result; + + // default test + EnvironmentStatusEnum[] values = EnvironmentStatusEnum.values(); + for (EnvironmentStatusEnum environmentStatusEnum : values) { + result = EnvironmentStatusEnum.getByName(environmentStatusEnum.getName()); + } + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnumTest.java new file mode 100644 index 0000000000..66147dc1bf --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnumTest.java @@ -0,0 +1,42 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import java.util.List; + +import org.junit.Test; + +public class FilterKeyEnumTest { + + private FilterKeyEnum createTestSubject() { + return FilterKeyEnum.CATEGORY; + } + + @Test + public void testGetName() throws Exception { + FilterKeyEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testGetAllFilters() throws Exception { + List<String> result; + + // default test + result = FilterKeyEnum.getAllFilters(); + } + + @Test + public void testGetValidFiltersByAssetType() throws Exception { + ComponentTypeEnum assetType = null; + List<String> result; + + // default test + result = FilterKeyEnum.getValidFiltersByAssetType(ComponentTypeEnum.RESOURCE); + result = FilterKeyEnum.getValidFiltersByAssetType(ComponentTypeEnum.SERVICE); + result = FilterKeyEnum.getValidFiltersByAssetType(ComponentTypeEnum.SERVICE_INSTANCE); + result = FilterKeyEnum.getValidFiltersByAssetType(assetType); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java new file mode 100644 index 0000000000..74bcf172e8 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnumTest.java @@ -0,0 +1,110 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import java.util.List; + +import org.junit.Test; + +public class GraphPropertyEnumTest { + + private GraphPropertyEnum createTestSubject() { + return GraphPropertyEnum.COMPONENT_TYPE; + } + + @Test + public void testGetByProperty() throws Exception { + String property = ""; + GraphPropertyEnum result; + + // default test + result = GraphPropertyEnum.getByProperty(property); + result = GraphPropertyEnum.getByProperty(GraphPropertyEnum.COMPONENT_TYPE.getProperty()); + } + + @Test + public void testGetProperty() throws Exception { + GraphPropertyEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperty(); + } + + @Test + public void testSetProperty() throws Exception { + GraphPropertyEnum testSubject; + String property = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setProperty(property); + } + + @Test + public void testGetClazz() throws Exception { + GraphPropertyEnum testSubject; + Class result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getClazz(); + } + + @Test + public void testSetClazz() throws Exception { + GraphPropertyEnum testSubject; + Class clazz = null; + + // default test + testSubject = createTestSubject(); + testSubject.setClazz(clazz); + } + + @Test + public void testIsUnique() throws Exception { + GraphPropertyEnum testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isUnique(); + } + + @Test + public void testSetUnique() throws Exception { + GraphPropertyEnum testSubject; + boolean unique = false; + + // default test + testSubject = createTestSubject(); + testSubject.setUnique(unique); + } + + @Test + public void testIsIndexed() throws Exception { + GraphPropertyEnum testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isIndexed(); + } + + @Test + public void testSetIndexed() throws Exception { + GraphPropertyEnum testSubject; + boolean indexed = false; + + // default test + testSubject = createTestSubject(); + testSubject.setIndexed(indexed); + } + + @Test + public void testGetAllProperties() throws Exception { + List<String> result; + + // default test + result = GraphPropertyEnum.getAllProperties(); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnumTest.java new file mode 100644 index 0000000000..c5502a1be9 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnumTest.java @@ -0,0 +1,20 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import org.junit.Test; + +public class GroupTypeEnumTest { + + private GroupTypeEnum createTestSubject() { + return GroupTypeEnum.HEAT_STACK; + } + + @Test + public void testGetGroupTypeName() throws Exception { + GroupTypeEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroupTypeName(); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsTest.java new file mode 100644 index 0000000000..9b26af8567 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFieldsTest.java @@ -0,0 +1,79 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import org.junit.Test; + +public class JsonPresentationFieldsTest { + + private JsonPresentationFields createTestSubject() { + return JsonPresentationFields.API_URL; + } + + @Test + public void testGetPresentation() throws Exception { + JsonPresentationFields testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getPresentation(); + } + + @Test + public void testSetPresentation() throws Exception { + JsonPresentationFields testSubject; + String presentation = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setPresentation(presentation); + } + + @Test + public void testGetStoredAs() throws Exception { + JsonPresentationFields testSubject; + GraphPropertyEnum result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getStoredAs(); + } + + @Test + public void testSetStoredAs() throws Exception { + JsonPresentationFields testSubject; + GraphPropertyEnum storedAs = null; + + // default test + testSubject = createTestSubject(); + testSubject.setStoredAs(storedAs); + } + + @Test + public void testGetPresentationByGraphProperty() throws Exception { + GraphPropertyEnum property = null; + String result; + + // default test + result = JsonPresentationFields.getPresentationByGraphProperty(null); + result = JsonPresentationFields.getPresentationByGraphProperty(GraphPropertyEnum.INVARIANT_UUID); + } + + @Test + public void testToString() throws Exception { + JsonPresentationFields testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + @Test + public void testGetByPresentation() throws Exception { + String presentation = ""; + JsonPresentationFields result; + + // default test + result = JsonPresentationFields.getByPresentation(presentation); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnumTest.java new file mode 100644 index 0000000000..e04510deaa --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnumTest.java @@ -0,0 +1,40 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import org.junit.Test; + +public class NodeTypeEnumTest { + + private NodeTypeEnum createTestSubject() { + return NodeTypeEnum.AdditionalInfoParameters; + } + + @Test + public void testGetName() throws Exception { + NodeTypeEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testGetByName() throws Exception { + String name = ""; + NodeTypeEnum result; + + // default test + result = NodeTypeEnum.getByName(name); + result = NodeTypeEnum.getByName(NodeTypeEnum.AdditionalInfoParameters.getName()); + } + + @Test + public void testGetByNameIgnoreCase() throws Exception { + String name = ""; + NodeTypeEnum result; + + // default test + result = NodeTypeEnum.getByNameIgnoreCase(name); + result = NodeTypeEnum.getByNameIgnoreCase(NodeTypeEnum.AdditionalInfoParameters.getName()); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnumTest.java new file mode 100644 index 0000000000..e2959cd860 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnumTest.java @@ -0,0 +1,60 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import org.junit.Test; + +public class OriginTypeEnumTest { + + private OriginTypeEnum createTestSubject() { + return OriginTypeEnum.CP; + } + + @Test + public void testGetValue() throws Exception { + OriginTypeEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(); + } + + @Test + public void testGetDisplayValue() throws Exception { + OriginTypeEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDisplayValue(); + } + + @Test + public void testGetInstanceType() throws Exception { + OriginTypeEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInstanceType(); + } + + @Test + public void testGetComponentType() throws Exception { + OriginTypeEnum testSubject; + ComponentTypeEnum result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getComponentType(); + } + + @Test + public void testFindByValue() throws Exception { + String value = ""; + OriginTypeEnum result; + + // default test + result = OriginTypeEnum.findByValue(value); + result = OriginTypeEnum.findByValue(OriginTypeEnum.CP.getValue()); + } +}
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnumTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnumTest.java new file mode 100644 index 0000000000..91fd50d6af --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnumTest.java @@ -0,0 +1,80 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import org.junit.Test; + +public class ResourceTypeEnumTest { + + private ResourceTypeEnum createTestSubject() { + return ResourceTypeEnum.ABSTRACT; + } + + @Test + public void testGetValue() throws Exception { + ResourceTypeEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(); + } + + @Test + public void testIsAtomicType() throws Exception { + ResourceTypeEnum testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isAtomicType(); + } + + @Test + public void testGetType() throws Exception { + String type = ""; + ResourceTypeEnum result; + + // default test + result = ResourceTypeEnum.getType(type); + result = ResourceTypeEnum.getType(ResourceTypeEnum.ABSTRACT.name()); + } + + @Test + public void testGetTypeByName() throws Exception { + String type = ""; + ResourceTypeEnum result; + + // default test + result = ResourceTypeEnum.getType(type); + result = ResourceTypeEnum.getTypeByName(ResourceTypeEnum.ABSTRACT.name()); + } + + @Test + public void testGetTypeIgnoreCase() throws Exception { + String type = ""; + ResourceTypeEnum result; + + // default test + result = ResourceTypeEnum.getTypeIgnoreCase(type); + result = ResourceTypeEnum.getTypeIgnoreCase(ResourceTypeEnum.ABSTRACT.name()); + } + + @Test + public void testContainsName() throws Exception { + String type = ""; + boolean result; + + // default test + result = ResourceTypeEnum.containsName(type); + result = ResourceTypeEnum.containsName(ResourceTypeEnum.ABSTRACT.name()); + } + + @Test + public void testContainsIgnoreCase() throws Exception { + String type = ""; + boolean result; + + // default test + result = ResourceTypeEnum.containsIgnoreCase(type); + result = ResourceTypeEnum.containsIgnoreCase(ResourceTypeEnum.ABSTRACT.name()); + } +}
\ No newline at end of file |