diff options
author | 2019-03-28 17:50:06 +0530 | |
---|---|---|
committer | 2019-03-28 18:31:52 +0530 | |
commit | 4827d14388d40fdffd95d560ae6500604aff578f (patch) | |
tree | c374ba32a0fc1bd62816be142e4c21de8ed2f66e /csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java | |
parent | d34c02725d33d4b9cfa3ac70742b47be65b31066 (diff) |
Update test cases to fix the TOSCA issues
Issue-ID: VNFSDK-352
Change-Id: I058dbe23a02244b90f3e9d58c136960249c7ffdf
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java')
-rw-r--r-- | csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java | 17 |
1 files changed, 13 insertions, 4 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 9d80605..7574ab5 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java @@ -905,6 +905,15 @@ public class CSARArchive implements AutoCloseable { } } + + public String getProductName() { + if (this.toscaMeta.getMode().equals(Mode.WITH_TOSCA_META_DIR)) { + return this.manifest.getMetadata().getProductName(); + } else { + return this.definition.getMetadata().getTemplateAuthor(); + } + } + public String getVendorName() { if (this.toscaMeta.getMode().equals(Mode.WITH_TOSCA_META_DIR)) { return this.toscaMeta.getCompanyName(); @@ -915,7 +924,7 @@ public class CSARArchive implements AutoCloseable { public String getVersion() { if (this.toscaMeta.getMode().equals(Mode.WITH_TOSCA_META_DIR)) { - return this.toscaMeta.getCsarVersion(); + return this.manifest.getMetadata().getPackageVersion(); } else { return this.definition.getMetadata().getTemplateVersion(); } @@ -937,7 +946,7 @@ public class CSARArchive implements AutoCloseable { int lineNo =0; List<String>lines = FileUtils.readLines(this.manifestMfFile); - //first hit the metadata section + //first hit the metadata: section for (String line: lines) { lineNo ++; line = line.trim(); @@ -955,13 +964,13 @@ public class CSARArchive implements AutoCloseable { if (lineNo < lines.size()) { for (int i = lineNo; i< lines.size(); i++) { String line = lines.get(i).trim(); - i ++; - if (line.startsWith("#")) { + if (line.startsWith("#") || line.isEmpty()) { continue; } String[] tokens = line.split(":"); + if (tokens.length < 2) continue; String key = tokens[0]; String value = tokens[1]; |