diff options
author | ayalaben <ayala.benzvi@amdocs.com> | 2018-01-03 08:38:27 +0200 |
---|---|---|
committer | ayalaben <ayala.benzvi@amdocs.com> | 2018-01-03 14:55:56 +0200 |
commit | 5c5d34c913a2d8451061b44a8ee2fec19354316c (patch) | |
tree | 9abde771395824756bfe13dde9e0faa3b1ffe453 /openecomp-be/backend | |
parent | 0abdaacf1dffaabf8fed86bc04b97105d9008385 (diff) |
Unit Tests
Change-Id: I39ee00e80475aa93b0f99a350b56754c31c6e9b6
Issue-ID: SDC-860
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/backend')
3 files changed, 24 insertions, 24 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ImagesTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ImagesTest.java index d78f4045b6..698afe62d4 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ImagesTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ImagesTest.java @@ -12,6 +12,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.impl.ImageManagerImpl; import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; 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; @@ -41,6 +42,11 @@ public class ImagesTest { MockitoAnnotations.initMocks(this); } + @AfterMethod + public void tearDown(){ + imageManager = null; + } + @Test public void createImage() { ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION01, COMP_ID, ID); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java index 35893409df..be53a1a71a 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java @@ -31,6 +31,7 @@ import org.testng.annotations.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.List; import static org.mockito.Matchers.anyObject; @@ -43,6 +44,8 @@ public class DeploymentFlavorManagerImplTest { private static final String COMPONENT_ID = "COMPONENT_ID"; private static final String DF1_ID = "df1"; private static final String DF2_ID = "df2"; + private static final String FG_ID = "FG_ID"; + private static final List<String> fgs = Collections.singletonList(FG_ID); @Mock private CompositionEntityDataManager compositionEntityDataManagerMock; @@ -88,6 +91,7 @@ public class DeploymentFlavorManagerImplTest { doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + vspDetails.setFeatureGroups(fgs); doReturn(vspDetails).when(vspInfoDao).get(anyObject()); deploymentFlavorManager.createDeploymentFlavor(expected); @@ -161,6 +165,7 @@ public class DeploymentFlavorManagerImplTest { doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + vspDetails.setFeatureGroups(fgs); doReturn(vspDetails).when(vspInfoDao).get(anyObject()); try { @@ -190,6 +195,7 @@ public class DeploymentFlavorManagerImplTest { doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + vspDetails.setFeatureGroups(fgs); doReturn(vspDetails).when(vspInfoDao).get(anyObject()); ComponentEntity component = new ComponentEntity(VSP_ID, VERSION, null); @@ -222,6 +228,7 @@ public class DeploymentFlavorManagerImplTest { doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + vspDetails.setFeatureGroups(fgs); doReturn(vspDetails).when(vspInfoDao).get(anyObject()); ComponentEntity component = new ComponentEntity(VSP_ID, VERSION, null); @@ -299,30 +306,11 @@ public class DeploymentFlavorManagerImplTest { @Test public void testGetNonExistingDepFlavorId_negative() { - testGet_negative(VSP_ID, VERSION, "non existing image id", + testGet_negative(VSP_ID, VERSION, VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); } - /* - @Test - public void testGet() { - DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); - doReturn(expected).when(deploymentFlavorDaoMock).get(anyObject()); - VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); - doReturn(vspDetails).when(vspInfoDao).get(anyObject()); - - CompositionEntityResponse<DeploymentFlavor> response = - deploymentFlavorManager.getDeploymentFlavor(VSP_ID, VERSION, DF1_ID); - Assert.assertEquals(response.getId(), expected.getId()); - Assert - .assertEquals(response.getData().getModel(), expected.getDeploymentFlavorCompositionData(). - getModel()); - Assert.assertEquals(response.getData().getDescription(), - expected.getDeploymentFlavorCompositionData(). - getDescription()); - } -*/ @Test public void testDeleteDepFlavorOnHEAT() { DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); @@ -374,6 +362,7 @@ public class DeploymentFlavorManagerImplTest { DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); deploymentFlavor.setModel(deploymentFlavorId + "name"); deploymentFlavor.setDescription(deploymentFlavorId + " desc"); + deploymentFlavor.setFeatureGroupId(FG_ID); deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); return deploymentFlavorEntity; @@ -395,10 +384,10 @@ public class DeploymentFlavorManagerImplTest { } } - private void testGet_negative(String vspId, Version version, String deploymentFlavorId, + private void testGet_negative(String vspId, Version version, String expectedErrorCode) { try { - deploymentFlavorManager.getDeploymentFlavor(vspId, version, deploymentFlavorId); + deploymentFlavorManager.getDeploymentFlavor(vspId, version, "non existing image id"); Assert.fail(); } catch (CoreException exception) { Assert.assertEquals(exception.code().id(), expectedErrorCode); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java index 5e735ff74e..470dca40ff 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java @@ -10,6 +10,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploa import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringUploadStatus; 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; @@ -50,6 +51,11 @@ public class MonitoringUploadsManagerImplTest { MockitoAnnotations.initMocks(this); } + @AfterMethod + public void tearDown(){ + monitoringUploadsManager = null; + } + @Test(expectedExceptions = CoreException.class) public void testUploadEmptyZip() { processFile(ZIP_DIR + EMPTY_ZIP_FILE_NAME, inputStream -> @@ -59,8 +65,7 @@ public class MonitoringUploadsManagerImplTest { } @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = - "Monitoring file uploaded for vendor software product with Id vspId and version version_id " + - "is invalid: Invalid zip file") + "Invalid zip file") public void testUploadInvalidZip() { processFile("/notZipFile", inputStream -> monitoringUploadsManager |