PropertiesFileJobParametersExtractor implements JobParametersExtractor { @Override public JobParameters getJobParameters(Job job, StepExecution stepExecution) { Properties properties = new Properties(); try (Reader reader = new FileReader(resource.getFile())) { properties.load(reader); } catch (IOException e) { if (stepExecution != null) { stepExecution.setExitStatus(ExitStatus.FAILED.addExitDescription(e)); } } return new DefaultJobParametersConverter().getJobParameters(properties); }  @Override JobParameters getJobParameters(Job job, StepExecution stepExecution); void setResource(Resource resource);  }
@Test public void testGetJobParameters() throws Exception { StepExecution stepExecution = MetaDataInstanceFactory.createStepExecution(); JobParameters jobParameters = extractor.getJobParameters(new SimpleJob(), stepExecution); Assert.assertNotNull(jobParameters); Assert.assertEquals(Files.readAllLines(resource.getFile().toPath()).size(), jobParameters.getParameters().size()); }