aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org
diff options
context:
space:
mode:
authorshiria <shiri.amichai@amdocs.com>2018-05-01 14:09:41 +0300
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-05-01 12:39:20 +0000
commitd74d87cd27afca784a8ed582b6b7015a8a8d243a (patch)
tree48d233cb848ecb2060f2c9c3b2805d9d44b4e98a /openecomp-be/lib/openecomp-tosca-lib/src/test/java/org
parent2ef3886c9b0223f4813ac1385318d6f2e600a4a8 (diff)
Fix TOSCA Analyzer - null point exception
In case there is import to not exist TOSCA file, exception with relevant error message should be thrown In getRequirementAssignment, when there is no Requirement, Optional.Empty is returned Change-Id: I8aabde177815dec2f69307f6be3c5114c5c8efa3 Issue-ID: SDC-1281 Signed-off-by: shiria <shiri.amichai@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/test/java/org')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java20
1 files changed, 20 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 83ed525c4c..e034fb8565 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
@@ -127,6 +127,26 @@ public class ToscaAnalyzerServiceImplTest {
}
@Test
+ public void testGetFlatEntityFileNotFound() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Tosca file 'missingFile.yaml' was not found in tosca service model");
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ try (InputStream yamlFile = toscaExtensionYamlUtil
+ .loadYamlFileIs("/mock/analyzerService/ServiceTemplateFileNotFoundTest.yaml")) {
+
+ ServiceTemplate
+ serviceTemplateFromYaml =
+ toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+
+ toscaAnalyzerService
+ .getFlatEntity(ToscaElementTypes.NODE_TYPE,
+ "org.openecomp.resource.vfc.nodes.heat.cmaui_image",
+ serviceTemplateFromYaml, toscaServiceModel);
+ }
+ }
+
+ @Test
public void testGetFlatEntityNodeType() throws Exception {
ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
try (InputStream yamlFile = toscaExtensionYamlUtil