IN PROGRESS - BATCH-857: map daos need to be truly transactional for correct restart
added serialization-based cloning to MapJobExecutionDao
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
package org.springframework.batch.core.repository.dao;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.internal.runners.JUnit4ClassRunner;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobInstance;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@RunWith(JUnit4ClassRunner.class)
|
||||
public class MapJobExecutionDaoTests extends AbstractJobExecutionDaoTests {
|
||||
@@ -12,4 +20,21 @@ public class MapJobExecutionDaoTests extends AbstractJobExecutionDaoTests {
|
||||
return new MapJobExecutionDao();
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifications to saved entity do not affect the persisted object.
|
||||
*/
|
||||
@Test
|
||||
public void testPersistentCopy() {
|
||||
JobExecutionDao tested = new MapJobExecutionDao();
|
||||
JobExecution jobExecution = new JobExecution(new JobInstance((long) 1, new JobParameters(), "mapJob"));
|
||||
|
||||
assertNull(jobExecution.getStartTime());
|
||||
tested.saveJobExecution(jobExecution);
|
||||
jobExecution.setStartTime(new Date());
|
||||
|
||||
JobExecution retrieved = tested.getJobExecution(jobExecution.getId());
|
||||
assertNull(retrieved.getStartTime());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user