diff options
author | Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> | 2020-10-14 14:01:03 +0200 |
---|---|---|
committer | Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> | 2020-10-15 10:26:41 +0200 |
commit | 35d4e259c80c9edeb362de0af9bd77bd3f4412b0 (patch) | |
tree | 1f07f1d56114656a2460594be8b87fce86ee8bd2 /csarvalidation/src/main/java/org/onap | |
parent | 5e085985d5e333fbb000c37c8c508c0d46b7d7ee (diff) |
Add handling of CSAR with no TOSCA meta and no certificate.
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Change-Id: Ic9914b13e0bd5d9844849f20051d99d18e369ae9
Issue-ID: VNFSDK-481
Diffstat (limited to 'csarvalidation/src/main/java/org/onap')
-rw-r--r-- | csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java b/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java index 70cd8f3..05f2070 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java @@ -531,6 +531,13 @@ public class CSARArchive implements AutoCloseable { } } + public static class CSARErrorNoManifestsFound extends CSARError { + public CSARErrorNoManifestsFound() { + super("0x0016"); + this.message = "No manifest file found in CSAR!"; + } + } + /** * Holds the CSAR meta data values in both Modes * @@ -1091,7 +1098,10 @@ public class CSARArchive implements AutoCloseable { //manifest files = this.tempDir.toFile().listFiles((dir, name) -> name.endsWith(MF)); - if (files.length > 1) { + if (files.length == 0) { + errors.add(new CSARErrorNoManifestsFound()); + this.toscaMeta.setEntryManifestMf(null); + } else if (files.length > 1) { List<String> fileNames = new ArrayList<>(); for (File f: files) { fileNames.add(f.getName()); @@ -1118,7 +1128,9 @@ public class CSARArchive implements AutoCloseable { //certificate files = this.tempDir.toFile().listFiles((dir, name) -> name.endsWith(CERT)); - if (files.length > 1) { + if (files.length == 0) { + this.toscaMeta.setEntryCertificate(null); + } else if (files.length > 1) { List<String> fileNames = new ArrayList<>(); for (File f: files) { fileNames.add(f.getName()); |