From f34e28d521b71be501dc85e75c5efa411c3194f1 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Mon, 30 Sep 2019 17:47:27 +0100 Subject: Validate artifacts signature in SOL004 package Change-Id: Ib048f4501fd8a81cdf11fab19f149350011f772e Issue-ID: SDC-2632 Signed-off-by: andre.schmid --- .../services/impl/etsi/ETSIServiceImpl.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src') diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java index ca60577b29..d6b1194b81 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java @@ -23,11 +23,11 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi; import static org.openecomp.sdc.tosca.csar.CSARConstants.ARTIFACTS_FOLDER; import static org.openecomp.sdc.tosca.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_MF_FILE_NAME; import static org.openecomp.sdc.tosca.csar.CSARConstants.MANIFEST_PNF_METADATA; -import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_DEFINITIONS; -import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ETSI_ENTRY_CHANGE_LOG; -import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ETSI_ENTRY_MANIFEST; import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ORIG_PATH_FILE_NAME; -import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_PATH_FILE_NAME; +import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.ENTRY_DEFINITIONS; +import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.ETSI_ENTRY_CHANGE_LOG; +import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.ETSI_ENTRY_MANIFEST; +import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.TOSCA_META_PATH_FILE_NAME; import java.io.IOException; import java.io.InputStream; @@ -203,18 +203,18 @@ public class ETSIServiceImpl implements ETSIService { private boolean hasMetaMandatoryEntries(final ToscaMetadata toscaMetadata) { final Map metaDataEntries = toscaMetadata.getMetaEntries(); - return metaDataEntries.containsKey(TOSCA_META_ENTRY_DEFINITIONS) && metaDataEntries - .containsKey(TOSCA_META_ETSI_ENTRY_MANIFEST) - && metaDataEntries.containsKey(TOSCA_META_ETSI_ENTRY_CHANGE_LOG); + return metaDataEntries.containsKey(ENTRY_DEFINITIONS.getName()) && metaDataEntries + .containsKey(ETSI_ENTRY_MANIFEST.getName()) + && metaDataEntries.containsKey(ETSI_ENTRY_CHANGE_LOG.getName()); } private boolean isMetaFilePresent(Map handler) { - return handler.containsKey(TOSCA_META_PATH_FILE_NAME) || handler.containsKey(TOSCA_META_ORIG_PATH_FILE_NAME); + return handler.containsKey(TOSCA_META_PATH_FILE_NAME.getName()) || handler.containsKey(TOSCA_META_ORIG_PATH_FILE_NAME); } public ResourceTypeEnum getResourceType(FileContentHandler handler) throws IOException { ToscaMetadata metadata = getMetadata(handler); - Manifest manifest = getManifest(handler, metadata.getMetaEntries().get(TOSCA_META_ETSI_ENTRY_MANIFEST)); + Manifest manifest = getManifest(handler, metadata.getMetaEntries().get(ETSI_ENTRY_MANIFEST.getName())); return getResourceType(manifest); } @@ -231,7 +231,7 @@ public class ETSIServiceImpl implements ETSIService { public Manifest getManifest(FileContentHandler handler) throws IOException { ToscaMetadata metadata = getMetadata(handler); - return getManifest(handler, metadata.getMetaEntries().get(TOSCA_META_ETSI_ENTRY_MANIFEST)); + return getManifest(handler, metadata.getMetaEntries().get(ETSI_ENTRY_MANIFEST.getName())); } private Manifest getManifest(FileContentHandler handler, String manifestLocation) throws IOException { @@ -244,16 +244,16 @@ public class ETSIServiceImpl implements ETSIService { public Path getOriginalManifestPath(final FileContentHandler handler) throws IOException { final ToscaMetadata metadata = getOriginalMetadata(handler); - final String originalMetadataPath = metadata.getMetaEntries().get(TOSCA_META_ETSI_ENTRY_MANIFEST); + final String originalMetadataPath = metadata.getMetaEntries().get(ETSI_ENTRY_MANIFEST.getName()); final Path path = Paths.get(originalMetadataPath); return path.getParent() == null ? Paths.get("") : path.getParent(); } private ToscaMetadata getMetadata(FileContentHandler handler) throws IOException { ToscaMetadata metadata; - if (handler.containsFile(TOSCA_META_PATH_FILE_NAME)) { + if (handler.containsFile(TOSCA_META_PATH_FILE_NAME.getName())) { metadata = OnboardingToscaMetadata - .parseToscaMetadataFile(handler.getFileContentAsStream(TOSCA_META_PATH_FILE_NAME)); + .parseToscaMetadataFile(handler.getFileContentAsStream(TOSCA_META_PATH_FILE_NAME.getName())); } else if (handler.containsFile(TOSCA_META_ORIG_PATH_FILE_NAME)) { metadata = OnboardingToscaMetadata .parseToscaMetadataFile(handler.getFileContentAsStream(TOSCA_META_ORIG_PATH_FILE_NAME)); -- cgit 1.2.3-korg