summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src/test/java
diff options
context:
space:
mode:
authorshiria <shiri.amichai@amdocs.com>2019-03-26 10:08:43 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-03-26 09:57:35 +0000
commit4428fc40a81ff3234b918af87da74a27ccbfe650 (patch)
tree31438af8fa2c273b019b55a7d2f5e461d43c3448 /openecomp-be/lib/openecomp-tosca-lib/src/test/java
parent52183bb7fed88d4dddaaa31e1114b8f77d7a5cc8 (diff)
Load tosca with no imports section
Change-Id: I50df2a149bd8d27973bb66e41f80a3260b8a9b8b Issue-ID: SDC-2192 Signed-off-by: shiria <shiri.amichai@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/test/java')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java28
1 files changed, 28 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 d2c1ed8a17..a915b9b131 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
@@ -1200,6 +1200,34 @@ public class ToscaAnalyzerServiceImplTest {
}
@Test
+ public void testConvertToscaImportForEmptyImport() throws Exception {
+ String inputResourceName = "/mock/analyzerService/importConvertTestNoImport.yml";
+ byte[] uploadedFileData = IOUtils.toByteArray(this.getClass().getResource(inputResourceName));
+
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ ToscaAnalyzerServiceImpl toscaAnalyzerServiceImpl = new ToscaAnalyzerServiceImpl();
+ String convertServiceTemplateImport =
+ toscaAnalyzerServiceImpl.convertServiceTemplateImport(toscaExtensionYamlUtil, uploadedFileData);
+
+ Assert.assertNotNull(convertServiceTemplateImport);
+ ServiceTemplate serviceTemplate =
+ new YamlUtil().yamlToObject(convertServiceTemplateImport, ServiceTemplate.class);
+ Assert.assertNull(serviceTemplate.getImports());
+ }
+
+ @Test
+ public void testInvalidToscaImportSection() throws Exception {
+ thrown.expect(SdcRuntimeException.class);
+ thrown.expectMessage("Invalid TOSCA import section");
+ String inputResourceName = "/mock/analyzerService/invalidToscaImport.yml";
+ byte[] uploadedFileData = IOUtils.toByteArray(this.getClass().getResource(inputResourceName));
+
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ ToscaAnalyzerServiceImpl toscaAnalyzerServiceImpl = new ToscaAnalyzerServiceImpl();
+ toscaAnalyzerServiceImpl.convertServiceTemplateImport(toscaExtensionYamlUtil, uploadedFileData);
+ }
+
+ @Test
public void loadValidToscaYamlFileTest() throws Exception {
String inputResourceName = "/mock/analyzerService/ServiceTemplateInterfaceInheritanceTest.yaml";
byte[] uploadedFileData = IOUtils.toByteArray(this.getClass().getResource(inputResourceName));