// finding rows in input file and opening it
numberOfInputRows = getNumCsvRows(cfg, Config.DAO_NAME);
// finding rows in success file and opening it
CSVFileReader successFileReader = openConfiguredPath(cfg, Config.OUTPUT_SUCCESS);
numberOfSuccessRows = getNumCsvRows(cfg, Config.OUTPUT_SUCCESS);
// finding rows in error file and opening it
CSVFileReader errorFileReader = openConfiguredPath(cfg, Config.OUTPUT_ERROR);
numberOfErrorRows = getNumCsvRows(cfg, Config.OUTPUT_ERROR);
if (numberOfOffsetRows <= numberOfInputRows) {
assertEquals("Number of lines between input and output do not match", numberOfInputRows,
numberOfSuccessRows + numberOfErrorRows + numberOfOffsetRows);
}
// Initializations of row results
Row firstInputOffsetAdjustedRow = new Row();
Row lastInputRow = new Row();
Row firstSuccessRow = new Row();
Row lastSuccessRow = new Row();
Row firstErrorRow = new Row();
Row lastErrorRow = new Row();
// The next few if statements deal with the edge statements on file size...(i.e. suppose that there are no
// errors)
if (numberOfSuccessRows > 0) {
getFirstRow(firstSuccessRow, successFileReader, true, 0);
getLastRow(lastSuccessRow, successFileReader, true);
}
if (numberOfErrorRows > 0) {
getFirstRow(firstErrorRow, errorFileReader, false, 0);
getLastRow(lastErrorRow, errorFileReader, false);
}
if (numberOfInputRows > 0) {
final CSVFileReader inputFileReader = openConfiguredPath(cfg, Config.DAO_NAME);
getFirstRow(firstInputOffsetAdjustedRow, inputFileReader, false, numberOfOffsetRows);
getLastRow(lastInputRow, inputFileReader, false);
}