RESOLVED - issue BATCH-492: CommandLineJobRunner should close the spring context

This commit is contained in:
dsyer
2008-03-19 14:55:58 +00:00
parent d4710ab1be
commit fc1e7debd9
3 changed files with 25 additions and 4 deletions

View File

@@ -85,6 +85,12 @@ public class CommandLineJobRunnerTests extends TestCase {
assertEquals(new JobParameters(), StubJobLauncher.jobParameters);
}
public void testDestroyCallback() throws Throwable {
String[] args = new String[] { jobPath, jobName };
CommandLineJobRunner.main(args);
assertTrue(StubJobLauncher.destroyed);
}
protected void tearDown() throws Exception {
super.tearDown();
@@ -112,6 +118,8 @@ public class CommandLineJobRunnerTests extends TestCase {
public static JobParameters jobParameters;
private static boolean destroyed = false;
public JobExecution run(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException {
StubJobLauncher.jobParameters = jobParameters;
@@ -122,11 +130,16 @@ public class CommandLineJobRunnerTests extends TestCase {
return jobExecution;
}
public void destroy() {
destroyed = true;
}
public static void tearDown() {
jobExecution = null;
throwExecutionRunningException = false;
jobParameters = null;
destroyed = false;
}
}