Search in sources :

Example 1 with FileEnterpriseFeederHelperService

use of org.kuali.kfs.module.ld.batch.service.FileEnterpriseFeederHelperService in project cu-kfs by CU-CommunityApps.

the class CuFileEnterpriseFeederHelperServiceImplTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    fileEnterpriseFeederHelperService = SpringContext.getBean(FileEnterpriseFeederHelperService.class);
    // make sure we have a batch directory
    String batchDirectory = SpringContext.getBean(EnterpriseFeederService.class).getDirectoryName();
    File batchDirectoryFile = new File(batchDirectory);
    batchDirectoryFile.mkdir();
    // copy the data file into place
    File dataFileSrc = new File(DATA_FILE_PATH);
    dataFileDest = new File(batchDirectory + "/SMGROS.data");
    FileUtils.copyFile(dataFileSrc, dataFileDest);
    // copy the recon file into place
    File rerconileSrc = new File(RECON_FILE_PATH);
    reconFileDest = new File(batchDirectory + "/SMGROS.recon");
    FileUtils.copyFile(rerconileSrc, reconFileDest);
    // create .done file
    String doneFileName = batchDirectory + "/SMGROS.done";
    doneFile = new File(doneFileName);
    if (!doneFile.exists()) {
        LOG.info("Creating done file: " + doneFile.getAbsolutePath());
        doneFile.createNewFile();
    }
    statusAndErrors = new EnterpriseFeederStatusAndErrorMessagesWrapper();
    statusAndErrors.setErrorMessages(new ArrayList<Message>());
    statusAndErrors.setFileNames(dataFileDest, reconFileDest, doneFile);
    File enterpriseFeedFile = null;
    String enterpriseFeedFileName = LaborConstants.BatchFileSystem.LABOR_ENTERPRISE_FEED + LaborConstants.BatchFileSystem.EXTENSION;
    enterpriseFeedFile = new File(batchDirectory + File.separator + enterpriseFeedFileName);
    enterpriseFeedPs = null;
    try {
        enterpriseFeedPs = new PrintStream(enterpriseFeedFile);
    } catch (FileNotFoundException e) {
        LOG.error("enterpriseFeedFile doesn't exist " + enterpriseFeedFileName);
        throw new RuntimeException("enterpriseFeedFile doesn't exist " + enterpriseFeedFileName);
    }
    ledgerSummaryReport = new LedgerSummaryReport();
    feederReportData = new EnterpriseFeederReportData();
    errorStatisticsReport = new ReportWriterTextServiceImpl();
}
Also used : EnterpriseFeederStatusAndErrorMessagesWrapper(org.kuali.kfs.gl.service.impl.EnterpriseFeederStatusAndErrorMessagesWrapper) PrintStream(java.io.PrintStream) Message(org.kuali.kfs.sys.Message) EnterpriseFeederReportData(org.kuali.kfs.module.ld.report.EnterpriseFeederReportData) FileNotFoundException(java.io.FileNotFoundException) ReportWriterTextServiceImpl(org.kuali.kfs.sys.service.impl.ReportWriterTextServiceImpl) FileEnterpriseFeederHelperService(org.kuali.kfs.module.ld.batch.service.FileEnterpriseFeederHelperService) EnterpriseFeederService(org.kuali.kfs.module.ld.batch.service.EnterpriseFeederService) LedgerSummaryReport(org.kuali.kfs.gl.report.LedgerSummaryReport) File(java.io.File)

Aggregations

File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 PrintStream (java.io.PrintStream)1 LedgerSummaryReport (org.kuali.kfs.gl.report.LedgerSummaryReport)1 EnterpriseFeederStatusAndErrorMessagesWrapper (org.kuali.kfs.gl.service.impl.EnterpriseFeederStatusAndErrorMessagesWrapper)1 EnterpriseFeederService (org.kuali.kfs.module.ld.batch.service.EnterpriseFeederService)1 FileEnterpriseFeederHelperService (org.kuali.kfs.module.ld.batch.service.FileEnterpriseFeederHelperService)1 EnterpriseFeederReportData (org.kuali.kfs.module.ld.report.EnterpriseFeederReportData)1 Message (org.kuali.kfs.sys.Message)1 ReportWriterTextServiceImpl (org.kuali.kfs.sys.service.impl.ReportWriterTextServiceImpl)1