Refactored task end event to be Spring Boot's ApplicationReadyEvent

In testing and other use cases, the ability to keep a context open
beyond the end of a task can be useful.  This change provides the
ability to keep the context alive once a task has completed while also
explicitly shutting the context down (by default) once a task has ended.

Resolves spring-cloud/spring-cloud-task#102
This commit is contained in:
Michael Minella
2016-04-05 11:44:09 -05:00
parent 3d3b90812e
commit 0a56672171
9 changed files with 88 additions and 107 deletions

View File

@@ -44,9 +44,9 @@ public class BatchJobApplicationTests {
final String CREATE_TASK_MESSAGE = "Creating: TaskExecution{executionId=";
final String UPDATE_TASK_MESSAGE = "Updating: TaskExecution with executionId=";
final String JOB_ASSOCIATION_MESSAGE = "The job execution id ";
final String EXIT_CODE_MESSAGE = "with the following {exitCode=0";
assertEquals(0, SpringApplication.exit(SpringApplication
.run(BatchJobApplication.class)));
SpringApplication.run(BatchJobApplication.class);
String output = this.outputCapture.toString();
assertTrue("Unable to find the timestamp: " + output,
@@ -55,6 +55,8 @@ public class BatchJobApplicationTests {
output.contains(CREATE_TASK_MESSAGE));
assertTrue("Test results do not show success message: " + output,
output.contains(UPDATE_TASK_MESSAGE));
assertTrue("Test results do not show success message: " + output,
output.contains(EXIT_CODE_MESSAGE));
int i = output.indexOf(JOB_ASSOCIATION_MESSAGE);