summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java
diff options
context:
space:
mode:
authorbilal.iqbal <bilal.iqbal@est.tech>2019-03-25 16:56:44 +0000
committerOren Kleks <orenkle@amdocs.com>2019-03-26 10:59:14 +0000
commit9294d16a358f919624c869db9c32e2baf7094911 (patch)
tree1fdaa5568179c9db467ebd7da9b2734be43d63f7 /openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java
parent4428fc40a81ff3234b918af87da74a27ccbfe650 (diff)
Fix sanity tests
Change-Id: I13415b3d22627fcdc67d3e57fa157afadd04a682 Issue-ID: SDC-2206 Signed-off-by: bilal.iqbal <bilal.iqbal@est.tech>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java65
1 files changed, 58 insertions, 7 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java
index 7b40686271..5db85fef06 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java
@@ -28,7 +28,13 @@ import org.mockito.Spy;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao;
import org.openecomp.sdc.vendorlicense.dao.LimitDao;
-import org.openecomp.sdc.vendorlicense.dao.types.*;
+import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime;
+import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
+import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
+import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -40,8 +46,10 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.*;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
public class EntitlementPoolTest {
@@ -191,6 +199,49 @@ public class EntitlementPoolTest {
}
@Test
+ public void createWithExpiryDateNullTest() {
+
+ Set<OperationalScope> opScopeChoices;
+ opScopeChoices = new HashSet<>();
+ opScopeChoices.add(OperationalScope.Core);
+ opScopeChoices.add(OperationalScope.CPU);
+ opScopeChoices.add(OperationalScope.Network_Wide);
+ EntitlementPoolEntity ep2 =
+ createEntitlementPool("vlm2Id", null, ep1_id, EP1_NAME, "EP2 dec", 70,
+ ThresholdUnit.Absolute,
+ EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+ opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
+ ep2.setStartDate(LocalDate.now().format(formatter));
+ ep2.setExpiryDate(null);
+ ep2.setVendorLicenseModelId(vlm1_id);
+ vendorLicenseManagerImpl.createEntitlementPool(ep2);
+ verify(vendorLicenseFacade).createEntitlementPool(ep2);
+
+ }
+
+ @Test
+ public void createWithStartAndExpiryDateNullTest() {
+
+ Set<OperationalScope> opScopeChoices;
+ opScopeChoices = new HashSet<>();
+ opScopeChoices.add(OperationalScope.Core);
+ opScopeChoices.add(OperationalScope.CPU);
+ opScopeChoices.add(OperationalScope.Network_Wide);
+ EntitlementPoolEntity ep2 =
+ createEntitlementPool("vlm2Id", null, ep1_id, EP1_NAME, "EP2 dec", 70,
+ ThresholdUnit.Absolute,
+ EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null,
+ opScopeChoices, null, EntitlementTime.Other, "time2", "sku2");
+ ep2.setStartDate(null);
+ ep2.setExpiryDate(null);
+ ep2.setVendorLicenseModelId(vlm1_id);
+ vendorLicenseManagerImpl.createEntitlementPool(ep2);
+ verify(vendorLicenseFacade).createEntitlementPool(ep2);
+
+ }
+
+ @Test
public void testUpdate() {
Set<OperationalScope> opScopeChoices;
opScopeChoices = new HashSet<>();
@@ -298,12 +349,12 @@ public class EntitlementPoolTest {
entitlementPool.setStartDate(LocalDate.now().format(formatter));
entitlementPool.setExpiryDate(LocalDate.now().plusDays(1L).format(formatter));
- doReturn(entitlementPool).when(entitlementPoolDao).get(anyObject());
+ doReturn(entitlementPool).when(entitlementPoolDao).get(any());
doNothing().when(vendorLicenseManagerImpl).deleteChildLimits(vlm1_id, VERSION01, ep1_id);
- doNothing().when(vendorLicenseManagerImpl).deleteUniqueName(anyObject(), anyObject(),
- anyObject(), anyObject());
+ doNothing().when(vendorLicenseManagerImpl).deleteUniqueName(any(), any(),
+ any(), any());
vendorLicenseManagerImpl.deleteEntitlementPool(entitlementPool);
@@ -328,7 +379,7 @@ public class EntitlementPoolTest {
entitlementPool.setStartDate(LocalDateTime.now().format(formatter));
entitlementPool.setExpiryDate(LocalDateTime.now().plusDays(1L).format(formatter));
- doReturn(entitlementPool).when(entitlementPoolDao).get(anyObject());
+ doReturn(entitlementPool).when(entitlementPoolDao).get(any());
EntitlementPoolEntity retrieved = vendorLicenseManagerImpl.getEntitlementPool(entitlementPool);