diff options
author | 2018-01-31 17:19:00 +0200 | |
---|---|---|
committer | 2018-01-31 17:19:00 +0200 | |
commit | 1cfb08779ea0e00be69e072a940b3063e049fe6b (patch) | |
tree | 6602a900387c8393ed0dcd81c0539381632903c6 /vid-app-common/src/test/java/org/onap/vid/asdc | |
parent | 2f20b001b9243e0f8b44aecc768ec265fd538732 (diff) |
org.onap migration
Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d
Issue-ID: VID-86
Signed-off-by: Ofir Sonsino <os0695@att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/asdc')
13 files changed, 2263 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ArtifactTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ArtifactTest.java new file mode 100644 index 00000000..04944120 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ArtifactTest.java @@ -0,0 +1,277 @@ +package org.onap.vid.asdc.beans; + +import org.junit.Test; + + +public class ArtifactTest { + + private Artifact createTestSubject() { + return new Artifact(); + } + + + @Test + public void testGetArtifactName() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactName(); + } + + + @Test + public void testGetArtifactType() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactType(); + } + + + @Test + public void testGetArtifactGroupType() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactGroupType(); + } + + + @Test + public void testGetArtifactLabel() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactLabel(); + } + + + @Test + public void testGetArtifactURL() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactURL(); + } + + + @Test + public void testGetArtifactDescription() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactDescription(); + } + + + @Test + public void testGetArtifactTimeout() throws Exception { + Artifact testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactTimeout(); + } + + + @Test + public void testGetArtifactChecksum() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactChecksum(); + } + + + @Test + public void testGetArtifactUUID() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactUUID(); + } + + + @Test + public void testGetArtifactVersion() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactVersion(); + } + + + @Test + public void testGetGeneratedFromUUID() throws Exception { + Artifact testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGeneratedFromUUID(); + } + + + @Test + public void testSetArtifactName() throws Exception { + Artifact testSubject; + String artifactName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactName(artifactName); + } + + + @Test + public void testSetArtifactType() throws Exception { + Artifact testSubject; + String artifactType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactType(artifactType); + } + + + @Test + public void testSetArtifactGroupType() throws Exception { + Artifact testSubject; + String artifactGroupType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactGroupType(artifactGroupType); + } + + + @Test + public void testSetArtifactLabel() throws Exception { + Artifact testSubject; + String artifactLabel = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactLabel(artifactLabel); + } + + + @Test + public void testSetArtifactURL() throws Exception { + Artifact testSubject; + String artifactURL = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactURL(artifactURL); + } + + + @Test + public void testSetArtifactDescription() throws Exception { + Artifact testSubject; + String artifactDescription = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactDescription(artifactDescription); + } + + + @Test + public void testSetArtifactTimeout() throws Exception { + Artifact testSubject; + int artifactTimeout = 0; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactTimeout(artifactTimeout); + } + + + @Test + public void testSetArtifactChecksum() throws Exception { + Artifact testSubject; + String artifactChecksum = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactChecksum(artifactChecksum); + } + + + @Test + public void testSetArtifactUUID() throws Exception { + Artifact testSubject; + String artifactUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactUUID(artifactUUID); + } + + + @Test + public void testSetArtifactVersion() throws Exception { + Artifact testSubject; + String artifactVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactVersion(artifactVersion); + } + + + @Test + public void testSetGeneratedFromUUID() throws Exception { + Artifact testSubject; + String generatedFromUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setGeneratedFromUUID(generatedFromUUID); + } + + + @Test + public void testHashCode() throws Exception { + Artifact testSubject; + int result; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactUUID("48a52540-8772-4368-9cdb-1f124ea5c931"); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + Artifact testSubject; + Object o = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(o); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ResourceTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ResourceTest.java new file mode 100644 index 00000000..af42409c --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/ResourceTest.java @@ -0,0 +1,391 @@ +package org.onap.vid.asdc.beans; + +import java.util.Collection; + +import org.junit.Test; +import org.onap.vid.asdc.beans.Resource.LifecycleState; +import org.onap.vid.asdc.beans.Resource.Type; + + +public class ResourceTest { + + private Resource createTestSubject() { + return new Resource(); + } + + + @Test + public void testGetUuid() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUuid(); + } + + + @Test + public void testGetInvariantUUID() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantUUID(); + } + + + @Test + public void testGetName() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + + @Test + public void testGetDescription() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testGetVersion() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + + @Test + public void testGetToscaModelURL() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaModelURL(); + } + + + @Test + public void testGetCategory() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategory(); + } + + + @Test + public void testGetSubCategory() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubCategory(); + } + + + @Test + public void testGetResourceType() throws Exception { + Resource testSubject; + Type result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceType(); + } + + + @Test + public void testGetLifecycleState() throws Exception { + Resource testSubject; + LifecycleState result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLifecycleState(); + } + + + @Test + public void testGetLastUpdaterUserId() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdaterUserId(); + } + + + @Test + public void testGetLastUpdaterFullName() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLastUpdaterFullName(); + } + + + @Test + public void testGetToscaModel() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaModel(); + } + + + @Test + public void testGetToscaResourceName() throws Exception { + Resource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getToscaResourceName(); + } + + + @Test + public void testGetArtifacts() throws Exception { + Resource testSubject; + Collection<Artifact> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + + @Test + public void testGetResources() throws Exception { + Resource testSubject; + Collection<SubResource> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResources(); + } + + + @Test + public void testSetUuid() throws Exception { + Resource testSubject; + String uuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUuid(uuid); + } + + + @Test + public void testSetInvariantUUID() throws Exception { + Resource testSubject; + String invariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUUID(invariantUUID); + } + + + @Test + public void testSetName() throws Exception { + Resource testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + + @Test + public void testSetDescription() throws Exception { + Resource testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testSetVersion() throws Exception { + Resource testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + + @Test + public void testSetToscaModelURL() throws Exception { + Resource testSubject; + String toscaModelURL = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaModelURL(toscaModelURL); + } + + + @Test + public void testSetCategory() throws Exception { + Resource testSubject; + String category = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCategory(category); + } + + + @Test + public void testSetSubCategory() throws Exception { + Resource testSubject; + String subCategory = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSubCategory(subCategory); + } + + + @Test + public void testSetResourceType() throws Exception { + Resource testSubject; + Type resourceType = null; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceType(resourceType); + } + + + @Test + public void testSetLifecycleState() throws Exception { + Resource testSubject; + LifecycleState lifecycleState = null; + + // default test + testSubject = createTestSubject(); + testSubject.setLifecycleState(lifecycleState); + } + + + @Test + public void testSetLastUpdaterUserId() throws Exception { + Resource testSubject; + String lastUpdaterUserId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdaterUserId(lastUpdaterUserId); + } + + + @Test + public void testSetLastUpdaterFullName() throws Exception { + Resource testSubject; + String lastUpdaterFullName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setLastUpdaterFullName(lastUpdaterFullName); + } + + + @Test + public void testSetToscaModel() throws Exception { + Resource testSubject; + String toscaModel = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaModel(toscaModel); + } + + + @Test + public void testSetToscaResourceName() throws Exception { + Resource testSubject; + String toscaResourceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setToscaResourceName(toscaResourceName); + } + + + @Test + public void testSetArtifacts() throws Exception { + Resource testSubject; + Collection<Artifact> artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } + + + @Test + public void testSetResources() throws Exception { + Resource testSubject; + Collection<SubResource> resources = null; + + // default test + testSubject = createTestSubject(); + testSubject.setResources(resources); + } + + + @Test + public void testHashCode() throws Exception { + Resource testSubject; + int result; + + // default test + testSubject = createTestSubject(); + testSubject.setUuid("cb49608f-5a24-4789-b0f7-2595473cb997"); + result = testSubject.hashCode(); + } + + + @Test + public void testEquals() throws Exception { + Resource testSubject; + Object o = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.equals(o); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/SubResourceTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/SubResourceTest.java new file mode 100644 index 00000000..e1672b71 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/SubResourceTest.java @@ -0,0 +1,167 @@ +package org.onap.vid.asdc.beans; + +import java.util.Collection; + +import org.junit.Test; + + +public class SubResourceTest { + + private SubResource createTestSubject() { + return new SubResource(); + } + + + @Test + public void testGetResourceInstanceName() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceInstanceName(); + } + + + @Test + public void testGetResourceName() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceName(); + } + + + @Test + public void testGetResourceInvariantUUID() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceInvariantUUID(); + } + + + @Test + public void testGetResourceVersion() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVersion(); + } + + + @Test + public void testGetResoucreType() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResoucreType(); + } + + + @Test + public void testGetResourceUUID() throws Exception { + SubResource testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceUUID(); + } + + + @Test + public void testGetArtifacts() throws Exception { + SubResource testSubject; + Collection<Artifact> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + + @Test + public void testSetResourceInstanceName() throws Exception { + SubResource testSubject; + String resourceInstanceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceInstanceName(resourceInstanceName); + } + + + @Test + public void testSetResourceName() throws Exception { + SubResource testSubject; + String resourceName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceName(resourceName); + } + + + @Test + public void testSetResourceInvariantUUID() throws Exception { + SubResource testSubject; + String resourceInvariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceInvariantUUID(resourceInvariantUUID); + } + + + @Test + public void testSetResourceVersion() throws Exception { + SubResource testSubject; + String resourceVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVersion(resourceVersion); + } + + + @Test + public void testSetResoucreType() throws Exception { + SubResource testSubject; + String resourceType = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResoucreType(resourceType); + } + + + @Test + public void testSetResourceUUID() throws Exception { + SubResource testSubject; + String resourceUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceUUID(resourceUUID); + } + + + @Test + public void testSetArtifacts() throws Exception { + SubResource testSubject; + Collection<Artifact> artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/TestSuite.java new file mode 100644 index 00000000..6f0d47a2 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/TestSuite.java @@ -0,0 +1,11 @@ +package org.onap.vid.asdc.beans; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ ArtifactTest.class, ResourceTest.class, SubResourceTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/CapabilityTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/CapabilityTest.java new file mode 100644 index 00000000..7609e36d --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/CapabilityTest.java @@ -0,0 +1,124 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.Collection; +import java.util.Map; + +import org.junit.Test; + + +public class CapabilityTest { + + private Capability createTestSubject() { + return new Capability(); + } + + + @Test + public void testGetType() throws Exception { + Capability testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testGetDescription() throws Exception { + Capability testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testGetOccurrences() throws Exception { + Capability testSubject; + Collection<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOccurrences(); + } + + + @Test + public void testGetProperties() throws Exception { + Capability testSubject; + Map<String, Property> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testGetValid_source_types() throws Exception { + Capability testSubject; + Collection<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValid_source_types(); + } + + + @Test + public void testSetType() throws Exception { + Capability testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testSetDescription() throws Exception { + Capability testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testSetOccurrences() throws Exception { + Capability testSubject; + Collection<String> occurrences = null; + + // default test + testSubject = createTestSubject(); + testSubject.setOccurrences(occurrences); + } + + + @Test + public void testSetProperties() throws Exception { + Capability testSubject; + Map<String, Property> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + + @Test + public void testSetValid_source_types() throws Exception { + Capability testSubject; + Collection<String> valid_source_types = null; + + // default test + testSubject = createTestSubject(); + testSubject.setValid_source_types(valid_source_types); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ConstraintTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ConstraintTest.java new file mode 100644 index 00000000..ebba7d17 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ConstraintTest.java @@ -0,0 +1,221 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.List; + +import org.junit.Test; + +public class ConstraintTest { + + private Constraint createTestSubject() { + return new Constraint(); + } + + + @Test + public void testGetvalid_values() throws Exception { + Constraint testSubject; + List<Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getvalid_values(); + } + + + @Test + public void testGetEqual() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEqual(); + } + + + @Test + public void testGetGreater_than() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGreater_than(); + } + + + @Test + public void testGetGreater_or_equal() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGreater_or_equal(); + } + + + @Test + public void testGetLess_than() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLess_than(); + } + + + @Test + public void testGetLess_or_equal() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLess_or_equal(); + } + + + @Test + public void testGetIn_range() throws Exception { + Constraint testSubject; + List<Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getIn_range(); + } + + + @Test + public void testGetLength() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLength(); + } + + + @Test + public void testGetMin_length() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMin_length(); + } + + + @Test + public void testGetMax_length() throws Exception { + Constraint testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMax_length(); + } + + + @Test + public void testSetvalid_values() throws Exception { + Constraint testSubject; + List<Object> vlist = null; + + // default test + testSubject = createTestSubject(); + testSubject.setvalid_values(vlist); + } + + + @Test + public void testSetEqual() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setEqual(e); + } + + + @Test + public void testSetGreater_than() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setGreater_than(e); + } + + + @Test + public void testSetLess_than() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setLess_than(e); + } + + + @Test + public void testSetIn_range() throws Exception { + Constraint testSubject; + List<Object> e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setIn_range(e); + } + + + @Test + public void testSetLength() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setLength(e); + } + + + @Test + public void testSetMin_length() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMin_length(e); + } + + + @Test + public void testSetMax_length() throws Exception { + Constraint testSubject; + Object e = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMax_length(e); + } + + + @Test + public void testToString() throws Exception { + Constraint testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/GroupTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/GroupTest.java new file mode 100644 index 00000000..3692a15b --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/GroupTest.java @@ -0,0 +1,124 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.Collection; +import java.util.Map; + +import org.junit.Test; + + +public class GroupTest { + + private Group createTestSubject() { + return new Group(); + } + + + @Test + public void testGetMetadata() throws Exception { + Group testSubject; + ToscaMetadata result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadata(); + } + + + @Test + public void testSetMetadata() throws Exception { + Group testSubject; + ToscaMetadata metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadata(metadata); + } + + + @Test + public void testGetMembers() throws Exception { + Group testSubject; + Collection<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMembers(); + } + + + @Test + public void testSetMembers() throws Exception { + Group testSubject; + Collection<String> members = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMembers(members); + } + + + @Test + public void testGetType() throws Exception { + Group testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + + @Test + public void testSetType() throws Exception { + Group testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + + @Test + public void testGetvf_module_type() throws Exception { + Group testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getvf_module_type(); + } + + + @Test + public void testSetvf_module_type() throws Exception { + Group testSubject; + String vf_module_type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setvf_module_type(vf_module_type); + } + + + @Test + public void testGetProperties() throws Exception { + Group testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + + @Test + public void testSetProperties() throws Exception { + Group testSubject; + Map<String, Object> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/NodeTemplateTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/NodeTemplateTest.java new file mode 100644 index 00000000..678a5102 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/NodeTemplateTest.java @@ -0,0 +1,92 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.Map; + +import org.junit.Test; + +public class NodeTemplateTest { + + private NodeTemplate createTestSubject() { + return new NodeTemplate(); + } + + @Test + public void testGetType() throws Exception { + NodeTemplate testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + @Test + public void testSetType() throws Exception { + NodeTemplate testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + @Test + public void testGetMetadata() throws Exception { + NodeTemplate testSubject; + ToscaMetadata result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadata(); + } + + @Test + public void testSetMetadata() throws Exception { + NodeTemplate testSubject; + ToscaMetadata metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadata(metadata); + } + + @Test + public void testGetProperties() throws Exception { + NodeTemplate testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + @Test + public void testSetProperties() throws Exception { + NodeTemplate testSubject; + Map<String, Object> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + @Test + public void testGetRequirements() throws Exception { + NodeTemplate testSubject; + Object result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirements(); + } + + @Test + public void testSetRequirements() throws Exception { + NodeTemplate testSubject; + Object requirements = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirements(requirements); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TestSuite.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TestSuite.java new file mode 100644 index 00000000..d94d3392 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TestSuite.java @@ -0,0 +1,12 @@ +package org.onap.vid.asdc.beans.tosca; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( + +{ GroupTest.class, TopologyTemplateTest.class, ToscaModelTest.class, CapabilityTest.class, ToscaMetadataTest.class, + ConstraintTest.class, NodeTemplateTest.class }) +public class TestSuite { // nothing +} diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TopologyTemplateTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TopologyTemplateTest.java new file mode 100644 index 00000000..8392d926 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/TopologyTemplateTest.java @@ -0,0 +1,101 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.Map; + +import org.junit.Test; + + +public class TopologyTemplateTest { + + private TopologyTemplate createTestSubject() { + return new TopologyTemplate(); + } + + + @Test + public void testGetsubstitution_mappings() throws Exception { + TopologyTemplate testSubject; + SubstitutionMappings result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getsubstitution_mappings(); + } + + + @Test + public void testSetsubstitution_mappings() throws Exception { + TopologyTemplate testSubject; + SubstitutionMappings substitution_mappings = null; + + // default test + testSubject = createTestSubject(); + testSubject.setsubstitution_mappings(substitution_mappings); + } + + + @Test + public void testGetInputs() throws Exception { + TopologyTemplate testSubject; + Map<String, Input> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInputs(); + } + + + @Test + public void testSetInputs() throws Exception { + TopologyTemplate testSubject; + Map<String, Input> inputs = null; + + // default test + testSubject = createTestSubject(); + testSubject.setInputs(inputs); + } + + + @Test + public void testGetnode_templates() throws Exception { + TopologyTemplate testSubject; + Map<String, NodeTemplate> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getnode_templates(); + } + + + @Test + public void testSetnode_templates() throws Exception { + TopologyTemplate testSubject; + Map<String, NodeTemplate> node_templates = null; + + // default test + testSubject = createTestSubject(); + testSubject.setnode_templates(node_templates); + } + + + @Test + public void testGetGroups() throws Exception { + TopologyTemplate testSubject; + Map<String, Group> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroups(); + } + + + @Test + public void testSetGroups() throws Exception { + TopologyTemplate testSubject; + Map<String, Group> groups = null; + + // default test + testSubject = createTestSubject(); + testSubject.setGroups(groups); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaMetadataTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaMetadataTest.java new file mode 100644 index 00000000..2c91d962 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaMetadataTest.java @@ -0,0 +1,443 @@ +package org.onap.vid.asdc.beans.tosca; + +import org.junit.Test; + +public class ToscaMetadataTest { + + private ToscaMetadata createTestSubject() { + return new ToscaMetadata(); + } + + @Test + public void testGetType() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getType(); + } + + @Test + public void testGetInvariantUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getInvariantUUID(); + } + + @Test + public void testGetCustomizationUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCustomizationUUID(); + } + + @Test + public void testGetUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUUID(); + } + + @Test + public void testGetVersion() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVersion(); + } + + @Test + public void testGetName() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testGetDescription() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + @Test + public void testGetCategory() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategory(); + } + + @Test + public void testGetSubcategory() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubcategory(); + } + + @Test + public void testGetResourceVendor() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVendor(); + } + + @Test + public void testGetResourceVendorRelease() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceVendorRelease(); + } + + @Test + public void testGetServiceEcompNaming() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getServiceEcompNaming(); + } + + @Test + public void testGetNamingPolicy() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getNamingPolicy(); + } + + @Test + public void testIsServiceHoming() throws Exception { + ToscaMetadata testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isServiceHoming(); + } + + @Test + public void testIsEcompGeneratedNaming() throws Exception { + ToscaMetadata testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isEcompGeneratedNaming(); + } + + @Test + public void testSetType() throws Exception { + ToscaMetadata testSubject; + String type = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setType(type); + } + + @Test + public void testSetInvariantUUID() throws Exception { + ToscaMetadata testSubject; + String invariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setInvariantUUID(invariantUUID); + } + + @Test + public void testSetNamingPolicy() throws Exception { + ToscaMetadata testSubject; + String namingPolicy = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setNamingPolicy(namingPolicy); + } + + @Test + public void testSetUUID() throws Exception { + ToscaMetadata testSubject; + String uuid = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUUID(uuid); + } + + @Test + public void testSetCustomizationUUID() throws Exception { + ToscaMetadata testSubject; + String u = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCustomizationUUID(u); + } + + @Test + public void testSetVersion() throws Exception { + ToscaMetadata testSubject; + String version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVersion(version); + } + + @Test + public void testSetName() throws Exception { + ToscaMetadata testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testSetDescription() throws Exception { + ToscaMetadata testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + @Test + public void testSetCategory() throws Exception { + ToscaMetadata testSubject; + String category = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setCategory(category); + } + + @Test + public void testSetServiceEcompNaming() throws Exception { + ToscaMetadata testSubject; + String serviceEcompNaming = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceEcompNaming(serviceEcompNaming); + } + + @Test + public void testSetServiceHoming() throws Exception { + ToscaMetadata testSubject; + boolean serviceHoming = false; + + // default test + testSubject = createTestSubject(); + testSubject.setServiceHoming(serviceHoming); + } + + @Test + public void testSetEcompGeneratedNaming() throws Exception { + ToscaMetadata testSubject; + boolean ecompGeneratedNaming = false; + + // default test + testSubject = createTestSubject(); + testSubject.setEcompGeneratedNaming(ecompGeneratedNaming); + } + + @Test + public void testGettemplate_name() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.gettemplate_name(); + } + + @Test + public void testSettemplate_name() throws Exception { + ToscaMetadata testSubject; + String template_name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.settemplate_name(template_name); + } + + + @Test + public void testSetSubcategory() throws Exception { + ToscaMetadata testSubject; + String subcategory = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setSubcategory(subcategory); + } + + + @Test + public void testSetResourceVendor() throws Exception { + ToscaMetadata testSubject; + String resourceVendor = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVendor(resourceVendor); + } + + + @Test + public void testSetResourceVendorRelease() throws Exception { + ToscaMetadata testSubject; + String resourceVendorRelease = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setResourceVendorRelease(resourceVendorRelease); + } + + + @Test + public void testGetVfModuleModelName() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelName(); + } + + + @Test + public void testSetVfModuleModelName() throws Exception { + ToscaMetadata testSubject; + String vfModuleModelName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelName(vfModuleModelName); + } + + + @Test + public void testGetVfModuleModelInvariantUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelInvariantUUID(); + } + + + @Test + public void testSetVfModuleModelInvariantUUID() throws Exception { + ToscaMetadata testSubject; + String vfModuleModelInvariantUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelInvariantUUID(vfModuleModelInvariantUUID); + } + + + @Test + public void testGetVfModuleModelUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelUUID(); + } + + + @Test + public void testSetVfModuleModelUUID() throws Exception { + ToscaMetadata testSubject; + String vfModuleModelUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelUUID(vfModuleModelUUID); + } + + + @Test + public void testGetVfModuleModelVersion() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelVersion(); + } + + + @Test + public void testSetVfModuleModelVersion() throws Exception { + ToscaMetadata testSubject; + String vfModuleModelVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelVersion(vfModuleModelVersion); + } + + + @Test + public void testSetVfModuleModelCustomizationUUID() throws Exception { + ToscaMetadata testSubject; + String u = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setVfModuleModelCustomizationUUID(u); + } + + + @Test + public void testGetVfModuleModelCustomizationUUID() throws Exception { + ToscaMetadata testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVfModuleModelCustomizationUUID(); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaModelTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaModelTest.java new file mode 100644 index 00000000..ee546374 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/beans/tosca/ToscaModelTest.java @@ -0,0 +1,146 @@ +package org.onap.vid.asdc.beans.tosca; + +import java.util.Collection; +import java.util.Map; + +import org.junit.Test; + + +public class ToscaModelTest { + + private ToscaModel createTestSubject() { + return new ToscaModel(); + } + + + @Test + public void testGetMetadata() throws Exception { + ToscaModel testSubject; + ToscaMetadata result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getMetadata(); + } + + + @Test + public void testSetMetadata() throws Exception { + ToscaModel testSubject; + ToscaMetadata metadata = null; + + // default test + testSubject = createTestSubject(); + testSubject.setMetadata(metadata); + } + + + @Test + public void testGettosca_definitions_version() throws Exception { + ToscaModel testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.gettosca_definitions_version(); + } + + + @Test + public void testSettosca_definitions_version() throws Exception { + ToscaModel testSubject; + String tosca_definitions_version = ""; + + // default test + testSubject = createTestSubject(); + testSubject.settosca_definitions_version(tosca_definitions_version); + } + + + @Test + public void testGettopology_template() throws Exception { + ToscaModel testSubject; + TopologyTemplate result; + + // default test + testSubject = createTestSubject(); + result = testSubject.gettopology_template(); + } + + + @Test + public void testSettopology_template() throws Exception { + ToscaModel testSubject; + TopologyTemplate topology_template = null; + + // default test + testSubject = createTestSubject(); + testSubject.settopology_template(topology_template); + } + + + @Test + public void testGetDescription() throws Exception { + ToscaModel testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDescription(); + } + + + @Test + public void testSetDescription() throws Exception { + ToscaModel testSubject; + String description = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDescription(description); + } + + + @Test + public void testGetImports() throws Exception { + ToscaModel testSubject; + Collection<Map<String, Map<String, String>>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getImports(); + } + + + @Test + public void testSetImports() throws Exception { + ToscaModel testSubject; + Collection<Map<String, Map<String, String>>> imports = null; + + // default test + testSubject = createTestSubject(); + testSubject.setImports(imports); + } + + + @Test + public void testGetnode_types() throws Exception { + ToscaModel testSubject; + Map<String, Object> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getnode_types(); + } + + + @Test + public void testSetnode_types() throws Exception { + ToscaModel testSubject; + Map<String, Object> node_types = null; + + // default test + testSubject = createTestSubject(); + testSubject.setnode_types(node_types); + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java new file mode 100644 index 00000000..99f8ef38 --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java @@ -0,0 +1,154 @@ +package org.onap.vid.asdc.parser; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.google.common.collect.ImmutableList; +import org.apache.log4j.Logger; +import org.junit.Assert; +import org.onap.vid.controller.WebConfig; +import org.onap.vid.model.VfModule; +import org.onap.vid.model.VolumeGroup; +import org.onap.vid.properties.AsdcClientConfiguration; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.toscaparser.api.Group; +import org.openecomp.sdc.toscaparser.api.NodeTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.web.context.WebApplicationContext; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.Map; + +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.*; + +@Test +@ContextConfiguration(classes = { WebConfig.class, AsdcClientConfiguration.class, SystemProperties.class }) +@WebAppConfiguration +public class ToscaParserImpl2Test extends AbstractTestNGSpringContextTests { + + private final String myUUID = "myUUID"; + private static final Logger log = Logger.getLogger(ToscaParserImpl2Test.class); + + @Autowired + private ToscaParserImpl2 toscaParserImpl2; + + @Autowired + private WebApplicationContext wac; + + @BeforeMethod + private void verifyWiring() { + Assert.assertNotNull(wac); + Assert.assertNotNull(toscaParserImpl2); + } + + @Test + public void testGetNFModuleFromVf() throws Exception { + ISdcCsarHelper csarHelper = getMockedSdcCsarHelper(); + + Map<String, VfModule> vfModulesFromVF = toscaParserImpl2.getVfModulesFromVF(csarHelper, myUUID); + + assertThat(vfModulesFromVF, allOf( + aMapWithSize(2), + hasKey("withoutVol"), + hasKey("withVol") + )); + + verify(csarHelper, only()).getVfModulesByVf(anyString()); + } + + @Test + public void testGetVolumeGroupsFromVF() throws Exception { + ISdcCsarHelper csarHelper = getMockedSdcCsarHelper(); + + Map<String, VolumeGroup> volumeGroupsFromVF = toscaParserImpl2.getVolumeGroupsFromVF(csarHelper, myUUID); + + assertThat(volumeGroupsFromVF, allOf( + aMapWithSize(1), + hasKey("withVol") + )); + + verify(csarHelper, only()).getVfModulesByVf(anyString()); + } + + private ISdcCsarHelper getMockedSdcCsarHelper() { + ISdcCsarHelper csarHelper = mock(ISdcCsarHelper.class); + +// ThreadLocalsHolder.setCollector(new ExceptionCollector("c:\\temp\\foo")); + + Group withVol = createMinimalGroup("withVol", true); + Group withoutVol = createMinimalGroup("withoutVol", false); + + when(csarHelper.getVfModulesByVf(myUUID)) + .thenReturn(ImmutableList.of(withVol, withoutVol)); + + return csarHelper; + } + + private static Group createMinimalGroup(String name, boolean isVolumeGroup) { + LinkedHashMap<String, Object> + templates, + properties, + metadata, + customDef, + vfModule, + vfModuleProperties, + volumeGroup; + + templates = new LinkedHashMap<>(); + templates.put("type", "org.onap.groups.VfModule"); + + properties = addNewNamedMap(templates, "properties"); + properties.put("volume_group", isVolumeGroup); + + metadata = addNewNamedMap(templates, "metadata"); + + ArrayList<NodeTemplate> memberNodes = new ArrayList<>(); + + customDef = new LinkedHashMap<>(); + vfModule = addNewNamedMap(customDef, "org.onap.groups.VfModule"); + vfModuleProperties = addNewNamedMap(vfModule, "properties"); +// vfModule.put("derived_from", "tosca.groups.Root"); +// vfModule.put("description", "Grouped all heat resources which are in the same VF Module"); + + volumeGroup = addNewNamedMap(vfModuleProperties, "volume_group"); +// volumeGroup.put("description", "volume_group"); + volumeGroup.put("type", "boolean"); + volumeGroup.put("default", false); + volumeGroup.put("required", true); + + + Group group = new Group( + name, + templates, + memberNodes, + customDef + ); + + try { + log.info(String.format("Built a group: %s", + (new com.fasterxml.jackson.databind.ObjectMapper()) + .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) + .writeValueAsString(group) + )); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + + return group; + } + + private static LinkedHashMap<String, Object> addNewNamedMap(LinkedHashMap<String, Object> root, String key) { + LinkedHashMap<String, Object> properties = new LinkedHashMap<>(); + root.put(key, properties); + return properties; + } + +} |