diff options
Diffstat (limited to 'openecomp-be/api')
17 files changed, 122 insertions, 30 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 ba23b8cbb0..18435b3c71 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 @@ -20,6 +20,7 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; +import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; @@ -46,5 +47,8 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDto target.setStartDate(source.getStartDate()); target.setExpiryDate(source.getExpiryDate()); target.setVersionUUID(source.getVersionUuId()); + if (ToggleableFeature.MRN.isActive()) { + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + } } } 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 9b215d69aa..bed7e696e7 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 @@ -20,6 +20,7 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; +import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdcrests.mapping.MappingBase; @@ -30,6 +31,9 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntity @Override public void doMapping(EntitlementPoolRequestDto source, EntitlementPoolEntity target) { target.setName(source.getName()); + if (ToggleableFeature.MRN.isActive()) { + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + } target.setDescription(source.getDescription()); target.setThresholdValue(source.getThresholdValue()); target.setThresholdUnit(source.getThresholdUnits()); 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/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.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/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java index dedc2a01f0..232588779c 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/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.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/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java @@ -20,6 +20,7 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; +import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto; @@ -31,6 +32,8 @@ public class MapFeatureGroupDescriptorDtoToFeatureGroupEntity target.setName(source.getName()); target.setDescription(source.getDescription()); target.setPartNumber(source.getPartNumber()); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + if (!ToggleableFeature.MRN.isActive()) { + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + } } }
\ No newline at end of file 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/MapFeatureGroupEntityToFeatureGroupDescriptorDto.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/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java index ce69384f41..e103b27687 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/MapFeatureGroupEntityToFeatureGroupDescriptorDto.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/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java @@ -20,6 +20,7 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; +import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto; @@ -31,6 +32,8 @@ public class MapFeatureGroupEntityToFeatureGroupDescriptorDto target.setName(source.getName()); target.setDescription(source.getDescription()); target.setPartNumber(source.getPartNumber()); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + if (!ToggleableFeature.MRN.isActive()) { + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + } } } 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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java index 2b314b7416..a7d4b5bc42 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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java @@ -20,6 +20,7 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; +import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto; @@ -42,5 +43,8 @@ public class MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto target.setThresholdValue(source.getThresholdValue()); target.setIncrements(source.getIncrements()); target.setVersionUUID(source.getVersionUuId()); + if (ToggleableFeature.MRN.isActive()) { + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + } } } 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/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.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/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java index 4682a46216..0eeda4a8b7 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/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.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/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java @@ -20,6 +20,7 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; +import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdcrests.mapping.MappingBase; @@ -30,6 +31,9 @@ public class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity @Override public void doMapping(LicenseKeyGroupRequestDto source, LicenseKeyGroupEntity target) { target.setName(source.getName()); + if (ToggleableFeature.MRN.isActive()) { + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + } target.setDescription(source.getDescription()); target.setType(source.getType()); target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther() 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/services/EntitlementPoolsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java index 076ae45017..292b4a0937 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java @@ -20,6 +20,9 @@ package org.openecomp.sdcrests.vendorlicense.rest.services; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; @@ -37,6 +40,7 @@ import org.springframework.stereotype.Service; import javax.inject.Named; import javax.ws.rs.core.Response; import java.util.Collection; +import java.util.Objects; @Named @Service("entitlementPools") @@ -76,6 +80,12 @@ public class EntitlementPoolsImpl implements EntitlementPools { */ public Response createEntitlementPool(EntitlementPoolRequestDto request, String vlmId, String versionId, String user) { + if (ToggleableFeature.MRN.isActive()) { + if (Objects.isNull(request.getManufacturerReferenceNumber())) { + throw new CoreException((new ErrorCode.ErrorCodeBuilder().withMessage("Field does not conform to " + + "predefined criteria : manufacturerReferenceNumber : is mandatory and should not be empty").build())); + } + } EntitlementPoolEntity entitlementPoolEntity = new MapEntitlementPoolRequestDtoToEntitlementPoolEntity() .applyMapping(request, EntitlementPoolEntity.class); 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/services/FeatureGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java index cd11a45886..1c967ffa08 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java @@ -21,6 +21,9 @@ package org.openecomp.sdcrests.vendorlicense.rest.services; import org.openecomp.core.utilities.CommonMethods; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; @@ -48,6 +51,7 @@ import javax.inject.Named; import javax.ws.rs.core.Response; import java.util.Collection; import java.util.HashSet; +import java.util.Objects; @Named @Service("featureGroups") @@ -71,7 +75,6 @@ public class FeatureGroupsImpl implements FeatureGroups { fgDto.setLicenseKeyGroupsIds(fg.getLicenseKeyGroupIds()); fgDto.setEntitlementPoolsIds(fg.getEntitlementPoolIds()); fgDto.setReferencingLicenseAgreements(fg.getReferencingLicenseAgreements()); - fgDto.setManufacturerReferenceNumber(fg.getManufacturerReferenceNumber()); outputMapper.doMapping(fg, fgDto); results.add(fgDto); } @@ -81,6 +84,15 @@ public class FeatureGroupsImpl implements FeatureGroups { @Override public Response createFeatureGroup(FeatureGroupRequestDto request, String vlmId, String versionId, String user) { + //Below if block is introduced to have feature toggleable. This if block needs to remove when + // we remove toggle. + if (!ToggleableFeature.MRN.isActive()) { + if (Objects.isNull(request.getManufacturerReferenceNumber())) { + throw new CoreException((new ErrorCode.ErrorCodeBuilder().withMessage("Field does not " + + "conform to predefined criteria : manufacturerReferenceNumber : is mandatory and should not be empty").build())); + } + } + FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity() .applyMapping(request, FeatureGroupEntity.class); featureGroupEntity.setVendorLicenseModelId(vlmId); 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 0d03c19808..a00c01080e 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 @@ -141,4 +141,17 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest { mapper.doMapping(source, target); assertEquals(target.getStartDate(), param); } + + @Test + public void testManufacturerReferenceNumber() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = new + MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + + String param = "02402e1e-7092-485a-9574-46e2d49cca97"; + source.setManufacturerReferenceNumber(param); + mapper.doMapping(source, target); + assertEquals(target.getManufacturerReferenceNumber(), param); + } } 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 86e94510bc..d927dc471c 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 @@ -114,6 +114,18 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest { assertEquals(target.getStartDate(), param); } + @Test + public void testManufacturerReferenceNumber() { + EntitlementPoolRequestDto source = new EntitlementPoolRequestDto(); + EntitlementPoolEntity target = new EntitlementPoolEntity(); + MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = new + MapEntitlementPoolRequestDtoToEntitlementPoolEntity(); + String param = "02402e1e-7092-485a-9574-46e2d49cca97"; + source.setManufacturerReferenceNumber(param); + mapper.doMapping(source, target); + assertEquals(target.getManufacturerReferenceNumber(), param); + } + enum TestEnum { Yes } 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/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.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/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java index ea8c59b94c..7024931523 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/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.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/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java @@ -50,18 +50,6 @@ public class MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest { } @Test - public void testManufacturerReferenceNumber() { - FeatureGroupDescriptorDto source = new FeatureGroupDescriptorDto(); - FeatureGroupEntity target = new FeatureGroupEntity(); - MapFeatureGroupDescriptorDtoToFeatureGroupEntity mapper = - new MapFeatureGroupDescriptorDtoToFeatureGroupEntity(); - String param = "6751e741-ffc2-4034-863b-f0083f62c033"; - source.setManufacturerReferenceNumber(param); - mapper.doMapping(source, target); - assertEquals(target.getManufacturerReferenceNumber(), param); - } - - @Test public void testPartNumber() { FeatureGroupDescriptorDto source = new FeatureGroupDescriptorDto(); FeatureGroupEntity target = new FeatureGroupEntity(); 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/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.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/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java index b575febac8..2a9c18f828 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/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.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/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java @@ -26,18 +26,6 @@ import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto; public class MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest { @Test - public void testManufacturerReferenceNumber() { - FeatureGroupEntity source = new FeatureGroupEntity(); - FeatureGroupDescriptorDto target = new FeatureGroupDescriptorDto(); - MapFeatureGroupEntityToFeatureGroupDescriptorDto mapper = - new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); - String param = "02402e1e-7092-485a-9574-46e2d49cca97"; - source.setManufacturerReferenceNumber(param); - mapper.doMapping(source, target); - assertEquals(target.getManufacturerReferenceNumber(), param); - } - - @Test public void testDescription() { FeatureGroupEntity source = new FeatureGroupEntity(); FeatureGroupDescriptorDto target = new FeatureGroupDescriptorDto(); 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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java index ce8363def4..0b17f6014d 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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java @@ -167,6 +167,18 @@ public class MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest { assertEquals(target.getStartDate(), param); } + @Test + public void testManufacturerReferenceNumber() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = new + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + String param = "02402e1e-7092-485a-9574-46e2d49cca97"; + source.setManufacturerReferenceNumber(param); + mapper.doMapping(source, target); + assertEquals(target.getManufacturerReferenceNumber(), param); + } + enum TestEnum { Yes } 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/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.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/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java index 8d0769ae05..a1e617e526 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/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.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/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java @@ -137,4 +137,16 @@ public class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest { mapper.doMapping(source, target); assertEquals(target.getStartDate(), param); } + + @Test + public void testManufacturerReferenceNumber() { + LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto(); + LicenseKeyGroupEntity target = new LicenseKeyGroupEntity(); + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = new + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity(); + String param = "02402e1e-7092-485a-9574-46e2d49cca97"; + source.setManufacturerReferenceNumber(param); + mapper.doMapping(source, target); + assertEquals(target.getManufacturerReferenceNumber(), param); + } } 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 18488ab83d..8fa34b8579 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 @@ -30,13 +30,16 @@ import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @ApiModel(value = "EntitlementPoolRequest") -@JsonIgnoreProperties({"manufacturerReferenceNumber", "time", "aggregationFunction", "entitlementMetric"}) +@JsonIgnoreProperties({"time", "aggregationFunction", "entitlementMetric"}) public class EntitlementPoolRequestDto { @NotNull @Size(max = 120) private String name; + @Size(max = 100) + private String manufacturerReferenceNumber; + @Size(max = 1000) private String description; @@ -60,6 +63,14 @@ public class EntitlementPoolRequestDto { this.name = name; } + public String getManufacturerReferenceNumber() { + return manufacturerReferenceNumber; + } + + public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { + this.manufacturerReferenceNumber = manufacturerReferenceNumber; + } + public String getDescription() { return description; } 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/FeatureGroupDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java index 56b3c25635..4270ffee9e 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java @@ -20,7 +20,6 @@ package org.openecomp.sdcrests.vendorlicense.types; -import org.hibernate.validator.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @@ -35,7 +34,7 @@ public class FeatureGroupDescriptorDto { @NotNull private String partNumber; - @NotBlank(message = "is mandatory and should not be empty") + @Size(max = 100) private String manufacturerReferenceNumber; 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/LicenseKeyGroupRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java index fb56f85326..c1e2ef05bf 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java @@ -32,8 +32,13 @@ public class LicenseKeyGroupRequestDto { @NotNull @Size(max = 120) private String name; + + @Size(max = 100) + private String manufacturerReferenceNumber; + @Size(max = 1000) private String description; + @NotNull private LicenseKeyType type; @@ -58,6 +63,14 @@ public class LicenseKeyGroupRequestDto { this.name = name; } + public String getManufacturerReferenceNumber() { + return manufacturerReferenceNumber; + } + + public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { + this.manufacturerReferenceNumber = manufacturerReferenceNumber; + } + public String getDescription() { return description; } |