diff options
author | Manzon, Inna (im453s) <im453s@intl.att.com> | 2018-09-12 18:32:18 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-09-27 11:57:59 +0000 |
commit | 9fb95e3c9e9ab5c239445c1511219686133437de (patch) | |
tree | 425dbf4b49abcdfb9e8b5c34bd660118e5751386 /src/test | |
parent | 6fefab672f8ee763b561b0f67681e4f5b09418bc (diff) |
Tosca Parser - property value resolving1.4.5
Change-Id: Ib0d2a0918d8d97d1e4988a8eeb7823f5957fa26f
Issue-ID: SDC-1757
Signed-off-by: Manzon, Inna (im453s) <im453s@intl.att.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/sdc/toscaparser/api/JToscaImportTest.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/test/java/org/onap/sdc/toscaparser/api/JToscaImportTest.java b/src/test/java/org/onap/sdc/toscaparser/api/JToscaImportTest.java index 7d0c54c..6fc8771 100644 --- a/src/test/java/org/onap/sdc/toscaparser/api/JToscaImportTest.java +++ b/src/test/java/org/onap/sdc/toscaparser/api/JToscaImportTest.java @@ -14,6 +14,7 @@ import java.util.stream.Collectors; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; public class JToscaImportTest { @@ -94,7 +95,23 @@ public class JToscaImportTest { assertTrue(inputs.stream().filter(i -> i.getAnnotations() != null).collect(Collectors.toList()).isEmpty()); } - private void validateInputsAnnotations(List<Input> inputs) { + @Test + public void testGetPropertyNameTest() throws JToscaException { + + String fileStr = JToscaImportTest.class.getClassLoader().getResource("csars/service-AdiodVmxVpeBvService-csar.csar").getFile(); + File file = new File(fileStr); + ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null); + NodeTemplate nodeTemplate = toscaTemplate.getNodeTemplates().get(0); + + ArrayList<String> valueList = (ArrayList<String>)nodeTemplate.getPropertyValueFromTemplatesByName("vmxvpfe_sriov41_0_port_vlanfilter"); + assertEquals(4, valueList.size()); + + assertEquals("vPE", (String) nodeTemplate.getPropertyValueFromTemplatesByName("nf_role")); + + assertNull(nodeTemplate.getPropertyValueFromTemplatesByName("test")); + } + + private void validateInputsAnnotations(List<Input> inputs) { List<Input> inputsWithAnnotations = inputs.stream().filter(i -> i.getAnnotations() != null) .collect(Collectors.toList()); assertTrue(!inputs.isEmpty()); |