aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Aharoni <pa0916@att.com>2017-06-27 12:29:46 +0300
committerPavel Aharoni <pa0916@att.com>2017-06-27 12:29:46 +0300
commitf016b5bad31c356a019c638e1e636f8f31ca0c4e (patch)
tree2064cffb1071f9dc57f3463b969045b3c2a9f209
parentea380b0df0a5e3632e758767244b2176808d641e (diff)
[SDC-39] fixing signature to be String
Change-Id: Icd107925d6e9b2c4f2099a1361405503e017e031 Signed-off-by: Pavel Aharoni <pa0916@att.com>
-rw-r--r--src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java2
-rw-r--r--src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java10
-rw-r--r--src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java68
3 files changed, 41 insertions, 39 deletions
diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java b/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java
index 333df0d..35c68d4 100644
--- a/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java
+++ b/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java
@@ -343,7 +343,7 @@ public interface ISdcCsarHelper {
* @param pattern value to filter with it
* @return Map <b>full path to a property</b> mapped to <b>property value</b> filtered by type and pattern
*/
- public Map<String, Object> filterNodeTemplatePropertiesByValue(NodeTemplate nodeTemplate, FilterType filterType, String pattern);
+ public Map<String, String> filterNodeTemplatePropertiesByValue(NodeTemplate nodeTemplate, FilterType filterType, String pattern);
/**
* Get all node templates by sdcType for parent Node Template.
diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
index 4a3f73e..8095974 100644
--- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
+++ b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
@@ -577,8 +577,8 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
return new ArrayList<>();
}
- public Map<String, Object> filterNodeTemplatePropertiesByValue(NodeTemplate nodeTemplate, FilterType filterType, String pattern) {
- Map<String, Object> filterMap = new HashMap<>();
+ public Map<String, String> filterNodeTemplatePropertiesByValue(NodeTemplate nodeTemplate, FilterType filterType, String pattern) {
+ Map<String, String> filterMap = new HashMap<>();
if (nodeTemplate == null) {
log.error("filterNodeTemplatePropertiesByValue nodeTemplate is null");
@@ -610,7 +610,7 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
}
/************************************* helper functions ***********************************/
- private Map<String, Object> filterProperties(Object property, String path, FilterType filterType, String pattern, Map<String, Object> filterMap) {
+ private Map<String, String> filterProperties(Object property, String path, FilterType filterType, String pattern, Map<String, String> filterMap) {
if (property instanceof Map) {
for (Map.Entry<String, Object> item: ((Map<String, Object>) property).entrySet()) {
@@ -628,11 +628,11 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
}
} else if (property instanceof Function) {
if (filterType.isMatch(property.toString(), pattern)) {
- filterMap.put(path, property);
+ filterMap.put(path, property.toString());
}
} else {
if (filterType.isMatch(property.toString(), pattern)) {
- filterMap.put(path, property);
+ filterMap.put(path, property.toString());
}
}
diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
index 4ce3db4..28058a5 100644
--- a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
+++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
@@ -405,7 +405,7 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
if(vfc.getName().equalsIgnoreCase("abstract_ddc"))
{
isChecked = true;
- Map<String, Object> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfc, FilterType.CONTAINS, "get_input");
+ Map<String, String> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfc, FilterType.CONTAINS, "get_input");
assertEquals(16, filteredInputs.size());
assertEquals("get_input:vnf_id", filteredInputs.get("compute_ddc_metadata#vf_module_id#vnf_id"));
@@ -421,7 +421,7 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
@Test
public void testFilterNodeTemplatePropertiesByDummyContains() {
List<NodeTemplate> vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef");
- Map<String, Object> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfcs.get(0), FilterType.CONTAINS, "dummy");
+ Map<String, String> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfcs.get(0), FilterType.CONTAINS, "dummy");
assertNotNull(filteredInputs);
assertEquals(0, filteredInputs.size());
}
@@ -434,7 +434,7 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
if(vfc.getName().equalsIgnoreCase("abstract_ddc"))
{
isChecked = true;
- Map<String, Object> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfc, FilterType.EQUALS, "ddc");
+ Map<String, String> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfc, FilterType.EQUALS, "ddc");
assertEquals(2, filteredInputs.size());
assertEquals("ddc", filteredInputs.get("vm_type_tag"));
@@ -445,6 +445,38 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
}
assertTrue(isChecked);
}
+
+ @Test
+ public void testFilterNodeTemplatePropertiesByDummyEquals() {
+ List<NodeTemplate> vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef");
+ Map<String, String> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfcs.get(0), FilterType.EQUALS, "dummy");
+ assertNotNull(filteredInputs);
+ assertEquals(0, filteredInputs.size());
+ }
+
+ @Test
+ public void testFilterNodeTemplatePropertiesByNullFilterType() {
+ List<NodeTemplate> vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef");
+ Map<String, String> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfcs.get(11), null, "ddc");
+ assertNotNull(filteredInputs);
+ assertEquals(0, filteredInputs.size());
+ }
+
+ @Test
+ public void testFilterNodeTemplatePropertiesByNullPattern() {
+ List<NodeTemplate> vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef");
+ Map<String, String> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfcs.get(11), FilterType.EQUALS, null);
+ assertNotNull(filteredInputs);
+ assertEquals(0, filteredInputs.size());
+ }
+
+ @Test
+ public void testFilterNodeTemplatePropertiesByNullVfc() {
+ Map<String, String> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(null, FilterType.EQUALS, "ddc");
+ assertNotNull(filteredInputs);
+ assertEquals(0, filteredInputs.size());
+ }
+ //endregion
//region getServiceNodeTemplateBySdcType
@Test
@@ -490,35 +522,5 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
//endregion
- @Test
- public void testFilterNodeTemplatePropertiesByDummyEquals() {
- List<NodeTemplate> vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef");
- Map<String, Object> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfcs.get(0), FilterType.EQUALS, "dummy");
- assertNotNull(filteredInputs);
- assertEquals(0, filteredInputs.size());
- }
-
- @Test
- public void testFilterNodeTemplatePropertiesByNullFilterType() {
- List<NodeTemplate> vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef");
- Map<String, Object> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfcs.get(11), null, "ddc");
- assertNotNull(filteredInputs);
- assertEquals(0, filteredInputs.size());
- }
-
- @Test
- public void testFilterNodeTemplatePropertiesByNullPattern() {
- List<NodeTemplate> vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef");
- Map<String, Object> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfcs.get(11), FilterType.EQUALS, null);
- assertNotNull(filteredInputs);
- assertEquals(0, filteredInputs.size());
- }
- @Test
- public void testFilterNodeTemplatePropertiesByNullVfc() {
- Map<String, Object> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(null, FilterType.EQUALS, "ddc");
- assertNotNull(filteredInputs);
- assertEquals(0, filteredInputs.size());
- }
- //endregion
}