summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend
diff options
context:
space:
mode:
authorAdam Wudzinski <adam.wudzinski@nokia.com>2021-01-15 17:38:30 +0100
committerAdam Wudzinski <adam.wudzinski@nokia.com>2021-01-18 16:58:27 +0100
commitf3b0ef4dc7cc21b273ea160781b5170b2d105e1a (patch)
tree04550aed49f28b599d2702a519ad7d51a855aac8 /openecomp-be/backend
parentbd5a1006210092f9ac5c48352cc94f6264e961ef (diff)
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 <adam.wudzinski@nokia.com> Change-Id: I2e21353b9e80b6bb68c4c6d408ad1ffa33314e7b
Diffstat (limited to 'openecomp-be/backend')
-rw-r--r--openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidator.java2
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java19
2 files changed, 19 insertions, 2 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidator.java b/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidator.java
index 71769cf7ec..78a05f536b 100644
--- a/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidator.java
+++ b/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidator.java
@@ -30,4 +30,4 @@ public class PmDictionaryValidator implements Validator {
@Override
public void validate(GlobalValidationContext globalContext) {
}
-} \ No newline at end of file
+}
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<ByteArrayInputStream> 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);