diff options
author | Sindhuri.A <arcot.sindhuri@huawei.com> | 2018-10-28 23:52:25 +0530 |
---|---|---|
committer | Michael Lando <michael.lando@intl.att.com> | 2018-10-29 18:00:27 +0000 |
commit | 2ce1a664e36a787b566d252c0604049c0b8d2652 (patch) | |
tree | 30a59f4d74e1a851e62a06ea2d170c0c7b612087 /catalog-model/src/test/java/org | |
parent | 48ab77ac8fa2cc4023ca11b212cdaa2e1da43e06 (diff) |
UT-enhance NodeTemplateOperationTest2
UT for catalog model NodeTemplateOperation class
Issue-ID: SDC-1775
Change-Id: I935f6cebcf12263c6f03f116a55056b290fb215a
Signed-off-by: Sindhuri.A <arcot.sindhuri@huawei.com>
Diffstat (limited to 'catalog-model/src/test/java/org')
-rw-r--r-- | catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java index 1822ad3500..49d0f9bf8d 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java @@ -48,6 +48,7 @@ import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -272,16 +273,26 @@ public class NodeTemplateOperationTest extends ModelTestBase { @Test public void testPrepareCalculatedCapabiltyForNodeType() throws Exception { - NodeTemplateOperation testSubject; - Map<String, ListCapabilityDataDefinition> capabilities = null; - ComponentInstanceDataDefinition componentInstance = null; - MapListCapabilityDataDefinition result; - - // test 1 - testSubject = createTestSubject(); - capabilities = null; - result = testSubject.prepareCalculatedCapabiltyForNodeType(capabilities, componentInstance); - Assert.assertEquals(null, result); + NodeTemplateOperation testSubject; + Map<String, ListCapabilityDataDefinition> capabilities = new HashMap<>(); + ListCapabilityDataDefinition listCapDataDefinition = new ListCapabilityDataDefinition(); + List<CapabilityDataDefinition> listToscaDataDefinition = new ArrayList<>(); + CapabilityDataDefinition capabilityDataDefinition = new CapabilityDefinition(); + capabilityDataDefinition.setMaxOccurrences("1"); + listToscaDataDefinition.add(capabilityDataDefinition); + listCapDataDefinition.setListToscaDataDefinition(listToscaDataDefinition); + capabilities.put("1", listCapDataDefinition); + ComponentInstanceDataDefinition componentInstance = new ComponentInstance(); + String id = "id"; + componentInstance.setComponentUid(id); + componentInstance.setUniqueId(id); + componentInstance.setName(id); + MapListCapabilityDataDefinition result; + + // test 1 + testSubject = createTestSubject(); + result = testSubject.prepareCalculatedCapabiltyForNodeType(capabilities, componentInstance); + Assert.assertEquals(1, result.getMapToscaDataDefinition().size()); } |