summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/main/java/org
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2019-05-27 14:24:13 +0200
committerZebek Bogumil <bogumil.zebek@nokia.com>2019-05-30 11:08:38 +0200
commit84eb0c707c621e4855bf27e49be0cc69ded1f321 (patch)
tree3e4a04a9ed0754640da04f7713437d42dea43cd6 /csarvalidation/src/main/java/org
parent2b293e3d6c9c2ff693ccebf8ee757980cf6e2499 (diff)
Specification change
Change-Id: I7810f0310d6c2ae178c6d865494fff88c8751634 Issue-ID: VNFSDK-410 Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com>
Diffstat (limited to 'csarvalidation/src/main/java/org')
-rw-r--r--csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java7
-rw-r--r--csarvalidation/src/main/java/org/onap/cvc/csar/PnfCSARArchive.java14
-rw-r--r--csarvalidation/src/main/java/org/onap/cvc/csar/PnfManifestParser.java7
-rw-r--r--csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092.java10
4 files changed, 27 insertions, 11 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 0924de7..f1aff70 100644
--- a/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java
+++ b/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java
@@ -738,6 +738,8 @@ public class CSARArchive implements AutoCloseable {
}
public static class Manifest{
+ private boolean isNonManoAvailable;
+
public static class Metadata {
private String providerId;
@@ -792,12 +794,17 @@ public class CSARArchive implements AutoCloseable {
this.metadata = metadata;
}
+ public boolean isNonManoAvailable(){
+ return isNonManoAvailable;
+ }
+
public Map<String, Map<String, List<String>>> getNonMano() {
return nonMano;
}
public void setNonMano(Map<String, Map<String, List<String>>> nonMano) {
this.nonMano = nonMano;
+ this.isNonManoAvailable = true;
}
}
diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/PnfCSARArchive.java b/csarvalidation/src/main/java/org/onap/cvc/csar/PnfCSARArchive.java
index 5ac67cd..6438306 100644
--- a/csarvalidation/src/main/java/org/onap/cvc/csar/PnfCSARArchive.java
+++ b/csarvalidation/src/main/java/org/onap/cvc/csar/PnfCSARArchive.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
public class PnfCSARArchive extends CSARArchive {
@@ -37,15 +38,20 @@ public class PnfCSARArchive extends CSARArchive {
Pair<Manifest.Metadata, List<CSARError>> metadataData = pnfManifestParser.fetchMetadata();
Pair<List<String>, List<CSARError>> sourcesSectionData = pnfManifestParser.fetchSourcesSection();
- Pair<Map<String, Map<String, List<String>>>, List<CSARError>> nonManoArtifactsData = pnfManifestParser.fetchNonManoArtifacts();
+ Optional<Pair<Map<String, Map<String, List<String>>>, List<CSARError>>> nonManoArtifactsData = pnfManifestParser.fetchNonManoArtifacts();
PnfManifest manifest = (PnfManifest) this.getManifest();
manifest.setMetadata(metadataData.getKey());
- manifest.setSources(sourcesSectionData.getKey());
- manifest.setNonMano(nonManoArtifactsData.getKey());
this.getErrors().addAll(metadataData.getValue());
- this.getErrors().addAll(nonManoArtifactsData.getValue());
+
+ manifest.setSources(sourcesSectionData.getKey());
this.getErrors().addAll(sourcesSectionData.getValue());
+
+ if(nonManoArtifactsData.isPresent()){
+ manifest.setNonMano(nonManoArtifactsData.get().getKey());
+ this.getErrors().addAll(nonManoArtifactsData.get().getValue());
+ }
+
}
@Override
diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/PnfManifestParser.java b/csarvalidation/src/main/java/org/onap/cvc/csar/PnfManifestParser.java
index 5ef74fd..8831082 100644
--- a/csarvalidation/src/main/java/org/onap/cvc/csar/PnfManifestParser.java
+++ b/csarvalidation/src/main/java/org/onap/cvc/csar/PnfManifestParser.java
@@ -29,6 +29,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -118,7 +119,7 @@ class PnfManifestParser {
return Pair.of(sources, errors);
}
- Pair<Map<String, Map<String, List<String>>>, List<CSARArchive.CSARError>> fetchNonManoArtifacts() {
+ Optional<Pair<Map<String, Map<String, List<String>>>, List<CSARArchive.CSARError>>> fetchNonManoArtifacts() {
Map<String, Map<String, List<String>>> nonManoArtifacts = new HashMap<>();
List<CSARArchive.CSARError> errors = new ArrayList<>();
@@ -143,10 +144,10 @@ class PnfManifestParser {
}
if (!isNonManoArtifactsSectionAvailable) {
- errors.add(new PnfCSARErrorEntryMissing(NON_MANO_ARTIFACT_SETS_TAG_SECTION, this.fileName, -1));
+ return Optional.empty();
}
- return Pair.of(nonManoArtifacts, errors);
+ return Optional.of(Pair.of(nonManoArtifacts, errors));
}
private boolean isLineExcluded(String line) {
diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092.java
index 95b35bf..6150a04 100644
--- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092.java
+++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092.java
@@ -59,10 +59,12 @@ public class VTPValidateCSARR146092 extends VTPValidateCSARBase {
@Override
protected void validateCSAR(CSARArchive csar) {
- Optional<ValidateNonManoSection> validateNonManoSection = ValidateNonManoSection.getInstance(csar);
- if(validateNonManoSection.isPresent()) {
- List<CSARArchive.CSARError> csarErrors = validateNonManoSection.get().validate();
- this.errors.addAll(csarErrors);
+ if(csar.getManifest().isNonManoAvailable()) {
+ Optional<ValidateNonManoSection> validateNonManoSection = ValidateNonManoSection.getInstance(csar);
+ if(validateNonManoSection.isPresent()) {
+ List<CSARArchive.CSARError> csarErrors = validateNonManoSection.get().validate();
+ this.errors.addAll(csarErrors);
+ }
}
}