diff options
author | 2018-01-04 16:11:30 +0200 | |
---|---|---|
committer | 2018-01-07 16:34:13 +0000 | |
commit | 9542ec5708daad3dd43052d326780f7f5c9a987d (patch) | |
tree | ff2c1e881d15383b20727b7c50412b7e7dcc915e /src/test/java | |
parent | eed89a056e2c51bfbc1df78995f757f3d1ed8231 (diff) |
CSAR files are decompressed twice
in the same thread fixed
Change-Id: Id59cc7250d8431114ab90d14e03049f86a4d49ca
Issue-ID: SDC-250
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java b/src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java index 37292e5..8f55fa4 100644 --- a/src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java +++ b/src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java @@ -5,12 +5,11 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.File; -import java.util.Collection; import java.util.LinkedHashMap; import org.junit.Test; import org.openecomp.sdc.toscaparser.api.common.JToscaException; -import org.openecomp.sdc.toscaparser.api.common.JToscaValidationIssue; +import org.openecomp.sdc.toscaparser.api.utils.JToscaErrorCodes; import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder; public class JToscaMetadataParse { @@ -29,11 +28,34 @@ public class JToscaMetadataParse { @Test public void noWarningsAfterParse() throws JToscaException { - String fileStr = JToscaMetadataParse.class.getClassLoader().getResource("csars/tmpCSAR_Huawei_vSPGW_fixed.csar.csar").getFile(); + String fileStr = JToscaMetadataParse.class.getClassLoader().getResource("csars/tmpCSAR_Huawei_vSPGW_fixed.csar").getFile(); File file = new File(fileStr); ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null); int validationIssuesCaught = ThreadLocalsHolder.getCollector().validationIssuesCaught(); assertTrue(validationIssuesCaught == 0 ); } - + + @Test + public void testEmptyCsar() throws JToscaException { + String fileStr = JToscaMetadataParse.class.getClassLoader().getResource("csars/emptyCsar.csar").getFile(); + File file = new File(fileStr); + try { + ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null); + } catch (JToscaException e) { + assertTrue(e.getCode().equals(JToscaErrorCodes.INVALID_CSAR_FORMAT.getValue())); + } + int validationIssuesCaught = ThreadLocalsHolder.getCollector().validationIssuesCaught(); + assertTrue(validationIssuesCaught == 0 ); + } + + @Test + public void testEmptyPath() throws JToscaException { + String fileStr = JToscaMetadataParse.class.getClassLoader().getResource("").getFile(); + File file = new File(fileStr); + try { + ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null); + }catch (JToscaException e) { + assertTrue(e.getCode().equals(JToscaErrorCodes.PATH_NOT_VALID.getValue())); + } + } } |