From 7cd3f6bbd4524421f290aa6b5f89836bc98c8cbf Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Wed, 27 May 2020 18:09:40 +0100 Subject: Importing VSP with node_type in separate file Import fails when a node_type referenced in the main template is defined in a separate yaml file in the csar even when that separate file is correctly imported in the main template Change-Id: I6abe074585c2ce592fe9bed7abe76f0856bcfe93 Issue-ID: SDC-2850 Signed-off-by: MichaelMorris --- .../org/openecomp/sdc/be/components/csar/CsarInfoTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'catalog-be/src/test/java') 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 a28e2efcdb..f3f0ab5628 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 @@ -38,7 +38,7 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.common.zip.ZipUtils; import org.openecomp.sdc.common.zip.exception.ZipException; - +import com.datastax.oss.driver.shaded.guava.common.collect.Lists; import java.io.File; import java.net.URISyntaxException; import java.util.Arrays; @@ -167,4 +167,16 @@ public class CsarInfoTest { assertTrue(csarInfo.extractNodeTypesInfo().isEmpty()); } + + @Test + public void testCreateCsarInfoVnfWithNodeTypeInGlobalSub() throws URISyntaxException, ZipException { + final CsarInfo csarInfo = createCsarInfo("nodeTypeInGlobalSub.csar", "Definitions/MainServiceTemplate.yaml"); + + assertEquals(1, csarInfo.extractNodeTypesInfo().size()); + final NodeTypeInfo nodeTypeInfo = csarInfo.extractNodeTypesInfo().get("tosca.nodes.l3vpn"); + assertNotNull(nodeTypeInfo); + assertEquals("Definitions/GlobalSubstitutionTypesServiceTemplate.yaml", nodeTypeInfo.getTemplateFileName()); + assertEquals("tosca.nodes.l3vpn", nodeTypeInfo.getType()); + assertEquals(Lists.newArrayList("tosca.nodes.Root"), nodeTypeInfo.getDerivedFrom()); + } } -- cgit 1.2.3-korg