aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
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
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')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java4
-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
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java2
4 files changed, 12 insertions, 13 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java
index 6702479864..eb4b29d742 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java
@@ -56,7 +56,7 @@ public class CandidateEntityBuilder {
Map<String, List<ErrorMessage>> uploadErrors) throws Exception {
//mdcDataDebugMessage.debugEntryMessage("VSP Id", vspDetails.getId());
- try (InputStream zipFileManifest = contentMap.getFileContent(SdcCommon.MANIFEST_NAME)) {
+ try (InputStream zipFileManifest = contentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME)) {
HeatFileAnalyzer heatFileAnalyzer = new HeatFileAnalyzerRowDataImpl();
AnalyzedZipHeatFiles analyzedZipHeatFiles =
heatFileAnalyzer.analyzeFilesNotEligibleForModulesFromFileAnalyzer(contentMap.getFiles());
@@ -87,7 +87,7 @@ public class CandidateEntityBuilder {
FileContentHandler fileContentHandler,
AnalyzedZipHeatFiles analyzedZipHeatFiles)
throws IOException {
- try (InputStream manifest = fileContentHandler.getFileContent(SdcCommon.MANIFEST_NAME)) {
+ try (InputStream manifest = fileContentHandler.getFileContentAsStream(SdcCommon.MANIFEST_NAME)) {
if (Objects.isNull(manifest)) {
Optional<ManifestContent> manifestContentOptional =
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))
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
index 3e37125442..1118260a16 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java
@@ -174,7 +174,7 @@ public class ServiceModelDaoFactoryTest {
artifacts.put("art4", ("this is art4 desc:" + CommonMethods.nextUuId()).getBytes());
FileContentHandler fileContentHandler = new FileContentHandler();
- fileContentHandler.putAll(artifacts);
+ fileContentHandler.setFiles(artifacts);
return fileContentHandler;
}