summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib
diff options
context:
space:
mode:
authortalio <tali.orenbach@amdocs.com>2018-01-28 09:47:38 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-02-04 06:56:25 +0000
commitb43e8ebd9f3e7436a51c2a6b9fe71f254d92b833 (patch)
tree88ef13834fc4529c26bf325fb7188c90309f4e3e /openecomp-be/lib/openecomp-tosca-lib
parent693a3f26aba6104fad1659d9b481cbdd0b75d6d8 (diff)
change capabilities datatype
change node template capabilities datatype from list of map to map Change-Id: Ie0fa71b8a41ec732ae5290a72c4d8e908701ce17 Issue-ID: SDC-968 Signed-off-by: talio <tali.orenbach@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java8
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java3
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml2
4 files changed, 6 insertions, 9 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
index fd89faeb85..8da2fc8c54 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
@@ -1114,16 +1114,14 @@ public class DataModelUtil {
public static void addNodeTemplateCapability(NodeTemplate nodeTemplate, String capabilityId,
Map<String, Object> capabilityProperties,
Map<String, Object> capabilityAttributes) {
- List<Map<String, CapabilityAssignment>> capabilities = nodeTemplate.getCapabilities();
+ Map<String, CapabilityAssignment> capabilities = nodeTemplate.getCapabilities();
if (Objects.isNull(capabilities)) {
- capabilities = new ArrayList<>();
+ capabilities = new HashMap<>();
}
CapabilityAssignment capabilityAssignment = new CapabilityAssignment();
capabilityAssignment.setProperties(capabilityProperties);
capabilityAssignment.setAttributes(capabilityAttributes);
- Map<String, CapabilityAssignment> nodeTemplateCapability = new HashMap<>();
- nodeTemplateCapability.put(capabilityId, capabilityAssignment);
- capabilities.add(nodeTemplateCapability);
+ capabilities.put(capabilityId, capabilityAssignment);
nodeTemplate.setCapabilities(capabilities);
}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
index e8c9c602f8..60f59dbd81 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
@@ -238,8 +238,7 @@ public class ToscaModelTest {
capAtts.put("num_cpus", "66");
capAss.setAttributes(capAtts);
nodeTemplateCapability.put("cap1", capAss);
- nodeTemplate.setCapabilities(new ArrayList<>());
- nodeTemplate.getCapabilities().add(nodeTemplateCapability);
+ nodeTemplate.setCapabilities(nodeTemplateCapability);
NodeFilter nodeTemplateNodeFilter = new NodeFilter();
Map<String, List<Constraint>> ntProp = new HashMap<>();
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml
index 2fb8042e00..c49f30f97b 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml
@@ -99,7 +99,7 @@ topology_template:
node: nodeA
relationship: relationB
capabilities:
- - cap1:
+ cap1:
properties:
num_cpus: '{ get_input: cpus }'
attributes:
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml
index 6f34a76ab4..ac349313c2 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml
@@ -104,7 +104,7 @@ topology_template:
node: nodeA
relationship: relationB
capabilities:
- - cap1:
+ cap1:
properties:
num_cpus: '{ get_input: cpus }'
attributes: