aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api')
-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/mapping/MapVspDescriptionDtoToVspDetails.java8
-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/mapping/MapVspDetailsToDto.java8
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetailsTest.java23
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java8
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java2
5 files changed, 43 insertions, 6 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/mapping/MapVspDescriptionDtoToVspDetails.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/mapping/MapVspDescriptionDtoToVspDetails.java
index 634bd90d20..3ab2667821 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/mapping/MapVspDescriptionDtoToVspDetails.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/mapping/MapVspDescriptionDtoToVspDetails.java
@@ -20,6 +20,7 @@
package org.openecomp.sdcrests.vsp.rest.mapping;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.LicenseType;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -38,12 +39,15 @@ public class MapVspDescriptionDtoToVspDetails extends MappingBase<VspDescription
target.setVendorName(source.getVendorName());
target.setVendorId(source.getVendorId());
- if (source.getLicensingVersion() != null) {
+ if (source.getLicensingVersion() != null && source.getLicenseType() != LicenseType.EXTERNAL) {
target.setVlmVersion(new Version(source.getLicensingVersion()));
}
+ if (source.getLicenseType() != null) {
+ target.setLicenseType(source.getLicenseType().name());
+ }
LicensingData licensingData = source.getLicensingData();
- if (licensingData != null) {
+ if (licensingData != null && source.getLicenseType() != LicenseType.EXTERNAL) {
target.setLicenseAgreement(licensingData.getLicenseAgreement());
target.setFeatureGroups(licensingData.getFeatureGroups());
}
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/mapping/MapVspDetailsToDto.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/mapping/MapVspDetailsToDto.java
index 6e659cbb54..1ba5d1355c 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/mapping/MapVspDetailsToDto.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/mapping/MapVspDetailsToDto.java
@@ -20,6 +20,8 @@
package org.openecomp.sdcrests.vsp.rest.mapping;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.LicenseType;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
import org.openecomp.sdcrests.mapping.MappingBase;
@@ -40,7 +42,11 @@ public class MapVspDetailsToDto extends MappingBase<VspDetails, VspDetailsDto> {
target.setVendorName(source.getVendorName());
target.setLicensingVersion(
source.getVlmVersion() == null ? null : source.getVlmVersion().getId());
-
+ if (StringUtils.isNotBlank(source.getLicenseType())) {
+ target.setLicenseType(LicenseType.valueOf(source.getLicenseType()));
+ } else if (StringUtils.isNotBlank(target.getLicensingVersion())){
+ target.setLicenseType(LicenseType.INTERNAL);
+ }
if (source.getLicenseAgreement() != null || source.getFeatureGroups() != null) {
LicensingData licensingData = new LicensingData();
licensingData.setLicenseAgreement(source.getLicenseAgreement());
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetailsTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetailsTest.java
index 9ec43e9226..20a544927e 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetailsTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetailsTest.java
@@ -17,9 +17,13 @@
package org.openecomp.sdcrests.vsp.rest.mapping;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
-import org.junit.Test;
+import java.util.Collections;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.LicenseType;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
/**
@@ -65,4 +69,21 @@ public class MapVspDescriptionDtoToVspDetailsTest {
assertEquals(vendorName, target.getVendorName());
assertEquals(vendorId, target.getVendorId());
}
+
+ @Test
+ public void testLicenceTypeMapping() {
+ final VspDescriptionDto source = new VspDescriptionDto();
+ LicensingData licensingData = new LicensingData();
+ licensingData.setLicenseAgreement("testLicenseAgreement");
+ licensingData.setFeatureGroups(Collections.emptyList());
+ source.setLicenseType(LicenseType.EXTERNAL);
+ source.setLicensingData(licensingData);
+
+ final VspDetails target = new VspDetails();
+ final MapVspDescriptionDtoToVspDetails mapper = new MapVspDescriptionDtoToVspDetails();
+ mapper.doMapping(source, target);
+ assertEquals(LicenseType.EXTERNAL.name(), target.getLicenseType());
+ assertNull(target.getLicenseAgreement());
+ assertNull(target.getFeatureGroups());
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java
index d5eb7be0d3..2386328378 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java
@@ -18,9 +18,9 @@ package org.openecomp.sdcrests.vsp.rest.mapping;
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.LicenseType;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
@@ -68,6 +68,9 @@ public class MapVspDetailsToDtoTest {
final String onboardingMethod = "b46520ac-e62f-4a24-8f40-ee6e65889bfc";
source.setOnboardingMethod(onboardingMethod);
+ final String licenseType = LicenseType.EXTERNAL.name();
+ source.setLicenseType(licenseType);
+
final VspDetailsDto target = new VspDetailsDto();
final MapVspDetailsToDto mapper = new MapVspDetailsToDto();
mapper.doMapping(source, target);
@@ -83,5 +86,6 @@ public class MapVspDetailsToDtoTest {
assertEquals(vendorName, target.getVendorName());
assertEquals(vlmVersionId, target.getLicensingVersion());
assertEquals(onboardingMethod, target.getOnboardingMethod());
+ assertEquals(LicenseType.EXTERNAL, target.getLicenseType());
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
index 1b64ab7b2c..3cddb5d4e3 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
@@ -17,6 +17,7 @@
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
import lombok.Data;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.LicenseType;
import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
import javax.validation.constraints.NotNull;
@@ -37,5 +38,6 @@ public class VspDescriptionDto {
@NotNull
private String vendorId; // this will be populated with vlm id
private String licensingVersion; // this will be populated with vlm version
+ private LicenseType licenseType;
private LicensingData licensingData;
}