aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorayalaben <ayala.benzvi@amdocs.com>2018-10-18 17:51:46 +0300
committerayalaben <ayala.benzvi@amdocs.com>2018-10-18 17:51:46 +0300
commit55a58e51dcae5a23c1679b5620237f13bcee8216 (patch)
tree50a81e87d81dc3c62206670c2c2cc60ca4c92f83
parent74307186c7d4401ba35d596c16aca10268921788 (diff)
VSP submit doesn't validate vlm version
Change-Id: I8105cc83c0ba6ec3b45a04672399ca6ac9986146 Issue-ID: SDC-1843 Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java2
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java11
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java8
4 files changed, 13 insertions, 12 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
index f0fcd15939..36e076083f 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
@@ -496,7 +496,9 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
private Optional<ValidationResponse> submit(String vspId, Version version, String message,
String user) throws IOException {
- ValidationResponse validationResponse = vendorSoftwareProductManager.validate(vspId, version);
+ VspDetails vspDetails = vendorSoftwareProductManager.getVsp(vspId, version);
+ vspDetails.setVlmVersion(versioningManager.get(vspDetails.getVendorId(),vspDetails.getVlmVersion()));
+ ValidationResponse validationResponse = vendorSoftwareProductManager.validate(vspDetails);
Map<String, List<ErrorMessage>> compilationErrors =
vendorSoftwareProductManager.compile(vspId, version);
if (!validationResponse.isValid() || MapUtils.isNotEmpty(compilationErrors)) {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
index 1b07f681ac..870c4e762a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
@@ -44,7 +44,7 @@ public interface VendorSoftwareProductManager {
void deleteVsp(String vspId, Version version);
- ValidationResponse validate(String vspId, Version version) throws IOException;
+ ValidationResponse validate(VspDetails vspDetails) throws IOException;
Map<String, List<ErrorMessage>> compile(String vspId, Version version);
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 df2e098be7..275aee646b 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
@@ -202,15 +202,14 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public ValidationResponse validate(String vspId, Version version) throws IOException {
- VspDetails vspDetails = getValidatedVsp(vspId, version);
+ public ValidationResponse validate(VspDetails vspDetails) throws IOException {
List<ErrorCode> vspErrors = new ArrayList<>(validateVspFields(vspDetails));
ValidationResponse validationResponse = new ValidationResponse();
if (Objects.nonNull(vspDetails.getOnboardingMethod())
&& OnboardingMethod.Manual.name().equals(vspDetails.getOnboardingMethod())) {
validateManualOnboardingMethod(vspDetails, validationResponse, vspErrors);
} else {
- validateOrchestrationTemplateCandidate(validationResponse, vspErrors, vspId, version);
+ validateOrchestrationTemplateCandidate(validationResponse, vspErrors, vspDetails.getId(), vspDetails.getVersion());
if (!validationResponse.isValid()) {
return validationResponse;
}
@@ -219,9 +218,9 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
vspErrors.addAll(validateMandatoryLicenseFields(vspDetails));
}
OrchestrationTemplateEntity orchestrationTemplate =
- orchestrationTemplateDao.get(vspId, version);
+ orchestrationTemplateDao.get(vspDetails.getId(), vspDetails.getVersion());
ToscaServiceModel serviceModel =
- serviceModelDao.getServiceModel(vspId, vspDetails.getVersion());
+ serviceModelDao.getServiceModel( vspDetails.getId(), vspDetails.getVersion());
if (isOrchestrationTemplateMissing(orchestrationTemplate)
|| isServiceModelMissing(serviceModel)) {
vspErrors.add(VendorSoftwareProductInvalidErrorBuilder
@@ -245,7 +244,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
Collection<ComponentDependencyModelEntity> componentDependencies =
- componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId, version, null));
+ componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspDetails.getId(), vspDetails.getVersion(), null));
if (validateComponentDependencies(componentDependencies)) {
vspErrors
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 0b2c9c0a42..a858e18aea 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
@@ -362,7 +362,7 @@ public class VendorSoftwareProductManagerImplTest {
.when(serviceModelDaoMock).getServiceModel(VSP_ID, VERSION01);
ValidationResponse validationResponse =
- vendorSoftwareProductManager.validate(VSP_ID, VERSION01);
+ vendorSoftwareProductManager.validate(vsp);
Assert.assertNotNull(validationResponse);
Assert.assertFalse(validationResponse.isValid());
Assert.assertNull(validationResponse.getVspErrors());
@@ -396,7 +396,7 @@ public class VendorSoftwareProductManagerImplTest {
.when(serviceModelDaoMock).getServiceModel(VSP_ID, VERSION01);
ValidationResponse validationResponse =
- vendorSoftwareProductManager.validate(VSP_ID, VERSION01);
+ vendorSoftwareProductManager.validate(vsp);
Assert.assertTrue(validationResponse.isValid());
/* Assert.assertEquals(vsp2.getVersionInfo().getVersion(), VERSION10);
@@ -569,7 +569,7 @@ public class VendorSoftwareProductManagerImplTest {
.when(orchestrationTemplateCandidateManagerMock)
.getInfo(VSP_ID, VERSION01);
ValidationResponse validationResponse =
- vendorSoftwareProductManager.validate(VSP_ID, VERSION01);
+ vendorSoftwareProductManager.validate(vsp);
Assert.assertNotNull(validationResponse);
Assert.assertFalse(validationResponse.isValid());
Assert.assertNotNull(validationResponse.getVspErrors());
@@ -593,7 +593,7 @@ public class VendorSoftwareProductManagerImplTest {
.when(orchestrationTemplateCandidateManagerMock)
.getInfo(VSP_ID, VERSION01);
ValidationResponse validationResponse =
- vendorSoftwareProductManager.validate(VSP_ID, VERSION01);
+ vendorSoftwareProductManager.validate(vsp);
Assert.assertNotNull(validationResponse);
Assert.assertFalse(validationResponse.isValid());
Assert.assertNotNull(validationResponse.getVspErrors());