aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java17
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java2
2 files changed, 17 insertions, 2 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 a022fb697e..d36f1bc8ce 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
@@ -100,6 +100,8 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentQu
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
import org.openecomp.sdc.vendorsoftwareproduct.utils.ComponentDependencyTracker;
+import org.openecomp.sdc.versioning.VersioningManager;
+import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -628,7 +630,9 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
ToscaServiceModel toscaServiceModel = enrichedServiceModelDao.getServiceModel(vspId, version);
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
Version vlmVersion = vspDetails.getVlmVersion();
-
+ if (vlmVersion != null) {
+ populateVersionsForVlm(vspDetails.getVendorId(), vlmVersion);
+ }
PackageInfo packageInfo = createPackageInfo(vspDetails);
ToscaFileOutputServiceCsarImpl toscaServiceTemplateServiceCsar =
@@ -646,6 +650,17 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return packageInfo;
}
+ protected void populateVersionsForVlm(String vlmId, Version vlmVersion) {
+ VersioningManager versioningManager = VersioningManagerFactory.getInstance().createInterface();
+ versioningManager.list(vlmId).stream()
+ .filter(version -> version.getId().equalsIgnoreCase(vlmVersion.getId()))
+ .findAny()
+ .ifPresent(version -> {
+ vlmVersion.setMinor(vlmVersion.getMinor());
+ vlmVersion.setMajor(vlmVersion.getMajor());
+ });
+ }
+
private PackageInfo createPackageInfo(VspDetails vspDetails) {
PackageInfo packageInfo = new PackageInfo(vspDetails.getId(), vspDetails.getVersion());
packageInfo.setVspName(vspDetails.getName());
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
index cc262ed869..fd274d0898 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
@@ -456,7 +456,7 @@ public class VendorSoftwareProductManagerImplTest {
doReturn(new ToscaServiceModel(new FileContentHandler(), new HashMap<>(), "")).when
(enrichedServiceModelDaoMock).getServiceModel(VSP_ID, VERSION10);
-
+ doNothing().when(vendorSoftwareProductManager).populateVersionsForVlm(anyObject(), anyObject());
VspDetails vsp = new VspDetails(VSP_ID, VERSION10);
vsp.setVendorId("vendorId");
vsp.setVlmVersion(VERSION10);