/** * Launch just the specified step in the job. A unique set of JobParameters * will automatically be generated. An IllegalStateException is thrown if * there is no Step with the given name. * * @param stepName The name of the step to launch * @param jobExecutionContext An ExecutionContext whose values will be * loaded into the Job ExecutionContext prior to launching the step. * @return JobExecution */ public JobExecution launchStep(String stepName, ExecutionContext jobExecutionContext) { return this.launchStep(stepName, this.getUniqueJobParameters(), jobExecutionContext); }
/** * Launch the entire job, including all steps. * * @return JobExecution, so that the test can validate the exit status * @throws Exception thrown if error occurs launching the job. */ public JobExecution launchJob() throws Exception { return this.launchJob(this.getUniqueJobParameters()); }
/** * Launch just the specified step in the job. A unique set of JobParameters * will automatically be generated. An IllegalStateException is thrown if * there is no Step with the given name. * * @param stepName The name of the step to launch * @return JobExecution */ public JobExecution launchStep(String stepName) { return this.launchStep(stepName, this.getUniqueJobParameters(), null); }
protected JobParameters getUniqueJobParameters() { return jobLauncherTestUtils.getUniqueJobParameters(); }
@Test public void runTest() throws Exception { JobParameters jobParameters = jobLauncherTestUtils.getUniqueJobParameters(); JobExecution je1 = jobLauncherTestUtils.launchJob(jobParameters); assertEquals(BatchStatus.FAILED, je1.getStatus()); AssertFile.assertLineCount(10, outputResource); JobExecution je2 = jobLauncherTestUtils.launchJob(jobParameters); assertEquals(BatchStatus.COMPLETED, je2.getStatus()); AssertFile.assertLineCount(20, outputResource); }