diff options
author | vasraz <vasyl.razinkov@est.tech> | 2022-08-26 13:59:23 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-09-14 08:24:38 +0000 |
commit | e4a10c8950c35f21fd192f54c8a293af2dd02b1a (patch) | |
tree | a3f6760d9b9424b6fed62f2755ba079c02776f75 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager | |
parent | 1db6e26a7fa6b1afcf1562b239866198dc54ed92 (diff) |
Fix 'Optional license in onboarding'-bug
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: I6b63629e834b8a5002372d6af59ae0a3a9460542
Issue-ID: SDC-3601
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.java | 17 |
1 files changed, 11 insertions, 6 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 234ee43f05..001c6c7e37 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 @@ -99,6 +99,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.LicenseType; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OnboardingMethod; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateEntity; @@ -142,7 +143,7 @@ import org.openecomp.sdc.versioning.dao.types.Version; public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductManager { - private static final Logger LOGGER = LoggerFactory.getLogger(VendorSoftwareProductManager.class); + private static final Logger LOGGER = LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class); private VspMergeDao vspMergeDao; private OrchestrationTemplateDao orchestrationTemplateDao; private OrchestrationTemplateCandidateManager orchestrationTemplateCandidateManager; @@ -386,7 +387,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa private Map<String, List<ErrorMessage>> compile(String vendorSoftwareProductId, Version version, ToscaServiceModel serviceModel) { if (isServiceModelMissing(serviceModel)) { - return null; + return Collections.emptyMap(); } enrichedServiceModelDao.deleteAll(vendorSoftwareProductId, version); if (CollectionUtils.isNotEmpty(serviceModel.getModelList())) { @@ -552,9 +553,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa populateVersionsForVlm(vspDetails.getVendorId(), vlmVersion); } final PackageInfo packageInfo = createPackageInfo(vspDetails); - final ToscaFileOutputServiceCsarImpl toscaServiceTemplateServiceCsar = new ToscaFileOutputServiceCsarImpl(new AsdPackageHelper(new ManifestUtils())); - final FileContentHandler licenseArtifacts = licenseArtifactsService - .createLicenseArtifacts(vspDetails.getId(), vspDetails.getVendorId(), vlmVersion, vspDetails.getFeatureGroups()); + final ToscaFileOutputServiceCsarImpl toscaServiceTemplateServiceCsar = new ToscaFileOutputServiceCsarImpl( + new AsdPackageHelper(new ManifestUtils())); final ETSIService etsiService = new ETSIServiceImpl(); if (etsiService.hasEtsiSol261Metadata(toscaServiceModel.getArtifactFiles())) { final FileContentHandler handler = toscaServiceModel.getArtifactFiles(); @@ -566,6 +566,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa packageInfo.setVendorRelease(etsiService.getHighestCompatibleSpecificationVersion(handler).getOriginalValue()); } } + FileContentHandler licenseArtifacts = null; + if (!LicenseType.EXTERNAL.name().equals(vspDetails.getLicenseType())) { + licenseArtifacts = licenseArtifactsService + .createLicenseArtifacts(vspDetails.getId(), vspDetails.getVendorId(), vlmVersion, vspDetails.getFeatureGroups()); + } packageInfo.setTranslatedFile(ByteBuffer.wrap(toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts))); packageInfoDao.create(packageInfo); return packageInfo; @@ -613,7 +618,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa private Map<String, List<ErrorMessage>> validateOrchestrationTemplate(OrchestrationTemplateEntity orchestrationTemplate) throws IOException { if (isOrchestrationTemplateMissing(orchestrationTemplate)) { - return null; + return Collections.emptyMap(); } Map<String, List<ErrorMessage>> validationErrors = new HashMap<>(); FileContentHandler fileContentMap = CommonUtil |