RESOLVED - BATCH-857: map daos need to be truly transactional for correct restart
some more tests
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
package org.springframework.batch.core.repository.dao;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.internal.runners.JUnit4ClassRunner;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
|
||||
/**
|
||||
* Tests for {@link MapExecutionContextDao}.
|
||||
@@ -31,6 +37,25 @@ public class MapExecutionContextDaoTests extends AbstractExecutionContextDaoTest
|
||||
protected ExecutionContextDao getExecutionContextDao() {
|
||||
return new MapExecutionContextDao();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPersistentCopy() throws Exception {
|
||||
MapExecutionContextDao tested = new MapExecutionContextDao();
|
||||
JobExecution jobExecution = new JobExecution((long)1);
|
||||
StepExecution stepExecution = new StepExecution("stepName", jobExecution);
|
||||
assertTrue(stepExecution.getExecutionContext().isEmpty());
|
||||
|
||||
tested.persistExecutionContext(stepExecution);
|
||||
stepExecution.getExecutionContext().put("key","value");
|
||||
|
||||
ExecutionContext retrieved = tested.getExecutionContext(stepExecution);
|
||||
assertTrue(retrieved.isEmpty());
|
||||
|
||||
tested.persistExecutionContext(jobExecution);
|
||||
jobExecution.getExecutionContext().put("key", "value");
|
||||
retrieved = tested.getExecutionContext(jobExecution);
|
||||
assertTrue(retrieved.isEmpty());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user