summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src
diff options
context:
space:
mode:
authorshrikantawachar <shrikant.awachar@amdocs.com>2018-08-10 16:14:56 +0530
committershrikantawachar <shrikant.awachar@amdocs.com>2018-08-10 19:05:17 +0530
commitc15ef65197789965734fb3aa90e9ea50bda05045 (patch)
tree83d4b26b9926b0c43261f952b90b40c8008af4d5 /openecomp-be/backend/openecomp-sdc-vendor-license-manager/src
parent7e0f45ab7839fda19459f790e0384c3a6c98e2bf (diff)
Inconsistent behavior in license model xmls
Removing toggle and fix for Inconsistent behavior in license model xmls Change-Id: I2fd032f25afbdcc17547224beaecf626ed6322bb Issue-ID: SDC-1625 Signed-off-by: shrikantawachar <shrikant.awachar@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-license-manager/src')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java58
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java9
2 files changed, 0 insertions, 67 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
index d1ff5387ca..3a635de1ee 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
@@ -16,10 +16,8 @@
package org.openecomp.sdc.vendorlicense.impl;
-import org.apache.commons.collections.CollectionUtils;
import org.openecomp.core.dao.UniqueValueDao;
import org.openecomp.core.util.UniqueValueUtil;
-import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
@@ -35,7 +33,6 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Collection;
-import java.util.Objects;
import java.util.Optional;
import java.util.Set;
@@ -213,61 +210,6 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager {
featureGroupDao.updateFeatureGroup(featureGroup, addedEntitlementPools, removedEntitlementPools,
addedLicenseKeyGroups, removedLicenseKeyGroups);
- updateEpLkgOnMrnChange(featureGroup, addedLicenseKeyGroups, addedEntitlementPools, retrieved);
- }
-
- /**
- * If MRN is updated in feature group then update all linked EPs and Lkgs with new versionUuId
- * @param featureGroup - Feature Group entity which is requested for update
- * @param addedLicenseKeyGroups - LicenseKeyGroups added with Feature Group
- * @param addedEntitlementPools - EntitlementPools added with Feature Group
- * @param retrieved - Feature Group entity fetched from database
- */
- private void updateEpLkgOnMrnChange(FeatureGroupEntity featureGroup,
- Set<String> addedLicenseKeyGroups,
- Set<String> addedEntitlementPools,
- FeatureGroupEntity retrieved) {
- if (Objects.nonNull(retrieved.getManufacturerReferenceNumber())
- && !retrieved.getManufacturerReferenceNumber().equals(featureGroup
- .getManufacturerReferenceNumber())) {
- if (CollectionUtils.isEmpty(addedEntitlementPools)) {
- updateEntitlementPool(featureGroup, retrieved.getEntitlementPoolIds());
- } else {
- updateEntitlementPool(featureGroup, addedEntitlementPools);
- }
-
- if (CollectionUtils.isEmpty(addedLicenseKeyGroups)) {
- updateLicenseKeyGroup(featureGroup, retrieved.getLicenseKeyGroupIds());
- } else {
- updateLicenseKeyGroup(featureGroup, addedLicenseKeyGroups);
- }
- }
- }
-
- private void updateEntitlementPool(FeatureGroupEntity featureGroup,
- Set<String> entitlementPoolIds) {
- for (String epId: entitlementPoolIds) {
- final EntitlementPoolEntity entitlementPoolEntity = entitlementPoolDao
- .get(new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), featureGroup
- .getVersion(), epId));
- if (Objects.nonNull(entitlementPoolEntity)) {
- entitlementPoolEntity.setVersionUuId(CommonMethods.nextUuId());
- entitlementPoolDao.update(entitlementPoolEntity);
- }
- }
- }
-
- private void updateLicenseKeyGroup(FeatureGroupEntity featureGroup,
- Set<String> licenseKeyGroupIds) {
- for (String lkgId: licenseKeyGroupIds) {
- final LicenseKeyGroupEntity licenseKeyGroupEntity = licenseKeyGroupDao
- .get(new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion(), lkgId));
- if (Objects.nonNull(licenseKeyGroupEntity)) {
- licenseKeyGroupEntity.setVersionUuId(CommonMethods.nextUuId());
- licenseKeyGroupDao.update(licenseKeyGroupEntity);
- }
- }
}
@Override
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java
index d4f66c61d2..b7636bb514 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java
@@ -255,7 +255,6 @@ public class FeatureGroupTest {
existingFG.setEntitlementPoolIds(new HashSet<String>());
existingFG.setLicenseKeyGroupIds(new HashSet<String>());
- existingFG.setManufacturerReferenceNumber("MRN");
doReturn(existingFG).when(featureGroupDao).get(anyObject());
@@ -283,7 +282,6 @@ public class FeatureGroupTest {
anyObject(),anyObject(), anyObject());
FeatureGroupEntity fg = new FeatureGroupEntity(vlm1_id, VERSION01, fg1_id);
- fg.setManufacturerReferenceNumber("MRN_UPD");
vendorLicenseManagerImpl.updateFeatureGroup(fg,addedLKGs,removedLKGs, addedEPs,
removedEPs);
@@ -298,9 +296,6 @@ public class FeatureGroupTest {
verify(featureGroupDao)
.updateFeatureGroup(fg,addedEPs,removedEPs, addedLKGs, removedLKGs);
-
- verify(entitlementPoolDao, times(2)).update(anyObject());
- verify(licenseKeyGroupDao,times(2)).update(anyObject());
}
@Test
@@ -311,7 +306,6 @@ public class FeatureGroupTest {
HashSet<String> lkgSet = new HashSet<String>(); lkgSet.add(lkg1_id);
existingFG.setEntitlementPoolIds(epSet);
existingFG.setLicenseKeyGroupIds(lkgSet);
- existingFG.setManufacturerReferenceNumber("MRN");
doReturn(existingFG).when(featureGroupDao).get(anyObject());
@@ -330,7 +324,6 @@ public class FeatureGroupTest {
anyObject(),anyObject(), anyObject());
FeatureGroupEntity fg = new FeatureGroupEntity(vlm1_id, VERSION01, fg1_id);
- fg.setManufacturerReferenceNumber("MRN_UPD");
vendorLicenseManagerImpl.updateFeatureGroup(fg,addedLKGs,removedLKGs, addedEPs,
removedEPs);
@@ -346,8 +339,6 @@ public class FeatureGroupTest {
verify(featureGroupDao)
.updateFeatureGroup(fg,addedEPs,removedEPs, addedLKGs, removedLKGs);
- verify(entitlementPoolDao, times(1)).update(anyObject());
- verify(licenseKeyGroupDao,times(1)).update(anyObject());
}