summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/main/java/org
diff options
context:
space:
mode:
authorGao Weitao <victor.gao@huawei.com>2019-07-03 06:15:53 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-03 06:15:53 +0000
commitd0c919b17b851d54f0588e18bad071643f95e4e8 (patch)
tree27bbfdf76b657aeed6e7be161f7e6a6d479f0245 /csarvalidation/src/main/java/org
parent98d90539d4cbbb9482012ce540fdec3b22c0fc45 (diff)
parent692a2d6c41f76c3d43e640af9c24269c5ac7f8f2 (diff)
Merge "Non_mano_artifact"
Diffstat (limited to 'csarvalidation/src/main/java/org')
-rw-r--r--csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092.java29
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)
+ );
}
}
}