Search in sources :

Example 1 with ConcurRequestExtractFile

use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile in project cu-kfs by CU-CommunityApps.

the class ConcurRequestExtractFileServiceImpl method loadFileIntoParsedDataObject.

private ConcurRequestExtractFile loadFileIntoParsedDataObject(String requestExtractFullyQualifiedFileName) {
    Object parsedFile = getConcurBatchUtilityService().loadFile(requestExtractFullyQualifiedFileName, getBatchInputFileType());
    List<ConcurRequestExtractFile> requestExtractFiles = (ArrayList<ConcurRequestExtractFile>) parsedFile;
    if (requestExtractFiles.size() != 1) {
        LOG.error("loadFileIntoParsedDataObject: Single physical file " + requestExtractFullyQualifiedFileName + " should have translated into single parsed file. More or less than one parsed file was detected.");
        throw new RuntimeException("Single physical file " + requestExtractFullyQualifiedFileName + " should have translated into single parsed file. More or less than one parsed file was detected.");
    } else {
        ConcurRequestExtractFile requestExtractFile = requestExtractFiles.get(0);
        return requestExtractFile;
    }
}
Also used : ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) ArrayList(java.util.ArrayList)

Example 2 with ConcurRequestExtractFile

use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile 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;
}
Also used : ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) ConcurRequestExtractBatchReportData(edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData) Test(org.junit.Test)

Example 3 with ConcurRequestExtractFile

use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile 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;
}
Also used : ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) ConcurRequestExtractBatchReportData(edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData) Test(org.junit.Test)

Example 4 with ConcurRequestExtractFile

use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile 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;
}
Also used : ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) ConcurRequestExtractBatchReportData(edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData) Test(org.junit.Test)

Example 5 with ConcurRequestExtractFile

use of edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile 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;
}
Also used : ConcurRequestExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile) ConcurRequestExtractBatchReportData(edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData) Test(org.junit.Test)

Aggregations

ConcurRequestExtractFile (edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractFile)8 ConcurRequestExtractBatchReportData (edu.cornell.kfs.concur.batch.report.ConcurRequestExtractBatchReportData)7 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)2 ConcurRequestExtractRequestDetailFileLine (edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine)1 File (java.io.File)1 IOException (java.io.IOException)1 FileStorageException (org.kuali.kfs.sys.exception.FileStorageException)1