diff options
author | Bogumil Zebek <bogumil.zebek@nokia.com> | 2019-06-13 14:50:32 +0200 |
---|---|---|
committer | Zebek Bogumil <bogumil.zebek@nokia.com> | 2019-06-13 14:50:32 +0200 |
commit | 692a2d6c41f76c3d43e640af9c24269c5ac7f8f2 (patch) | |
tree | b0aaa24447e4ceb9e4ffce22e7762a05c42d3ae5 /csarvalidation/src/main/java | |
parent | 67491d85d6af6d5854914d2736d1a24846d74e5a (diff) |
Non_mano_artifact
Change-Id: I0a47aac7935f12e406998fcdc3ae1eba6c5a2adc
Issue-ID: VNFSDK-418
Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com>
Diffstat (limited to 'csarvalidation/src/main/java')
-rw-r--r-- | csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092.java | 29 |
1 files changed, 15 insertions, 14 deletions
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 6150a04..b84dea7 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 @@ -31,13 +31,12 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; -import java.util.stream.Collectors; @OnapCommandSchema(schema = "vtp-validate-csar-r146092.yaml") public class VTPValidateCSARR146092 extends VTPValidateCSARBase { private static final int UNKNOWN_LINE_NUMBER = -1; - private static final String SOURCE_ELEMENT_TAG = "source"; + private static final String SOURCE_ELEMENT_TAG = "Source"; private static class MissingSourceElementUnderAttributeError extends PnfCSARError { private MissingSourceElementUnderAttributeError(String attributeName, String fileName) { @@ -96,7 +95,7 @@ public class VTPValidateCSARR146092 extends VTPValidateCSARBase { List<String> attributeNames = Arrays.asList( "onap_ves_events", "onap_pm_dictionary", - "onap_yang_module", + "onap_yang_modules", "onap_others" ); @@ -123,21 +122,23 @@ public class VTPValidateCSARR146092 extends VTPValidateCSARBase { private void validateSourceElementsUnderAttribute(String attributeName) { Map<String, List<String>> attributeElements = this.nonMano.get(attributeName); - List<String> attributeElementNames = attributeElements.keySet().stream() - .map(String::toLowerCase) - .collect(Collectors.toList()); + Set<String> attributeElementNames = attributeElements.keySet(); if (!attributeElementNames.contains(SOURCE_ELEMENT_TAG)) { this.errors.add(new MissingSourceElementUnderAttributeError(attributeName, this.fileName)); } else { - for (String pathToFile : attributeElements.get(SOURCE_ELEMENT_TAG)) { - File fileFromCsar = this.csar.getFileFromCsar(pathToFile); - if (!fileFromCsar.exists()) { - this.errors.add( - new InvalidPathToFileError(attributeName, - pathToFile, this.fileName) - ); - } + validateThatSourceFileExists(attributeName, attributeElements); + } + } + + private void validateThatSourceFileExists(String attributeName, Map<String, List<String>> attributeElements) { + for (String pathToFile : attributeElements.get(SOURCE_ELEMENT_TAG)) { + File fileFromCsar = this.csar.getFileFromCsar(pathToFile); + if (!fileFromCsar.exists()) { + this.errors.add( + new InvalidPathToFileError(attributeName, + pathToFile, this.fileName) + ); } } } |