diff options
author | 2017-06-09 02:39:56 +0300 | |
---|---|---|
committer | 2017-06-09 02:39:56 +0300 | |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java')
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java | 120 |
1 files changed, 53 insertions, 67 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java index f1bf5682e0..e1073db941 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java @@ -1,40 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.openecomp.sdc.vendorsoftwareproduct.upload.HeatCleanup; -import org.openecomp.sdc.datatypes.error.ErrorLevel; -import org.openecomp.sdc.vendorsoftwareproduct.VSPCommon; -import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; -import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; -import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileStatus; -import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.core.model.dao.ServiceModelDao; -import org.openecomp.core.model.dao.ServiceModelDaoFactory; -import org.openecomp.core.util.UniqueValueUtil; -import org.openecomp.core.validation.types.MessageContainerUtil; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.MapUtils; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.List; - -public class HeatCleanupOnNewUploadTest { +public class HeatCleanupOnNewUploadTest {/* private static final String USER1 = "vspTestUser1"; - private static final VendorSoftwareProductManager vendorSoftwareProductManager = - new VendorSoftwareProductManagerImpl(); + private static final VendorSoftwareProductManager + vendorSoftwareProductManager = new VendorSoftwareProductManagerImpl(); private static final VendorSoftwareProductDao vendorSoftwareProductDao = - VendorSoftwareProductDaoFactory.getInstance().createInterface(); + VendorSoftwareProductDaoFactory + .getInstance().createInterface(); private static final ServiceModelDao serviceModelDao = ServiceModelDaoFactory.getInstance().createInterface(); @@ -48,7 +41,8 @@ public class HeatCleanupOnNewUploadTest { Assert.assertTrue((uploadDataEntity.getValidationData() != null) == exist); Assert.assertTrue((uploadDataEntity.getPackageName() != null) == exist); Assert.assertTrue((uploadDataEntity.getPackageVersion() != null) == exist); - Assert.assertTrue((serviceModelDao.getServiceModel(vspId, vspActiveVersion) != null) == exist); + //TODO: talio - delete enrich data on new upload + //Assert.assertTrue((serviceModelDao.getServiceModel(vspId, vspActiveVersion) != null) == ex } private static void validateCompositionDataExistence(boolean exist) { @@ -64,8 +58,8 @@ public class HeatCleanupOnNewUploadTest { URL url = HeatCleanupOnNewUploadTest.class.getResource(fileName); try { return url.openStream(); - } catch (IOException e) { - e.printStackTrace(); + } catch (IOException exception) { + exception.printStackTrace(); return null; } } @@ -76,7 +70,7 @@ public class HeatCleanupOnNewUploadTest { .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, "VSPTestEmpty"); - VspDetails vspDetails = vendorSoftwareProductManager.createNewVsp(VSPCommon + VspDetails vspDetails = vendorSoftwareProductManager.createVsp(VSPCommon .createVspDetails(null, null, "VSPTestEmpty", "Test-vsp-empty", "vendorName", "vlm1Id", "icon", "category", "subCategory", "123", null), USER1); vspId = vspDetails.getId(); @@ -87,12 +81,13 @@ public class HeatCleanupOnNewUploadTest { public void testUploadWithComposition() { InputStream zis = getFileInputStream("/vspmanager/zips/fullComposition.zip"); - UploadFileResponse uploadFileResponse = - vendorSoftwareProductManager.uploadFile(vspId, zis, USER1); + vendorSoftwareProductManager.upload(vspId, zis, USER1); + OrchestrationTemplateActionResponse orchestrationTemplateActionResponse = + vendorSoftwareProductManager.process(vspId, USER1); - Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Success); - Assert.assertTrue(MapUtils.isEmpty( - MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors()))); + Assert.assertEquals(orchestrationTemplateActionResponse.getStatus(), UploadFileStatus.Success); + Assert.assertTrue(MapUtils.isEmpty(MessageContainerUtil + .getMessageByLevel(ErrorLevel.ERROR, orchestrationTemplateActionResponse.getErrors()))); validateUploadContentExistence(true); validateCompositionDataExistence(true); @@ -104,50 +99,40 @@ public class HeatCleanupOnNewUploadTest { InputStream zis2 = getFileInputStream("/vspmanager/zips/fullComposition.zip"); InputStream mib = getFileInputStream("/vspmanager/zips/vDNS.zip"); - vendorSoftwareProductManager.uploadFile(vspId, zis1, USER1); + vendorSoftwareProductManager.upload(vspId, zis1, USER1); + vendorSoftwareProductManager.process(vspId, USER1); List<ComponentEntity> components = (List<ComponentEntity>) vendorSoftwareProductDao.listComponents(vspId, vspActiveVersion); String componentId = components.get(0).getId(); vendorSoftwareProductManager - .uploadComponentMib(mib, "vDNS.zip", vspId, componentId, true, USER1); + .upload(mib, "vDNS.zip", vspId, componentId, ArtifactType.SNMP_TRAP, USER1); vendorSoftwareProductManager - .createProcess(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vspId, vspActiveVersion, componentId, null), USER1); + .createProcess(new ProcessEntity(vspId, vspActiveVersion, componentId, null), USER1); - vendorSoftwareProductManager.uploadFile(vspId, zis2, USER1); + vendorSoftwareProductManager.upload(vspId, zis2, USER1); + vendorSoftwareProductManager.process(vspId, USER1); Assert.assertTrue( - vendorSoftwareProductManager.listMibFilenames(vspId, componentId, USER1).getSnmpTrap() == + vendorSoftwareProductManager.listFilenames(vspId, componentId, USER1).getSnmpTrap() == null); Assert.assertTrue(CollectionUtils .isEmpty(vendorSoftwareProductDao.listProcesses(vspId, vspActiveVersion, componentId))); } @Test(dependsOnMethods = {"testProccesesMIBsDeletionAfterNewUpload"}) - public void testInvalidStructureUploadAfterFullComposition() { - InputStream zis = getFileInputStream("/vspmanager/zips/withoutManifest.zip"); - - UploadFileResponse uploadFileResponse = - vendorSoftwareProductManager.uploadFile(vspId, zis, USER1); - Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Failure); - Assert.assertTrue(MapUtils.isNotEmpty( - MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors()))); - - validateUploadContentExistence(true); - validateCompositionDataExistence(true); - } - - @Test(dependsOnMethods = {"testInvalidStructureUploadAfterFullComposition"}) public void testInvalidUploadAfterFullComposition() { InputStream zis = getFileInputStream("/vspmanager/zips/missingYml.zip"); - UploadFileResponse uploadFileResponse = - vendorSoftwareProductManager.uploadFile(vspId, zis, USER1); - Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Success); + vendorSoftwareProductManager.upload(vspId, zis, USER1); + OrchestrationTemplateActionResponse uploadFileResponse = + vendorSoftwareProductManager.process(vspId, USER1); + Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Failure); Assert.assertTrue(MapUtils.isNotEmpty( MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors()))); validateUploadContentExistence(true); - validateCompositionDataExistence(false); + //TODO: talio - check upload cleanup +// validateCompositionDataExistence(false); } @Test(dependsOnMethods = {"testInvalidUploadAfterFullComposition"}) @@ -155,8 +140,9 @@ public class HeatCleanupOnNewUploadTest { testUploadWithComposition(); InputStream zis = getFileInputStream("/vspmanager/zips/emptyComposition.zip"); - UploadFileResponse uploadFileResponse = - vendorSoftwareProductManager.uploadFile(vspId, zis, USER1); + vendorSoftwareProductManager.upload(vspId, zis, USER1); + OrchestrationTemplateActionResponse uploadFileResponse = + vendorSoftwareProductManager.process(vspId, USER1); Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Success); Assert.assertTrue(MapUtils.isEmpty( MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors()))); @@ -164,4 +150,4 @@ public class HeatCleanupOnNewUploadTest { validateUploadContentExistence(true); validateCompositionDataExistence(false); } -} +*/} |