public DataDrivenParameterArray loadFile()

in wilma-functionaltest/src/main/java/com/epam/gepard/datadriven/feeders/SimpleMultiplierDataFeederFileLoader.java [44:80]


    public DataDrivenParameterArray loadFile(final ConfigFileInfo fileInfo, final int multiplier) throws IOException {
        DataDrivenParameterArray myArray = new DataDrivenParameterArray();
        //have configuration file for the specific class
        LineNumberReader listReader = new LineNumberReader(new InputStreamReader(new FileInputStream(fileInfo.getConfigFilename()), "UTF-8"));
        String headerLine = null; //to hold header line in case of CSV file
        String line; //= null, to hold the line actually loaded
        Integer counter = 0; //this is the key in the map
        String[] rowData; //will hold a data row
        String[] columnNames = null;
        while ((line = listReader.readLine()) != null) {
            line = line.trim();
            if (("".equals(line) || line.startsWith("//") || line.startsWith("#")) && !fileInfo.isCSV()) {
                continue;
            }
            //handling csv header, "if" ensures that it will be called for the first line only...
            if (fileInfo.isCSV() && (headerLine == null)) {
                //ignore first line in CSV files
                headerLine = line;
                columnNames = headerLine.split(fileInfo.getSplitter());
            } else {
                rowData = line.split(fileInfo.getSplitter());
                myArray.put(counter, rowData);
                counter++;
            }
            if (counter == multiplier) {
                break; //enough row is loaded, do not continue the load of the file
            }
        } //file is loaded
        listReader.close();
        //columnNames is either filled, or empty and waiting for generation
        if (columnNames != null) {
            myArray.setParameterNames(columnNames);
        } else {
            myArray.setParameterNames(DataDrivenParameterArray.generateNames(myArray));
        }
        return myArray;
    }