@Test public void shouldCreateBudgetLineItemWithDateAsNullIfNotIncludedInFile() throws Exception { configuration.setHeaderInFile(true); when(listReader.getRowNumber()).thenReturn(2, 3); BudgetLineItemDTO lineItemDTO = mock(BudgetLineItemDTO.class); mockStatic(BudgetLineItemDTO.class); List<String> csvRow = asList("F10", "HIV", "2013-12-10", "345.45", "My good notes"); when(BudgetLineItemDTO.populate(csvRow, asList(defaultEDIColumn))).thenReturn(lineItemDTO); when(lineItemDTO.getFacilityCode()).thenReturn("F10"); when(lineItemDTO.getProgramCode()).thenReturn("HIV"); Facility facility = new Facility(); facility.setCode("F10"); when(facilityService.getByCode(facility)).thenReturn(facility); Program program = new Program(); when(programService.getByCode("HIV")).thenReturn(program); BudgetLineItem budgetLineItem = new BudgetLineItem(); Date date = new Date(); budgetLineItem.setPeriodDate(date); when(transformer.transform(lineItemDTO, null, 1)).thenReturn(budgetLineItem); ProcessingPeriod processingPeriod = new ProcessingPeriod(); when(processingScheduleService.getPeriodForDate(facility, program, date)).thenReturn(processingPeriod); periodDateColumn.setInclude(false); budgetFileProcessor.process(message); verify(transformer).transform(lineItemDTO, null, 1); verify(BudgetLineItemDTO.populate(csvRow, asList(defaultEDIColumn))); }
public void process(Message message) throws Exception { File budgetFile = (File) message.getPayload(); logger.debug("processing Budget File " + budgetFile.getName()); BudgetFileInfo budgetFileInfo = saveBudgetFile(budgetFile, false); Boolean processingError = getSpringProxy().processBudgetFile(budgetFile, budgetFileInfo); budgetFileInfo.setProcessingError(processingError); budgetFilePostProcessHandler.process(budgetFileInfo, budgetFile); }
BudgetFileProcessor { public void process(Message message) throws Exception { File budgetFile = (File) message.getPayload(); logger.debug("processing Budget File " + budgetFile.getName()); BudgetFileInfo budgetFileInfo = saveBudgetFile(budgetFile, false); Boolean processingError = getSpringProxy().processBudgetFile(budgetFile, budgetFileInfo); budgetFileInfo.setProcessingError(processingError); budgetFilePostProcessHandler.process(budgetFileInfo, budgetFile); } }
BudgetFileProcessor { public void process(Message message) throws Exception { File budgetFile = (File) message.getPayload(); logger.debug("processing Budget File " + budgetFile.getName()); BudgetFileInfo budgetFileInfo = saveBudgetFile(budgetFile, false); Boolean processingError = getSpringProxy().processBudgetFile(budgetFile, budgetFileInfo); budgetFileInfo.setProcessingError(processingError); budgetFilePostProcessHandler.process(budgetFileInfo, budgetFile); }  }
BudgetFileProcessor { public void process(Message message) throws Exception { File budgetFile = (File) message.getPayload(); logger.debug("processing Budget File " + budgetFile.getName()); BudgetFileInfo budgetFileInfo = saveBudgetFile(budgetFile, false); Boolean processingError = getSpringProxy().processBudgetFile(budgetFile, budgetFileInfo); budgetFileInfo.setProcessingError(processingError); budgetFilePostProcessHandler.process(budgetFileInfo, budgetFile); }  void process(Message message); @Transactional Boolean processBudgetFile(File budgetFile, BudgetFileInfo budgetFileInfo); }
BudgetFileProcessor { public void process(Message message) throws Exception { File budgetFile = (File) message.getPayload(); logger.debug("processing Budget File " + budgetFile.getName()); BudgetFileInfo budgetFileInfo = saveBudgetFile(budgetFile, false); Boolean processingError = getSpringProxy().processBudgetFile(budgetFile, budgetFileInfo); budgetFileInfo.setProcessingError(processingError); budgetFilePostProcessHandler.process(budgetFileInfo, budgetFile); }  void process(Message message); @Transactional Boolean processBudgetFile(File budgetFile, BudgetFileInfo budgetFileInfo);  }