diff options
author | MichaelMorris <michael.morris@est.tech> | 2020-05-25 17:08:23 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-06-17 07:58:03 +0000 |
commit | 63ab11e3a5c635d69056d6f79156ce1d114fa1be (patch) | |
tree | 83fcdef91abc64d344f4d792d37b14233457c564 /catalog-be/src/test | |
parent | ada10a6e126e7698b17f4a70de631f4478a10dca (diff) |
Support the substitution_mappings in the VNFD
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Issue-ID: SDC-2957
Change-Id: I8a385b02568b3bf3d83a250cbe36a7e7f61e710c
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java | 26 | ||||
-rw-r--r-- | catalog-be/src/test/resources/etsi_vnf.csar | bin | 0 -> 14280 bytes |
2 files changed, 21 insertions, 5 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java index 62fd3f9e78..a28e2efcdb 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java @@ -75,14 +75,19 @@ public class CsarInfoTest { @Before public void setup() throws ZipException, URISyntaxException { // given - final File csarFile = new File(CsarInfoTest.class.getClassLoader().getResource(PAYLOAD_NAME).toURI()); - final Map<String, byte[]> payload = ZipUtils.readZip(csarFile, false); - String mainTemplateContent = new String(payload.get(MAIN_TEMPLATE_NAME)); + csarInfo = createCsarInfo(PAYLOAD_NAME, MAIN_TEMPLATE_NAME); - csarInfo = new CsarInfo(user, CSAR_UUID, payload, RESOURCE_NAME, - MAIN_TEMPLATE_NAME, mainTemplateContent, true); new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be")); } + + private CsarInfo createCsarInfo(final String csarFileName, final String mainTemplateName) throws URISyntaxException, ZipException { + final File csarFile = new File(CsarInfoTest.class.getClassLoader().getResource(csarFileName).toURI()); + final Map<String, byte[]> payload = ZipUtils.readZip(csarFile, false); + String mainTemplateContent = new String(payload.get(mainTemplateName)); + + return new CsarInfo(user, CSAR_UUID, payload, RESOURCE_NAME, + mainTemplateName, mainTemplateContent, true); + } @Test public void add2TimesTheSameNodeTest() { @@ -151,4 +156,15 @@ public class CsarInfoTest { final Optional<String> softwareInformationPath = csarInfo.getSoftwareInformationPath(); assertThat("The software information yaml path should not be present", softwareInformationPath.isPresent(), is(false)); } + + @SuppressWarnings("unchecked") + @Test + public void testCreateCsarInfoEtsiVnf() throws URISyntaxException, ZipException { + final CsarInfo csarInfo = createCsarInfo("etsi_vnf.csar", "Definitions/MainServiceTemplate.yaml"); + + final String nodeTypeInSubstitutionMapping = (String) ((Map<String, Object>)((Map<String, Object>)csarInfo.getMappedToscaMainTemplate().get("topology_template")).get("substitution_mappings")).get("node_type"); + assertTrue(((Map<String, Object>) csarInfo.getMappedToscaMainTemplate().get("node_types")).containsKey(nodeTypeInSubstitutionMapping)); + + assertTrue(csarInfo.extractNodeTypesInfo().isEmpty()); + } } diff --git a/catalog-be/src/test/resources/etsi_vnf.csar b/catalog-be/src/test/resources/etsi_vnf.csar Binary files differnew file mode 100644 index 0000000000..93e62bc20e --- /dev/null +++ b/catalog-be/src/test/resources/etsi_vnf.csar |