IN PROGRESS - BATCH-857: map daos need to be truly transactional for correct restart

moved transaction manager and proxy up to AbstractJobRepository so that it applies to Map implementation too
This commit is contained in:
robokaso
2008-10-14 12:58:20 +00:00
parent eacf9a41a1
commit 9b1371f6fd
5 changed files with 92 additions and 81 deletions

View File

@@ -104,11 +104,13 @@ public class JobRepositoryFactoryBeanTests {
@Test
public void testMissingTransactionManager() throws Exception {
factory.setDatabaseType("mockDb");
factory.setTransactionManager(null);
try {
expect(incrementerFactory.isSupportedIncrementerType(null)).andReturn(true);
expect(incrementerFactory.isSupportedIncrementerType("mockDb")).andReturn(true);
expect(incrementerFactory.getSupportedIncrementerTypes()).andReturn(new String[0]);
replay(incrementerFactory);
factory.afterPropertiesSet();
fail();
}

View File

@@ -8,6 +8,7 @@ import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.job.JobSupport;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
/**
* Tests for {@link MapJobRepositoryFactoryBean}.
@@ -22,6 +23,8 @@ public class MapJobRepositoryFactoryBeanTests {
*/
@Test
public void testCreateRepository() throws Exception {
tested.setTransactionManager(new ResourcelessTransactionManager());
tested.afterPropertiesSet();
JobRepository repository = (JobRepository) tested.getObject();
Job job = new JobSupport("jobName");
JobParameters jobParameters = new JobParameters();