IN PROGRESS - BATCH-857: map daos need to be truly transactional for correct restart
added cloning to step and execution context map daos
This commit is contained in:
@@ -483,6 +483,8 @@ public class SimpleJobTests extends TestCase {
|
||||
}
|
||||
stepExecution.setExitStatus(ExitStatus.FINISHED);
|
||||
stepExecution.setStatus(BatchStatus.COMPLETED);
|
||||
jobRepository.update(stepExecution);
|
||||
jobRepository.updateExecutionContext(stepExecution);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@ public class MapJobExecutionDaoTests extends AbstractJobExecutionDaoTests {
|
||||
JobExecution retrieved = tested.getJobExecution(jobExecution.getId());
|
||||
assertNull(retrieved.getStartTime());
|
||||
|
||||
tested.updateJobExecution(jobExecution);
|
||||
jobExecution.setEndTime(new Date());
|
||||
assertNull(retrieved.getEndTime());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
package org.springframework.batch.core.repository.dao;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.SimpleJobRepository;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.internal.runners.JUnit4ClassRunner;
|
||||
|
||||
@@ -19,5 +26,29 @@ public class MapStepExecutionDaoTests extends AbstractStepExecutionDaoTests {
|
||||
return new SimpleJobRepository(new MapJobInstanceDao(), new MapJobExecutionDao(), new MapStepExecutionDao(),
|
||||
new MapExecutionContextDao());
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifications to saved entity do not affect the persisted object.
|
||||
*/
|
||||
@Test
|
||||
public void testPersistentCopy() {
|
||||
StepExecutionDao tested = new MapStepExecutionDao();
|
||||
JobExecution jobExecution = new JobExecution((long) 77);
|
||||
StepExecution stepExecution = new StepExecution("stepName", jobExecution);
|
||||
|
||||
assertNull(stepExecution.getEndTime());
|
||||
tested.saveStepExecution(stepExecution);
|
||||
stepExecution.setEndTime(new Date());
|
||||
|
||||
StepExecution retrieved = tested.getStepExecution(jobExecution, "stepName");
|
||||
assertNull(retrieved.getEndTime());
|
||||
|
||||
stepExecution.setEndTime(null);
|
||||
tested.updateStepExecution(stepExecution);
|
||||
stepExecution.setEndTime(new Date());
|
||||
|
||||
StepExecution stored = tested.getStepExecution(jobExecution, "stepName");
|
||||
assertNull(stored.getEndTime());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user