From 692a2d6c41f76c3d43e640af9c24269c5ac7f8f2 Mon Sep 17 00:00:00 2001 From: Bogumil Zebek Date: Thu, 13 Jun 2019 14:50:32 +0200 Subject: Non_mano_artifact Change-Id: I0a47aac7935f12e406998fcdc3ae1eba6c5a2adc Issue-ID: VNFSDK-418 Signed-off-by: Zebek Bogumil --- .../cvc/csar/cc/sol004/VTPValidateCSARR146092.java | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004') 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 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> attributeElements = this.nonMano.get(attributeName); - List attributeElementNames = attributeElements.keySet().stream() - .map(String::toLowerCase) - .collect(Collectors.toList()); + Set 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> 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) + ); } } } -- cgit 1.2.3-korg