diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/test')
2 files changed, 35 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java index 4962f243ca..d2c1ed8a17 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java @@ -85,6 +85,7 @@ public class ToscaAnalyzerServiceImplTest { private static final String TOSCA_LIFECYCLE_STANDARD = "tosca.interfaces.node.lifecycle.Standard"; private static final String CMAUI_INTERFACE_TEST = "org.openecomp.resource.vfc.nodes.heat.cmaui_image_interfaceTest"; + private static final String NODE_TYPE_NO_INTERFACE = "org.openecomp.resource.vfc.nodes.nodeBNoInterface"; /* Dictionary: @@ -227,6 +228,29 @@ public class ToscaAnalyzerServiceImplTest { } } + @Test + public void testGetFlatNodeTypeNoInterfaces() throws Exception { + ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil(); + try (InputStream yamlFile = toscaExtensionYamlUtil.loadYamlFileIs( + "/mock/analyzerService/ServiceTemplateInterfaceInheritanceTest.yaml")) { + + ServiceTemplate serviceTemplateFromYaml = + toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class); + + ToscaFlatData flatData = toscaAnalyzerService + .getFlatEntity(ToscaElementTypes.NODE_TYPE, NODE_TYPE_NO_INTERFACE, + serviceTemplateFromYaml, toscaServiceModel); + + Assert.assertNotNull(flatData); + Assert.assertNotNull(flatData.getFlatEntity()); + NodeType flatEntity = (NodeType) flatData.getFlatEntity(); + Assert.assertNull(flatEntity.getInterfaces()); + List<String> inheritanceHierarchyType = flatData.getInheritanceHierarchyType(); + Assert.assertNotNull(inheritanceHierarchyType); + Assert.assertEquals(2, inheritanceHierarchyType.size()); + } + } + @Test public void testGetFlatEntityDataType() throws Exception { diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/ServiceTemplateInterfaceInheritanceTest.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/ServiceTemplateInterfaceInheritanceTest.yaml index 17cfe33592..3df6798b6c 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/ServiceTemplateInterfaceInheritanceTest.yaml +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/ServiceTemplateInterfaceInheritanceTest.yaml @@ -70,6 +70,17 @@ node_types: name: type: string + org.openecomp.resource.vfc.nodes.nodeANoInterface: + properties: + name: + type: string + + org.openecomp.resource.vfc.nodes.nodeBNoInterface: + derived_from: org.openecomp.resource.vfc.nodes.nodeANoInterface + properties: + name: + type: string + data_types: org.openecomp.datatypes.heat.network.MyAddressPair: derived_from: org.openecomp.datatypes.heat.network.AddressPair |