summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test
diff options
context:
space:
mode:
authorbilal.iqbal <bilal.iqbal@est.tech>2019-03-19 19:16:03 +0000
committerOren Kleks <orenkle@amdocs.com>2019-03-20 08:02:02 +0000
commit54b96133b33b3bf55e9670ed2a8c89996ac413b9 (patch)
tree5c1dd673a61938e68fb1f43f6199c847e2f4fe7a /openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test
parentd0031501cd81a9046396358f42657f168b5a58a8 (diff)
Process CSAR
1. Handle Main service Template 2. keep copy of the onboarded package 3. Sonar fixes Issue-ID: SDC-2153 Issue-ID: SDC-2112 Change-Id: I7f84d5d6d7a4c6eeed317a7ddd19b53272182fd8 Signed-off-by: bilal.iqbal <bilal.iqbal@est.tech>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java13
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java33
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java13
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java19
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java13
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java12
6 files changed, 49 insertions, 54 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java
index 986e732410..101ecde4c8 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java
@@ -16,6 +16,10 @@
package org.openecomp.sdc.vendorlicense;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -31,11 +35,6 @@ import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
import org.openecomp.sdc.versioning.types.VersionInfo;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -82,12 +81,12 @@ public class LimitTest {
return limitEntity;
}
- @BeforeMethod
+ @Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
- @AfterMethod
+ @After
public void tearDown(){
vendorLicenseManagerImpl = null;
}
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 ca242f5810..03be183ab7 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
@@ -17,6 +17,10 @@
package org.openecomp.sdc.vendorlicense.impl;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -28,11 +32,6 @@ import org.openecomp.sdc.vendorlicense.dao.types.*;
import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -94,13 +93,13 @@ public class EntitlementPoolTest {
return entitlementPool;
}
- @BeforeMethod
+ @Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
- @AfterMethod
+ @After
public void tearDown(){
vendorLicenseManagerImpl = null;
}
@@ -127,8 +126,7 @@ public class EntitlementPoolTest {
}
- @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " +
- "license model with id vlm1_id has invalid date range.")
+ @Test(expected = CoreException.class)
public void createWithInvalidStartExpiryDateTest() {
Set<OperationalScope> opScopeChoices;
@@ -146,12 +144,11 @@ public class EntitlementPoolTest {
ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter));
ep2.setVendorLicenseModelId(vlm1_id);
vendorLicenseManagerImpl.createEntitlementPool(ep2).getId();
- Assert.fail();
+ Assert.fail("Vendor license model with id vlm1_id has invalid date range.");
}
- @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " +
- "license model with id vlm1_id has invalid date range.")
+ @Test(expected = CoreException.class)
public void createWithoutStartDateTest() {
Set<OperationalScope> opScopeChoices;
@@ -168,12 +165,11 @@ public class EntitlementPoolTest {
ep2.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter));
ep2.setVendorLicenseModelId(vlm1_id);
vendorLicenseManagerImpl.createEntitlementPool(ep2).getId();
- Assert.fail();
+ Assert.fail("Vendor license model with id vlm1_id has invalid date range.");
}
- @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " +
- "license model with id vlm1_id has invalid date range.")
+ @Test(expected = CoreException.class)
public void createWithSameStartExpiryDateTest() {
Set<OperationalScope> opScopeChoices;
@@ -191,7 +187,7 @@ public class EntitlementPoolTest {
ep2.setExpiryDate(LocalDate.now().format(formatter));
ep2.setVendorLicenseModelId(vlm1_id);
vendorLicenseManagerImpl.createEntitlementPool(ep2).getId();
- Assert.fail();
+ Assert.fail("Vendor license model with id vlm1_id has invalid date range.");
}
@Test
@@ -214,8 +210,7 @@ public class EntitlementPoolTest {
vendorLicenseManagerImpl.updateEntitlementPool(ep2);
}
- @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = "Vendor " +
- "license model with id vlm1_id has invalid date range.")
+ @Test(expected = CoreException.class)
public void updateWithInvalidStartExpiryDateTest() {
Set<OperationalScope> opScopeChoices;
@@ -233,7 +228,7 @@ public class EntitlementPoolTest {
ep2.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter));
ep2.setVendorLicenseModelId(vlm1_id);
vendorLicenseManagerImpl.updateEntitlementPool(ep2);
- Assert.fail();
+ Assert.fail("Vendor license model with id vlm1_id has invalid date range.");
}
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 b7636bb514..ca37dcd801 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
@@ -16,6 +16,10 @@
package org.openecomp.sdc.vendorlicense.impl;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -28,11 +32,6 @@ import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
@@ -87,7 +86,7 @@ public class FeatureGroupTest {
private VendorLicenseManagerImpl vendorLicenseManagerImpl;
- @AfterMethod
+ @After
public void tearDown(){
vendorLicenseManagerImpl = null;
}
@@ -114,7 +113,7 @@ public class FeatureGroupTest {
return featureGroup;
}
- @BeforeMethod
+ @Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java
index 511ebb87d0..722343a4a3 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java
@@ -16,6 +16,10 @@
package org.openecomp.sdc.vendorlicense.impl;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import org.mockito.*;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
@@ -27,12 +31,11 @@ import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.*;
@@ -78,12 +81,12 @@ public class LicenseAgreementTest {
private ArgumentCaptor<ActivityLogEntity> activityLogEntityArg;
- @BeforeMethod
+ @Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
- @AfterMethod
+ @After
public void tearDown(){
vendorLicenseManager = null;
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java
index c5076fdf2c..d8e2959464 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java
@@ -17,6 +17,10 @@
package org.openecomp.sdc.vendorlicense.impl;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -31,11 +35,6 @@ import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
@@ -73,12 +72,12 @@ public class LicenseKeyGroupTest {
@Spy
private VendorLicenseManagerImpl vendorLicenseManagerImpl;
- @BeforeMethod
+ @Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
- @AfterMethod
+ @After
public void tearDown(){
vendorLicenseManagerImpl = null;
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java
index b81c2e805f..e072453421 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java
@@ -1,5 +1,8 @@
package org.openecomp.sdc.vendorlicense.impl;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.mockito.*;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
@@ -8,9 +11,6 @@ import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.*;
@@ -59,12 +59,12 @@ public class VendorLicenseModelTest {
private ArgumentCaptor<ActivityLogEntity> activityLogEntityArg;
- @BeforeMethod
+ @Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
- @AfterMethod
+ @After
public void tearDown(){
vendorLicenseManager = null;
}
@@ -121,7 +121,7 @@ public class VendorLicenseModelTest {
verify(vendorLicenseFacadeMcok).getVendorLicenseModel(vlm1_id, VERSION01);
}
- @Test(expectedExceptions = UnsupportedOperationException.class)
+ @Test(expected = UnsupportedOperationException.class)
public void testDeleteVLMUnsupportedOperation() {
vendorLicenseManager.deleteVendorLicenseModel(vlm1_id, null); // TODO: 8/13/2017
}