diff options
author | Lianhao Lu <lianhao.lu@intel.com> | 2019-11-21 10:29:08 +0800 |
---|---|---|
committer | Lianhao Lu <lianhao.lu@intel.com> | 2019-11-22 17:08:34 +0800 |
commit | 5e89003fa9a6f892c2922658a5c1d3f900b557d9 (patch) | |
tree | 22095a741412c50ff439458acf02d19f3c32072b /csarvalidation/src/test/java | |
parent | d20bea49fb797bc5a530d7ac854e5e8d3034785f (diff) |
Tolerate subdirectory zip entries in csar
Issue-ID: VNFSDK-516
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Change-Id: Ic14e713522871fba5ebce92870ff796624f4a820
Diffstat (limited to 'csarvalidation/src/test/java')
-rw-r--r-- | csarvalidation/src/test/java/org/onap/cvc/csar/FileArchiveTest.java | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/FileArchiveTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/FileArchiveTest.java index 738b4f6..1c66bbe 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/FileArchiveTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/FileArchiveTest.java @@ -66,4 +66,37 @@ public class FileArchiveTest { assertTrue(workspace.getPathToCmsFile().isPresent()); } -}
\ No newline at end of file + @Test + public void shouldUnpackCsarNoDirectoryEntry() throws URISyntaxException, IOException { + /* + * We should be able to unpack the csar with the following simlary zip entries: + * $ unzip -l /tmp/output1.csar + * Archive: /tmp/output1.csar + * Length Date Time Name + * --------- ---------- ----- ---- + * 0 2019-11-01 14:29 ChangeLog.txt + * 1143 2019-11-01 14:29 test.crt + * 782 2019-11-01 14:29 test_entry.yaml + * 0 2019-11-01 14:29 Tests/test + * 1516 2019-11-12 09:52 test_entry.mf + * 237 2019-11-12 09:52 TOSCA-Metadata/TOSCA.meta + * --------- ------- + * 3678 7 files + */ + + // given + String absolutePath = folder.getRoot().getAbsolutePath(); + + // when + FileArchive.Workspace workspace = new FileArchive(absolutePath).unpack(absoluteFilePath("vnf/noDirectoryEntry.csar")); + + // then + assertFalse(workspace.isZip()); + assertTrue(workspace.getRootFolder().isPresent()); + assertTrue(workspace.getPathToCsarFolder().isPresent()); + assertFalse(workspace.getPathToCertFile().isPresent()); + assertFalse(workspace.getPathToCmsFile().isPresent()); + } + + +} |