aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorPavel Aharoni <pa0916@att.com>2017-06-26 17:32:09 +0300
committerPavel Aharoni <pa0916@att.com>2017-06-26 17:32:41 +0300
commit53b4ab6e88e4e7359534e6ca84e884005c7153b4 (patch)
tree4236812d294e1ae1a0ca6651f0db54e993be69b2 /src/test/java
parentb29c5c244b23bbf549bc4e7637019e28ed48b0c4 (diff)
[SDC-39] filter nt props values by string
Change-Id: Ic03853b58e97bfcacf1f82449fb4f498acfc347c Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
index f9cedf3..4ce3db4 100644
--- a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
+++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
@@ -12,6 +12,7 @@ import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import org.openecomp.sdc.tosca.parser.impl.FilterType;
import org.openecomp.sdc.tosca.parser.impl.SdcTypes;
import org.openecomp.sdc.toscaparser.api.Group;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
@@ -395,6 +396,56 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
}
//endregion
+ //region filterNodeTemplatePropertiesByValue
+ @Test
+ public void testFilterNodeTemplatePropertiesByContains() {
+ List<NodeTemplate> vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef");
+ boolean isChecked = false;
+ for (NodeTemplate vfc: vfcs) {
+ if(vfc.getName().equalsIgnoreCase("abstract_ddc"))
+ {
+ isChecked = true;
+ Map<String, Object> 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"));
+ assertEquals("get_input:[ddc_int_imbl_v6_ips, 3]", filteredInputs.get("port_ddc_int_imbl__port_fixed_ips#ip_address"));
+
+ break;
+ }
+
+ }
+ assertTrue(isChecked);
+ }
+
+ @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");
+ assertNotNull(filteredInputs);
+ assertEquals(0, filteredInputs.size());
+ }
+
+ @Test
+ public void testFilterNodeTemplatePropertiesByEquals() {
+ List<NodeTemplate> vfcs = complexCps.getVfcListByVf("f999e2ca-72c0-42d3-9b11-13f2122fb8ef");
+ boolean isChecked = false;
+ for (NodeTemplate vfc: vfcs) {
+ if(vfc.getName().equalsIgnoreCase("abstract_ddc"))
+ {
+ isChecked = true;
+ Map<String, Object> filteredInputs = complexCps.filterNodeTemplatePropertiesByValue(vfc, FilterType.EQUALS, "ddc");
+
+ assertEquals(2, filteredInputs.size());
+ assertEquals("ddc", filteredInputs.get("vm_type_tag"));
+ assertEquals("ddc", filteredInputs.get("nfc_naming_code"));
+ break;
+ }
+
+ }
+ assertTrue(isChecked);
+ }
+
//region getServiceNodeTemplateBySdcType
@Test
public void testServiceNodeTemplateBySdcType() {
@@ -437,4 +488,37 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
assertEquals(0, vfcList.size());
}
//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
}