diff options
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest')
5 files changed, 41 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java index 52135fad55..2510bd0634 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java @@ -32,6 +32,7 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDto target.setId(source.getId()); target.setName(source.getName()); target.setDescription(source.getDescription()); + target.setType(source.getType()); target.setThresholdValue(source.getThresholdValue()); target.setThresholdUnits(source.getThresholdUnit()); target.setIncrements(source.getIncrements()); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java index 5832596580..5c45ed652a 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java @@ -32,6 +32,7 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntity target.setName(source.getName()); target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); target.setDescription(source.getDescription()); + target.setType(source.getType()); target.setThresholdValue(source.getThresholdValue()); target.setThresholdUnit(source.getThresholdUnits()); target.setIncrements(source.getIncrements()); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java index f2010e62de..999b430bd8 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; @@ -154,4 +155,16 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest { mapper.doMapping(source, target); assertEquals(target.getManufacturerReferenceNumber(), param); } + + @Test + public void testType() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + EntitlementPoolType entitlementPoolType = EntitlementPoolType.One_Time; + source.setType(entitlementPoolType); + mapper.doMapping(source, target); + assertEquals(target.getType(), entitlementPoolType); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java index 7ff6fb78f5..0c28ceef36 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java @@ -21,6 +21,7 @@ import static org.testng.Assert.assertEquals; import java.util.Collections; import java.util.HashSet; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; @@ -126,6 +127,19 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest { assertEquals(target.getManufacturerReferenceNumber(), param); } + @Test + public void testType() { + EntitlementPoolRequestDto source = new EntitlementPoolRequestDto(); + EntitlementPoolEntity target = new EntitlementPoolEntity(); + MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = new + MapEntitlementPoolRequestDtoToEntitlementPoolEntity(); + EntitlementPoolType entitlementPoolType = EntitlementPoolType.Universal; + source.setType(entitlementPoolType); + mapper.doMapping(source, target); + assertEquals(target.getType(), entitlementPoolType); + } + + enum TestEnum { Yes } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java index dbd6ddc063..f9a04566b2 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java @@ -24,6 +24,7 @@ package org.openecomp.sdcrests.vendorlicense.types; import io.swagger.v3.oas.annotations.media.Schema; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.hibernate.validator.constraints.NotBlank; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; @@ -46,6 +47,9 @@ public class EntitlementPoolRequestDto { @Size(max = 1000) private String description; + @NotNull + private EntitlementPoolType type; + private Integer thresholdValue; private ThresholdUnit thresholdUnits; @@ -82,6 +86,14 @@ public class EntitlementPoolRequestDto { this.description = description; } + public EntitlementPoolType getType() { + return type; + } + + public void setType(EntitlementPoolType type) { + this.type = type; + } + public Integer getThresholdValue() { return thresholdValue; } |