diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2018-05-31 16:57:17 +0300 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2018-05-31 15:24:39 +0000 |
commit | cdb8d264670ae4b98eb3b40cc58ee06b2c2e70c9 (patch) | |
tree | d43609c24140c13f92c6d303b76820b74f8c7634 | |
parent | cc4088f4d26212b8dbeeff01f0ae2e38f2df4d3f (diff) |
new unit tests for sdc-dao
Change-Id: Ibf37c20c3d07f3cd2962e324f3e37354adad9870
Issue-ID: SDC-1333
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
51 files changed, 1035 insertions, 25 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupTypeData.java index 87f4fcf283..3a92819231 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupTypeData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupTypeData.java @@ -60,9 +60,11 @@ public class GroupTypeData extends GraphNode { groupTypeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); groupTypeDataDefinition.setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty())); - - groupTypeDataDefinition.setHighestVersion( - (boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty())); + + if (properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()) != null) { + groupTypeDataDefinition.setHighestVersion( + (boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty())); + } groupTypeDataDefinition .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PolicyTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PolicyTypeData.java index 28081cce96..8847262e87 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PolicyTypeData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PolicyTypeData.java @@ -69,8 +69,10 @@ public class PolicyTypeData extends GraphNode { policyTypeDataDefinition .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - policyTypeDataDefinition.setHighestVersion( - (boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty())); + if (properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()) != null) { + policyTypeDataDefinition.setHighestVersion( + (boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty())); + } policyTypeDataDefinition.setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty())); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java index 06e098ff4b..efb89db0da 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java @@ -42,7 +42,9 @@ public class ResourceMetadataData extends ComponentMetadataData { super(NodeTypeEnum.Resource, new ResourceMetadataDataDefinition(), properties); ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorName((String) properties.get(GraphPropertiesDictionary.VENDOR_NAME.getProperty())); ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorRelease((String) properties.get(GraphPropertiesDictionary.VENDOR_RELEASE.getProperty())); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setResourceType(ResourceTypeEnum.valueOf((String) properties.get(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty()))); + if (properties.get(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty()) != null) { + ((ResourceMetadataDataDefinition) metadataDataDefinition).setResourceType(ResourceTypeEnum.valueOf((String) properties.get(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty()))); + } ((ResourceMetadataDataDefinition) metadataDataDefinition).setAbstract((Boolean) properties.get(GraphPropertiesDictionary.IS_ABSTRACT.getProperty())); ((ResourceMetadataDataDefinition) metadataDataDefinition).setCost((String) properties.get(GraphPropertiesDictionary.COST.getProperty())); ((ResourceMetadataDataDefinition) metadataDataDefinition).setLicenseType((String) properties.get(GraphPropertiesDictionary.LICENSE_TYPE.getProperty())); diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/MapUtilTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/MapUtilTest.java new file mode 100644 index 0000000000..ed2f3134d2 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/MapUtilTest.java @@ -0,0 +1,109 @@ +package org.openecomp.sdc.be.dao.utils; + +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import org.junit.Test; + +public class MapUtilTest { + + @Test + public void testGet() throws Exception { + Map<String, ? extends Object> map = null; + String path = ""; + Object result; + + // default test + result = MapUtil.get(map, path); + path = "\\mock\\mock"; + result = MapUtil.get(map, path); + } + + @Test + public void testGroupListBy() throws Exception { + Collection valuesToMap = new LinkedList<String>(); + Function<String, String> groupingFunction = new Function<String, String>() { + + @Override + public String apply(String t) { + return t; + } + }; + Map<String, List<String>> result; + + // default test + result = MapUtil.groupListBy(valuesToMap, groupingFunction); + } + + @Test + public void testToMap() throws Exception { + Collection<String> valuesToMap = null; + Function<String, String> mappingFunction = null; + Map<String, String> result; + + // default test + result = MapUtil.toMap(valuesToMap, mappingFunction); + } + + @Test + public void testConvertMapKeys() throws Exception { + Map<String, List<String>> map = new HashMap<>(); + Function<String, String> keyMappingFunction = new Function<String, String>() { + + @Override + public String apply(String t) { + return t; + } + }; + Map<String, List<String>> result; + + // default test + result = MapUtil.convertMapKeys(map, keyMappingFunction); + } + + @Test + public void testNewHashMap() throws Exception { + String[] keys = new String[] { "mock" }; + String[] values = new String[] { "mock" }; + Map<String, String> result; + + // test 1 + result = MapUtil.newHashMap(keys, values); + //Assert.assertEquals(null, result); + + // test 2 + keys = new String[] { "mock" }; + values = null; + try { + result = MapUtil.newHashMap(keys, values); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + // test 3 + values = null; + keys = null; + try { + result = MapUtil.newHashMap(keys, values); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //Assert.assertEquals(null, result); + + // test 4 + values = new String[] { "mock" }; + keys = null; + try { + result = MapUtil.newHashMap(keys, values); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/TypeMapTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/TypeMapTest.java new file mode 100644 index 0000000000..1909a16e60 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/TypeMapTest.java @@ -0,0 +1,37 @@ +package org.openecomp.sdc.be.dao.utils; + +import java.util.Map; + +import org.junit.Test; + +import mockit.Deencapsulation; + +public class TypeMapTest { + + private TypeMap createTestSubject() { + return new TypeMap(); + } + + @Test + public void testPut() throws Exception { + TypeMap testSubject; + String key = "mock"; + Object value = new Object(); + + // default test + testSubject = createTestSubject(); + testSubject.put(key, value); + } + + @Test + public void testGet() throws Exception { + TypeMap testSubject; + Class clazz = Object.class; + String key = "mock"; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.get(clazz, key); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/UserStatusEnumTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/UserStatusEnumTest.java new file mode 100644 index 0000000000..46e35bf228 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/UserStatusEnumTest.java @@ -0,0 +1,19 @@ +package org.openecomp.sdc.be.dao.utils; + +import org.junit.Test; +import org.openecomp.sdc.common.util.MethodActivationStatusEnum; + +import fj.data.Either; + +public class UserStatusEnumTest { + + @Test + public void testFindByName() throws Exception { + String name = "mock"; + Either<UserStatusEnum, MethodActivationStatusEnum> result; + + // default test + result = UserStatusEnum.findByName(name); + result = UserStatusEnum.findByName(UserStatusEnum.ACTIVE.name()); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AdditionalInfoParameterDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AdditionalInfoParameterDataTest.java index d693bc075f..9a1771688f 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AdditionalInfoParameterDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AdditionalInfoParameterDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,11 @@ public class AdditionalInfoParameterDataTest { return new AdditionalInfoParameterData(); } + @Test + public void testCtor() throws Exception { + new AdditionalInfoParameterData(new HashMap<>()); + new AdditionalInfoParameterData(new AdditionalInfoParameterDataDefinition(), new HashMap<>(), new HashMap<>()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ArtifactDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ArtifactDataTest.java index 7419498e5a..944f11b88b 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ArtifactDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ArtifactDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,11 @@ public class ArtifactDataTest { return new ArtifactData(); } + @Test + public void testCtor() throws Exception { + new ArtifactData(new ArtifactDataDefinition()); + new ArtifactData(new HashMap<>()); + } @Test public void testGetArtifactDataDefinition() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AttributeDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AttributeDataTest.java index f056d676d1..aab4a98b03 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AttributeDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AttributeDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,11 @@ public class AttributeDataTest { return new AttributeData(); } + @Test + public void testCtor() throws Exception { + new AttributeData(new HashMap<>()); + new AttributeData(new PropertyDataDefinition()); + } @Test public void testToString() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AttributeValueDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AttributeValueDataTest.java index 0ccd7a1b70..0da5a17659 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AttributeValueDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/AttributeValueDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -11,6 +12,10 @@ public class AttributeValueDataTest { return new AttributeValueData(); } + @Test + public void testCtor() throws Exception { + new AttributeValueData(new HashMap<String, Object>()); + } @Test public void testGetUniqueId() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityDataTest.java index 1702ca4a32..0a0dee56dd 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -11,7 +12,11 @@ public class CapabilityDataTest { private CapabilityData createTestSubject() { return new CapabilityData(); } - + + @Test + public void testCtor() throws Exception { + new CapabilityData(new HashMap<>()); + } @Test public void testGetUniqueId() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityInstDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityInstDataTest.java index 88b46c9531..2ca030cc89 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityInstDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityInstDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -12,6 +13,10 @@ public class CapabilityInstDataTest { return new CapabilityInstData(); } + @Test + public void testCtor() throws Exception { + new CapabilityInstData(new HashMap<>()); + } @Test public void testGetUniqueId() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityTypeDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityTypeDataTest.java index c737f5dfe6..e3dbdb9000 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityTypeDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/CapabilityTypeDataTest.java @@ -2,6 +2,7 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; +import org.apache.commons.collections.map.HashedMap; import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.CapabilityTypeDataDefinition; @@ -12,6 +13,11 @@ public class CapabilityTypeDataTest { return new CapabilityTypeData(); } + @Test + public void testCtor() throws Exception { + new CapabilityTypeData(new CapabilityTypeDataDefinition()); + new CapabilityTypeData(new HashedMap()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ComponentCacheDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ComponentCacheDataTest.java index 7ea9683981..bda882e465 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ComponentCacheDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ComponentCacheDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.nio.ByteBuffer; import java.util.Date; import org.junit.Test; @@ -10,7 +11,13 @@ public class ComponentCacheDataTest { private ComponentCacheData createTestSubject() { return new ComponentCacheData(); } - + + @Test + public void testCtor() throws Exception { + new ComponentCacheData("mock"); + new ComponentCacheData("mock", new byte[0]); + new ComponentCacheData("mock", new byte[0], new Date(), "mock", true, true); + } @Test public void testGetDataAsArray() throws Exception { @@ -40,8 +47,24 @@ public class ComponentCacheDataTest { } + @Test + public void testGetData() throws Exception { + ComponentCacheData testSubject ; + + testSubject = createTestSubject(); + + testSubject.getData(); + } - + @Test + public void testSetData() throws Exception { + ComponentCacheData testSubject ; + + testSubject = createTestSubject(); + + ByteBuffer data = ByteBuffer.allocate(0); + testSubject.setData(data); + } @Test public void testGetId() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ComponentInstanceDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ComponentInstanceDataTest.java index 0e48444106..f3bbae7d87 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ComponentInstanceDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ComponentInstanceDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,12 @@ public class ComponentInstanceDataTest { return new ComponentInstanceData(); } + @Test + public void testCtor() throws Exception { + new ComponentInstanceData(new ComponentInstanceDataDefinition()); + new ComponentInstanceData(new ComponentInstanceDataDefinition(), new Integer(0)); + new ComponentInstanceData(new HashMap<>()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ConsumerDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ConsumerDataTest.java index 2071b19f62..1737781eac 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ConsumerDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ConsumerDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,11 @@ public class ConsumerDataTest { return new ConsumerData(); } + @Test + public void testCtor() throws Exception { + new ConsumerData(new ConsumerDataDefinition()); + new ConsumerData(new HashMap<>()); + } @Test public void testGetUniqueIdKey() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/DataTypeDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/DataTypeDataTest.java index 3277a039ad..85fc2620e6 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/DataTypeDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/DataTypeDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,11 @@ public class DataTypeDataTest { return new DataTypeData(); } + @Test + public void testCtor() throws Exception { + new DataTypeData(new DataTypeDataDefinition()); + new DataTypeData(new HashMap<>()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ESArtifactDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ESArtifactDataTest.java new file mode 100644 index 0000000000..69aa1601d5 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ESArtifactDataTest.java @@ -0,0 +1,85 @@ +package org.openecomp.sdc.be.resources.data; + +import java.nio.ByteBuffer; + +import org.junit.Test; + +public class ESArtifactDataTest { + + private ESArtifactData createTestSubject() { + return new ESArtifactData(); + } + + @Test + public void testCtor() throws Exception { + new ESArtifactData("mock"); + new ESArtifactData("mock", new byte[0]); + } + + @Test + public void testGetDataAsArray() throws Exception { + ESArtifactData testSubject; + byte[] result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDataAsArray(); + } + + @Test + public void testSetDataAsArray() throws Exception { + ESArtifactData testSubject; + byte[] data = new byte[] { ' ' }; + + // test 1 + testSubject = createTestSubject(); + data = null; + testSubject.setDataAsArray(data); + + // test 2 + testSubject = createTestSubject(); + data = new byte[] { ' ' }; + testSubject.setDataAsArray(data); + } + + @Test + public void testGetData() throws Exception { + ESArtifactData testSubject; + ByteBuffer result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getData(); + } + + @Test + public void testSetData() throws Exception { + ESArtifactData testSubject; + ByteBuffer data = null; + + // test 1 + testSubject = createTestSubject(); + data = null; + testSubject.setData(data); + } + + @Test + public void testGetId() throws Exception { + ESArtifactData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getId(); + } + + @Test + public void testSetId() throws Exception { + ESArtifactData testSubject; + String id = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setId(id); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/EntryDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/EntryDataTest.java new file mode 100644 index 0000000000..66c8db9fd0 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/EntryDataTest.java @@ -0,0 +1,41 @@ +package org.openecomp.sdc.be.resources.data; + +import org.junit.Test; + +public class EntryDataTest { + + private EntryData createTestSubject() { + return new EntryData(new Object(), new Object()); + } + + @Test + public void testGetKey() throws Exception { + EntryData testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getKey(); + } + + @Test + public void testGetValue() throws Exception { + EntryData testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(); + } + + @Test + public void testSetValue() throws Exception { + EntryData testSubject; + Object value = null; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.setValue(value); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GraphNodeLockTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GraphNodeLockTest.java new file mode 100644 index 0000000000..406e96399d --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GraphNodeLockTest.java @@ -0,0 +1,69 @@ +package org.openecomp.sdc.be.resources.data; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +public class GraphNodeLockTest { + + private GraphNodeLock createTestSubject() { + return new GraphNodeLock(); + } + + @Test + public void testCtor() throws Exception { + new GraphNodeLock(new HashMap<>()); + new GraphNodeLock("mock"); + } + + @Test + public void testGetUniqueId() throws Exception { + GraphNodeLock testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + @Test + public void testToGraphMap() throws Exception { + GraphNodeLock testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toGraphMap(); + } + + @Test + public void testSetUniqueId() throws Exception { + GraphNodeLock testSubject; + String uniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uniqueId); + } + + @Test + public void testGetTime() throws Exception { + GraphNodeLock testSubject; + Long result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTime(); + } + + @Test + public void testSetTime() throws Exception { + GraphNodeLock testSubject; + Long time = null; + + // default test + testSubject = createTestSubject(); + testSubject.setTime(time); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupDataTest.java index 072949a6ae..30faa644b5 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,11 @@ public class GroupDataTest { return new GroupData(); } + @Test + public void testCtor() throws Exception { + new GroupData(new GroupDataDefinition()); + new GroupData(new HashMap<>()); + } @Test public void testGetUniqueId() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupInstanceDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupInstanceDataTest.java index a0d75fa3ed..af87f8fa34 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupInstanceDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupInstanceDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,11 @@ public class GroupInstanceDataTest { return new GroupInstanceData(); } + @Test + public void testCtor() throws Exception { + new GroupInstanceData(new GroupInstanceDataDefinition()); + new GroupInstanceData(new HashMap<>()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupTypeDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupTypeDataTest.java index 922a20aeb4..6432672c57 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupTypeDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/GroupTypeDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,11 @@ public class GroupTypeDataTest { return new GroupTypeData(); } + @Test + public void testCtor() throws Exception { + new GroupTypeData(new HashMap<>()); + new GroupTypeData(new GroupTypeDataDefinition()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/HeatParameterDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/HeatParameterDataTest.java index 066c5a4882..ae18dbffac 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/HeatParameterDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/HeatParameterDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,9 +13,12 @@ public class HeatParameterDataTest { return new HeatParameterData(); } - + @Test + public void testCtor() throws Exception { + new HeatParameterData(new HeatParameterDataDefinition()); + new HeatParameterData(new HashMap<>()); + } - @Test public void testGetHeatDataDefinition() throws Exception { HeatParameterData testSubject; diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/HeatParameterValueDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/HeatParameterValueDataTest.java index 662664421d..794940f6a2 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/HeatParameterValueDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/HeatParameterValueDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -11,6 +12,10 @@ public class HeatParameterValueDataTest { return new HeatParameterValueData(); } + @Test + public void testCtor() throws Exception { + new HeatParameterValueData(new HashMap<>()); + } @Test public void testGetUniqueId() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InputValueDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InputValueDataTest.java index f2d500366e..bd0cfc0447 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InputValueDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InputValueDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -11,6 +12,10 @@ public class InputValueDataTest { return new InputValueData(); } + @Test + public void testCtor() throws Exception { + new InputValueData(new HashMap<>()); + } @Test public void testGetUniqueId() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InputsDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InputsDataTest.java index 49de163c59..1ba2ba76cd 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InputsDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InputsDataTest.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -13,6 +15,11 @@ public class InputsDataTest { return new InputsData(); } + @Test + public void testCtor() throws Exception { + new InputsData(new HashMap<>()); + new InputsData(new PropertyDataDefinition(), new LinkedList<>()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InterfaceDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InterfaceDataTest.java index 58c111c62e..d963238f19 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InterfaceDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/InterfaceDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,12 @@ public class InterfaceDataTest { return new InterfaceData(); } + @Test + public void testCtor() throws Exception { + new InterfaceData(new InterfaceData()); + new InterfaceData(new InterfaceDataDefinition()); + new InterfaceData(new HashMap<>()); + } @Test public void testGetInterfaceDataDefinition() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/OperationDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/OperationDataTest.java index 88d53d368d..5745832187 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/OperationDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/OperationDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,13 @@ public class OperationDataTest { return new OperationData(); } + @Test + public void testCtor() throws Exception { + new OperationData(new HashMap<>()); + new OperationData(new OperationData()); + new OperationData(new OperationDataDefinition()); + + } @Test public void testGetOperationDataDefinition() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/OperationalEnvironmentEntryTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/OperationalEnvironmentEntryTest.java new file mode 100644 index 0000000000..e81da3ada3 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/OperationalEnvironmentEntryTest.java @@ -0,0 +1,223 @@ +package org.openecomp.sdc.be.resources.data; + +import java.util.Date; +import java.util.Set; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum; + +public class OperationalEnvironmentEntryTest { + + private OperationalEnvironmentEntry createTestSubject() { + return new OperationalEnvironmentEntry(); + } + + @Test + public void testGetLastModified() throws Exception { + OperationalEnvironmentEntry testSubject; + Date result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastModified(); + } + + @Test + public void testSetLastModified() throws Exception { + OperationalEnvironmentEntry testSubject; + Date lastModified = null; + + // default test + testSubject = createTestSubject(); + testSubject.setLastModified(lastModified); + } + + @Test + public void testGetEnvironmentId() throws Exception { + OperationalEnvironmentEntry testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEnvironmentId(); + } + + @Test + public void testSetEnvironmentId() throws Exception { + OperationalEnvironmentEntry testSubject; + String environmentId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setEnvironmentId(environmentId); + } + + @Test + public void testGetTenant() throws Exception { + OperationalEnvironmentEntry testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTenant(); + } + + @Test + public void testSetTenant() throws Exception { + OperationalEnvironmentEntry testSubject; + String tenant = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setTenant(tenant); + } + + @Test + public void testGetIsProduction() throws Exception { + OperationalEnvironmentEntry testSubject; + Boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getIsProduction(); + } + + @Test + public void testSetIsProduction() throws Exception { + OperationalEnvironmentEntry testSubject; + Boolean production = null; + + // default test + testSubject = createTestSubject(); + testSubject.setIsProduction(production); + } + + @Test + public void testGetEcompWorkloadContext() throws Exception { + OperationalEnvironmentEntry testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEcompWorkloadContext(); + } + + @Test + public void testSetEcompWorkloadContext() throws Exception { + OperationalEnvironmentEntry testSubject; + String ecompWorkloadContext = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setEcompWorkloadContext(ecompWorkloadContext); + } + + @Test + public void testGetStatus() throws Exception { + OperationalEnvironmentEntry testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getStatus(); + } + + @Test + public void testSetStatus() throws Exception { + OperationalEnvironmentEntry testSubject; + String status = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setStatus(status); + } + + @Test + public void testSetStatus_1() throws Exception { + OperationalEnvironmentEntry testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.setStatus(EnvironmentStatusEnum.COMPLETED); + } + + @Test + public void testGetDmaapUebAddress() throws Exception { + OperationalEnvironmentEntry testSubject; + Set<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDmaapUebAddress(); + } + + @Test + public void testSetDmaapUebAddress() throws Exception { + OperationalEnvironmentEntry testSubject; + Set<String> dmaapUebAddress = null; + + // default test + testSubject = createTestSubject(); + testSubject.setDmaapUebAddress(dmaapUebAddress); + } + + @Test + public void testAddDmaapUebAddress() throws Exception { + OperationalEnvironmentEntry testSubject; + String address = ""; + + // default test + testSubject = createTestSubject(); + testSubject.addDmaapUebAddress(address); + } + + @Test + public void testGetUebApikey() throws Exception { + OperationalEnvironmentEntry testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUebApikey(); + } + + @Test + public void testSetUebApikey() throws Exception { + OperationalEnvironmentEntry testSubject; + String uebApikey = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUebApikey(uebApikey); + } + + @Test + public void testGetUebSecretKey() throws Exception { + OperationalEnvironmentEntry testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUebSecretKey(); + } + + @Test + public void testSetUebSecretKey() throws Exception { + OperationalEnvironmentEntry testSubject; + String uebSecretKey = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUebSecretKey(uebSecretKey); + } + + @Test + public void testToString() throws Exception { + OperationalEnvironmentEntry testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PolicyTypeDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PolicyTypeDataTest.java index afd58c5994..648a9e8e88 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PolicyTypeDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PolicyTypeDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,11 @@ public class PolicyTypeDataTest { return new PolicyTypeData(); } + @Test + public void testCtor() throws Exception { + new PolicyTypeData(new HashMap<>()); + new PolicyTypeData(new PolicyTypeDataDefinition()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ProductMetadataDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ProductMetadataDataTest.java index 7edc786f11..a87fbba17f 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ProductMetadataDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ProductMetadataDataTest.java @@ -1,8 +1,10 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.ProductMetadataDataDefinition; public class ProductMetadataDataTest { @@ -11,6 +13,11 @@ public class ProductMetadataDataTest { return new ProductMetadataData(); } + @Test + public void testCtor() throws Exception { + new ProductMetadataData(new ProductMetadataDataDefinition()); + new ProductMetadataData(new HashMap<>()); + } @Test public void testGetUniqueIdKey() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PropertyDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PropertyDataTest.java index 4533b53e84..ea372d4390 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PropertyDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PropertyDataTest.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -13,6 +15,11 @@ public class PropertyDataTest { return new PropertyData(); } + @Test + public void testCtor() throws Exception { + new PropertyData(new HashMap<>()); + new PropertyData(new PropertyDataDefinition(), new LinkedList<>()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PropertyValueDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PropertyValueDataTest.java index 7bd7eaa4b5..138eaa8156 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PropertyValueDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/PropertyValueDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -13,6 +14,10 @@ public class PropertyValueDataTest { return new PropertyValueData(); } + @Test + public void testCtor() throws Exception { + new PropertyValueData(new HashMap<>()); + } @Test public void testGetUniqueId() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RelationshipInstDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RelationshipInstDataTest.java index 1c550654f0..b70216d37f 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RelationshipInstDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RelationshipInstDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -11,6 +12,10 @@ public class RelationshipInstDataTest { return new RelationshipInstData(); } + @Test + public void testCtor() throws Exception { + new RelationshipInstData(new HashMap<>()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RelationshipTypeDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RelationshipTypeDataTest.java index 6baf1a4ecf..00fc45bb77 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RelationshipTypeDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RelationshipTypeDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -12,6 +13,11 @@ public class RelationshipTypeDataTest { return new RelationshipTypeData(); } + @Test + public void testCtor() throws Exception { + new RelationshipTypeData(new HashMap<>()); + new RelationshipTypeData(new RelationshipInstDataDefinition()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RequirementDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RequirementDataTest.java index 580c9e5eb3..f4689dc19d 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RequirementDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RequirementDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -11,6 +12,10 @@ public class RequirementDataTest { return new RequirementData(); } + @Test + public void testCtor() throws Exception { + new RequirementData(new HashMap<>()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RequirementImplDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RequirementImplDataTest.java index b9159c6868..d2f391dd6e 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RequirementImplDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/RequirementImplDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -11,6 +12,10 @@ public class RequirementImplDataTest { return new RequirementImplData(); } + @Test + public void testCtor() throws Exception { + new RequirementImplData(new HashMap<String, Object>()); + } @Test public void testToGraphMap() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ResourceCategoryDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ResourceCategoryDataTest.java index e67fb8d92e..6180172c83 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ResourceCategoryDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ResourceCategoryDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -11,6 +12,11 @@ public class ResourceCategoryDataTest { return new ResourceCategoryData(); } + @Test + public void testCtor() throws Exception { + new ResourceCategoryData(new HashMap<>()); + new ResourceCategoryData("mock", "mock"); + } @Test public void testGetCategoryName() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ResourceMetadataDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ResourceMetadataDataTest.java new file mode 100644 index 0000000000..172ef5fe01 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ResourceMetadataDataTest.java @@ -0,0 +1,30 @@ +package org.openecomp.sdc.be.resources.data; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; + +public class ResourceMetadataDataTest { + + private ResourceMetadataData createTestSubject() { + return new ResourceMetadataData(); + } + + @Test + public void testCtor() throws Exception { + new ResourceMetadataData(new ResourceMetadataDataDefinition()); + new ResourceMetadataData(new HashMap<>()); + } + + @Test + public void testToGraphMap() throws Exception { + ResourceMetadataData testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toGraphMap(); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesDataTest.java index 2f3fb03051..31a6fb1314 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.nio.ByteBuffer; import java.util.Date; import org.junit.Test; @@ -11,6 +12,10 @@ public class SdcSchemaFilesDataTest { return new SdcSchemaFilesData(); } + @Test + public void testCtor() throws Exception { + new SdcSchemaFilesData("mock", new Date(), "mock", "mock", new byte[0], "mock"); + } @Test public void testGetSdcReleaseNum() throws Exception { @@ -77,7 +82,24 @@ public class SdcSchemaFilesDataTest { testSubject.setFileName(fileName); } + @Test + public void testGetPayload() throws Exception { + SdcSchemaFilesData testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.getPayload(); + } + @Test + public void testSetPayload() throws Exception { + SdcSchemaFilesData testSubject; + ByteBuffer payload = ByteBuffer.wrap(new byte[0]); + + // default test + testSubject = createTestSubject(); + testSubject.setPayload(payload); + } diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceCategoryDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceCategoryDataTest.java new file mode 100644 index 0000000000..1e0cc7cf68 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceCategoryDataTest.java @@ -0,0 +1,28 @@ +package org.openecomp.sdc.be.resources.data; + +import org.apache.commons.collections.map.HashedMap; +import org.junit.Test; + +import mockit.Deencapsulation; + +public class ServiceCategoryDataTest { + + private ServiceCategoryData createTestSubject() { + return new ServiceCategoryData(); + } + + @Test + public void testCtor() throws Exception { + new ServiceCategoryData(new HashedMap()); + new ServiceCategoryData("mock"); + } + + @Test + public void testCreateUniqueId() throws Exception { + ServiceCategoryData testSubject; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "createUniqueId"); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceMetadataDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceMetadataDataTest.java index 929d82e442..a60231134b 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceMetadataDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/ServiceMetadataDataTest.java @@ -1,8 +1,10 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; public class ServiceMetadataDataTest { @@ -11,6 +13,11 @@ public class ServiceMetadataDataTest { return new ServiceMetadataData(); } + @Test + public void testCtor() throws Exception { + new ServiceMetadataData(new HashMap()); + new ServiceMetadataData(new ServiceMetadataDataDefinition()); + } @Test public void testGetUniqueIdKey() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/TagDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/TagDataTest.java new file mode 100644 index 0000000000..482ebffa2b --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/TagDataTest.java @@ -0,0 +1,105 @@ +package org.openecomp.sdc.be.resources.data; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; + +public class TagDataTest { + + private TagData createTestSubject() { + return new TagData(); + } + + @Test + public void testCtor() throws Exception { + new TagData(new HashMap<>()); + new TagData("mock"); + new TagData(NodeTypeEnum.Tag); + } + + @Test + public void testToGraphMap() throws Exception { + TagData testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toGraphMap(); + } + + @Test + public void testGetName() throws Exception { + TagData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + TagData testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testToString() throws Exception { + TagData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + @Test + public void testHashCode() throws Exception { + TagData testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + @Test + public void testEquals() throws Exception { + TagData testSubject; + Object obj = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + obj = null; + result = testSubject.equals(obj); + Assert.assertEquals(false, result); + } + + @Test + public void testGetUniqueIdKey() throws Exception { + TagData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueIdKey(); + } + + @Test + public void testGetUniqueId() throws Exception { + TagData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UniqueIdDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UniqueIdDataTest.java new file mode 100644 index 0000000000..0b82c5bb1e --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UniqueIdDataTest.java @@ -0,0 +1,33 @@ +package org.openecomp.sdc.be.resources.data; + +import java.util.Map; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; + +public class UniqueIdDataTest { + + private UniqueIdData createTestSubject() { + return new UniqueIdData(NodeTypeEnum.AdditionalInfoParameters, "mock"); + } + + @Test + public void testGetUniqueId() throws Exception { + UniqueIdData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + @Test + public void testToGraphMap() throws Exception { + UniqueIdData testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toGraphMap(); + } +}
\ No newline at end of file diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UserDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UserDataTest.java index 3aab39b8e9..356e4f05e6 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UserDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UserDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Assert; @@ -9,9 +10,14 @@ import org.junit.Test; public class UserDataTest { private UserData createTestSubject() { - return new UserData("", "", "", "", "", "", null); + return new UserData(); } + @Test + public void testCtor() throws Exception { + new UserData(new HashMap<>()); + new UserData("mock", "mock", "mock", "mock", "mock", "mock", 0L); + } @Test public void testGetFirstName() throws Exception { @@ -188,6 +194,15 @@ public class UserDataTest { obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); + + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + + result = testSubject.equals(new Object()); + Assert.assertEquals(false, result); } diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UserFunctionalMenuDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UserFunctionalMenuDataTest.java index 9111d5cc61..22922e7520 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UserFunctionalMenuDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/UserFunctionalMenuDataTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -8,9 +9,14 @@ import org.junit.Test; public class UserFunctionalMenuDataTest { private UserFunctionalMenuData createTestSubject() { - return new UserFunctionalMenuData("", ""); + return new UserFunctionalMenuData(); } + @Test + public void testCtor() throws Exception { + new UserFunctionalMenuData(new HashMap<>()); + new UserFunctionalMenuData("mock", "mock"); + } @Test public void testGetFunctionalMenu() throws Exception { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java index ade07e3cbc..eb5ee579cb 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java @@ -1,11 +1,8 @@ package org.openecomp.sdc.be.resources.data.auditing.model; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; -@Generated(value = "org.junit-tools-1.0.6") public class CommonAuditDataTest { private CommonAuditData createTestSubject() { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionDataTest.java index 606e219b39..2274a41888 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionDataTest.java @@ -1,10 +1,7 @@ package org.openecomp.sdc.be.resources.data.auditing.model; -import javax.annotation.Generated; - import org.junit.Test; -@Generated(value = "org.junit-tools-1.0.6") public class DistributionDataTest { private DistributionData createTestSubject() { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditDataTest.java index fcbec32cc0..b5be4e83e7 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditDataTest.java @@ -1,10 +1,7 @@ package org.openecomp.sdc.be.resources.data.auditing.model; -import javax.annotation.Generated; - import org.junit.Test; -@Generated(value = "org.junit-tools-1.0.6") public class OperationalEnvAuditDataTest { private OperationalEnvAuditData createTestSubject() { diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java index 0246068deb..df6968da7c 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java @@ -1,11 +1,8 @@ package org.openecomp.sdc.be.resources.data.auditing.model; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder; -@Generated(value = "org.junit-tools-1.0.6") public class ResourceAuditDataTest { private ResourceAuditData createTestSubject() { |