From 46f9fd57f24428f6a6fd0d290b0463e188975231 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Thu, 10 Aug 2017 12:08:45 +0300 Subject: [SDC] code sync Change-Id: Ia33a7874802b8ac2f49aed9199e109ea509e950e Signed-off-by: Michael Lando --- .../tests/US/MIBsArtifactsOnResourceInstance.java | 8 +- .../org/openecomp/sdc/ci/tests/US/Testing.java | 146 ++++++++++++++++----- .../tests/dataProvider/OnbordingDataProviders.java | 66 ++++++++++ .../tests/execute/sanity/AdminUserManagment.java | 6 + .../sdc/ci/tests/execute/sanity/Onboard.java | 140 +------------------- .../ci/tests/execute/sanity/OnboardViaApis.java | 30 +---- .../sdc/ci/tests/execute/sanity/Service.java | 7 +- .../ci/tests/execute/sanity/ToscaValidation.java | 77 +++++++++++ .../sdc/ci/tests/execute/sanity/VFCArtifacts.java | 2 +- .../sdc/ci/tests/utilities/FileHandling.java | 9 ++ .../sdc/ci/tests/utilities/OnboardingUtils.java | 17 +++ 11 files changed, 303 insertions(+), 205 deletions(-) create mode 100644 ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java create mode 100644 ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java (limited to 'ui-ci/src/main/java') diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java index 4e4192fe7e..9ea1b7239c 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java @@ -75,7 +75,7 @@ public class MIBsArtifactsOnResourceInstance extends SetupCDTest { // TODO: Change download validation from download artifact via external API to UI @Test(dataProvider="mibsArtifactCRUDUi") public void mibsArtifactCRUDUi(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception { - setLog("mibsArtifactCRUDUi"); + setLog(fileName); String filePath = FileHandling.getFilePath(folder); // import Resource @@ -144,8 +144,12 @@ public class MIBsArtifactsOnResourceInstance extends SetupCDTest { // Import VFC/VL/CP, upload MIBs artifacts then drag it on VF & verify that deployment artifact have only download option @Test(dataProvider="mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption") public void mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception { + + if(resourceTypeEnum.equals(ResourceTypeEnum.CP)){ + throw new SkipException("Open bug 322930"); + } - setLog("mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption"); + setLog(fileName); String filePath = FileHandling.getFilePath(folder); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java index 089ad9580f..4e9770cbea 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java @@ -21,11 +21,17 @@ package org.openecomp.sdc.ci.tests.US; import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.Set; +import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaParameterConstants; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; import org.testng.Assert; @@ -36,40 +42,40 @@ import org.testng.Assert; public class Testing { - public static void main(String[] args) throws Exception { - // TODO Auto-generated method stub - - File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml"); - ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path); - - Map vl_us831517_1 = new HashMap(); - vl_us831517_1.put("property_1", true); - vl_us831517_1.put("property_2", "init_value_2"); - vl_us831517_1.put("property_3", "init_value_3"); - - - Map vl_us831517_2 = new HashMap(); - vl_us831517_2.put("property_1", false); - vl_us831517_2.put("property_2", "init_value_2"); - vl_us831517_2.put("property_3", "new_value_3"); - - Map vl_us831517_3 = new HashMap(); - vl_us831517_3.put("property_1", true); - vl_us831517_3.put("property_2", "init_value_2"); - vl_us831517_3.put("property_3", "init_value_3"); - vl_us831517_3.put("property_4", false); - vl_us831517_3.put("property_5", "init_value_5"); - - Map> predefinedProperties = new HashMap>(); - predefinedProperties.put("VL_US831517_1", vl_us831517_1); - predefinedProperties.put("VL_US831517_2", vl_us831517_2); - predefinedProperties.put("VL_US831517_3", vl_us831517_3); - - validateNodeTemplatesProperties(predefinedProperties, toscaDefinition); - - - - } +// public static void main(String[] args) throws Exception { +// // TODO Auto-generated method stub +// +// File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml"); +// ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path); +// +// Map vl_us831517_1 = new HashMap(); +// vl_us831517_1.put("property_1", true); +// vl_us831517_1.put("property_2", "init_value_2"); +// vl_us831517_1.put("property_3", "init_value_3"); +// +// +// Map vl_us831517_2 = new HashMap(); +// vl_us831517_2.put("property_1", false); +// vl_us831517_2.put("property_2", "init_value_2"); +// vl_us831517_2.put("property_3", "new_value_3"); +// +// Map vl_us831517_3 = new HashMap(); +// vl_us831517_3.put("property_1", true); +// vl_us831517_3.put("property_2", "init_value_2"); +// vl_us831517_3.put("property_3", "init_value_3"); +// vl_us831517_3.put("property_4", false); +// vl_us831517_3.put("property_5", "init_value_5"); +// +// Map> predefinedProperties = new HashMap>(); +// predefinedProperties.put("VL_US831517_1", vl_us831517_1); +// predefinedProperties.put("VL_US831517_2", vl_us831517_2); +// predefinedProperties.put("VL_US831517_3", vl_us831517_3); +// +// validateNodeTemplatesProperties(predefinedProperties, toscaDefinition); +// +// +// +// } @@ -121,5 +127,77 @@ public class Testing { } + + + + + + + + + + + + + + + + + + public static void main(String[] args) throws Exception { + ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition; + File filesFolder = new File("C:/Users/al714h/Downloads/Design/"); + File importToscaFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/"); + + File dataTypesLocation = new File(importToscaFilesFolder.getPath() + "/data-types/dataTypes.yml"); + + File genericVfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VF/Generic_VF.yml"); + File genericVfcFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_VFC/Generic_VFC.yml"); + File genericPnfFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_PNF/Generic_PNF.yml"); + File genericServiceFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_Service/Generic_Service.yml"); + + File amdocsCsarFileName = new File("/77e6b842669f441db20a83489da3f4be.csar"); + File VfCsarFileName = new File("/resource-Civfonboarded2016012VmxAv301072E2e1424cb9d-csar.csar"); + File serviceCsarFileName = new File("/service-Ciservicefeba0521131d-csar.csar"); + + Map parseDataTypesYaml = FileHandling.parseDataTypesYaml(dataTypesLocation.getAbsoluteFile().toString()); + System.out.println("start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date())); + + toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + amdocsCsarFileName)); + toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName)); + toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + serviceCsarFileName)); + ToscaTopologyTemplateDefinition topologyTemplate = toscaMainAmdocsDefinition.getTopology_template(); + ToscaDefinition objectHelper = ToscaParserUtils.parseToscaYamlToJavaObject(genericVfFileLocation); + + Map additionalInputs = new HashMap<>(); + Set keySet = objectHelper.getNode_types().keySet(); + if(keySet != null){ + for(String key: keySet){ + additionalInputs = objectHelper.getNode_types().get(key).getProperties(); + } + } + topologyTemplate.addInputs(additionalInputs); + + + + +// toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path); + System.out.println("listTypeHeatMetaDefinition start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date())); +// List listTypeHeatMetaDefinition = CsarParserUtils.getListTypeHeatMetaDefinition(csarPath); + System.out.println("get service start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date())); +// System.out.println(listTypeHeatMetaDefinition); +// for(TypeHeatMetaDefinition typeHeatMetaDefinition : listTypeHeatMetaDefinition){ +// for(GroupHeatMetaDefinition groupHeatMetaDefinition : typeHeatMetaDefinition.getGroupHeatMetaDefinition()){ +// List artifactList = groupHeatMetaDefinition.getArtifactList(); +// boolean isBase = groupHeatMetaDefinition.getPropertyHeatMetaDefinition().getValue(); +// } +// +// } + System.out.println("Finished"); + System.out.println("get service start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date())); + } + + + } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java new file mode 100644 index 0000000000..f63be6c8c3 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java @@ -0,0 +1,66 @@ +package org.openecomp.sdc.ci.tests.dataProvider; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.testng.annotations.DataProvider; + +public class OnbordingDataProviders { + + protected static String filepath = FileHandling.getVnfRepositoryPath(); + + @DataProvider(name = "randomVNF_List", parallel = false) + private static final Object[][] randomVnfList() throws Exception { + int randomElementNumber = 3; //how many VNFs to onboard randomly + List fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList(); + List newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder); + System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size())); + return provideData(newRandomFileNamesFromFolder, filepath); + } + + @DataProvider(name = "VNF_List" , parallel = true) + private static final Object[][] VnfList() throws Exception { + + List fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList(); + + System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size())); + return provideData(fileNamesFromFolder, filepath); + } + + +// -----------------------methods----------------------------------------- + public static Object[][] provideData(List fileNamesFromFolder, String filepath) { + + Object[][] arObject = new Object[fileNamesFromFolder.size()][]; + int index = 0; + for (Object obj : fileNamesFromFolder) { + arObject[index++] = new Object[] { filepath, obj }; + } + return arObject; + } + + private static List getRandomElements(int randomElementNumber, List fileNamesFromFolder) { + if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){ + return null; + }else{ + List indexList = new ArrayList<>(); + List newRandomFileNamesFromFolder = new ArrayList<>(); + for(int i = 0; i < fileNamesFromFolder.size(); i++){ + indexList.add(i); + } + Collections.shuffle(indexList); + Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]); + for(int i = 0; i < randomArray.length; i++){ + newRandomFileNamesFromFolder.add(fileNamesFromFolder.get(randomArray[i])); + } + return newRandomFileNamesFromFolder; + } + } + + + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java index b1cd09c6d8..f842136425 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java @@ -48,6 +48,7 @@ import org.openecomp.sdc.ci.tests.verificator.UserManagementVerificator; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.Assert; +import org.testng.SkipException; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -104,6 +105,11 @@ public class AdminUserManagment extends SetupCDTest { //TC922253 @Test public void createInvalidMacIdTest(){ + + if(true){ + throw new SkipException("Open bug 324032"); + } + String macId = generateValidMacId(); StringBuilder invalidMacId = new StringBuilder(macId); invalidMacId.setCharAt(0, 'a'); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java index 0c4802af64..e6d1177425 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java @@ -34,6 +34,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders; import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; @@ -78,124 +79,9 @@ public class Onboard extends SetupCDTest { makeDistributionValue = makeDistributionReadValue; } -// public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) { -// Object[][] arObject = new Object[fileNamesFromFolder.length][]; -// -// int index = 0; -// for (Object obj : fileNamesFromFolder) { -// arObject[index++] = new Object[] { filepath, obj }; -// } -// return arObject; -// } - - public static Object[][] provideData(List fileNamesFromFolder, String filepath) { - Object[][] arObject = new Object[fileNamesFromFolder.size()][]; - - int index = 0; - for (Object obj : fileNamesFromFolder) { - arObject[index++] = new Object[] { filepath, obj }; - } - return arObject; - } - - @DataProvider(name = "VNF_List" , parallel = true) - private static final Object[][] VnfList() throws Exception { - - List fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - List exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip", - "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip", - "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip", - "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip"); - fileNamesFromFolder.removeAll(exludeVnfList); - - System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size())); - return provideData(fileNamesFromFolder, filepath); - } - - -// @DataProvider(name = "randomVNF_List", parallel = false) -// private static final Object[][] randomVnfList() throws Exception { -// int randomElementNumber = 3; //how many VNFs to onboard randomly -// String filepath = getFilePath(); -// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); -// Object[] newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder); -// System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.length)); -// return provideData(newRandomFileNamesFromFolder, filepath); -// } - - @DataProvider(name = "randomVNF_List", parallel = false) - private static final Object[][] randomVnfList() throws Exception { - int randomElementNumber = 3; //how many VNFs to onboard randomly - List fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - List exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip", - "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip", - "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip", - "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip"); - fileNamesFromFolder.removeAll(exludeVnfList); - List newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder); - System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size())); - return provideData(newRandomFileNamesFromFolder, filepath); - } - - private static List getRandomElements(int randomElementNumber, List fileNamesFromFolder) { - if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){ - return null; - }else{ - List indexList = new ArrayList<>(); - List newRandomFileNamesFromFolder = new ArrayList<>(); - for(int i = 0; i < fileNamesFromFolder.size(); i++){ - indexList.add(i); - } - Collections.shuffle(indexList); - Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]); - for(int i = 0; i < randomArray.length; i++){ - newRandomFileNamesFromFolder.add(fileNamesFromFolder.get(randomArray[i])); - } - return newRandomFileNamesFromFolder; - } - } - -// private static Object[] getRandomElements(int randomElementNumber, Object[] fileNamesFromFolder) { -// if(fileNamesFromFolder.length == 0 || fileNamesFromFolder.length < randomElementNumber){ -// return null; -// }else{ -// List indexList = new ArrayList<>(); -// Object[] newRandomFileNamesFromFolder = new Object[randomElementNumber]; -// for(int i = 0; i < fileNamesFromFolder.length; i++){ -// indexList.add(i); -// } -// Collections.shuffle(indexList); -// Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]); -// for(int i = 0; i < randomArray.length; i++){ -// newRandomFileNamesFromFolder[i] = fileNamesFromFolder[randomArray[i]]; -// } -// return newRandomFileNamesFromFolder; -// } -// } - -// public static String getFilePath() { -// String filepath = System.getProperty("filepath"); -// if (filepath == null && System.getProperty("os.name").contains("Windows")) { -// filepath = FileHandling.getResourcesFilesPath() +"VNFs"; -// } -// -// else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ -// filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator +"VNFs"; -// } -// return filepath; -// } - @Test public void onboardVNFTestSanity() throws Exception, Throwable { -// String vnfFile = "2016-012_vMX_AV_30_1072_e2e.zip"; -// String filepath = getFilePath(); -// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - List fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - List exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip", - "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip", - "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip", - "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip"); - fileNamesFromFolder.removeAll(exludeVnfList); + List fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList(); String vnfFile = fileNamesFromFolder.get(0).toString(); runOnboardToDistributionFlow(filepath, vnfFile); } @@ -217,7 +103,7 @@ public class Onboard extends SetupCDTest { assertNotNull(vfElement); ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser()); - ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile ,"The service topology is as follows : "); + ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile ,"The service topology is as follows: "); ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); @@ -265,35 +151,21 @@ public class Onboard extends SetupCDTest { } - - -// protected synchronized void validateInputArtsVSouput(String serviceName) { -// -// -// String filepath = System.getProperty("filepath"); -// if (filepath == null && System.getProperty("os.name").contains("Windows")) { -// filepath = FileHandling.getResourcesFilesPath() + folder + File.separator; -// } -// -// Set>>> serviceArtifactCorrelationMap = ArtifactsCorrelationManager.getServiceArtifactCorrelationMap(serviceName); -// -// } - - @Test(dataProvider = "VNF_List") + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") public void onboardVNFTest(String filepath, String vnfFile) throws Exception, Throwable { setLog(vnfFile); System.out.println("printttttttttttttt - >" + makeDistributionValue); runOnboardToDistributionFlow(filepath, vnfFile); } - @Test(dataProvider = "VNF_List") + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") public void onboardVNFShotFlow(String filepath, String vnfFile) throws Exception, Throwable { setLog(vnfFile); System.out.println("printttttttttttttt - >" + makeDistributionValue); onboardAndCertify(filepath, vnfFile); } - @Test(dataProvider = "randomVNF_List") + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List") public void onboardRandomVNFsTest(String filepath, String vnfFile) throws Exception, Throwable { setLog(vnfFile); System.out.println("printttttttttttttt - >" + makeDistributionValue); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java index 2ce944d273..c9dcf2a08e 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java @@ -28,7 +28,6 @@ import java.io.FileOutputStream; import java.nio.charset.StandardCharsets; import java.sql.Timestamp; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -40,6 +39,7 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders; import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; @@ -53,7 +53,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.slf4j.LoggerFactory; import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import com.clearspring.analytics.util.Pair; @@ -68,31 +67,6 @@ public class OnboardViaApis{ private static final String FULL_PATH = "C://tmp//CSARs//"; - public static Object[][] provideData(List fileNamesFromFolder, String filepath) { - Object[][] arObject = new Object[fileNamesFromFolder.size()][]; - - int index = 0; - for (Object obj : fileNamesFromFolder) { - arObject[index++] = new Object[] { filepath, obj }; - } - return arObject; - } - - @DataProvider(name = "VNF_List" , parallel = false) - private static final Object[][] VnfList() throws Exception { - String filepath = FileHandling.getVnfRepositoryPath(); - -// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - List fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - List exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip", - "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip", - "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip", - "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip"); - fileNamesFromFolder.removeAll(exludeVnfList); - System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size())); - return provideData(fileNamesFromFolder, filepath); - } - //------------------------------------------------------------------------------------------------------- User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); @@ -109,7 +83,7 @@ public class OnboardViaApis{ resourceDetails = ElementFactory.getDefaultResource(); } - @Test(dataProvider = "VNF_List") + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") public void onboardVNFTestViaApis(String filepath, String vnfFile) throws Exception, Throwable { Service service = null; String fullFileName = FULL_PATH + vnfFile + ".csar"; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java index 9b4d97e0a7..339f9290e8 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java @@ -264,12 +264,7 @@ public class Service extends SetupCDTest { } @Test - public void addAPIArtifactInCompositionScreenTest() throws Exception{ - - if(true){ - throw new SkipException("Open bug 292017"); - } - + public void addAPIArtifactInCompositionScreenTest() throws Exception{ String fileName = HEAT_FILE_YAML_NAME, descriptionText = DESCRIPTION, url = "http://kuku.com"; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java new file mode 100644 index 0000000000..293547f392 --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java @@ -0,0 +1,77 @@ +/*- + * ============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.ci.tests.execute.sanity; + +import java.util.HashMap; +import java.util.Map; + +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +public class ToscaValidation{ + + + @BeforeClass + public void precondition(){ + + Map> expected = new HashMap>(); + + //import amdocs VNF and download csar + + //parse downloaded csar and add it to expected object + + //create VF base on VNF imported from previous step - declare all inputs + + //certify VF and download csar + + //parse downloaded csar and add it to expected object + + //create service add VF - declare all inputs + + //certify service and download csar + + //parse downloaded csar and add it to expected object + + + } + + @Test + public void validateMetaData(){ + + + + + } + + @Test + public void validatePropertiesInputs(){ + + + + } + + + + + + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java index 9eee0e9096..c96c66982c 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java @@ -67,7 +67,7 @@ public class VFCArtifacts extends SetupCDTest { private String filePath; @BeforeClass public void beforeClass(){ - filePath = FileHandling.getFilePath(""); + filePath = FileHandling.getFilePath("VFCArtifacts"); } @Test diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java index 3c141d3a43..4fe1938af8 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java @@ -26,6 +26,7 @@ import java.io.BufferedOutputStream; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.FilenameFilter; @@ -44,7 +45,9 @@ import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; import org.apache.commons.io.FileUtils; +import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.common.util.GeneralUtility; @@ -88,6 +91,12 @@ public class FileHandling { return objectMap; } + + public static Map parseDataTypesYaml(String filePath) throws Exception { + @SuppressWarnings("unchecked") + Map dataTypesMap = (Map) parseYamlFile(filePath); + return dataTypesMap; + } // ------------------------------------------------------------------------------------------------- public static String getFilePath(String folder) { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java index eed4f765c5..398e1f18db 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java @@ -77,6 +77,11 @@ import com.clearspring.analytics.util.Pair; public class OnboardingUtils { + protected static List exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip", + "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip", + "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip", + "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip"); + public OnboardingUtils() { } @@ -790,6 +795,18 @@ public class OnboardingUtils { ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType()); } } + + + /** + * @return + * The method returns VNF names list from Files directory under sdc-vnfs repository + */ + public static List getVnfNamesFileList() { + String filepath = FileHandling.getVnfRepositoryPath(); + List fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); + fileNamesFromFolder.removeAll(exludeVnfList); + return fileNamesFromFolder; + } } -- cgit 1.2.3-korg