[sdc] sync 47/6847/1
authorTal Gitelman <tg851x@intl.att.com>
Mon, 7 Aug 2017 16:54:49 +0000 (19:54 +0300)
committerTal Gitelman <tg851x@intl.att.com>
Mon, 7 Aug 2017 16:54:49 +0000 (19:54 +0300)
Change-Id: Idcff5f6315dad556d34d346501608f6567ffbd67
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java

index 165d10c..0ad5c0f 100644 (file)
@@ -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"
index bbd05c8..a2683ea 100644 (file)
@@ -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<String, Object> newInput = new HashMap<String, Object>();
+               for (PropertyDefinition property : resource.getProperties()) {
+                       newInput.put(property.getLabel(),property);
+               }
+               topology_template.setInputs(newInput);
+               
+               
+               List<PropertyDefinition> 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");
 
index 80801af..a4c7ffa 100644 (file)
@@ -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);
index 66ab0b3..0c4802a 100644 (file)
@@ -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());
index 71fe44c..2ce944d 100644 (file)
@@ -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);
                
index 1261546..8763d67 100644 (file)
@@ -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();
index cf8bfa5..86e81df 100644 (file)
@@ -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();
index fdcb3f3..3c141d3 100644 (file)
@@ -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){