public void simpleJob() throws Exception {
StringBuilder jobInfo = new StringBuilder();
final long jobExecutionId = exec.startJob(testDataFolder.getRoot().getAbsolutePath());
System.out.println("Job Exec ID: " + jobExecutionId);
JobExecution jx = exec.getJobExecutionDetails(jobExecutionId);
// Job is executed asynchronously, se we have to wait for the result.
while (jx.getBatchStatus() != BatchStatus.COMPLETED
&& jx.getBatchStatus() != BatchStatus.FAILED
&& jx.getBatchStatus() != BatchStatus.ABANDONED
&& jx.getBatchStatus() != BatchStatus.STOPPED) {
Thread.sleep(500);
}
jobInfo.append("ID: ").append(jx.getExecutionId()).append('\n');
jobInfo.append("Name: ").append(jx.getJobName()).append('\n');
jobInfo.append("Parameters: ").append(jx.getJobParameters()).append('\n');
jobInfo.append("Status: ").append(jx.getBatchStatus()).append('\n');
jobInfo.append("Created: ").append(jx.getCreateTime()).append('\n');
jobInfo.append("Ended: ").append(jx.getEndTime()).append('\n');
jobInfo.append("Exit status: ").append(jx.getExitStatus()).append('\n');
System.out.println(jobInfo);
}