diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2018-06-06 13:56:56 +0300 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2018-06-06 11:35:44 +0000 |
commit | e849acfa8d05d86d5f57a3e45f1e2acaf023cb93 (patch) | |
tree | 859b816fcc03a9f03203b40244a17d965ad42f34 /catalog-model/src/test/java/org | |
parent | 97093972d5eb21b5529a40be9ad9fcbe043d5576 (diff) |
new unit tests for sdc-dao
Change-Id: Id7ba81e71502db771f7243f526d46eb0865f16f2
Issue-ID: SDC-1333
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-model/src/test/java/org')
26 files changed, 896 insertions, 10 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/AdditionalInformationDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/AdditionalInformationDefinitionTest.java index f7ebf75b3c..f8f116539f 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/AdditionalInformationDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/AdditionalInformationDefinitionTest.java @@ -1,6 +1,9 @@ package org.openecomp.sdc.be.model; +import java.util.LinkedList; + import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition; public class AdditionalInformationDefinitionTest { @@ -9,6 +12,12 @@ public class AdditionalInformationDefinitionTest { return new AdditionalInformationDefinition(); } + @Test + public void testCtor() throws Exception { + new AdditionalInformationDefinition(new AdditionalInformationDefinition()); + new AdditionalInformationDefinition(new AdditionalInfoParameterDataDefinition()); + new AdditionalInformationDefinition(new AdditionalInformationDefinition(), "mock", new LinkedList<>()); + } @Test public void testGetParentUniqueId() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactDefinitionTest.java index 49e35363d6..3c0034aa3b 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactDefinitionTest.java @@ -1,8 +1,11 @@ package org.openecomp.sdc.be.model; +import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; public class ArtifactDefinitionTest { @@ -11,6 +14,13 @@ public class ArtifactDefinitionTest { return new ArtifactDefinition(); } + @Test + public void testCtor() throws Exception { + new ArtifactDefinition(new ArtifactDefinition()); + new ArtifactDefinition(new ArtifactDataDefinition()); + new ArtifactDefinition(new HashMap<>()); + new ArtifactDefinition(new ArtifactDataDefinition(), "mock"); + } @Test public void testGetPayloadData() throws Exception { @@ -59,6 +69,8 @@ public class ArtifactDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.getListHeatParameters(); + testSubject.setHeatParameters(new LinkedList<>()); + result = testSubject.getListHeatParameters(); } @@ -69,7 +81,8 @@ public class ArtifactDefinitionTest { // test 1 testSubject = createTestSubject(); - properties = null; + testSubject.setListHeatParameters(properties); + properties = new LinkedList<>(); testSubject.setListHeatParameters(properties); } @@ -82,6 +95,8 @@ public class ArtifactDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.checkEsIdExist(); + testSubject.setEsId("mock"); + result = testSubject.checkEsIdExist(); } @@ -99,11 +114,13 @@ public class ArtifactDefinitionTest { @Test public void testEquals() throws Exception { ArtifactDefinition testSubject; - Object obj = null; boolean result; // default test testSubject = createTestSubject(); - result = testSubject.equals(obj); + result = testSubject.equals(null); + result = testSubject.equals(testSubject); + result = testSubject.equals(new Object()); + result = testSubject.equals(createTestSubject()); } }
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactTypeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactTypeTest.java new file mode 100644 index 0000000000..cb870b752e --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactTypeTest.java @@ -0,0 +1,67 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Assert; +import org.junit.Test; + +public class ArtifactTypeTest { + + private ArtifactType createTestSubject() { + return new ArtifactType(); + } + + @Test + public void testGetName() throws Exception { + ArtifactType testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + ArtifactType testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testHashCode() throws Exception { + ArtifactType testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + @Test + public void testEquals() throws Exception { + ArtifactType testSubject; + Object obj = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + result = testSubject.equals(obj); + obj = new Object(); + result = testSubject.equals(obj); + Assert.assertEquals(false, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + testSubject.setName("mock"); + ArtifactType createTestSubject = createTestSubject(); + createTestSubject.setName("mock"); + result = testSubject.equals(createTestSubject); + Assert.assertEquals(true, result); + createTestSubject.setName("mock2"); + result = testSubject.equals(createTestSubject); + Assert.assertEquals(false, result); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapReqDefTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapReqDefTest.java index 7714d43c68..6c7e879a9e 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapReqDefTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapReqDefTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.model; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -12,6 +13,10 @@ public class CapReqDefTest { return new CapReqDef(); } + @Test + public void testCtor() throws Exception { + new CapReqDef(new HashMap<>(), new HashMap<>()); + } @Test public void testGetCapabilities() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java index d1c734383d..ffe0a829bb 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java @@ -1,8 +1,10 @@ package org.openecomp.sdc.be.model; +import java.util.LinkedList; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; public class CapabilityDefinitionTest { @@ -11,6 +13,14 @@ public class CapabilityDefinitionTest { return new CapabilityDefinition(); } + @Test + public void testCtor() throws Exception { + CapabilityDefinition other = new CapabilityDefinition(); + new CapabilityDefinition(other); + other.setProperties(new LinkedList<>()); + new CapabilityDefinition(other); + new CapabilityDefinition(new CapabilityDataDefinition()); + } @Test public void testHashCode() throws Exception { @@ -32,6 +42,14 @@ public class CapabilityDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.equals(obj); + result = testSubject.equals(new Object()); + result = testSubject.equals(testSubject); + CapabilityDefinition createTestSubject = createTestSubject(); + result = testSubject.equals(createTestSubject); + createTestSubject.setProperties(new LinkedList<>()); + result = testSubject.equals(createTestSubject); + testSubject.setProperties(new LinkedList<>()); + result = testSubject.equals(createTestSubject); } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityRequirementRelationshipTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityRequirementRelationshipTest.java new file mode 100644 index 0000000000..85cbef6958 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityRequirementRelationshipTest.java @@ -0,0 +1,80 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; + +public class CapabilityRequirementRelationshipTest { + + private CapabilityRequirementRelationship createTestSubject() { + return new CapabilityRequirementRelationship(); + } + + @Test + public void testGetRelation() throws Exception { + CapabilityRequirementRelationship testSubject; + RelationshipInfo result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelation(); + } + + @Test + public void testSetRelation() throws Exception { + CapabilityRequirementRelationship testSubject; + RelationshipInfo relation = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRelation(relation); + } + + @Test + public void testGetCapability() throws Exception { + CapabilityRequirementRelationship testSubject; + CapabilityDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapability(); + } + + @Test + public void testSetCapability() throws Exception { + CapabilityRequirementRelationship testSubject; + CapabilityDataDefinition capability = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapability(capability); + } + + @Test + public void testGetRequirement() throws Exception { + CapabilityRequirementRelationship testSubject; + RequirementDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirement(); + } + + @Test + public void testSetRequirement() throws Exception { + CapabilityRequirementRelationship testSubject; + RequirementDataDefinition requirement = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirement(requirement); + } + + @Test + public void testGetSerialversionuid() throws Exception { + long result; + + // default test + result = CapabilityRequirementRelationship.getSerialversionuid(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java index f05a302fdb..dde80598e7 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import java.util.Map; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.CapabilityTypeDataDefinition; public class CapabilityTypeDefinitionTest { @@ -11,6 +12,10 @@ public class CapabilityTypeDefinitionTest { return new CapabilityTypeDefinition(); } + @Test + public void testCtor() throws Exception { + new CapabilityTypeDefinition(new CapabilityTypeDataDefinition()); + } @Test public void testGetDerivedFrom() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabiltyInstanceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabiltyInstanceTest.java new file mode 100644 index 0000000000..ff13a6ce04 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabiltyInstanceTest.java @@ -0,0 +1,62 @@ +package org.openecomp.sdc.be.model; + +import java.util.Map; + +import org.junit.Test; + +public class CapabiltyInstanceTest { + + private CapabiltyInstance createTestSubject() { + return new CapabiltyInstance(); + } + + @Test + public void testGetUniqueId() throws Exception { + CapabiltyInstance testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + @Test + public void testSetUniqueId() throws Exception { + CapabiltyInstance testSubject; + String uniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uniqueId); + } + + @Test + public void testGetProperties() throws Exception { + CapabiltyInstance testSubject; + Map<String, String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + @Test + public void testSetProperties() throws Exception { + CapabiltyInstance testSubject; + Map<String, String> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + @Test + public void testToString() throws Exception { + CapabiltyInstance testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CategoryTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CategoryTest.java new file mode 100644 index 0000000000..1f8b116325 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CategoryTest.java @@ -0,0 +1,75 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Assert; +import org.junit.Test; + +public class CategoryTest { + + private Category createTestSubject() { + return new Category(); + } + + @Test + public void testGetName() throws Exception { + Category testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + Category testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testHashCode() throws Exception { + Category testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + @Test + public void testEquals() throws Exception { + Category testSubject; + Object obj = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + obj = null; + result = testSubject.equals(obj); + Assert.assertEquals(false, result); + result = testSubject.equals(new Object()); + Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); + Category createTestSubject = createTestSubject(); + createTestSubject.setName("mock"); + testSubject.setName("mock2"); + result = testSubject.equals(createTestSubject); + Assert.assertEquals(false, result); + } + + @Test + public void testToString() throws Exception { + Category testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstInputsMapTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstInputsMapTest.java index 90eb99504f..006d4fc7ad 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstInputsMapTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstInputsMapTest.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.be.model; +import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -11,7 +13,6 @@ public class ComponentInstInputsMapTest { return new ComponentInstInputsMap(); } - @Test public void testGetComponentInstanceInputsMap() throws Exception { ComponentInstInputsMap testSubject; @@ -22,7 +23,6 @@ public class ComponentInstInputsMapTest { result = testSubject.getComponentInstanceInputsMap(); } - @Test public void testSetComponentInstanceInputsMap() throws Exception { ComponentInstInputsMap testSubject; @@ -33,7 +33,6 @@ public class ComponentInstInputsMapTest { testSubject.setComponentInstanceInputsMap(componentInstanceInputsMap); } - @Test public void testGetComponentInstanceProperties() throws Exception { ComponentInstInputsMap testSubject; @@ -44,7 +43,6 @@ public class ComponentInstInputsMapTest { result = testSubject.getComponentInstanceProperties(); } - @Test public void testSetComponentInstancePropInput() throws Exception { ComponentInstInputsMap testSubject; @@ -54,4 +52,48 @@ public class ComponentInstInputsMapTest { testSubject = createTestSubject(); testSubject.setComponentInstancePropInput(componentInstanceProperties); } + + @Test + public void testResolvePropertiesToDeclareEmpty() throws Exception { + ComponentInstInputsMap testSubject; + Map<String, List<ComponentInstancePropInput>> componentInstanceProperties = null; + + // default test + testSubject = createTestSubject(); + try { + testSubject.resolvePropertiesToDeclare(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void testResolvePropertiesToDeclare() throws Exception { + ComponentInstInputsMap testSubject; + Map<String, List<ComponentInstancePropInput>> componentInstanceProperties = null; + + Map<String, List<ComponentInstancePropInput>> inputs = new HashMap<>(); + inputs.put("mock", new LinkedList<>()); + // default test + testSubject = createTestSubject(); + testSubject.setComponentInstanceInputsMap(inputs); + testSubject.resolvePropertiesToDeclare(); + testSubject = createTestSubject(); + testSubject.setComponentInstancePropInput(inputs); + testSubject.resolvePropertiesToDeclare(); + testSubject = createTestSubject(); + testSubject.setPolicyProperties(inputs); + testSubject.resolvePropertiesToDeclare(); + } + + @Test + public void testGetPolicyProperties() throws Exception { + ComponentInstInputsMap testSubject; + Map<String, List<ComponentInstancePropInput>> componentInstanceProperties = null; + + // default test + testSubject = createTestSubject(); + testSubject.getPolicyProperties(); + } }
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInputTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInputTest.java index 56e34678f9..d02b05fac5 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInputTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInputTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; @@ -12,6 +13,12 @@ public class ComponentInstanceInputTest { return new ComponentInstanceInput(); } + @Test + public void testCtor() throws Exception { + new ComponentInstanceInput(new PropertyDataDefinition()); + new ComponentInstanceInput(new InputDefinition(), "mock", "mock"); + new ComponentInstanceInput(new PropertyDataDefinition(), "mock", "mock", "mock"); + } @Test public void testGetComponentInstanceName() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropInputTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropInputTest.java index 2d53b31905..2d35a170b8 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropInputTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropInputTest.java @@ -9,6 +9,10 @@ public class ComponentInstancePropInputTest { return new ComponentInstancePropInput(); } + @Test + public void testCtor() throws Exception { + new ComponentInstancePropInput(new ComponentInstanceProperty()); + } @Test public void testGetPropertiesName() throws Exception { @@ -62,5 +66,7 @@ public class ComponentInstancePropInputTest { // default test testSubject = createTestSubject(); result = testSubject.getParsedPropNames(); + testSubject.setPropertiesName("mock"); + result = testSubject.getParsedPropNames(); } }
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropertyTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropertyTest.java index b888e95d64..a734722f2a 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropertyTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropertyTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; @@ -12,6 +13,13 @@ public class ComponentInstancePropertyTest { return new ComponentInstanceProperty(); } + @Test + public void testCtor() throws Exception { + new ComponentInstanceProperty(new PropertyDataDefinition()); + new ComponentInstanceProperty(new PropertyDefinition()); + new ComponentInstanceProperty(false, new PropertyDefinition(), "mock"); + new ComponentInstanceProperty(new PropertyDefinition(), "mock", "mock"); + } @Test public void testGetComponentInstanceName() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceTest.java new file mode 100644 index 0000000000..fd533122d8 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceTest.java @@ -0,0 +1,172 @@ +package org.openecomp.sdc.be.model; + +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; +import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; + +public class ComponentInstanceTest { + + private ComponentInstance createTestSubject() { + return new ComponentInstance(); + } + + @Test + public void testCtor() throws Exception { + new ComponentInstance(new ComponentInstanceDataDefinition()); + } + + @Test + public void testGetCapabilities() throws Exception { + ComponentInstance testSubject; + Map<String, List<CapabilityDefinition>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilities(); + } + + @Test + public void testSetCapabilities() throws Exception { + ComponentInstance testSubject; + Map<String, List<CapabilityDefinition>> capabilities = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilities(capabilities); + } + + @Test + public void testGetRequirements() throws Exception { + ComponentInstance testSubject; + Map<String, List<RequirementDefinition>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirements(); + } + + @Test + public void testSetRequirements() throws Exception { + ComponentInstance testSubject; + Map<String, List<RequirementDefinition>> requirements = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirements(requirements); + } + + @Test + public void testGetDeploymentArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDeploymentArtifacts(); + } + + @Test + public void testSafeGetDeploymentArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.safeGetDeploymentArtifacts(); + } + + @Test + public void testSafeGetInformationalArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.safeGetInformationalArtifacts(); + } + + @Test + public void testSetDeploymentArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> deploymentArtifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setDeploymentArtifacts(deploymentArtifacts); + } + + @Test + public void testGetArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + @Test + public void testSafeGetArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.safeGetArtifacts(); + } + + @Test + public void testSetArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } + + @Test + public void testGetGroupInstances() throws Exception { + ComponentInstance testSubject; + List<GroupInstance> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroupInstances(); + } + + @Test + public void testSetGroupInstances() throws Exception { + ComponentInstance testSubject; + List<GroupInstance> groupInstances = null; + + // default test + testSubject = createTestSubject(); + testSubject.setGroupInstances(groupInstances); + } + + @Test + public void testGetActualComponentUid() throws Exception { + ComponentInstance testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getActualComponentUid(); + } + + @Test + public void testIsArtifactExists() throws Exception { + ComponentInstance testSubject; + ArtifactGroupTypeEnum groupType = null; + String artifactLabel = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isArtifactExists(groupType, artifactLabel); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentMetadataDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentMetadataDefinitionTest.java index 1642f517c2..a8425e100b 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentMetadataDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentMetadataDefinitionTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; +import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; public class ComponentMetadataDefinitionTest { @@ -10,7 +11,11 @@ public class ComponentMetadataDefinitionTest { private ComponentMetadataDefinition createTestSubject() { return new ComponentMetadataDefinition(); } - + + @Test + public void testCtor() throws Exception { + new ComponentMetadataDefinition(new ResourceMetadataDataDefinition()); + } @Test public void testGetMetadataDataDefinition() throws Exception { @@ -42,8 +47,21 @@ public class ComponentMetadataDefinitionTest { // test 1 testSubject = createTestSubject(); - obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + obj = new Object(); + result = testSubject.equals(obj); + Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); + ComponentMetadataDefinition testSubject2 = createTestSubject(); + testSubject.componentMetadataDataDefinition = new ResourceMetadataDataDefinition(); + result = testSubject.equals(testSubject2); + Assert.assertEquals(false, result); + testSubject2.componentMetadataDataDefinition = new ResourceMetadataDataDefinition(); + result = testSubject.equals(testSubject2); + Assert.assertEquals(true, result); } }
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java index 57de2189e9..8dd2d0da3f 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java @@ -1,7 +1,10 @@ package org.openecomp.sdc.be.model; +import java.util.LinkedList; + import org.junit.Test; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.datatypes.enums.ComponentFieldsEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; public class ComponentParametersViewTest { @@ -10,6 +13,16 @@ public class ComponentParametersViewTest { return new ComponentParametersView(); } + @Test + public void testCtor() throws Exception { + new ComponentParametersView(true); + + LinkedList<String> linkedList = new LinkedList<>(); + for (ComponentFieldsEnum iterable_element : ComponentFieldsEnum.values()) { + linkedList.add(iterable_element.getValue()); + } + new ComponentParametersView(linkedList); + } @Test public void testFilter() throws Exception { @@ -21,6 +34,8 @@ public class ComponentParametersViewTest { // default test testSubject = createTestSubject(); result = testSubject.filter(component, componentType); + testSubject.disableAll(); + result = testSubject.filter(new Resource(), componentType); } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/DataTypeDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DataTypeDefinitionTest.java index 7cd50ce418..1b5abb8a1c 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/DataTypeDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DataTypeDefinitionTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition; public class DataTypeDefinitionTest { @@ -11,6 +12,11 @@ public class DataTypeDefinitionTest { return new DataTypeDefinition(); } + @Test + public void testCtor() throws Exception { + new DataTypeDefinition(new DataTypeDefinition()); + new DataTypeDefinition(new DataTypeDataDefinition()); + } @Test public void testGetConstraints() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionStatusEnumTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionStatusEnumTest.java new file mode 100644 index 0000000000..26e15ab783 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionStatusEnumTest.java @@ -0,0 +1,30 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Test; + +public class DistributionStatusEnumTest { + + private DistributionStatusEnum createTestSubject() { + return DistributionStatusEnum.DISTRIBUTED; + } + + @Test + public void testGetValue() throws Exception { + DistributionStatusEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(); + } + + @Test + public void testFindState() throws Exception { + String state = ""; + DistributionStatusEnum result; + + // default test + result = DistributionStatusEnum.findState(state); + DistributionStatusEnum.findState(DistributionStatusEnum.DISTRIBUTED.getValue()); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionTransitionEnumTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionTransitionEnumTest.java new file mode 100644 index 0000000000..c292996595 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionTransitionEnumTest.java @@ -0,0 +1,38 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Test; + +public class DistributionTransitionEnumTest { + + private DistributionTransitionEnum createTestSubject() { + return DistributionTransitionEnum.APPROVE; + } + + @Test + public void testGetDisplayName() throws Exception { + DistributionTransitionEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDisplayName(); + } + + @Test + public void testGetFromDisplayName() throws Exception { + String name = ""; + DistributionTransitionEnum result; + + // default test + result = DistributionTransitionEnum.getFromDisplayName(name); + result = DistributionTransitionEnum.getFromDisplayName(DistributionTransitionEnum.APPROVE.getDisplayName()); + } + + @Test + public void testValuesAsString() throws Exception { + String result; + + // default test + result = DistributionTransitionEnum.valuesAsString(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupDefinitionTest.java index db97b1e809..58709aa889 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupDefinitionTest.java @@ -1,8 +1,11 @@ package org.openecomp.sdc.be.model; +import java.util.LinkedList; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; public class GroupDefinitionTest { @@ -11,6 +14,11 @@ public class GroupDefinitionTest { return new GroupDefinition(); } + @Test + public void testCtor() throws Exception { + new GroupDefinition(new GroupDefinition()); + new GroupDefinition(new GroupDataDefinition()); + } @Test public void testConvertToGroupProperties() throws Exception { @@ -20,6 +28,10 @@ public class GroupDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.convertToGroupProperties(); + List<PropertyDataDefinition> properties = new LinkedList<>(); + properties.add(new PropertyDataDefinition()); + testSubject.setProperties(properties); + result = testSubject.convertToGroupProperties(); } @@ -30,7 +42,9 @@ public class GroupDefinitionTest { // test 1 testSubject = createTestSubject(); - properties = null; + testSubject.convertFromGroupProperties(properties); + properties = new LinkedList<>(); + properties.add(new GroupProperty()); testSubject.convertFromGroupProperties(properties); } @@ -44,5 +58,7 @@ public class GroupDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.isSamePrefix(resourceName); + testSubject.setName("mock"); + result = testSubject.isSamePrefix("mock"); } }
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstancePropertyTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstancePropertyTest.java new file mode 100644 index 0000000000..a0484cca01 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstancePropertyTest.java @@ -0,0 +1,38 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; + +public class GroupInstancePropertyTest { + + private GroupInstanceProperty createTestSubject() { + return new GroupInstanceProperty(); + } + + @Test + public void testCtor() throws Exception { + new GroupInstanceProperty(new GroupInstanceProperty()); + new GroupInstanceProperty(new PropertyDataDefinition()); + new GroupInstanceProperty(new GroupInstanceProperty(), "mock"); + } + + @Test + public void testGetParentValue() throws Exception { + GroupInstanceProperty testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getParentValue(); + } + + @Test + public void testSetParentValue() throws Exception { + GroupInstanceProperty testSubject; + String parentValue = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setParentValue(parentValue); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstanceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstanceTest.java new file mode 100644 index 0000000000..84acf9dac8 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstanceTest.java @@ -0,0 +1,107 @@ +package org.openecomp.sdc.be.model; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; + +import mockit.Deencapsulation; + +public class GroupInstanceTest { + + private GroupInstance createTestSubject() { + return new GroupInstance(); + } + + @Test + public void testCtor() throws Exception { + new GroupInstance(new GroupInstanceDataDefinition()); + } + + @Test + public void testConvertToGroupInstancesProperties() throws Exception { + GroupInstance testSubject; + List<GroupInstanceProperty> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertToGroupInstancesProperties(); + List<PropertyDataDefinition> properties = new LinkedList<>(); + properties.add(new PropertyDataDefinition()); + testSubject.setProperties(properties); + result = testSubject.convertToGroupInstancesProperties(); + } + + @Test + public void testConvertFromGroupInstancesProperties() throws Exception { + GroupInstance testSubject; + List<GroupInstanceProperty> groupInstancesProperties = null; + + // test 1 + testSubject = createTestSubject(); + groupInstancesProperties = null; + testSubject.convertFromGroupInstancesProperties(groupInstancesProperties); + groupInstancesProperties = new LinkedList<>(); + groupInstancesProperties.add(new GroupInstanceProperty()); + testSubject.convertFromGroupInstancesProperties(groupInstancesProperties); + } + + @Test + public void testRemoveArtifactsDuplicates() throws Exception { + GroupInstance testSubject; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "removeArtifactsDuplicates"); + LinkedList<String> artifacts = new LinkedList<>(); + artifacts.add("mock"); + testSubject.setArtifacts(artifacts); + LinkedList<String> groupInstanceArtifacts = new LinkedList<>(); + groupInstanceArtifacts.add("mock"); + testSubject.setGroupInstanceArtifacts(groupInstanceArtifacts); + Deencapsulation.invoke(testSubject, "removeArtifactsDuplicates"); + } + + @Test + public void testClearArtifactsUuid() throws Exception { + GroupInstance testSubject; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "clearArtifactsUuid"); + } + + @Test + public void testAlignArtifactsUuid() throws Exception { + GroupInstance testSubject; + Map<String, ArtifactDefinition> deploymentArtifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.alignArtifactsUuid(deploymentArtifacts); + LinkedList<String> artifacts = new LinkedList<>(); + artifacts.add("mock"); + testSubject.setArtifacts(artifacts); + testSubject.alignArtifactsUuid(deploymentArtifacts); + deploymentArtifacts = new HashMap<>(); + deploymentArtifacts.put("mock", new ArtifactDefinition()); + testSubject.alignArtifactsUuid(deploymentArtifacts); + } + + @Test + public void testAddArtifactsIdToCollection() throws Exception { + GroupInstance testSubject; + List<String> artifactUuids = new LinkedList<>(); + ArtifactDefinition artifact = new ArtifactDefinition(); + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "addArtifactsIdToCollection", artifactUuids, artifact); + artifact.setArtifactUUID("mock"); + Deencapsulation.invoke(testSubject, "addArtifactsIdToCollection", artifactUuids, artifact); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupPropertyTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupPropertyTest.java index ffec81e6ea..0353fe42fb 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupPropertyTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupPropertyTest.java @@ -1,6 +1,7 @@ package org.openecomp.sdc.be.model; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; public class GroupPropertyTest { @@ -9,6 +10,12 @@ public class GroupPropertyTest { return new GroupProperty(); } + @Test + public void testCtor() throws Exception { + new GroupProperty(new GroupProperty()); + new GroupProperty(new PropertyDataDefinition()); + new GroupProperty(new PropertyDefinition(), "mock", "mock"); + } @Test public void testGetValueUniqueUid() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java index f84ec7c750..47e11e1d29 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java @@ -1,8 +1,10 @@ package org.openecomp.sdc.be.model; +import java.util.LinkedList; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.GroupTypeDataDefinition; public class GroupTypeDefinitionTest { @@ -11,6 +13,10 @@ public class GroupTypeDefinitionTest { return new GroupTypeDefinition(); } + @Test + public void testCtor() throws Exception { + new GroupTypeDefinition(new GroupTypeDataDefinition()); + } @Test public void testGetProperties() throws Exception { @@ -33,6 +39,24 @@ public class GroupTypeDefinitionTest { testSubject.setProperties(properties); } + @Test + public void testGetCapabilityTypes() throws Exception { + GroupTypeDefinition testSubject; + List<PropertyDefinition> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.getCapabilityTypes(); + } + + @Test + public void testSetCapabilityTypes() throws Exception { + GroupTypeDefinition testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilityTypes(new LinkedList<>()); + } @Test public void testToString() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/InputDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/InputDefinitionTest.java index 65732607d1..e865f4e81e 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/InputDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/InputDefinitionTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; public class InputDefinitionTest { @@ -11,6 +12,11 @@ public class InputDefinitionTest { return new InputDefinition(); } + @Test + public void testCtor() throws Exception { + new InputDefinition(new PropertyDefinition()); + new InputDefinition(new PropertyDataDefinition()); + } @Test public void testGetInputs() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/InterfaceDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/InterfaceDefinitionTest.java index 3f5b218097..5a8e155056 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/InterfaceDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/InterfaceDefinitionTest.java @@ -1,8 +1,10 @@ package org.openecomp.sdc.be.model; +import java.util.HashMap; import java.util.Map; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; public class InterfaceDefinitionTest { @@ -12,6 +14,12 @@ public class InterfaceDefinitionTest { } @Test + public void testCtor() throws Exception { + new InterfaceDefinition(new InterfaceDataDefinition()); + new InterfaceDefinition("mock", "mock", new HashMap<>()); + } + + @Test public void testIsDefinition() throws Exception { InterfaceDefinition testSubject; boolean result; |