From f3b0ef4dc7cc21b273ea160781b5170b2d105e1a Mon Sep 17 00:00:00 2001 From: Adam Wudzinski Date: Fri, 15 Jan 2021 17:38:30 +0100 Subject: Map VSP PM_DICTIONARY Type to VF PM_DICTIONARY Type File defined in ZIP VSP package as PM_DICTIONARY will be now mapped to PM_DICTIONARY type in VF. Also PmDictionaryValidator is run on files with PM_DICTIONARY type in ZIP Manifest file, instead of file naming convention. Issue-ID: SDC-3390 Signed-off-by: Adam Wudzinski Change-Id: I2e21353b9e80b6bb68c4c6d408ad1ffa33314e7b --- .../OrchestrationTemplateProcessZipHandler.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager') 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 71e47db48c..2d18a62122 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 @@ -1,5 +1,6 @@ /* * Copyright © 2016-2018 European Support Limited + * Modifications copyright (c) 2021 Nokia * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,7 +91,13 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp } - String manifest = candidateService.createManifest(vspDetails, structure); + ManifestContent zipManifestFile = readManifestFromZip(fileContentMap); + String manifest = null; + if (zipManifestFile == null) { + manifest = candidateService.createManifest(vspDetails, structure); + } else { + manifest = candidateService.createManifestFromExisting(vspDetails, structure, zipManifestFile); + } fileContentMap.addFile(SdcCommon.MANIFEST_NAME, manifest.getBytes()); Optional zipByteArrayInputStream = candidateService @@ -144,6 +151,16 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp return response; } + private ManifestContent readManifestFromZip(FileContentHandler fileContentMap) { + ManifestContent zipManifestFile = null; + try (InputStream zipFileManifest = fileContentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME)) { + zipManifestFile = JsonUtil.json2Object(zipFileManifest, ManifestContent.class); + } catch (Exception e) { + LOGGER.error("Invalid package content", e); + } + return zipManifestFile; + } + private FileContentHandler addDummyHeatBase(InputStream zipFileManifest, FileContentHandler fileContentMap) { ManifestContent manifestContent = JsonUtil.json2Object(zipFileManifest, ManifestContent.class); -- cgit 1.2.3-korg