@Test public void testReceive() throws Exception { Exchange exchange = new DefaultExchange(new DefaultCamelContext()); IngestionFileEntry entry = new IngestionFileEntry("/", FileFormat.EDFI_XML, FileType.XML_STUDENT_PROGRAM, "fileName", "111"); FileEntryWorkNote workNote = new FileEntryWorkNote("batchJobId", entry, false); boolean fileEntryLatchOpened; exchange.getIn().setBody(workNote, FileEntryWorkNote.class); fileEntryLatchOpened = fileEntryLatch.lastFileProcessed(exchange); Assert.assertFalse(fileEntryLatchOpened); fileEntryLatchOpened = fileEntryLatch.lastFileProcessed(exchange); Assert.assertTrue(fileEntryLatchOpened); }
@Handler public boolean lastFileProcessed(Exchange exchange) throws Exception { FileEntryWorkNote workNote = exchange.getIn().getBody(FileEntryWorkNote.class); String batchJobId = workNote.getBatchJobId(); TenantContext.setJobId(batchJobId); if (batchJobDAO.updateFileEntryLatch(workNote.getBatchJobId(), workNote.getFileEntry().getFileName())) { RangedWorkNote wn = RangedWorkNote.createSimpleWorkNote(batchJobId); exchange.getIn().setBody(wn, RangedWorkNote.class); return true; } return false; }
FileEntryLatch { @Handler public boolean lastFileProcessed(Exchange exchange) throws Exception { FileEntryWorkNote workNote = exchange.getIn().getBody(FileEntryWorkNote.class); String batchJobId = workNote.getBatchJobId(); TenantContext.setJobId(batchJobId); if (batchJobDAO.updateFileEntryLatch(workNote.getBatchJobId(), workNote.getFileEntry().getFileName())) { RangedWorkNote wn = RangedWorkNote.createSimpleWorkNote(batchJobId); exchange.getIn().setBody(wn, RangedWorkNote.class); return true; } return false; } }
FileEntryLatch { @Handler public boolean lastFileProcessed(Exchange exchange) throws Exception { FileEntryWorkNote workNote = exchange.getIn().getBody(FileEntryWorkNote.class); String batchJobId = workNote.getBatchJobId(); TenantContext.setJobId(batchJobId); if (batchJobDAO.updateFileEntryLatch(workNote.getBatchJobId(), workNote.getFileEntry().getFileName())) { RangedWorkNote wn = RangedWorkNote.createSimpleWorkNote(batchJobId); exchange.getIn().setBody(wn, RangedWorkNote.class); return true; } return false; }  }
FileEntryLatch { @Handler public boolean lastFileProcessed(Exchange exchange) throws Exception { FileEntryWorkNote workNote = exchange.getIn().getBody(FileEntryWorkNote.class); String batchJobId = workNote.getBatchJobId(); TenantContext.setJobId(batchJobId); if (batchJobDAO.updateFileEntryLatch(workNote.getBatchJobId(), workNote.getFileEntry().getFileName())) { RangedWorkNote wn = RangedWorkNote.createSimpleWorkNote(batchJobId); exchange.getIn().setBody(wn, RangedWorkNote.class); return true; } return false; }  @Handler boolean lastFileProcessed(Exchange exchange); BatchJobDAO getBatchJobDAO(); void setBatchJobDAO(BatchJobDAO batchJobDAO); }
FileEntryLatch { @Handler public boolean lastFileProcessed(Exchange exchange) throws Exception { FileEntryWorkNote workNote = exchange.getIn().getBody(FileEntryWorkNote.class); String batchJobId = workNote.getBatchJobId(); TenantContext.setJobId(batchJobId); if (batchJobDAO.updateFileEntryLatch(workNote.getBatchJobId(), workNote.getFileEntry().getFileName())) { RangedWorkNote wn = RangedWorkNote.createSimpleWorkNote(batchJobId); exchange.getIn().setBody(wn, RangedWorkNote.class); return true; } return false; }  @Handler boolean lastFileProcessed(Exchange exchange); BatchJobDAO getBatchJobDAO(); void setBatchJobDAO(BatchJobDAO batchJobDAO);  }