From c306dd79597e870053bfe35e970b59dec7ba5f2e Mon Sep 17 00:00:00 2001 From: Tal Gitelman Date: Mon, 7 Aug 2017 19:54:49 +0300 Subject: [sdc] sync Change-Id: Idcff5f6315dad556d34d346501608f6567ffbd67 Signed-off-by: Tal Gitelman --- .../recipes/FE_2_setup_configuration.rb | 5 +- .../sdc/ci/tests/execute/devCI/AndreyTest.java | 34 +++++- .../sdc/ci/tests/US/Service_Tests_UI.java | 4 +- .../sdc/ci/tests/execute/sanity/Onboard.java | 125 +++++++++++++++------ .../ci/tests/execute/sanity/OnboardViaApis.java | 20 +++- .../openecomp/sdc/ci/tests/execute/sanity/Vf.java | 4 +- .../sdc/ci/tests/execute/sanity/VfArtifacts.java | 6 +- .../sdc/ci/tests/utilities/FileHandling.java | 32 +++++- 8 files changed, 170 insertions(+), 60 deletions(-) diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb index 165d10c1f2..0ad5c0f356 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb +++ b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb @@ -1,5 +1,6 @@ +jetty_base="/var/lib/jetty" template "catalog-fe-config" do - path "/var/lib/jetty/config/catalog-fe/configuration.yaml" + path "#{jetty_base}/config/catalog-fe/configuration.yaml" source "FE-configuration.yaml.erb" owner "jetty" group "jetty" @@ -14,7 +15,7 @@ end template "onboarding-fe-config" do - path "/#{jetty_base}/config/onboarding-fe/onboarding_configuration.yaml" + path "#{jetty_base}/config/onboarding-fe/onboarding_configuration.yaml" source "FE-onboarding-configuration.yaml.erb" owner "jetty" group "jetty" diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java index bbd05c893e..a2683eafc8 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java @@ -25,15 +25,18 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; -import org.openecomp.sdc.ci.tests.datatypes.GroupHeatMetaDefinition; -import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; -import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; -import org.openecomp.sdc.ci.tests.utils.CsarParserUtils; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition; import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; @@ -49,13 +52,32 @@ public class AndreyTest { public static void main(String[] args) throws Exception { - ToscaDefinition toscaDefinition; + ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition; + File filesFolder = new File("C:/Users/al714h/Downloads/Design/"); + File amdocsCsarFileName = new File("/77e6b842669f441db20a83489da3f4be.csar"); + File VfCsarFileName = new File("/resource-Civfonboarded2016012VmxAv301072E2e1424cb9d-csar.csar"); + File serviceCsarFileName = new File("/service-Ciservicefeba0521131d-csar.csar"); + System.out.println("start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date())); + // File path = new File("C:/Data/D2.0/TOSCA_Ex/Definitions/tosca_definition_version.yaml"); // File path = new File("C:/Data/D2.0/TOSCA_Ex/resource-Vl11Vl10-template.yml"); // File path = new File("C:/Data/D2.0/TOSCA_Ex/service-Servicepxtc-template US822998.yml"); // File path = new File("C:/Data/FileToParse/Definitions/service-Ciservice513e6fa67d07-template.yml"); - toscaDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File("C:/Data/FileToParse/LDSA/service-LdsaService-csar.csar")); +// toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File("C:/Data/FileToParse/LDSA/service-LdsaService-csar.csar")); + toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + amdocsCsarFileName)); + toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName)); + toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + serviceCsarFileName)); + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, "Generic_VF", "1.0"); + ToscaTopologyTemplateDefinition topology_template = toscaMainAmdocsDefinition.getTopology_template(); + Map newInput = new HashMap(); + for (PropertyDefinition property : resource.getProperties()) { + newInput.put(property.getLabel(),property); + } + topology_template.setInputs(newInput); + + + List properties = resource.getProperties(); // File path = new File("C:/Data/FileToParse/Definitions/resource-Civfonboarded2016006VvmVvm301607E2100a9b04-template.yml"); // File csarPath = new File("C:/Data/D2.0/TOSCA_Ex/Nested.csar"); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java index 80801afafb..a4c7ffa632 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java @@ -54,7 +54,7 @@ public class Service_Tests_UI extends SetupCDTest{ @Test public void declareVL_CP_InputsInServiceLevel() throws Exception { String vnfFile = "FDNT.zip"; - Pair> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + Pair> VspName =OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser()); ServiceUIUtils.createService(servicemetadata, getUser()); GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); @@ -72,7 +72,7 @@ public class Service_Tests_UI extends SetupCDTest{ @Test public void CreateServiceWithCpInstance() throws Exception { String vnfFile = "FDNT.zip"; - Pair> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + Pair> VspName =OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser()); ServiceUIUtils.createService(servicemetadata, getUser()); GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); 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 66ab0b3cef..0c4802af64 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 @@ -69,7 +69,7 @@ import com.clearspring.analytics.util.Pair; public class Onboard extends SetupCDTest { - + protected static String filepath = FileHandling.getVnfRepositoryPath(); protected String makeDistributionValue; @Parameters({ "makeDistribution" }) @@ -78,8 +78,18 @@ public class Onboard extends SetupCDTest { makeDistributionValue = makeDistributionReadValue; } - public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) { - Object[][] arObject = new Object[fileNamesFromFolder.length][]; +// 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) { @@ -87,65 +97,106 @@ public class Onboard extends SetupCDTest { } return arObject; } - + @DataProvider(name = "VNF_List" , parallel = true) private static final Object[][] VnfList() throws Exception { - String filepath = getFilePath(); - Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.length)); + 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 - 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)); + 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 Object[] getRandomElements(int randomElementNumber, Object[] fileNamesFromFolder) { - if(fileNamesFromFolder.length == 0 || fileNamesFromFolder.length < randomElementNumber){ + private static List getRandomElements(int randomElementNumber, List fileNamesFromFolder) { + if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){ return null; }else{ List indexList = new ArrayList<>(); - Object[] newRandomFileNamesFromFolder = new Object[randomElementNumber]; - for(int i = 0; i < fileNamesFromFolder.length; i++){ + 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[i] = fileNamesFromFolder[randomArray[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; - } +// 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 filepath = getFilePath(); // String vnfFile = "2016-012_vMX_AV_30_1072_e2e.zip"; // String filepath = getFilePath(); - Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - String vnfFile = fileNamesFromFolder[0].toString(); +// 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); + String vnfFile = fileNamesFromFolder.get(0).toString(); runOnboardToDistributionFlow(filepath, vnfFile); } @@ -253,9 +304,10 @@ public class Onboard extends SetupCDTest { @Test public void onboardUpdateVNFTest() throws Exception, Throwable { - String filepath = getFilePath(); - Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - String vnfFile = fileNamesFromFolder[0].toString(); +// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); + List fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); +// String vnfFile = fileNamesFromFolder[0].toString(); + String vnfFile = fileNamesFromFolder.get(0); Pair> vsp = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser()); String vspName = vsp.left; @@ -280,7 +332,8 @@ public class Onboard extends SetupCDTest { HomePage.navigateToHomePage(); ///update flow - String updatedVnfFile = fileNamesFromFolder[1].toString(); +// String updatedVnfFile = fileNamesFromFolder[1].toString(); + String updatedVnfFile = fileNamesFromFolder.get(1); getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile)); // update VendorSoftwareProduct @@ -332,8 +385,6 @@ public class Onboard extends SetupCDTest { @Test public void threeVMMSCsInServiceTest() throws Exception{ - String filepath = getFilePath(); - List vmmscList = new ArrayList(); vmmscList = Arrays.asList(new File(filepath).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList()); 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 71fe44cc79..2ce944d273 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,6 +28,7 @@ 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; @@ -67,8 +68,8 @@ public class OnboardViaApis{ private static final String FULL_PATH = "C://tmp//CSARs//"; - public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) { - Object[][] arObject = new Object[fileNamesFromFolder.length][]; + public static Object[][] provideData(List fileNamesFromFolder, String filepath) { + Object[][] arObject = new Object[fileNamesFromFolder.size()][]; int index = 0; for (Object obj : fileNamesFromFolder) { @@ -81,8 +82,14 @@ public class OnboardViaApis{ private static final Object[][] VnfList() throws Exception { String filepath = FileHandling.getVnfRepositoryPath(); - Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.length)); +// 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); } @@ -126,8 +133,9 @@ public class OnboardViaApis{ public void onboardingAndParser() throws Exception { Service service = null; String filepath = getFilePath(); - Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - String vnfFile = fileNamesFromFolder[7].toString(); +// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); + List fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); + String vnfFile = fileNamesFromFolder.get(7); System.err.println(timestamp + " Starting test with VNF: " + vnfFile); service = runOnboardViaApisOnly(filepath, vnfFile); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java index 126154661a..8763d677dd 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java @@ -647,7 +647,7 @@ public class Vf extends SetupCDTest { @Test public void exportToscaWithModulePropertiesVFTest() throws AWTException, Exception { String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip"; - Pair> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + Pair> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); String vspName = vsp.left; ResourceGeneralPage.clickSubmitForTestingButton(vsp.left); Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1"); @@ -657,7 +657,7 @@ public class Vf extends SetupCDTest { @Test public void exportToscaWithModulePropertiesTemplateCheckVFTest() throws AWTException, Exception { String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip"; - OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue()); File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java index cf8bfa5e5e..86e81df0bb 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java @@ -206,7 +206,7 @@ public class VfArtifacts extends SetupCDTest{ String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); - Pair> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + Pair> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); Map currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath); GeneralUIUtils.findComponentAndClick(vsp.left); @@ -231,7 +231,7 @@ public class VfArtifacts extends SetupCDTest{ String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; - Pair> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + Pair> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); Map currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath); GeneralUIUtils.findComponentAndClick(vsp.left); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); @@ -255,7 +255,7 @@ public class VfArtifacts extends SetupCDTest{ String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip"; String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); - Pair> CreatedVsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); + Pair> CreatedVsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1"); Map deploymentArtifacts = resource.getDeploymentArtifacts(); 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 fdcb3f372d..3c141d3a43 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 @@ -179,6 +179,30 @@ public class FileHandling { return null; } + public static List filterFileNamesListFromFolder(String filepath, String extension) { + try { + File dir = new File(filepath); + List filenames = new ArrayList(); + + FilenameFilter extensionFilter = new FilenameFilter() { + public boolean accept(File dir, String name) { + return name.endsWith(extension); + } + }; + + if (dir.isDirectory()) { + for (File file : dir.listFiles(extensionFilter)) { + filenames.add(file.getName()); + } + return filenames; + } + + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + public static String[] getArtifactsFromZip(String filepath, String zipFilename){ try{ ZipFile zipFile = new ZipFile(filepath + File.separator + zipFilename); @@ -211,8 +235,12 @@ public class FileHandling { } - public static Object[] getZipFileNamesFromFolder(String filepath) { - return filterFileNamesFromFolder(filepath, ".zip"); +// public static Object[] getZipFileNamesFromFolder(String filepath) { +// return filterFileNamesFromFolder(filepath, ".zip"); +// } + + public static List getZipFileNamesFromFolder(String filepath) { + return filterFileNamesListFromFolder(filepath, ".zip"); } public static int countFilesInZipFile(String[] artifactsArr, String reqExtension){ -- cgit 1.2.3-korg