RESOLVED - issue BATCH-975: SimpleStepFactoryBean should check for its required dependencies

This commit is contained in:
dsyer
2008-12-30 07:39:53 +00:00
parent aab745e591
commit cbb462ca59
3 changed files with 15 additions and 5 deletions

View File

@@ -8,12 +8,16 @@ 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.dao.StepExecutionDao;
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
import org.springframework.beans.factory.FactoryBean;
/**
* A {@link FactoryBean} that automates the creation of a
* {@link SimpleJobRepository} using non-persistent in-memory DAO
* implementations.
* implementations. This repository is only really intended for use in testing
* and rapid prototyping. In such settings you might find that
* {@link ResourcelessTransactionManager} is useful (as long as your business
* logic does not use a relational database).
*
* @author Robert Kasanicky
*/

View File

@@ -106,12 +106,12 @@ public class SimpleStepFactoryBean<T, S> implements FactoryBean, BeanNameAware {
private int throttleLimit = TaskExecutorRepeatTemplate.DEFAULT_THROTTLE_LIMIT;
/**
*
* Default constructor for {@link SimpleStepFactoryBean}.
*/
public SimpleStepFactoryBean() {
super();
}
/**
* Set the bean name property, which will become the name of the
* {@link Step} when it is created.
@@ -268,11 +268,12 @@ public class SimpleStepFactoryBean<T, S> implements FactoryBean, BeanNameAware {
/**
* Create a {@link Step} from the configuration provided.
*
* @see org.springframework.beans.factory.FactoryBean#getObject()
* @see FactoryBean#getObject()
*/
public final Object getObject() throws Exception {
TaskletStep step = new TaskletStep(getName());
applyConfiguration(step);
step.afterPropertiesSet();
return step;
}
@@ -480,7 +481,7 @@ public class SimpleStepFactoryBean<T, S> implements FactoryBean, BeanNameAware {
ChunkOrientedTasklet<T> tasklet = new ChunkOrientedTasklet<T>(chunkProvider, chunkProcessor);
step.setTasklet(tasklet);
}
/**

View File

@@ -81,6 +81,11 @@ public class SimpleStepFactoryBeanTests {
MapStepExecutionDao.clear();
}
@Test(expected=IllegalArgumentException.class)
public void testMandatoryProperties() throws Exception {
new SimpleStepFactoryBean<String, String>().getObject();
}
@Test
public void testSimpleJob() throws Exception {