From 644017cb3edd5b7a077a634ffd5daf2fee6bc088 Mon Sep 17 00:00:00 2001 From: az2497 Date: Thu, 10 Aug 2017 17:49:40 +0300 Subject: [SDC] OnBoard with enabled tests and features Change-Id: I4c1bbf6e1c854cf97a3561c736f83da44b58b7c0 Signed-off-by: az2497 [SDC] OnBoard with enabled tests and features. Change-Id: Icd52f039aee4dd393a1404d530bb9fdd0b20e604 Signed-off-by: az2497 --- .../dao/types/EntitlementPoolEntity.java | 16 +++--- .../dao/types/LicenseKeyGroupEntity.java | 16 +++--- .../sdc/vendorlicense/dao/types/LimitEntity.java | 24 ++++----- .../dao/impl/zusammen/LimitZusammenDaoImpl.java | 12 ++--- .../facade/impl/VendorLicenseFacadeImpl.java | 58 +++++++++++----------- 5 files changed, 61 insertions(+), 65 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib') diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java index dce2939ae5..2b7b3a6ded 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java @@ -258,11 +258,11 @@ public class EntitlementPoolEntity implements VersionableEntity { if(obj.getType().equals(LimitType.ServiceProvider)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric()!=null?obj.getMetric().name():null); - xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); - xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); + xmlObj.setMetric(obj.getMetric()); + xmlObj.setValues(obj.getValue()); + xmlObj.setUnit(obj.getUnit()); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); - xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null); + xmlObj.setTime(obj.getTime()); hs.add(xmlObj); } } @@ -281,11 +281,11 @@ public class EntitlementPoolEntity implements VersionableEntity { if(obj.getType().equals(LimitType.Vendor)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric()!=null?obj.getMetric().name():null); - xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); - xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); + xmlObj.setMetric(obj.getMetric()); + xmlObj.setValues(obj.getValue()); + xmlObj.setUnit(obj.getUnit()); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); - xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null); + xmlObj.setTime(obj.getTime()); hs.add(xmlObj); } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java index d5efd59a6b..364a240498 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java @@ -224,11 +224,11 @@ public class LicenseKeyGroupEntity implements VersionableEntity { if(obj.getType().equals(LimitType.ServiceProvider)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric().toString()); - xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); - xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); + xmlObj.setMetric(obj.getMetric()); + xmlObj.setValues(obj.getValue()); + xmlObj.setUnit(obj.getUnit()); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); - xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null); + xmlObj.setTime(obj.getTime()); hs.add(xmlObj); } } @@ -247,11 +247,11 @@ public class LicenseKeyGroupEntity implements VersionableEntity { if(obj.getType().equals(LimitType.Vendor)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric().toString()); - xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); - xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); + xmlObj.setMetric(obj.getMetric()); + xmlObj.setValues(obj.getValue()); + xmlObj.setUnit(obj.getUnit()); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); - xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null); + xmlObj.setTime(obj.getTime()); hs.add(xmlObj); } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java index ba9c38f453..e40b2988b3 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java @@ -14,12 +14,12 @@ public class LimitEntity implements VersionableEntity { private String name; private LimitType type; private String description; - private EntitlementMetric metric; + private String metric; private Version version; - private Integer value; - private Integer unit; + private String value; + private String unit; private AggregationFunction aggregationFunction; - private EntitlementTime time; + private String time; public LimitEntity() { } @@ -31,11 +31,11 @@ public class LimitEntity implements VersionableEntity { this.id = id; } - public Integer getUnit() { + public String getUnit() { return unit; } - public void setUnit(Integer unit) { + public void setUnit(String unit) { this.unit = unit; } @@ -48,11 +48,11 @@ public class LimitEntity implements VersionableEntity { this.aggregationFunction = aggregationFunction; } - public EntitlementTime getTime() { + public String getTime() { return time; } - public void setTime(EntitlementTime time) { + public void setTime(String time) { this.time = time; } @@ -119,11 +119,11 @@ public class LimitEntity implements VersionableEntity { this.name = name; } - public EntitlementMetric getMetric() { + public String getMetric() { return metric; } - public void setMetric(EntitlementMetric metric) { + public void setMetric(String metric) { this.metric = metric; } @@ -135,11 +135,11 @@ public class LimitEntity implements VersionableEntity { this.description = description; } - public Integer getValue() { + public String getValue() { return value; } - public void setValue(Integer value) { + public void setValue(String value) { this.value = value; } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java index c8612bfeaa..c36d255b31 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java @@ -113,20 +113,16 @@ public class LimitZusammenDaoImpl implements LimitDao { limitEntity.setType( elementInfo.getInfo().getProperties().get(LIMT_TYPE) != null ? LimitType.valueOf((String) elementInfo.getInfo().getProperties().get(LIMT_TYPE)) : null); - limitEntity.setTime( elementInfo.getInfo().getProperties().get(TIME) != null ? - EntitlementTime.valueOf((String) elementInfo.getInfo().getProperties().get(TIME)) : - null); - limitEntity.setMetric( elementInfo.getInfo().getProperties().get(METRIC) != null ? - EntitlementMetric.valueOf((String) elementInfo.getInfo().getProperties().get(METRIC)) : - null); + limitEntity.setTime((String) elementInfo.getInfo().getProperties().get(TIME) ); + limitEntity.setMetric( (String) elementInfo.getInfo().getProperties().get(METRIC)); limitEntity.setAggregationFunction( elementInfo.getInfo().getProperties().get (AGGREGATIONFUNCTION) != null ? AggregationFunction.valueOf((String) elementInfo.getInfo().getProperties() .get(AGGREGATIONFUNCTION)) : null); Object unit = elementInfo.getInfo().getProperties().get(UNIT); - limitEntity.setUnit(unit != null ? VlmZusammenUtil.toInteger(unit) : null); + limitEntity.setUnit((String) unit); Object value = elementInfo.getInfo().getProperties().get(VALUE); - limitEntity.setValue(value != null ? VlmZusammenUtil.toInteger(value) : null); + limitEntity.setValue((String) value); return limitEntity; } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java index 5f9dd10816..2f7e0ea50e 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.vendorlicense.facade.impl; import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE; import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP; import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG; -import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA; import org.apache.commons.collections4.CollectionUtils; import org.openecomp.core.util.UniqueValueUtil; @@ -519,33 +518,34 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { } } private void validateCompletedVendorLicenseModel(String vendorLicenseModelId, String user) { - Version version = VersioningUtil.resolveVersion(null, - getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user); - Collection licenseAgreements = licenseAgreementDao - .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null)); - - if (CollectionUtils.isNotEmpty(licenseAgreements)) { - licenseAgreements.forEach(licenseAgreement -> { - if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) { - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); - throw new CoreException( - new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build()); - } - }); - - Collection featureGroupEntities = featureGroupDao.list( - new FeatureGroupEntity(vendorLicenseModelId, version, null)); - featureGroupEntities.forEach(featureGroupEntity -> { - if(CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) { - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); - throw new CoreException( - new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build()); - } - }); - } + Collection allFeatureGroupEntities = new HashSet<>(); + Version version = VersioningUtil.resolveVersion(null, + getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user); + Collection licenseAgreements = licenseAgreementDao + .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null)); + + if (CollectionUtils.isNotEmpty(licenseAgreements)) { + licenseAgreements.forEach(licenseAgreement -> { + if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); + throw new CoreException( + new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build()); + } + allFeatureGroupEntities.addAll(licenseAgreement.getFeatureGroupIds()); + }); + + allFeatureGroupEntities.forEach(fg -> { + FeatureGroupEntity featureGroupEntity = featureGroupDao.get(new FeatureGroupEntity(vendorLicenseModelId, version, fg)); + if(CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); + throw new CoreException( + new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build()); + } + }); + } } } -- cgit 1.2.3-korg