diff options
author | vasraz <vasyl.razinkov@est.tech> | 2022-12-19 18:29:41 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-01-03 12:26:48 +0000 |
commit | 4871b522afd7dfee773dc891cb94d3f1eaafb040 (patch) | |
tree | 4561d57b64992e929e0c39523e26d4c651733576 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src | |
parent | 52d23fc161d88fba7fefc76b89478e8abab42970 (diff) |
Fix 'Artifact type CONTROLLER_BLUEPRINT_ARCHIVE is not recognized based on its type'-bug
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: Iab23331c5eb2e8ff5526a877adab8babbadd86d9
Issue-ID: SDC-3216
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src')
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) { |