summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/main/java/org
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2020-05-18 08:33:00 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-18 08:33:00 +0000
commitd6e34605e0e961920327ff4f878e2fb2e99a5d9c (patch)
treebd36477375beca7ce9f62f2a75d9f756efd85ad6 /csarvalidation/src/main/java/org
parentbcaab76906b642de056e4aea97548f0f5bd90e44 (diff)
parent497835a9faf9ec947af69a8e1c48f02ce7376fcd (diff)
Merge "Fix R972082 bug"
Diffstat (limited to 'csarvalidation/src/main/java/org')
-rw-r--r--csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082.java31
1 files changed, 12 insertions, 19 deletions
diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082.java
index 1061480..60bdd47 100644
--- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082.java
+++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082.java
@@ -23,13 +23,15 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
@@ -115,13 +117,12 @@ public class VTPValidateCSARR972082 extends VTPValidateCSARBase {
private static class ValidateNonManoSection {
+ private static final String ATTRIBUTE_NAME = "onap_pnf_sw_information";
+
private final CSARArchive csar;
private final String fileName;
private final Map<String, Map<String, List<String>>> nonMano;
private final List<CSARError> errors = new ArrayList<>();
- private final List<String> attributeNames = Arrays.asList(
- "onap_pnf_sw_information"
- );
private ValidateNonManoSection(final CSARArchive csar, final String fileName,
final Map<String, Map<String, List<String>>> nonMano) {
@@ -141,28 +142,20 @@ public class VTPValidateCSARR972082 extends VTPValidateCSARBase {
}
private List<CSARError> validate() {
- if (nonMano.keySet().stream().filter(Objects::nonNull).count() > 0) {
- nonMano.keySet().stream().filter(Objects::nonNull).forEach(this::validateAttribute);
+ List<String> attributesNotNull = nonMano.keySet().stream()
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ if (!attributesNotNull.isEmpty()) {
+ attributesNotNull.forEach(this::validateAttribute);
} else {
- errors.add(new PnfCSARErrorEntryMissing(
- attributeNames.toString(),
- fileName,
- UNKNOWN_LINE_NUMBER)
- );
+ errors.add(new PnfCSARErrorEntryMissing(ATTRIBUTE_NAME, fileName, UNKNOWN_LINE_NUMBER));
}
return errors;
}
private void validateAttribute(final String nonManoAttributes) {
-
- if (!attributeNames.contains(nonManoAttributes)) {
- errors.add(new PnfCSARErrorEntryMissing(
- nonManoAttributes,
- fileName,
- UNKNOWN_LINE_NUMBER)
- );
- } else {
+ if (ATTRIBUTE_NAME.equals(nonManoAttributes)) {
validateSourceElementsUnderAttribute(nonManoAttributes);
}
}