|
1 | 1 | /*
|
2 |
| - * Copyright 2008-2014 the original author or authors. |
| 2 | + * Copyright 2008-2018 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
38 | 38 | import org.springframework.transaction.annotation.Transactional;
|
39 | 39 | import org.springframework.util.Assert;
|
40 | 40 |
|
| 41 | +/** |
| 42 | + * Parent Test Class for {@link JdbcJobExecutionDao} and {@link MapJobExecutionDao}. |
| 43 | + */ |
41 | 44 | public abstract class AbstractJobExecutionDaoTests {
|
42 | 45 |
|
43 | 46 | protected JobExecutionDao dao;
|
@@ -193,14 +196,24 @@ public void testGetMissingLastExecution() {
|
193 | 196 | @Transactional
|
194 | 197 | @Test
|
195 | 198 | public void testFindRunningExecutions() {
|
196 |
| - |
| 199 | + //Normally completed JobExecution as EndTime is populated |
197 | 200 | JobExecution exec = new JobExecution(jobInstance, jobParameters);
|
198 | 201 | exec.setCreateTime(new Date(0));
|
199 |
| - exec.setEndTime(new Date(1L)); |
| 202 | + exec.setStartTime(new Date(1L)); |
| 203 | + exec.setEndTime(new Date(2L)); |
| 204 | + exec.setLastUpdated(new Date(5L)); |
| 205 | + dao.saveJobExecution(exec); |
| 206 | + |
| 207 | + //BATCH-2675 |
| 208 | + //Abnormal JobExecution as both StartTime and EndTime are null |
| 209 | + //This can occur when SimpleJobLauncher#run() submission to taskExecutor throws a TaskRejectedException |
| 210 | + exec = new JobExecution(jobInstance, jobParameters); |
200 | 211 | exec.setLastUpdated(new Date(5L));
|
201 | 212 | dao.saveJobExecution(exec);
|
202 | 213 |
|
| 214 | + //Running JobExecution as StartTime is populated but EndTime is null |
203 | 215 | exec = new JobExecution(jobInstance, jobParameters);
|
| 216 | + exec.setStartTime(new Date(2L)); |
204 | 217 | exec.setLastUpdated(new Date(5L));
|
205 | 218 | exec.createStepExecution("step");
|
206 | 219 | dao.saveJobExecution(exec);
|
|
0 commit comments