summaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main/java
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2017-08-07 19:54:49 +0300
committerTal Gitelman <tg851x@intl.att.com>2017-08-07 19:54:49 +0300
commitc306dd79597e870053bfe35e970b59dec7ba5f2e (patch)
tree6f2468aed0e3a92b308105c02e898f96400cd738 /ui-ci/src/main/java
parentba229230144f00d35d55e31a80ca2576bd831448 (diff)
[sdc] sync
Change-Id: Idcff5f6315dad556d34d346501608f6567ffbd67 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'ui-ci/src/main/java')
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java125
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java20
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java6
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java32
6 files changed, 139 insertions, 52 deletions
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<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ Pair<String,Map<String,String>> 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<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ Pair<String,Map<String,String>> 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<String> 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<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ List<String> 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<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ List<String> 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<String> 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<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) {
+ if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){
return null;
}else{
List<Integer> indexList = new ArrayList<>();
- Object[] newRandomFileNamesFromFolder = new Object[randomElementNumber];
- for(int i = 0; i < fileNamesFromFolder.length; i++){
+ List<String> 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<Integer> 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<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ List<String> 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<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+// String vnfFile = fileNamesFromFolder[0].toString();
+ String vnfFile = fileNamesFromFolder.get(0);
Pair<String,Map<String,String>> 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<String> vmmscList = new ArrayList<String>();
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<String> 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<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ List<String> 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<String> 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<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ Pair<String, Map<String, String>> 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<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
Map<String, File> 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<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
Map<String, File> 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<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1");
Map<String, ArtifactDefinition> 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<String> filterFileNamesListFromFolder(String filepath, String extension) {
+ try {
+ File dir = new File(filepath);
+ List<String> filenames = new ArrayList<String>();
+
+ 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<String> getZipFileNamesFromFolder(String filepath) {
+ return filterFileNamesListFromFolder(filepath, ".zip");
}
public static int countFilesInZipFile(String[] artifactsArr, String reqExtension){