@Test public void beforeStep() throws IOException { File importMetadataFile1 = new File("some/path/1"); File importMetadataFile2 = new File("some/path/2"); File contentFile1 = new File(importContentDir, "abc.zip"); File contentFile2 = new File(importContentDir, "123.zip"); contentFile1.createNewFile(); contentFile2.createNewFile(); File oldDownloadedContentFile = new File(downloadedContentDir, "zxc.zip"); oldDownloadedContentFile.createNewFile(); when(importFileUtils.listImportFiles(importPath)).thenReturn(Lists.newArrayList(importMetadataFile1, importMetadataFile2)); when(importContentFileFinder.findContentFile(importContentDir, importMetadataFile1)).thenReturn(contentFile1); when(importContentFileFinder.findContentFile(importContentDir, importMetadataFile2)).thenReturn(contentFile2); contentDownloadListenter.beforeStep(mock(StepExecution.class)); File downloadedContentFile1 = new File(downloadedContentDir, "abc.zip"); File downloadedContentFile2 = new File(downloadedContentDir, "123.zip"); assertTrue(downloadedContentFile1.exists()); assertTrue(downloadedContentFile2.exists()); assertFalse(oldDownloadedContentFile.exists()); verify(importFileUtils).listImportFiles(importPath); verify(importContentFileFinder).findContentFile(importContentDir, importMetadataFile1); verify(importContentFileFinder).findContentFile(importContentDir, importMetadataFile2); }
@Override public void beforeStep(StepExecution stepExecution) { deleteDownloadedContentFiles(); downloadContentFiles(); }
ContentDownloadStepExecutionListener implements StepExecutionListener { @Override public void beforeStep(StepExecution stepExecution) { deleteDownloadedContentFiles(); downloadContentFiles(); } }
ContentDownloadStepExecutionListener implements StepExecutionListener { @Override public void beforeStep(StepExecution stepExecution) { deleteDownloadedContentFiles(); downloadContentFiles(); }  }
ContentDownloadStepExecutionListener implements StepExecutionListener { @Override public void beforeStep(StepExecution stepExecution) { deleteDownloadedContentFiles(); downloadContentFiles(); }  @Override void beforeStep(StepExecution stepExecution); @Override ExitStatus afterStep(StepExecution stepExecution); @Autowired void setImportFileUtils(ImportFileUtils importFileUtils); @Autowired void setImportContentFileFinder(ContentSourceFileFinder importContentFileFinder); void setImportMetadataDir(String importMetadataDir); void setImportContentDir(String importContentDir); void setDownloadedContentDir(String downloadedContentDir); }
ContentDownloadStepExecutionListener implements StepExecutionListener { @Override public void beforeStep(StepExecution stepExecution) { deleteDownloadedContentFiles(); downloadContentFiles(); }  @Override void beforeStep(StepExecution stepExecution); @Override ExitStatus afterStep(StepExecution stepExecution); @Autowired void setImportFileUtils(ImportFileUtils importFileUtils); @Autowired void setImportContentFileFinder(ContentSourceFileFinder importContentFileFinder); void setImportMetadataDir(String importMetadataDir); void setImportContentDir(String importContentDir); void setDownloadedContentDir(String downloadedContentDir);  }