diff options
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java')
1 files changed, 25 insertions, 22 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java index d99848ddb8..7416339b87 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java @@ -111,19 +111,6 @@ class SOL004MetaDirectoryValidator implements Validator { this.securityManager = securityManager; } - @Override - public Map<String, List<ErrorMessage>> validateContent(final FileContentHandler fileContentHandler) { - this.contentHandler = (OnboardingPackageContentHandler) fileContentHandler; - this.folderList = contentHandler.getFolderList(); - parseToscaMetadata(); - verifyMetadataFile(); - if (packageHasCertificate()) { - verifySignedFiles(); - } - validatePmDictionaryContentsAgainstSchema(); - return Collections.unmodifiableMap(getAnyValidationErrors()); - } - private boolean packageHasCertificate() { final String certificatePath = getCertificatePath().orElse(null); return contentHandler.containsFile(certificatePath); @@ -499,15 +486,6 @@ class SOL004MetaDirectoryValidator implements Validator { LOGGER.warn(Messages.METADATA_UNSUPPORTED_ENTRY.getErrorMessage(), entry.getKey()); } - private Map<String, List<ErrorMessage>> getAnyValidationErrors() { - if (errorsByFile.isEmpty()) { - return Collections.emptyMap(); - } - final Map<String, List<ErrorMessage>> errors = new HashMap<>(); - errors.put(SdcCommon.UPLOAD_FILE, errorsByFile); - return errors; - } - private void validatePmDictionaryContentsAgainstSchema() { final Stream<byte[]> pmDictionaryFiles = new FileExtractor(getEtsiEntryManifestPath(), contentHandler).findFiles(ONAP_PM_DICTIONARY); new PMDictionaryValidator().validate(pmDictionaryFiles, (String message) -> reportError(ErrorLevel.ERROR, message)); @@ -532,4 +510,29 @@ class SOL004MetaDirectoryValidator implements Validator { reportError(ErrorLevel.ERROR, Messages.UNIQUE_ONAP_CNF_HELM_NON_MANO_ERROR.formatMessage(formattedFileList)); } } + + @Override + public ValidationResult validate(final FileContentHandler csarContent) { + this.contentHandler = (OnboardingPackageContentHandler) csarContent; + this.folderList = contentHandler.getFolderList(); + parseToscaMetadata(); + verifyMetadataFile(); + if (packageHasCertificate()) { + verifySignedFiles(); + } + validatePmDictionaryContentsAgainstSchema(); + final var csarValidationResult = new CsarValidationResult(); + errorsByFile.forEach(csarValidationResult::addError); + return csarValidationResult; + } + + @Override + public boolean appliesTo(final String model) { + return model == null; + } + + @Override + public int getOrder() { + return 0; + } } |