BATCH-1450: make Maps in Daos local not global
This commit is contained in:
@@ -42,13 +42,16 @@ public abstract class AbstractJobParserTests {
|
||||
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private MapJobRepositoryFactoryBean mapJobRepositoryFactoryBean;
|
||||
|
||||
@Autowired
|
||||
protected ArrayList<String> stepNamesList = new ArrayList<String>();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
mapJobRepositoryFactoryBean.clear();
|
||||
stepNamesList.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertTrue;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -32,7 +31,6 @@ import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -51,11 +49,6 @@ public class BranchStepJobParserTests {
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBranchStep() throws Exception {
|
||||
assertNotNull(job);
|
||||
@@ -70,4 +63,5 @@ public class BranchStepJobParserTests {
|
||||
assertTrue(names.contains("job.s3"));
|
||||
assertFalse(names.contains("job.s2"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.batch.core.configuration.xml;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -29,7 +28,6 @@ import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionStatus;
|
||||
import org.springframework.batch.core.job.flow.JobExecutionDecider;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -50,11 +48,6 @@ public class DecisionJobParserTests {
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecisionState() throws Exception {
|
||||
assertNotNull(job);
|
||||
|
||||
@@ -16,18 +16,16 @@
|
||||
package org.springframework.batch.core.configuration.xml;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.internal.runners.JUnit4ClassRunner;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* @author Dan Garrette
|
||||
* @author Dave Syer
|
||||
* @since 2.0
|
||||
*/
|
||||
@RunWith(JUnit4ClassRunner.class)
|
||||
public class DuplicateTransitionJobParserTests extends AbstractJobParserTests {
|
||||
public class DuplicateTransitionJobParserTests {
|
||||
|
||||
@Test(expected = BeanDefinitionStoreException.class)
|
||||
public void testNextAttributeWithNestedElement() throws Exception {
|
||||
|
||||
@@ -63,10 +63,13 @@ public class FlowJobParserTests {
|
||||
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private MapJobRepositoryFactoryBean mapJobRepositoryFactoryBean;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
mapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.batch.core.configuration.xml;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -26,7 +25,6 @@ import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -48,11 +46,6 @@ public class OneStepJobParserTests {
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOneStep() throws Exception {
|
||||
assertNotNull(job);
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.batch.core.configuration.xml;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -26,7 +25,6 @@ import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -48,11 +46,6 @@ public class RepositoryJobParserTests {
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTaskletStepWithBadListener() throws Exception {
|
||||
assertNotNull(job);
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.batch.core.configuration.xml;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -26,7 +25,6 @@ import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -48,11 +46,6 @@ public class SplitJobParserTests {
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSplitJob() throws Exception {
|
||||
assertNotNull(job);
|
||||
|
||||
@@ -19,7 +19,6 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -28,7 +27,6 @@ import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.StepListener;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -68,11 +66,6 @@ public class StepWithBasicProcessTaskJobParserTests {
|
||||
@Autowired
|
||||
private StepParserStepFactoryBean factory;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStepWithTask() throws Exception {
|
||||
assertNotNull(job);
|
||||
|
||||
@@ -19,7 +19,6 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -28,7 +27,6 @@ import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.StepListener;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.retry.RetryListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -74,11 +72,6 @@ public class StepWithFaultTolerantProcessTaskJobParserTests {
|
||||
@Autowired
|
||||
private StepParserStepFactoryBean factory;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStepWithTask() throws Exception {
|
||||
assertNotNull(job);
|
||||
|
||||
@@ -19,7 +19,6 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -29,7 +28,6 @@ import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.job.flow.FlowJob;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.step.tasklet.TaskletStep;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -54,11 +52,6 @@ public class StepWithSimpleTaskJobParserTests {
|
||||
@Qualifier("listener")
|
||||
private TestListener listener;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJob() throws Exception {
|
||||
assertNotNull(job);
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.batch.core.configuration.xml;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -26,7 +25,6 @@ import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -46,11 +44,6 @@ public class TwoStepJobParserTests {
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTwoStep() throws Exception {
|
||||
assertNotNull(job);
|
||||
|
||||
@@ -1,25 +1,35 @@
|
||||
package org.springframework.batch.core.exlore.support;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
|
||||
/**
|
||||
* Tests for {@link MapJobExplorerFactoryBean}.
|
||||
*/
|
||||
public class MapJobExplorerFactoryBeanTests {
|
||||
|
||||
private MapJobExplorerFactoryBean tested = new MapJobExplorerFactoryBean();
|
||||
|
||||
/**
|
||||
* Use the factory to create repository and check the repository remembers
|
||||
* Use the factory to create repository and check the explorer remembers
|
||||
* created executions.
|
||||
*/
|
||||
@Test
|
||||
public void testCreateRepository() throws Exception {
|
||||
public void testCreateExplorer() throws Exception {
|
||||
|
||||
MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean();
|
||||
((JobRepository)repositoryFactory.getObject()).createJobExecution("foo", new JobParameters());
|
||||
|
||||
MapJobExplorerFactoryBean tested = new MapJobExplorerFactoryBean(repositoryFactory);
|
||||
tested.afterPropertiesSet();
|
||||
|
||||
JobExplorer explorer = (JobExplorer) tested.getObject();
|
||||
|
||||
explorer.findRunningJobExecutions("foo");
|
||||
assertEquals(1, explorer.findRunningJobExecutions("foo").size());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.springframework.batch.core.scope.context.ChunkContext;
|
||||
import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||
import org.springframework.batch.core.step.tasklet.TaskletStep;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
|
||||
/**
|
||||
@@ -47,12 +46,8 @@ public class MapJobExplorerIntegrationTests {
|
||||
@Test
|
||||
public void testRunningJobExecution() throws Exception {
|
||||
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
|
||||
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
|
||||
MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean();
|
||||
ResourcelessTransactionManager transactionManager = new ResourcelessTransactionManager();
|
||||
repositoryFactory.setTransactionManager(transactionManager);
|
||||
repositoryFactory.afterPropertiesSet();
|
||||
JobRepository jobRepository = (JobRepository) repositoryFactory.getObject();
|
||||
jobLauncher.setJobRepository(jobRepository);
|
||||
@@ -69,7 +64,7 @@ public class MapJobExplorerIntegrationTests {
|
||||
return RepeatStatus.FINISHED;
|
||||
}
|
||||
});
|
||||
step.setTransactionManager(transactionManager);
|
||||
step.setTransactionManager(repositoryFactory.getTransactionManager());
|
||||
step.setJobRepository(jobRepository);
|
||||
step.afterPropertiesSet();
|
||||
job.addStep(step);
|
||||
@@ -79,7 +74,7 @@ public class MapJobExplorerIntegrationTests {
|
||||
jobLauncher.run(job, new JobParametersBuilder().addString("test", getClass().getName()).toJobParameters());
|
||||
|
||||
Thread.sleep(500L);
|
||||
JobExplorer explorer = (JobExplorer) new MapJobExplorerFactoryBean().getObject();
|
||||
JobExplorer explorer = (JobExplorer) new MapJobExplorerFactoryBean(repositoryFactory).getObject();
|
||||
Set<JobExecution> executions = explorer.findRunningJobExecutions("job");
|
||||
assertEquals(1, executions.size());
|
||||
assertEquals(1, executions.iterator().next().getStepExecutions().size());
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.step.StepSupport;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -51,9 +50,7 @@ public class ExtendedAbstractJobTests {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
factory.setTransactionManager(new ResourcelessTransactionManager());
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
job = new StubJob("job", jobRepository);
|
||||
}
|
||||
@@ -166,9 +163,7 @@ public class ExtendedAbstractJobTests {
|
||||
}
|
||||
}
|
||||
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
factory.setTransactionManager(new ResourcelessTransactionManager());
|
||||
factory.afterPropertiesSet();
|
||||
JobRepository repository = (JobRepository) factory.getObject();
|
||||
job.setJobRepository(repository);
|
||||
|
||||
@@ -99,10 +99,6 @@ public class SimpleJobTests {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
MapJobInstanceDao.clear();
|
||||
MapJobExecutionDao.clear();
|
||||
MapStepExecutionDao.clear();
|
||||
MapExecutionContextDao.clear();
|
||||
jobInstanceDao = new MapJobInstanceDao();
|
||||
jobExecutionDao = new MapJobExecutionDao();
|
||||
stepExecutionDao = new MapStepExecutionDao();
|
||||
|
||||
@@ -42,14 +42,8 @@ import org.springframework.batch.core.job.flow.support.state.SplitState;
|
||||
import org.springframework.batch.core.job.flow.support.state.StepState;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.dao.JobExecutionDao;
|
||||
import org.springframework.batch.core.repository.dao.MapExecutionContextDao;
|
||||
import org.springframework.batch.core.repository.dao.MapJobExecutionDao;
|
||||
import org.springframework.batch.core.repository.dao.MapJobInstanceDao;
|
||||
import org.springframework.batch.core.repository.dao.MapStepExecutionDao;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.repository.support.SimpleJobRepository;
|
||||
import org.springframework.batch.core.step.StepSupport;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -69,13 +63,9 @@ public class FlowJobTests {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
factory.setTransactionManager(new ResourcelessTransactionManager());
|
||||
factory.afterPropertiesSet();
|
||||
jobExecutionDao = new MapJobExecutionDao();
|
||||
jobRepository = new SimpleJobRepository(new MapJobInstanceDao(), jobExecutionDao, new MapStepExecutionDao(),
|
||||
new MapExecutionContextDao());
|
||||
jobExecutionDao = factory.getJobExecutionDao();
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
job.setJobRepository(jobRepository);
|
||||
jobExecution = jobRepository.createJobExecution("job", new JobParameters());
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.springframework.batch.core.partition.StepExecutionSplitter;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.step.StepSupport;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -50,9 +49,7 @@ public class PartitionStepTests {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
factory.setTransactionManager(new ResourcelessTransactionManager());
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
step.setJobRepository(jobRepository);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.step.tasklet.TaskletStep;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
|
||||
public class SimpleStepExecutionSplitterTests {
|
||||
|
||||
@@ -31,14 +30,13 @@ public class SimpleStepExecutionSplitterTests {
|
||||
public void setUp() throws Exception {
|
||||
step = new TaskletStep("step");
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
factory.setTransactionManager(new ResourcelessTransactionManager());
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleStepExecutionProviderJobRepositoryStep() throws Exception {
|
||||
SimpleStepExecutionSplitter provider = new SimpleStepExecutionSplitter(jobRepository, step);
|
||||
Set<StepExecution> execs = provider.split(stepExecution, 2);
|
||||
SimpleStepExecutionSplitter splitter = new SimpleStepExecutionSplitter(jobRepository, step);
|
||||
Set<StepExecution> execs = splitter.split(stepExecution, 2);
|
||||
assertEquals(2, execs.size());
|
||||
|
||||
for (StepExecution execution : execs) {
|
||||
@@ -49,12 +47,12 @@ public class SimpleStepExecutionSplitterTests {
|
||||
@Test
|
||||
public void testSimpleStepExecutionProviderJobRepositoryStepPartitioner() throws Exception {
|
||||
final Map<String, ExecutionContext> map = Collections.singletonMap("foo", new ExecutionContext());
|
||||
SimpleStepExecutionSplitter provider = new SimpleStepExecutionSplitter(jobRepository, step, new Partitioner() {
|
||||
SimpleStepExecutionSplitter splitter = new SimpleStepExecutionSplitter(jobRepository, step, new Partitioner() {
|
||||
public Map<String, ExecutionContext> partition(int gridSize) {
|
||||
return map;
|
||||
}
|
||||
});
|
||||
assertEquals(1, provider.split(stepExecution, 2).size());
|
||||
assertEquals(1, splitter.split(stepExecution, 2).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -17,19 +17,16 @@ public class MapExecutionContextDaoTests extends AbstractExecutionContextDaoTest
|
||||
|
||||
@Override
|
||||
protected JobInstanceDao getJobInstanceDao() {
|
||||
MapJobInstanceDao.clear();
|
||||
return new MapJobInstanceDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JobExecutionDao getJobExecutionDao() {
|
||||
MapJobExecutionDao.clear();
|
||||
return new MapJobExecutionDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StepExecutionDao getStepExecutionDao() {
|
||||
MapStepExecutionDao.clear();
|
||||
return new MapStepExecutionDao();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ public class MapJobExecutionDaoTests extends AbstractJobExecutionDaoTests {
|
||||
|
||||
@Override
|
||||
protected JobExecutionDao getJobExecutionDao() {
|
||||
MapJobExecutionDao.clear();
|
||||
MapJobInstanceDao.clear();
|
||||
return new MapJobExecutionDao();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import org.junit.internal.runners.JUnit4ClassRunner;
|
||||
public class MapJobInstanceDaoTests extends AbstractJobInstanceDaoTests {
|
||||
|
||||
protected JobInstanceDao getJobInstanceDao() {
|
||||
MapJobInstanceDao.clear();
|
||||
return new MapJobInstanceDao();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,6 @@ public class MapStepExecutionDaoTests extends AbstractStepExecutionDaoTests {
|
||||
}
|
||||
|
||||
protected JobRepository getJobRepository() {
|
||||
MapJobInstanceDao.clear();
|
||||
MapJobExecutionDao.clear();
|
||||
MapStepExecutionDao.clear();
|
||||
return new SimpleJobRepository(new MapJobInstanceDao(), new MapJobExecutionDao(), new MapStepExecutionDao(),
|
||||
new MapExecutionContextDao());
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ 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}.
|
||||
@@ -23,7 +22,6 @@ 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");
|
||||
|
||||
@@ -94,10 +94,6 @@ public class FaultTolerantStepFactoryBeanRetryTests {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
MapJobInstanceDao.clear();
|
||||
MapJobExecutionDao.clear();
|
||||
MapStepExecutionDao.clear();
|
||||
|
||||
factory = new FaultTolerantStepFactoryBean<String, String>();
|
||||
factory.setBeanName("step");
|
||||
|
||||
|
||||
@@ -77,9 +77,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests {
|
||||
|
||||
factory.setSkippableExceptionClasses(getExceptionMap(Exception.class));
|
||||
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean();
|
||||
repositoryFactory.setTransactionManager(new ResourcelessTransactionManager());
|
||||
repositoryFactory.afterPropertiesSet();
|
||||
repository = (JobRepository) repositoryFactory.getObject();
|
||||
factory.setJobRepository(repository);
|
||||
|
||||
@@ -103,9 +103,7 @@ public class FaultTolerantStepFactoryBeanTests {
|
||||
factory
|
||||
.setSkippableExceptionClasses(getExceptionMap(SkippableException.class, SkippableRuntimeException.class));
|
||||
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean();
|
||||
repositoryFactory.setTransactionManager(new ResourcelessTransactionManager());
|
||||
repositoryFactory.afterPropertiesSet();
|
||||
repository = (JobRepository) repositoryFactory.getObject();
|
||||
factory.setJobRepository(repository);
|
||||
|
||||
@@ -81,9 +81,6 @@ public class SimpleStepFactoryBeanTests {
|
||||
public void setUp() throws Exception {
|
||||
job.setJobRepository(repository);
|
||||
job.setBeanName("simpleJob");
|
||||
MapJobInstanceDao.clear();
|
||||
MapJobExecutionDao.clear();
|
||||
MapStepExecutionDao.clear();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.batch.core.launch.support.SimpleJobLauncher;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -48,10 +47,8 @@ public class JobStepTests {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
step.setName("step");
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
factory.setTransactionManager(new ResourcelessTransactionManager());
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
step.setJobRepository(jobRepository);
|
||||
JobExecution jobExecution = jobRepository.createJobExecution("job", new JobParameters());
|
||||
|
||||
@@ -56,9 +56,6 @@ public class StepExecutorInterruptionTests extends TestCase {
|
||||
private Field semaphore;
|
||||
|
||||
public void setUp() throws Exception {
|
||||
MapJobInstanceDao.clear();
|
||||
MapJobExecutionDao.clear();
|
||||
MapStepExecutionDao.clear();
|
||||
|
||||
jobRepository = new SimpleJobRepository(new MapJobInstanceDao(), new MapJobExecutionDao(),
|
||||
new MapStepExecutionDao(), new MapExecutionContextDao());
|
||||
|
||||
@@ -113,9 +113,6 @@ public class TaskletStepTests {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MapJobInstanceDao.clear();
|
||||
MapStepExecutionDao.clear();
|
||||
MapJobExecutionDao.clear();
|
||||
|
||||
transactionManager = new ResourcelessTransactionManager();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user