diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/sdc/toscaparser/api/JToscaImportTest.java | 26 |
1 files changed, 26 insertions, 0 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 c660153..ff03aed 100644 --- a/src/test/java/org/onap/sdc/toscaparser/api/JToscaImportTest.java +++ b/src/test/java/org/onap/sdc/toscaparser/api/JToscaImportTest.java @@ -154,6 +154,31 @@ public class JToscaImportTest { assertNotNull(inputs); } + @Test + public void testGetPolicyMetadata() throws JToscaException { + String fileStr = JToscaImportTest.class.getClassLoader().getResource("csars/service-NetworkCloudVnfServiceMock-csar.csar").getFile(); + File file = new File(fileStr); + ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null); + ArrayList<Policy> policies = toscaTemplate.getPolicies(); + assertNotNull(policies); + assertEquals(1, policies.size()); + assertEquals("org.openecomp.policies.External", policies.get(0).getType()); + assertEquals("adf03496-bf87-43cf-b20a-450e47cb44bd", policies.get(0).getMetaData().getOrDefault("UUID", "").toString()); + assertTrue(policies.get(0).getMetaData().getOrDefault("UUID_test", "").toString().isEmpty()); + } + + @Test + public void testGetPolicyMetadataObj() throws JToscaException { + String fileStr = JToscaImportTest.class.getClassLoader().getResource("csars/service-NetworkCloudVnfServiceMock-csar.csar").getFile(); + File file = new File(fileStr); + ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null); + ArrayList<Policy> policies = toscaTemplate.getPolicies(); + assertNotNull(policies); + assertEquals(1, policies.size()); + assertEquals("adf03496-bf87-43cf-b20a-450e47cb44bd", policies.get(0).getMetaDataObj().getAllProperties().getOrDefault("UUID", "").toString()); + assertTrue(policies.get(0).getMetaDataObj().getAllProperties().getOrDefault("name_test", "").toString().isEmpty()); + } + private void validateInputsAnnotations(List<Input> inputs) { List<Input> inputsWithAnnotations = inputs.stream().filter(i -> i.getAnnotations() != null) .collect(Collectors.toList()); @@ -174,4 +199,5 @@ public class JToscaImportTest { assertEquals(source_type.get().getValue(), "HEAT"); } + } |