aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2019-09-19 16:14:01 +0100
committerOfir Sonsino <ofir.sonsino@intl.att.com>2019-11-03 15:41:37 +0000
commit433947b5ab5e28fc29aee447de934de89a707419 (patch)
treea485b95b2ae7716ced4825fb7b9eb2b6eeb3433b /openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp
parentee64a64fb0705422c18608304e63a505d10d8ba1 (diff)
Centralize onboarding package validation
Change-Id: I3cc58cf15f62008e83cfc7ddb095d07ab216b82a Issue-ID: SDC-2583 Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp')
-rw-r--r--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.java17
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.java2
2 files changed, 9 insertions, 10 deletions
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 e727078daa..ca60577b29 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
@@ -152,12 +152,11 @@ public class ETSIServiceImpl implements ETSIService {
private Optional<Path> updateNonManoPathInHandler(final FileContentHandler handler, final NonManoType nonManoType,
final Path nonManoOriginalFilePath) {
final Path fixedSourcePath = fixNonManoPath(nonManoOriginalFilePath);
- final Map<String, byte[]> packageFileMap = handler.getFiles();
- if (packageFileMap.containsKey(fixedSourcePath.toString())) {
+ if (handler.containsFile(fixedSourcePath.toString())) {
final Path newNonManoPath = Paths.get(nonManoType.getType(), nonManoType.getLocation()
, fixedSourcePath.getFileName().toString());
- if (!packageFileMap.containsKey(newNonManoPath.toString())) {
- packageFileMap.put(newNonManoPath.toString(), packageFileMap.remove(fixedSourcePath.toString()));
+ if (!handler.containsFile(newNonManoPath.toString())) {
+ handler.addFile(newNonManoPath.toString(), handler.remove(fixedSourcePath.toString()));
return Optional.of(newNonManoPath);
}
}
@@ -254,10 +253,10 @@ public class ETSIServiceImpl implements ETSIService {
ToscaMetadata metadata;
if (handler.containsFile(TOSCA_META_PATH_FILE_NAME)) {
metadata = OnboardingToscaMetadata
- .parseToscaMetadataFile(handler.getFileContent(TOSCA_META_PATH_FILE_NAME));
+ .parseToscaMetadataFile(handler.getFileContentAsStream(TOSCA_META_PATH_FILE_NAME));
} else if (handler.containsFile(TOSCA_META_ORIG_PATH_FILE_NAME)) {
metadata = OnboardingToscaMetadata
- .parseToscaMetadataFile(handler.getFileContent(TOSCA_META_ORIG_PATH_FILE_NAME));
+ .parseToscaMetadataFile(handler.getFileContentAsStream(TOSCA_META_ORIG_PATH_FILE_NAME));
} else {
throw new IOException("TOSCA.meta file not found!");
}
@@ -267,7 +266,7 @@ public class ETSIServiceImpl implements ETSIService {
private ToscaMetadata getOriginalMetadata(final FileContentHandler handler) throws IOException {
if (handler.containsFile(TOSCA_META_ORIG_PATH_FILE_NAME)) {
return OnboardingToscaMetadata
- .parseToscaMetadataFile(handler.getFileContent(TOSCA_META_ORIG_PATH_FILE_NAME));
+ .parseToscaMetadataFile(handler.getFileContentAsStream(TOSCA_META_ORIG_PATH_FILE_NAME));
} else {
throw new IOException(String.format("%s file not found", TOSCA_META_ORIG_PATH_FILE_NAME));
}
@@ -276,9 +275,9 @@ public class ETSIServiceImpl implements ETSIService {
private InputStream getManifestInputStream(FileContentHandler handler, String manifestLocation) throws IOException {
InputStream io;
if (manifestLocation == null || !handler.containsFile(manifestLocation)) {
- io = handler.getFileContent(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME);
+ io = handler.getFileContentAsStream(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME);
} else {
- io = handler.getFileContent(manifestLocation);
+ io = handler.getFileContentAsStream(manifestLocation);
}
if (io == null) {
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/filedatastructuremodule/CandidateServiceImpl.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/filedatastructuremodule/CandidateServiceImpl.java
index 07dc53dfae..5535416838 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/filedatastructuremodule/CandidateServiceImpl.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/filedatastructuremodule/CandidateServiceImpl.java
@@ -132,7 +132,7 @@ public class CandidateServiceImpl implements CandidateService {
analyzedZipHeatFiles);
handleOtherResources(tree, usedEnvFiles, structure);
FilesDataStructure fileDataStructureFromManifest =
- createFileDataStructureFromManifest(zipContentMap.getFileContent(SdcCommon.MANIFEST_NAME));
+ createFileDataStructureFromManifest(zipContentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME));
List<String> structureArtifacts = structure.getArtifacts();
structureArtifacts.addAll(fileDataStructureFromManifest.getArtifacts().stream().filter
(artifact -> isNotStrctureArtifact(structureArtifacts, artifact))