Hi,
Here's some code I'd posted earlier:
Code:
@Test
public void testProgramaticJob() throws Exception {
JobParameters parameters = new JobParametersBuilder(jobLauncherTestUtils.getUniqueJobParameters()).toJobParameters();
TaskletStep taskletStep = new TaskletStep();
taskletStep.setName("step1");
taskletStep.setJobRepository(jobRepository);
taskletStep.setTransactionManager(transactionManager);
Tasklet tasklet = new SplitFilesTasklet();
taskletStep.setTasklet(tasklet);
SimpleJob job = new SimpleJob("test");
job.addStep(taskletStep);
job.setJobRepository(jobRepository);
jobLauncherTestUtils.setJob(job);
JobExecution jobExecution = jobLauncherTestUtils.launchJob(parameters);
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
}
If you would like to create the step statically, just inject the Tasklet into the class that launches the job.
Now the problem that I've not been able to solve is how to run a job from within a job (which is what you'd probably end up with in this situation).
I've posted about it here:
http://forum.springsource.org/showth...m-within-a-Job
If you find a way to get around this, please post.
HTH!