OPEN - issue BATCH-324: Step as factory for StepExecutor
http://jira.springframework.org/browse/BATCH-324 Consolidate changes and remove unnecessary methods from interfaces
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
import org.springframework.batch.core.executor.StepExecutor;
|
||||
import org.springframework.batch.core.tasklet.Tasklet;
|
||||
|
||||
/**
|
||||
* Batch domain interface representing the configuration of a step. As with the
|
||||
@@ -35,11 +34,6 @@ public interface Step {
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return the {@link Tasklet} instance to execute for each item processed.
|
||||
*/
|
||||
Tasklet getTasklet();
|
||||
|
||||
/**
|
||||
* @return true if a step that is already marked as complete can be started
|
||||
* again.
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
import org.springframework.batch.core.executor.StepExecutor;
|
||||
import org.springframework.batch.core.tasklet.Tasklet;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
|
||||
/**
|
||||
@@ -33,8 +32,6 @@ public class StepSupport implements Step, BeanNameAware {
|
||||
|
||||
private int startLimit = Integer.MAX_VALUE;
|
||||
|
||||
private Tasklet tasklet;
|
||||
|
||||
private boolean allowStartIfComplete;
|
||||
|
||||
private boolean saveRestartData = false;
|
||||
@@ -106,24 +103,6 @@ public class StepSupport implements Step, BeanNameAware {
|
||||
this.startLimit = startLimit;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.springframework.batch.core.configuration.StepConfiguration#getTasklet()
|
||||
*/
|
||||
public Tasklet getTasklet() {
|
||||
return this.tasklet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the tasklet.
|
||||
*
|
||||
* @param tasklet the tasklet to set
|
||||
*/
|
||||
public void setTasklet(Tasklet tasklet) {
|
||||
this.tasklet = tasklet;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -63,11 +63,4 @@ public interface StepExecutor {
|
||||
StepExecution stepExecution) throws StepInterruptedException,
|
||||
BatchCriticalException;
|
||||
|
||||
/**
|
||||
* Apply the configuration by inspecting it to see if it has any relevant
|
||||
* policy information. Should be called before any calls to process.
|
||||
*
|
||||
* @param configuration
|
||||
*/
|
||||
void applyConfiguration(Step configuration);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.springframework.batch.core.configuration;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.core.domain.StepSupport;
|
||||
import org.springframework.batch.core.tasklet.Tasklet;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -53,20 +51,6 @@ public class StepSupportTests extends TestCase {
|
||||
assertEquals(10, configuration.getStartLimit());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.StepSupport#getTasklet()}.
|
||||
*/
|
||||
public void testGetTasklet() {
|
||||
assertEquals(null, configuration.getTasklet());
|
||||
Tasklet tasklet = new Tasklet() {
|
||||
public ExitStatus execute() throws Exception {
|
||||
return ExitStatus.FINISHED;
|
||||
}
|
||||
};
|
||||
configuration.setTasklet(tasklet);
|
||||
assertEquals(tasklet, configuration.getTasklet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.StepSupport#isAllowStartIfComplete()}.
|
||||
*/
|
||||
@@ -76,4 +60,17 @@ public class StepSupportTests extends TestCase {
|
||||
assertEquals(true, configuration.isAllowStartIfComplete());
|
||||
}
|
||||
|
||||
public void testUnsuccessfulWrongConfiguration() throws Exception {
|
||||
try {
|
||||
new StepSupport().createStepExecutor();
|
||||
fail("Expected UnsupportedOperationException");
|
||||
} catch (UnsupportedOperationException e) {
|
||||
// expected
|
||||
assertTrue(
|
||||
"Error message does not contain SimpleStep: "
|
||||
+ e.getMessage(), e.getMessage().indexOf(
|
||||
"SimpleStep") >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user