aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java17
2 files changed, 11 insertions, 14 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index 001c6c7e37..baabc74822 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -636,27 +636,25 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, validationErrors)) ? null : validationErrors;
}
- private FileContentHandler addDummyHeatBase(InputStream zipFileManifest, FileContentHandler fileContentMap) {
+ private void addDummyHeatBase(InputStream zipFileManifest, FileContentHandler fileContentMap) {
ManifestContent manifestContent = JsonUtil.json2Object(zipFileManifest, ManifestContent.class);
for (FileData fileData : manifestContent.getData()) {
if ((fileData.getFile()).contains("dummy_ignore.yaml")) {
String filePath = new File("").getAbsolutePath() + "/resources";
File envFilePath = new File(filePath + "/base_template.env");
File baseFilePath = new File(filePath + "/base_template.yaml");
- try (InputStream envStream = new FileInputStream(envFilePath); InputStream baseStream = new FileInputStream(baseFilePath);) {
+ try (InputStream envStream = new FileInputStream(envFilePath); InputStream baseStream = new FileInputStream(baseFilePath)) {
fileContentMap.addFile("base_template_dummy_ignore.env", envStream);
fileContentMap.addFile("base_template_dummy_ignore.yaml", baseStream);
} catch (Exception e) {
- LOGGER.error("File not found error {}", e);
+ LOGGER.error("File not found error ", e);
}
}
}
- return fileContentMap;
}
private QuestionnaireValidationResult validateQuestionnaire(String vspId, Version version, String onboardingMethod) {
// The apis of CompositionEntityDataManager used here are stateful!
-
// so, it must be re-created from scratch when it is used!
CompositionEntityDataManager compositionEntityDataManager = CompositionEntityDataManagerFactory.getInstance().createInterface();
compositionEntityDataManager.addEntity(vspInfoDao.getQuestionnaire(vspId, version), null);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java
index 4754a2d384..46e5fe81a7 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java
@@ -73,11 +73,10 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp
UploadFileResponse uploadFileResponse = new UploadFileResponse();
Optional<FileContentHandler> fileContent = OrchestrationUtil
.getFileContentMap(OnboardingTypesEnum.ZIP, uploadFileResponse, candidateData.getContentData().array());
- if (!fileContent.isPresent()) {
+ if (fileContent.isEmpty()) {
response.addStructureErrors(uploadFileResponse.getErrors());
return response;
}
- Map<String, List<ErrorMessage>> uploadErrors = uploadFileResponse.getErrors();
FileContentHandler fileContentMap = fileContent.get();
try (InputStream zipFileManifest = fileContentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME)) {
addDummyHeatBase(zipFileManifest, fileContentMap);
@@ -90,16 +89,17 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp
return response;
}
ManifestContent zipManifestFile = readManifestFromZip(fileContentMap);
- String manifest = null;
+ String manifest;
if (zipManifestFile == null) {
manifest = candidateService.createManifest(vspDetails, structure);
} else {
manifest = candidateService.createManifestFromExisting(vspDetails, structure, zipManifestFile);
}
+ Map<String, List<ErrorMessage>> uploadErrors = uploadFileResponse.getErrors();
fileContentMap.addFile(SdcCommon.MANIFEST_NAME, manifest.getBytes());
Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService
.fetchZipFileByteArrayInputStream(vspId, candidateData, manifest, OnboardingTypesEnum.ZIP, uploadErrors);
- if (!zipByteArrayInputStream.isPresent()) {
+ if (zipByteArrayInputStream.isEmpty()) {
return response;
}
HeatStructureTree tree = createAndValidateHeatTree(response, fileContentMap);
@@ -146,22 +146,21 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp
return zipManifestFile;
}
- private FileContentHandler addDummyHeatBase(InputStream zipFileManifest, FileContentHandler fileContentMap) {
+ private void addDummyHeatBase(InputStream zipFileManifest, FileContentHandler fileContentMap) {
ManifestContent manifestContent = JsonUtil.json2Object(zipFileManifest, ManifestContent.class);
for (FileData fileData : manifestContent.getData()) {
- if (Objects.nonNull(fileData.getType()) && fileData.getType().equals(FileData.Type.HELM) && fileData.getBase()) {
+ if (Objects.nonNull(fileData.getType()) && fileData.getType().equals(FileData.Type.HELM) && Boolean.TRUE.equals(fileData.getBase())) {
String filePath = new File("").getAbsolutePath() + "/resources";
File envFilePath = new File(filePath + "/base_template.env");
File baseFilePath = new File(filePath + "/base_template.yaml");
- try (InputStream envStream = new FileInputStream(envFilePath); InputStream baseStream = new FileInputStream(baseFilePath);) {
+ try (InputStream envStream = new FileInputStream(envFilePath); InputStream baseStream = new FileInputStream(baseFilePath)) {
fileContentMap.addFile("base_template_dummy_ignore.env", envStream);
fileContentMap.addFile("base_template_dummy_ignore.yaml", baseStream);
} catch (Exception e) {
- LOGGER.error("File not found error {}", e);
+ LOGGER.error("File not found error ", e);
}
}
}
- return fileContentMap;
}
private Map<String, List<ErrorMessage>> getErrors(OrchestrationTemplateActionResponse orchestrationTemplateActionResponse) {