use of edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData in project cu-kfs by CU-CommunityApps.
the class ConcurRequestExtractFileValidationServiceImplTest method testFileContainsMultipleRequestDetailLinesHeaderAmountMatch.
@Test
public void testFileContainsMultipleRequestDetailLinesHeaderAmountMatch() {
LOG.info("testFileContainsMultipleRequestDetailLinesHeaderAmountMatch");
ConcurRequestExtractFile testFile = ConcurRequestExtractFileFixture.GOOD_FILE_MULTIPLE_DETAILS.createConcurRequestExtractFile();
ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData();
assertTrue("Expected Result: Header amount SHOULD match sum of row amounts from file.", concurRequestExtractFileValidationService.requestExtractHeaderRowValidatesToFileContents(testFile, reportData));
LOG.info(reportData.getHeaderValidationErrors());
LOG.info(KFSConstants.NEWLINE);
reportData = null;
}
use of edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData in project cu-kfs by CU-CommunityApps.
the class ConcurRequestExtractFileValidationServiceImplTest method testHeaderRowCountDoesNotMatch.
@Test
public void testHeaderRowCountDoesNotMatch() {
LOG.info("testHeaderRowCountDoesNotMatch");
ConcurRequestExtractFile testFile = ConcurRequestExtractFileFixture.BAD_FILE_COUNT_FILE.createConcurRequestExtractFile();
ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData();
assertFalse("Expected Result: Header row count should NOT match file row count.", concurRequestExtractFileValidationService.requestExtractHeaderRowValidatesToFileContents(testFile, reportData));
LOG.info(reportData.getHeaderValidationErrors());
LOG.info(KFSConstants.NEWLINE);
reportData = null;
}
use of edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData in project cu-kfs by CU-CommunityApps.
the class ConcurRequestExtractFileValidationServiceImplTest method testHeaderAmountAndHeaderRowCountsMatch.
@Test
public void testHeaderAmountAndHeaderRowCountsMatch() {
LOG.info("testHeaderAmountAndHeaderRowCountsMatch");
ConcurRequestExtractFile testFile = ConcurRequestExtractFileFixture.GOOD_FILE.createConcurRequestExtractFile();
ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData();
assertTrue("Expected Result: Header amount SHOULD match sum of row amounts from file.", concurRequestExtractFileValidationService.requestExtractHeaderRowValidatesToFileContents(testFile, reportData));
LOG.info(reportData.getHeaderValidationErrors());
LOG.info(KFSConstants.NEWLINE);
reportData = null;
}
use of edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData in project cu-kfs by CU-CommunityApps.
the class ConcurRequestExtractFileValidationServiceImplTest method testFileContainsMultipleRequestDetailLinesHeaderAmountDoesNotMatch.
@Test
public void testFileContainsMultipleRequestDetailLinesHeaderAmountDoesNotMatch() {
LOG.info("testFileContainsMultipleRequestDetailLinesHeaderAmountDoesNotMatch");
ConcurRequestExtractFile testFile = ConcurRequestExtractFileFixture.BAD_REQUEST_AMOUNT_MULTIPLE_DETAILS_FILE.createConcurRequestExtractFile();
ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData();
assertFalse("Expected Result: Header amount should NOT match sum of row amounts from file.", concurRequestExtractFileValidationService.requestExtractHeaderRowValidatesToFileContents(testFile, reportData));
LOG.info(reportData.getHeaderValidationErrors());
LOG.info(KFSConstants.NEWLINE);
reportData = null;
}
use of edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData in project cu-kfs by CU-CommunityApps.
the class ConcurRequestExtractFileServiceImpl method processFile.
public boolean processFile(String requestExtractFullyQualifiedFileName) {
boolean processingSuccessful = false;
ConcurRequestExtractFile requestExtractFile = loadFileIntoParsedDataObject(requestExtractFullyQualifiedFileName);
ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData();
reportData.setConcurFileName(parseRequestExtractFileNameFrom(requestExtractFullyQualifiedFileName));
if (getConcurRequestExtractFileValidationService().requestExtractHeaderRowValidatesToFileContents(requestExtractFile, reportData)) {
List<String> uniqueRequestIdsInFile = new ArrayList<String>();
for (ConcurRequestExtractRequestDetailFileLine detailFileLine : requestExtractFile.getRequestDetails()) {
getConcurRequestExtractFileValidationService().performRequestDetailLineValidation(detailFileLine, uniqueRequestIdsInFile);
}
requestExtractFile.setFileName(parseRequestExtractFileNameFrom(requestExtractFullyQualifiedFileName));
processingSuccessful = getConcurCashAdvancePdpFeedFileService().createPdpFeedFileForValidatedDetailFileLines(requestExtractFile, reportData);
if (processingSuccessful && StringUtils.isNotBlank(requestExtractFile.getFullyQualifiedPdpFileName())) {
try {
getConcurCashAdvancePdpFeedFileService().createDoneFileForPdpFile(requestExtractFile.getFullyQualifiedPdpFileName());
} catch (IOException ioe) {
LOG.error("processFile: ConcurCashAdvancePdpFeedFileService().createDoneFileForPdpFile generated IOException attempting to create .done file for generated PdpFeedFile: " + requestExtractFile.getFullyQualifiedPdpFileName());
processingSuccessful = false;
} catch (FileStorageException fse) {
LOG.error("processFile: ConcurCashAdvancePdpFeedFileService().createDoneFileForPdpFile generated FileStorageException attempting to create .done file for generated PdpFeedFile: " + requestExtractFile.getFullyQualifiedPdpFileName());
processingSuccessful = false;
}
}
}
File reportFile = getConcurRequestExtractReportService().generateReport(reportData);
getConcurRequestExtractReportService().sendResultsEmail(reportData, reportFile);
LOG.debug("method processFile:: requestExtractFile data after processing: " + KFSConstants.NEWLINE + requestExtractFile.toString());
return processingSuccessful;
}
Aggregations