BATCH-2146: Renamed JSR specific artifacts to be prefixed so they are easily identifiable
This commit is contained in:
committed by
Chris Schaefer
parent
f093dc01de
commit
7eabb5e040
@@ -33,7 +33,7 @@ import org.springframework.util.Assert;
|
||||
* @author Chris Schaefer
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JobContext implements javax.batch.runtime.context.JobContext {
|
||||
public class JsrJobContext implements javax.batch.runtime.context.JobContext {
|
||||
private Object transientUserData;
|
||||
private Properties properties;
|
||||
private JobExecution jobExecution;
|
||||
@@ -40,7 +40,7 @@ import org.springframework.util.Assert;
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JobContextFactoryBean implements FactoryBean<JobContext> {
|
||||
public class JsrJobContextFactoryBean implements FactoryBean<JobContext> {
|
||||
|
||||
private JobExecution jobExecution;
|
||||
@Autowired
|
||||
@@ -116,7 +116,7 @@ public class JobContextFactoryBean implements FactoryBean<JobContext> {
|
||||
throw new FactoryBeanNotInitializedException("A JobExecution is required");
|
||||
}
|
||||
|
||||
org.springframework.batch.core.jsr.JobContext jobContext = new org.springframework.batch.core.jsr.JobContext();
|
||||
JsrJobContext jobContext = new JsrJobContext();
|
||||
jobContext.setJobExecution(jobExecution);
|
||||
|
||||
if(propertyContext != null) {
|
||||
@@ -25,12 +25,12 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Wrapper class to adapt the {@link javax.batch.runtime.JobExecution} to
|
||||
* a {@link JobExecution}.
|
||||
* a {@link org.springframework.batch.core.JobExecution}.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JobExecution implements javax.batch.runtime.JobExecution {
|
||||
public class JsrJobExecution implements javax.batch.runtime.JobExecution {
|
||||
|
||||
private org.springframework.batch.core.JobExecution execution;
|
||||
private JobParametersConverter parametersConverter;
|
||||
@@ -38,7 +38,7 @@ public class JobExecution implements javax.batch.runtime.JobExecution {
|
||||
/**
|
||||
* @param execution for all information to be delegated from
|
||||
*/
|
||||
public JobExecution(org.springframework.batch.core.JobExecution execution, JobParametersConverter parametersConverter) {
|
||||
public JsrJobExecution(org.springframework.batch.core.JobExecution execution, JobParametersConverter parametersConverter) {
|
||||
Assert.notNull(execution, "A JobExecution is required");
|
||||
this.execution = execution;
|
||||
|
||||
@@ -38,15 +38,15 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Chris Schaefer
|
||||
* @since 3.0
|
||||
*/
|
||||
public class StepContext implements javax.batch.runtime.context.StepContext {
|
||||
public class JsrStepContext implements javax.batch.runtime.context.StepContext {
|
||||
private final static String PERSISTENT_USER_DATA_KEY = "batch_jsr_persistentUserData";
|
||||
private StepExecution stepExecution;
|
||||
private Object transientUserData;
|
||||
private Properties properties = new Properties();
|
||||
private AtomicBoolean exitStatusSet = new AtomicBoolean();
|
||||
private final ExecutionContextUserSupport executionContextUserSupport = new ExecutionContextUserSupport(ClassUtils.getShortName(StepContext.class));
|
||||
private final ExecutionContextUserSupport executionContextUserSupport = new ExecutionContextUserSupport(ClassUtils.getShortName(JsrStepContext.class));
|
||||
|
||||
public StepContext(StepExecution stepExecution, Properties properties) {
|
||||
public JsrStepContext(StepExecution stepExecution, Properties properties) {
|
||||
Assert.notNull(stepExecution, "A StepExecution is required");
|
||||
|
||||
this.stepExecution = stepExecution;
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
|
||||
* @author Chris Schaefer
|
||||
* @since 3.0
|
||||
*/
|
||||
public class StepContextFactoryBean implements FactoryBean<StepContext>, InitializingBean {
|
||||
public class JsrStepContextFactoryBean implements FactoryBean<StepContext>, InitializingBean {
|
||||
@Autowired
|
||||
private BatchPropertyContext batchPropertyContext;
|
||||
|
||||
@@ -74,9 +74,9 @@ public class StepContextFactoryBean implements FactoryBean<StepContext>, Initial
|
||||
Properties stepProperties = batchPropertyContext.getStepProperties(curStepExecution.getStepName());
|
||||
|
||||
if(stepProperties != null) {
|
||||
context = new org.springframework.batch.core.jsr.StepContext(curStepExecution, stepProperties);
|
||||
context = new JsrStepContext(curStepExecution, stepProperties);
|
||||
} else {
|
||||
context = new org.springframework.batch.core.jsr.StepContext(curStepExecution, new Properties());
|
||||
context = new JsrStepContext(curStepExecution, new Properties());
|
||||
}
|
||||
|
||||
contextHolder.set(context);
|
||||
@@ -27,32 +27,32 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Implementation of the StepExecution as defined in JSR-352. This implementation
|
||||
* Implementation of the JsrStepExecution as defined in JSR-352. This implementation
|
||||
* wraps a {@link org.springframework.batch.core.StepExecution} as it's source of
|
||||
* data.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
*/
|
||||
public class StepExecution implements javax.batch.runtime.StepExecution{
|
||||
public class JsrStepExecution implements javax.batch.runtime.StepExecution{
|
||||
|
||||
private final static String PERSISTENT_USER_DATA_KEY = "batch_jsr_persistentUserData";
|
||||
private final org.springframework.batch.core.StepExecution stepExecution;
|
||||
// The API for the persistent user data is handled by the StepContext which is why the name here is based on the StepContext.
|
||||
private final ExecutionContextUserSupport executionContextUserSupport = new ExecutionContextUserSupport(ClassUtils.getShortName(StepContext.class));
|
||||
// The API for the persistent user data is handled by the JsrStepContext which is why the name here is based on the JsrStepContext.
|
||||
private final ExecutionContextUserSupport executionContextUserSupport = new ExecutionContextUserSupport(ClassUtils.getShortName(JsrStepContext.class));
|
||||
|
||||
/**
|
||||
* @param stepExecution The {@link org.springframework.batch.core.StepExecution} used
|
||||
* as the basis for the data.
|
||||
*/
|
||||
public StepExecution(org.springframework.batch.core.StepExecution stepExecution) {
|
||||
public JsrStepExecution(org.springframework.batch.core.StepExecution stepExecution) {
|
||||
Assert.notNull(stepExecution, "A StepExecution is required");
|
||||
|
||||
this.stepExecution = stepExecution;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.batch.runtime.StepExecution#getStepExecutionId()
|
||||
* @see javax.batch.runtime.JsrStepExecution#getStepExecutionId()
|
||||
*/
|
||||
@Override
|
||||
public long getStepExecutionId() {
|
||||
@@ -60,7 +60,7 @@ public class StepExecution implements javax.batch.runtime.StepExecution{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.batch.runtime.StepExecution#getStepName()
|
||||
* @see javax.batch.runtime.JsrStepExecution#getStepName()
|
||||
*/
|
||||
@Override
|
||||
public String getStepName() {
|
||||
@@ -68,7 +68,7 @@ public class StepExecution implements javax.batch.runtime.StepExecution{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.batch.runtime.StepExecution#getBatchStatus()
|
||||
* @see javax.batch.runtime.JsrStepExecution#getBatchStatus()
|
||||
*/
|
||||
@Override
|
||||
public BatchStatus getBatchStatus() {
|
||||
@@ -76,7 +76,7 @@ public class StepExecution implements javax.batch.runtime.StepExecution{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.batch.runtime.StepExecution#getStartTime()
|
||||
* @see javax.batch.runtime.JsrStepExecution#getStartTime()
|
||||
*/
|
||||
@Override
|
||||
public Date getStartTime() {
|
||||
@@ -84,7 +84,7 @@ public class StepExecution implements javax.batch.runtime.StepExecution{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.batch.runtime.StepExecution#getEndTime()
|
||||
* @see javax.batch.runtime.JsrStepExecution#getEndTime()
|
||||
*/
|
||||
@Override
|
||||
public Date getEndTime() {
|
||||
@@ -92,7 +92,7 @@ public class StepExecution implements javax.batch.runtime.StepExecution{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.batch.runtime.StepExecution#getExitStatus()
|
||||
* @see javax.batch.runtime.JsrStepExecution#getExitStatus()
|
||||
*/
|
||||
@Override
|
||||
public String getExitStatus() {
|
||||
@@ -106,7 +106,7 @@ public class StepExecution implements javax.batch.runtime.StepExecution{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.batch.runtime.StepExecution#getPersistentUserData()
|
||||
* @see javax.batch.runtime.JsrStepExecution#getPersistentUserData()
|
||||
*/
|
||||
@Override
|
||||
public Serializable getPersistentUserData() {
|
||||
@@ -114,7 +114,7 @@ public class StepExecution implements javax.batch.runtime.StepExecution{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.batch.runtime.StepExecution#getMetrics()
|
||||
* @see javax.batch.runtime.JsrStepExecution#getMetrics()
|
||||
*/
|
||||
@Override
|
||||
public Metric[] getMetrics() {
|
||||
@@ -25,7 +25,7 @@ import java.util.Set;
|
||||
|
||||
import org.springframework.batch.core.configuration.xml.AbstractFlowParser;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionStatus;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.DefaultFlow;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.JsrFlow;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
@@ -79,7 +79,7 @@ public class FlowParser extends AbstractFlowParser {
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
builder.getRawBeanDefinition().setAttribute("flowName", flowName);
|
||||
builder.addPropertyValue("name", flowName);
|
||||
builder.addPropertyValue("flowType", DefaultFlow.class);
|
||||
builder.addPropertyValue("flowType", JsrFlow.class);
|
||||
|
||||
List<BeanDefinition> stateTransitions = new ArrayList<BeanDefinition>();
|
||||
|
||||
@@ -94,9 +94,9 @@ public class FlowParser extends AbstractFlowParser {
|
||||
if (nodeName.equals(STEP_ELE)) {
|
||||
stateTransitions.addAll(stepParser.parse(child, parserContext, builder));
|
||||
} else if(nodeName.equals(SPLIT_ELE)) {
|
||||
stateTransitions.addAll(new SplitParser(flowName).parse(child, parserContext));
|
||||
stateTransitions.addAll(new JsrSplitParser(flowName).parse(child, parserContext));
|
||||
} else if(nodeName.equals(DECISION_ELE)) {
|
||||
stateTransitions.addAll(new DecisionParser().parse(child, parserContext, flowName));
|
||||
stateTransitions.addAll(new JsrDecisionParser().parse(child, parserContext, flowName));
|
||||
} else if(nodeName.equals(FLOW_ELE)) {
|
||||
stateTransitions.addAll(parseFlow(child, parserContext, builder));
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public class FlowParser extends AbstractFlowParser {
|
||||
if (status.isEnd()) {
|
||||
|
||||
BeanDefinitionBuilder endBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition("org.springframework.batch.core.jsr.job.flow.support.state.EndState");
|
||||
.genericBeanDefinition("org.springframework.batch.core.jsr.job.flow.support.state.JsrEndState");
|
||||
|
||||
boolean exitCodeExists = StringUtils.hasText(exitCode);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.Collection;
|
||||
|
||||
import org.springframework.batch.core.job.flow.JobExecutionDecider;
|
||||
import org.springframework.batch.core.jsr.configuration.support.BatchArtifact;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.StepState;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.JsrStepState;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
|
||||
@@ -37,7 +37,7 @@ import org.w3c.dom.Element;
|
||||
* @author Chris Schaefer
|
||||
* @since 3.0
|
||||
*/
|
||||
public class DecisionParser {
|
||||
public class JsrDecisionParser {
|
||||
|
||||
private static final String ID_ATTRIBUTE = "id";
|
||||
private static final String REF_ATTRIBUTE = "ref";
|
||||
@@ -47,7 +47,7 @@ public class DecisionParser {
|
||||
AbstractBeanDefinition factoryDefinition = factoryBuilder.getRawBeanDefinition();
|
||||
factoryDefinition.setBeanClass(DecisionStepFactoryBean.class);
|
||||
|
||||
BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder.genericBeanDefinition(StepState.class);
|
||||
BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder.genericBeanDefinition(JsrStepState.class);
|
||||
|
||||
String idAttribute = element.getAttribute(ID_ATTRIBUTE);
|
||||
|
||||
@@ -17,10 +17,10 @@ package org.springframework.batch.core.jsr.configuration.xml;
|
||||
|
||||
import org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean;
|
||||
import org.springframework.batch.core.job.flow.State;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.StepState;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.JsrStepState;
|
||||
|
||||
/**
|
||||
* Extension to the {@link SimpleFlowFactoryBean} that provides {@link StepState}
|
||||
* Extension to the {@link SimpleFlowFactoryBean} that provides {@link org.springframework.batch.core.jsr.job.flow.support.state.JsrStepState}
|
||||
* implementations for JSR-352 based jobs.
|
||||
*
|
||||
* @author Michael Minella
|
||||
@@ -34,6 +34,6 @@ public class JsrFlowFactoryBean extends SimpleFlowFactoryBean {
|
||||
@Override
|
||||
protected State createNewStepState(State state, String oldName,
|
||||
String stateName) {
|
||||
return new StepState(stateName, ((StepState) state).getStep(oldName));
|
||||
return new JsrStepState(stateName, ((JsrStepState) state).getStep(oldName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JobListenerFactoryBean extends org.springframework.batch.core.listener.JobListenerFactoryBean {
|
||||
public class JsrJobListenerFactoryBean extends org.springframework.batch.core.listener.JobListenerFactoryBean {
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
@@ -16,7 +16,7 @@
|
||||
package org.springframework.batch.core.jsr.configuration.xml;
|
||||
|
||||
import org.springframework.batch.core.configuration.xml.CoreNamespaceUtils;
|
||||
import org.springframework.batch.core.jsr.StepContextFactoryBean;
|
||||
import org.springframework.batch.core.jsr.JsrStepContextFactoryBean;
|
||||
import org.springframework.batch.core.jsr.configuration.support.BatchArtifact;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
@@ -34,7 +34,7 @@ import org.w3c.dom.Element;
|
||||
* @author Chris Schaefer
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
public class JsrJobParser extends AbstractSingleBeanDefinitionParser {
|
||||
private static final String ID_ATTRIBUTE = "id";
|
||||
private static final String RESTARTABLE_ATTRIBUTE = "restartable";
|
||||
|
||||
@@ -66,13 +66,13 @@ public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
BeanDefinition flowDef = new FlowParser(jobName, jobName).parse(element, parserContext);
|
||||
builder.addPropertyValue("flow", flowDef);
|
||||
|
||||
AbstractBeanDefinition stepContextBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(StepContextFactoryBean.class)
|
||||
AbstractBeanDefinition stepContextBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(JsrStepContextFactoryBean.class)
|
||||
.getBeanDefinition();
|
||||
|
||||
stepContextBeanDefinition.setScope("step");
|
||||
|
||||
parserContext.getRegistry().registerBeanDefinition("stepContextFactory", stepContextBeanDefinition);
|
||||
|
||||
new ListenerParser(JobListenerFactoryBean.class, "jobExecutionListeners").parseListeners(element, parserContext, builder);
|
||||
new ListenerParser(JsrJobListenerFactoryBean.class, "jobExecutionListeners").parseListeners(element, parserContext, builder);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class JsrNamespaceHandler extends NamespaceHandlerSupport {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.registerBeanDefinitionParser("job", new JobParser());
|
||||
this.registerBeanDefinitionParser("job", new JsrJobParser());
|
||||
this.registerBeanDefinitionParser("batch-artifacts", new BatchParser());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ import org.w3c.dom.Element;
|
||||
* @author Chris Schaefer
|
||||
* @since 3.0
|
||||
*/
|
||||
public class SplitParser {
|
||||
public class JsrSplitParser {
|
||||
private static final String TASK_EXECUTOR_PROPERTY_NAME = "taskExecutor";
|
||||
private static final String JSR_352_SPLIT_TASK_EXECUTOR_BEAN_NAME = "jsr352splitTaskExecutor";
|
||||
|
||||
private String jobFactoryRef;
|
||||
|
||||
public SplitParser(String jobFactoryRef) {
|
||||
public JsrSplitParser(String jobFactoryRef) {
|
||||
this.jobFactoryRef = jobFactoryRef;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SplitParser {
|
||||
String idAttribute = element.getAttribute("id");
|
||||
|
||||
BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition("org.springframework.batch.core.jsr.job.flow.support.state.SplitState");
|
||||
.genericBeanDefinition("org.springframework.batch.core.jsr.job.flow.support.state.JsrSplitState");
|
||||
|
||||
List<Element> flowElements = DomUtils.getChildElementsByTagName(element, "flow");
|
||||
|
||||
@@ -124,11 +124,11 @@ public class ListenerParser {
|
||||
}
|
||||
|
||||
private boolean isLazyInit() {
|
||||
return listenerType == JobListenerFactoryBean.class;
|
||||
return listenerType == JsrJobListenerFactoryBean.class;
|
||||
}
|
||||
|
||||
private String getListenerScope() {
|
||||
if (listenerType == JobListenerFactoryBean.class) {
|
||||
if (listenerType == JsrJobListenerFactoryBean.class) {
|
||||
return SCOPE_JOB;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.batch.core.jsr.configuration.xml;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.batch.core.jsr.configuration.support.BatchArtifact;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.StepState;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.JsrStepState;
|
||||
import org.springframework.batch.core.listener.StepListenerFactoryBean;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
@@ -54,7 +54,7 @@ public class StepParser extends AbstractSingleBeanDefinitionParser {
|
||||
bd.setBeanClass(StepFactoryBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("batchPropertyContext", new RuntimeBeanReference("batchPropertyContext"));
|
||||
|
||||
BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder.genericBeanDefinition(StepState.class);
|
||||
BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder.genericBeanDefinition(JsrStepState.class);
|
||||
|
||||
String stepName = element.getAttribute(SPLIT_ID_ATTRIBUTE);
|
||||
builder.addPropertyValue("name", stepName);
|
||||
|
||||
@@ -40,16 +40,16 @@ import org.springframework.util.StringUtils;
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
*/
|
||||
public class DefaultStepHandler extends SimpleStepHandler {
|
||||
public class JsrStepHandler extends SimpleStepHandler {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DefaultStepHandler.class);
|
||||
private static final Log logger = LogFactory.getLog(JsrStepHandler.class);
|
||||
|
||||
private JobExplorer jobExplorer;
|
||||
|
||||
/**
|
||||
* @param jobRepository
|
||||
*/
|
||||
public DefaultStepHandler(JobRepository jobRepository, JobExplorer jobExplorer) {
|
||||
public JsrStepHandler(JobRepository jobRepository, JobExplorer jobExplorer) {
|
||||
super(jobRepository, new ExecutionContext());
|
||||
this.jobExplorer = jobExplorer;
|
||||
}
|
||||
@@ -29,9 +29,9 @@ import org.springframework.batch.core.job.flow.FlowJob;
|
||||
import org.springframework.batch.core.job.flow.JobFlowExecutor;
|
||||
import org.springframework.batch.core.job.flow.State;
|
||||
import org.springframework.batch.core.job.flow.support.state.FlowState;
|
||||
import org.springframework.batch.core.jsr.job.DefaultStepHandler;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.DefaultFlow;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.StepState;
|
||||
import org.springframework.batch.core.jsr.job.JsrStepHandler;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.JsrFlow;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.JsrStepState;
|
||||
import org.springframework.batch.core.jsr.step.DecisionStep;
|
||||
import org.springframework.batch.core.launch.NoSuchJobException;
|
||||
import org.springframework.batch.core.launch.support.ExitCodeMapper;
|
||||
@@ -73,9 +73,9 @@ public class JsrFlowJob extends FlowJob {
|
||||
protected void doExecute(final JobExecution execution) throws JobExecutionException {
|
||||
try {
|
||||
JobFlowExecutor executor = new JsrFlowExecutor(getJobRepository(),
|
||||
new DefaultStepHandler(getJobRepository(), jobExplorer), execution);
|
||||
new JsrStepHandler(getJobRepository(), jobExplorer), execution);
|
||||
|
||||
State startState = ((DefaultFlow)flow).getStartState();
|
||||
State startState = ((JsrFlow)flow).getStartState();
|
||||
|
||||
validateFirstStep(startState);
|
||||
|
||||
@@ -94,9 +94,9 @@ public class JsrFlowJob extends FlowJob {
|
||||
while(true) {
|
||||
if(startState instanceof DelegateState) {
|
||||
startState = ((DelegateState) startState).getState();
|
||||
} else if(startState instanceof StepState) {
|
||||
} else if(startState instanceof JsrStepState) {
|
||||
String stepName = startState.getName().substring(startState.getName().indexOf(".") + 1, startState.getName().length());
|
||||
Step step = ((StepState) startState).getStep(stepName);
|
||||
Step step = ((JsrStepState) startState).getStep(stepName);
|
||||
if(step instanceof DecisionStep) {
|
||||
throw new JobExecutionException("Decision step is an invalid first step");
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.batch.core.job.flow.FlowExecutionStatus;
|
||||
import org.springframework.batch.core.job.flow.State;
|
||||
import org.springframework.batch.core.job.flow.support.SimpleFlow;
|
||||
import org.springframework.batch.core.job.flow.support.StateTransition;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.StepState;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.JsrStepState;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -41,14 +41,14 @@ import org.springframework.util.StringUtils;
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
*/
|
||||
public class DefaultFlow extends SimpleFlow {
|
||||
public class JsrFlow extends SimpleFlow {
|
||||
|
||||
private StepState currentStep;
|
||||
private JsrStepState currentStep;
|
||||
|
||||
/**
|
||||
* @param name name of the flow
|
||||
*/
|
||||
public DefaultFlow(String name) {
|
||||
public JsrFlow(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ public class DefaultFlow extends SimpleFlow {
|
||||
state = ((DelegateState) state).getState();
|
||||
}
|
||||
|
||||
if(state instanceof StepState) {
|
||||
currentStep = (StepState) state;
|
||||
if(state instanceof JsrStepState) {
|
||||
currentStep = (JsrStepState) state;
|
||||
}
|
||||
|
||||
return super.isFlowContinued(state, status, stepExecution);
|
||||
@@ -32,7 +32,7 @@ import org.springframework.batch.item.ExecutionContext;
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
*/
|
||||
public class EndState extends org.springframework.batch.core.job.flow.support.state.EndState {
|
||||
public class JsrEndState extends org.springframework.batch.core.job.flow.support.state.EndState {
|
||||
|
||||
private JobRepository jobRepository;
|
||||
private String restart;
|
||||
@@ -41,7 +41,7 @@ public class EndState extends org.springframework.batch.core.job.flow.support.st
|
||||
* @param status The {@link FlowExecutionStatus} to end with
|
||||
* @param name The name of the state
|
||||
*/
|
||||
public EndState(FlowExecutionStatus status, String name) {
|
||||
public JsrEndState(FlowExecutionStatus status, String name) {
|
||||
super(status, status.getName(), name);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class EndState extends org.springframework.batch.core.job.flow.support.st
|
||||
* @param status The {@link FlowExecutionStatus} to end with
|
||||
* @param name The name of the state
|
||||
*/
|
||||
public EndState(FlowExecutionStatus status, String code, String name) {
|
||||
public JsrEndState(FlowExecutionStatus status, String code, String name) {
|
||||
super(status, code, name, false);
|
||||
}
|
||||
|
||||
@@ -60,11 +60,11 @@ public class EndState extends org.springframework.batch.core.job.flow.support.st
|
||||
* marked as abandoned (if there is one)
|
||||
*
|
||||
*/
|
||||
public EndState(FlowExecutionStatus status, String code, String name, boolean abandon) {
|
||||
public JsrEndState(FlowExecutionStatus status, String code, String name, boolean abandon) {
|
||||
super(status, code, name, abandon);
|
||||
}
|
||||
|
||||
public EndState(FlowExecutionStatus status, String code, String name, String restart, boolean abandon, JobRepository jobRepository) {
|
||||
public JsrEndState(FlowExecutionStatus status, String code, String name, String restart, boolean abandon, JobRepository jobRepository) {
|
||||
super(status, code, name, abandon);
|
||||
this.jobRepository = jobRepository;
|
||||
this.restart = restart;
|
||||
@@ -24,7 +24,7 @@ import org.springframework.batch.core.job.flow.Flow;
|
||||
import org.springframework.batch.core.job.flow.FlowExecution;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionStatus;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutor;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.DefaultFlow;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.JsrFlow;
|
||||
|
||||
/**
|
||||
* JSR-352 states that artifacts cannot set the ExitStatus from within a split for a job. Because
|
||||
@@ -34,13 +34,13 @@ import org.springframework.batch.core.jsr.job.flow.support.DefaultFlow;
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
*/
|
||||
public class SplitState extends org.springframework.batch.core.job.flow.support.state.SplitState {
|
||||
public class JsrSplitState extends org.springframework.batch.core.job.flow.support.state.SplitState {
|
||||
|
||||
/**
|
||||
* @param flows {@link Flow}s to be executed in parallel
|
||||
* @param name
|
||||
*/
|
||||
public SplitState(Collection<Flow> flows, String name) {
|
||||
public JsrSplitState(Collection<Flow> flows, String name) {
|
||||
super(flows, name);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SplitState extends org.springframework.batch.core.job.flow.support.
|
||||
List<String> stepNames = new ArrayList<String>();
|
||||
|
||||
for (Flow curFlow : getFlows()) {
|
||||
DefaultFlow flow = (DefaultFlow) curFlow;
|
||||
JsrFlow flow = (JsrFlow) curFlow;
|
||||
if(flow.getMostRecentStepName() != null) {
|
||||
stepNames.add(flow.getMostRecentStepName());
|
||||
}
|
||||
@@ -28,12 +28,12 @@ import org.springframework.batch.core.job.flow.FlowExecutor;
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
*/
|
||||
public class StepState extends org.springframework.batch.core.job.flow.support.state.StepState {
|
||||
public class JsrStepState extends org.springframework.batch.core.job.flow.support.state.StepState {
|
||||
|
||||
/**
|
||||
* @param step the step that will be executed
|
||||
*/
|
||||
public StepState(Step step) {
|
||||
public JsrStepState(Step step) {
|
||||
super(step);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class StepState extends org.springframework.batch.core.job.flow.support.s
|
||||
* @param name for the step that will be executed
|
||||
* @param step the step that will be executed
|
||||
*/
|
||||
public StepState(String name, Step step) {
|
||||
public JsrStepState(String name, Step step) {
|
||||
super(name, step);
|
||||
}
|
||||
|
||||
@@ -54,8 +54,10 @@ import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.DuplicateJobException;
|
||||
import org.springframework.batch.core.converter.JobParametersConverter;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.jsr.JobContextFactoryBean;
|
||||
import org.springframework.batch.core.jsr.JsrJobContextFactoryBean;
|
||||
import org.springframework.batch.core.jsr.JsrJobExecution;
|
||||
import org.springframework.batch.core.jsr.JsrJobParametersConverter;
|
||||
import org.springframework.batch.core.jsr.JsrStepExecution;
|
||||
import org.springframework.batch.core.jsr.configuration.xml.JsrXmlApplicationContext;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.scope.context.StepSynchronizationManager;
|
||||
@@ -255,7 +257,7 @@ public class JsrJobOperator implements JobOperator, InitializingBean {
|
||||
throw new NoSuchJobExecutionException("No execution was found for executionId " + executionId);
|
||||
}
|
||||
|
||||
return new org.springframework.batch.core.jsr.JobExecution(jobExecution, jobParametersConverter);
|
||||
return new JsrJobExecution(jobExecution, jobParametersConverter);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -277,7 +279,7 @@ public class JsrJobOperator implements JobOperator, InitializingBean {
|
||||
|
||||
List<JobExecution> results = new ArrayList<JobExecution>(batchExecutions.size());
|
||||
for (org.springframework.batch.core.JobExecution jobExecution : batchExecutions) {
|
||||
results.add(new org.springframework.batch.core.jsr.JobExecution(jobExecution, jobParametersConverter));
|
||||
results.add(new JsrJobExecution(jobExecution, jobParametersConverter));
|
||||
}
|
||||
|
||||
return results;
|
||||
@@ -398,7 +400,7 @@ public class JsrJobOperator implements JobOperator, InitializingBean {
|
||||
if(executions != null) {
|
||||
for (org.springframework.batch.core.StepExecution stepExecution : executions) {
|
||||
if(!stepExecution.getStepName().contains(":partition")) {
|
||||
batchExecutions.add(new org.springframework.batch.core.jsr.StepExecution(jobExplorer.getStepExecution(executionId, stepExecution.getId())));
|
||||
batchExecutions.add(new JsrStepExecution(jobExplorer.getStepExecution(executionId, stepExecution.getId())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -465,7 +467,7 @@ public class JsrJobOperator implements JobOperator, InitializingBean {
|
||||
batchContext.load(jobXml);
|
||||
}
|
||||
|
||||
AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition("org.springframework.batch.core.jsr.JobContextFactoryBean").getBeanDefinition();
|
||||
AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition("org.springframework.batch.core.jsr.JsrJobContextFactoryBean").getBeanDefinition();
|
||||
beanDefinition.setScope(BeanDefinition.SCOPE_SINGLETON);
|
||||
batchContext.registerBeanDefinition(JSR_JOB_CONTEXT_BEAN_NAME, beanDefinition);
|
||||
|
||||
@@ -495,9 +497,9 @@ public class JsrJobOperator implements JobOperator, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
JobContextFactoryBean factoryBean = null;
|
||||
JsrJobContextFactoryBean factoryBean = null;
|
||||
try {
|
||||
factoryBean = (JobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
|
||||
factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
|
||||
factoryBean.setJobExecution(jobExecution);
|
||||
final Job job = batchContext.getBean(Job.class);
|
||||
|
||||
@@ -597,7 +599,7 @@ public class JsrJobOperator implements JobOperator, InitializingBean {
|
||||
batchContext.load(jobXml);
|
||||
}
|
||||
|
||||
AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition("org.springframework.batch.core.jsr.JobContextFactoryBean").getBeanDefinition();
|
||||
AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition("org.springframework.batch.core.jsr.JsrJobContextFactoryBean").getBeanDefinition();
|
||||
beanDefinition.setScope(BeanDefinition.SCOPE_SINGLETON);
|
||||
batchContext.registerBeanDefinition(JSR_JOB_CONTEXT_BEAN_NAME, beanDefinition);
|
||||
|
||||
@@ -636,9 +638,9 @@ public class JsrJobOperator implements JobOperator, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
JobContextFactoryBean factoryBean = null;
|
||||
JsrJobContextFactoryBean factoryBean = null;
|
||||
try {
|
||||
factoryBean = (JobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
|
||||
factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
|
||||
factoryBean.setJobExecution(jobExecution);
|
||||
final Job job = batchContext.getBean(Job.class);
|
||||
semaphore.release();
|
||||
|
||||
@@ -24,6 +24,7 @@ import javax.batch.api.Decider;
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.jsr.JsrStepExecution;
|
||||
import org.springframework.batch.core.step.AbstractStep;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
|
||||
@@ -58,7 +59,7 @@ public class DecisionStep extends AbstractStep {
|
||||
|
||||
for (String stepName : stepNames) {
|
||||
StepExecution curStepExecution = getJobRepository().getLastStepExecution(stepExecution.getJobExecution().getJobInstance(), stepName);
|
||||
stepExecutions.add(new org.springframework.batch.core.jsr.StepExecution(curStepExecution));
|
||||
stepExecutions.add(new JsrStepExecution(curStepExecution));
|
||||
}
|
||||
} else {
|
||||
Collection<StepExecution> currentRunStepExecutions = stepExecution.getJobExecution().getStepExecutions();
|
||||
@@ -72,7 +73,7 @@ public class DecisionStep extends AbstractStep {
|
||||
}
|
||||
}
|
||||
|
||||
stepExecutions.add(new org.springframework.batch.core.jsr.StepExecution(lastExecution));
|
||||
stepExecutions.add(new JsrStepExecution(lastExecution));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,15 +39,15 @@ import org.springframework.beans.factory.FactoryBeanNotInitializedException;
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
|
||||
public class JobContextFactoryBeanTests {
|
||||
public class JsrJobContextFactoryBeanTests {
|
||||
|
||||
private JobContextFactoryBean factoryBean;
|
||||
private JsrJobContextFactoryBean factoryBean;
|
||||
private BatchPropertyContext propertyContext;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
propertyContext = new BatchPropertyContext();
|
||||
factoryBean = new JobContextFactoryBean();
|
||||
factoryBean = new JsrJobContextFactoryBean();
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -32,9 +32,9 @@ import org.springframework.batch.core.JobInstance;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
|
||||
public class JobContextTests {
|
||||
public class JsrJobContextTests {
|
||||
|
||||
private JobContext context;
|
||||
private JsrJobContext context;
|
||||
@Mock
|
||||
private JobExecution execution;
|
||||
@Mock
|
||||
@@ -47,7 +47,7 @@ public class JobContextTests {
|
||||
Properties properties = new Properties();
|
||||
properties.put("jobLevelProperty1", "jobLevelValue1");
|
||||
|
||||
context = new JobContext();
|
||||
context = new JsrJobContext();
|
||||
context.setProperties(properties);
|
||||
context.setJobExecution(execution);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class JobContextTests {
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testCreateWithNull() {
|
||||
context = new JobContext();
|
||||
context = new JsrJobContext();
|
||||
context.setJobExecution(null);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.core.converter.JobParametersConverterSupport;
|
||||
|
||||
public class JobExecutionTests {
|
||||
public class JsrJobExecutionTests {
|
||||
|
||||
private JobExecution adapter;
|
||||
private JsrJobExecution adapter;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@@ -36,12 +36,12 @@ public class JobExecutionTests {
|
||||
execution.setStatus(BatchStatus.FAILED);
|
||||
execution.setVersion(21);
|
||||
|
||||
adapter = new JobExecution(execution, new JobParametersConverterSupport());
|
||||
adapter = new JsrJobExecution(execution, new JobParametersConverterSupport());
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testCreateWithNull() {
|
||||
adapter = new JobExecution(null, new JobParametersConverterSupport());
|
||||
adapter = new JsrJobExecution(null, new JobParametersConverterSupport());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -28,9 +28,9 @@ import org.springframework.beans.factory.FactoryBeanNotInitializedException;
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
|
||||
public class StepContextFactoryBeanTests {
|
||||
public class JsrStepContextFactoryBeanTests {
|
||||
|
||||
private StepContextFactoryBean factory;
|
||||
private JsrStepContextFactoryBean factory;
|
||||
@Mock
|
||||
private BatchPropertyContext propertyContext;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class StepContextFactoryBeanTests {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
factory = new StepContextFactoryBean();
|
||||
factory = new JsrStepContextFactoryBean();
|
||||
factory.setBatchPropertyContext(propertyContext);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import static org.junit.Assert.fail;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.batch.runtime.Metric;
|
||||
import javax.batch.runtime.context.StepContext;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -35,12 +36,12 @@ import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.util.ExecutionContextUserSupport;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
public class StepContextTests {
|
||||
public class JsrStepContextTests {
|
||||
|
||||
private StepExecution stepExecution;
|
||||
private StepContext stepContext;
|
||||
private ExecutionContext executionContext;
|
||||
private ExecutionContextUserSupport executionContextUserSupport = new ExecutionContextUserSupport(ClassUtils.getShortName(StepContext.class));
|
||||
private ExecutionContextUserSupport executionContextUserSupport = new ExecutionContextUserSupport(ClassUtils.getShortName(JsrStepContext.class));
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@@ -64,7 +65,7 @@ public class StepContextTests {
|
||||
Properties properties = new Properties();
|
||||
properties.put("key", "value");
|
||||
|
||||
stepContext = new StepContext(stepExecution, properties);
|
||||
stepContext = new JsrStepContext(stepExecution, properties);
|
||||
stepContext.setTransientUserData("This is my transient data");
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.item.util.ExecutionContextUserSupport;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
public class StepExecutionTests {
|
||||
public class JsrStepExecutionTests {
|
||||
|
||||
private StepExecution stepExecution;
|
||||
private javax.batch.runtime.StepExecution jsrStepExecution;
|
||||
//The API that sets the persisted user data is on the StepContext so the key within the ExecutionContext is StepContext
|
||||
private ExecutionContextUserSupport executionContextUserSupport = new ExecutionContextUserSupport(ClassUtils.getShortName(StepContext.class));
|
||||
//The API that sets the persisted user data is on the JsrStepContext so the key within the ExecutionContext is JsrStepContext
|
||||
private ExecutionContextUserSupport executionContextUserSupport = new ExecutionContextUserSupport(ClassUtils.getShortName(JsrStepContext.class));
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@@ -45,12 +45,12 @@ public class StepExecutionTests {
|
||||
stepExecution.setEndTime(new Date(10000000));
|
||||
stepExecution.getExecutionContext().put(executionContextUserSupport.getKey("batch_jsr_persistentUserData"), "persisted data");
|
||||
|
||||
jsrStepExecution = new org.springframework.batch.core.jsr.StepExecution(stepExecution);
|
||||
jsrStepExecution = new JsrStepExecution(stepExecution);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testWithNullStepExecution() {
|
||||
new org.springframework.batch.core.jsr.StepExecution(null);
|
||||
new JsrStepExecution(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -32,7 +32,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class DecisionParsingTests {
|
||||
public class JsrDecisionParsingTests {
|
||||
|
||||
@Autowired
|
||||
public Job job;
|
||||
@@ -39,14 +39,14 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
|
||||
public class SplitParsingTests {
|
||||
public class JsrSplitParsingTests {
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
javax.batch.runtime.JobExecution execution = runJob("SplitParsingTests-context", null, 10000l);
|
||||
javax.batch.runtime.JobExecution execution = runJob("JsrSplitParsingTests-context", null, 10000l);
|
||||
assertEquals(javax.batch.runtime.BatchStatus.COMPLETED, execution.getBatchStatus());
|
||||
assertEquals("COMPLETED", execution.getExitStatus());
|
||||
|
||||
@@ -70,7 +70,7 @@ public class SplitParsingTests {
|
||||
public void testUserSpecifiedTaskExecutor() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/org/springframework/batch/core/jsr/configuration/xml/user-specified-split-task-executor-context.xml");
|
||||
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) context.getBeanFactory();
|
||||
PropertyValue propertyValue = new SplitParser(null).getSplitTaskExecutorPropertyValue(registry);
|
||||
PropertyValue propertyValue = new JsrSplitParser(null).getSplitTaskExecutorPropertyValue(registry);
|
||||
|
||||
RuntimeBeanReference runtimeBeanReferenceValue = (RuntimeBeanReference) propertyValue.getValue();
|
||||
|
||||
@@ -82,7 +82,7 @@ public class SplitParsingTests {
|
||||
public void testDefaultTaskExecutor() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/org/springframework/batch/core/jsr/configuration/xml/default-split-task-executor-context.xml");
|
||||
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) context.getBeanFactory();
|
||||
PropertyValue propertyValue = new SplitParser(null).getSplitTaskExecutorPropertyValue(registry);
|
||||
PropertyValue propertyValue = new JsrSplitParser(null).getSplitTaskExecutorPropertyValue(registry);
|
||||
Assert.assertTrue("Task executor not an instance of SimpleAsyncTaskExecutor" , (propertyValue.getValue() instanceof SimpleAsyncTaskExecutor));
|
||||
context.close();
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class ListenerParserTests {
|
||||
|
||||
applicationContext.registerBeanDefinition("jobListener", newBeanDefinition);
|
||||
|
||||
ListenerParser listenerParser = new ListenerParser(JobListenerFactoryBean.class, "jobExecutionListeners");
|
||||
ListenerParser listenerParser = new ListenerParser(JsrJobListenerFactoryBean.class, "jobExecutionListeners");
|
||||
listenerParser.applyListenerScope("jobListener", applicationContext);
|
||||
|
||||
BeanDefinition beanDefinition = applicationContext.getBeanDefinition("jobListener");
|
||||
|
||||
@@ -52,7 +52,8 @@ import org.springframework.batch.core.job.flow.support.state.EndState;
|
||||
import org.springframework.batch.core.job.flow.support.state.FlowState;
|
||||
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.jsr.job.flow.support.DefaultFlow;
|
||||
import org.springframework.batch.core.jsr.JsrStepExecution;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.JsrFlow;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.dao.JobExecutionDao;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
@@ -94,7 +95,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetSteps() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
|
||||
@@ -108,7 +109,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testTwoSteps() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
StepState step2 = new StepState(new StubStep("step2"));
|
||||
@@ -127,7 +128,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testFailedStep() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StateSupport("step1", FlowExecutionStatus.FAILED),
|
||||
"step2"));
|
||||
@@ -148,7 +149,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testFailedStepRestarted() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
State step2State = new StateSupport("step2") {
|
||||
@@ -186,7 +187,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testStoppingStep() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
State state2 = new StateSupport("step2", FlowExecutionStatus.FAILED);
|
||||
@@ -207,7 +208,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testInterrupted() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
|
||||
@Override
|
||||
@@ -230,7 +231,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testUnknownStatusStopsJob() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
|
||||
@Override
|
||||
@@ -255,9 +256,9 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testInterruptedSplit() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow1 = new DefaultFlow("flow1");
|
||||
SimpleFlow flow2 = new DefaultFlow("flow2");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
SimpleFlow flow1 = new JsrFlow("flow1");
|
||||
SimpleFlow flow2 = new JsrFlow("flow2");
|
||||
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
|
||||
@@ -301,7 +302,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testInterruptedException() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
|
||||
@Override
|
||||
@@ -323,9 +324,9 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testInterruptedSplitException() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow1 = new DefaultFlow("flow1");
|
||||
SimpleFlow flow2 = new DefaultFlow("flow2");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
SimpleFlow flow1 = new JsrFlow("flow1");
|
||||
SimpleFlow flow2 = new JsrFlow("flow2");
|
||||
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
|
||||
@@ -358,7 +359,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testEndStateStopped() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "end"));
|
||||
transitions.add(StateTransition
|
||||
@@ -377,7 +378,7 @@ public class JsrFlowJobTests {
|
||||
}
|
||||
|
||||
public void testEndStateFailed() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "end"));
|
||||
transitions
|
||||
@@ -398,7 +399,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testEndStateStoppedWithRestart() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "end"));
|
||||
transitions.add(StateTransition
|
||||
@@ -426,7 +427,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testBranching() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
StepState step1 = new StepState(new StubStep("step1"));
|
||||
transitions.add(StateTransition.createStateTransition(step1, "step2"));
|
||||
@@ -452,7 +453,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testBasicFlow() throws Throwable {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step")), "end0"));
|
||||
transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
|
||||
@@ -468,7 +469,7 @@ public class JsrFlowJobTests {
|
||||
@Test
|
||||
public void testDecisionFlow() throws Throwable {
|
||||
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
Decider decider = new Decider() {
|
||||
|
||||
@Override
|
||||
@@ -512,7 +513,7 @@ public class JsrFlowJobTests {
|
||||
@Test
|
||||
public void testDecisionFlowWithExceptionInDecider() throws Throwable {
|
||||
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
JobExecutionDecider decider = new JobExecutionDecider() {
|
||||
@Override
|
||||
public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) {
|
||||
@@ -555,7 +556,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepExists() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
|
||||
@@ -572,7 +573,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepExistsWithPrefix() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState("job.step", new StubStep("step")), "end0"));
|
||||
transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
|
||||
@@ -589,7 +590,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepNamesWithPrefix() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState("job.step", new StubStep("step")), "end0"));
|
||||
transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
|
||||
@@ -604,7 +605,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepNotExists() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
|
||||
@@ -620,7 +621,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepNotStepState() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
|
||||
@@ -636,14 +637,14 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepNestedFlow() throws Exception {
|
||||
SimpleFlow nested = new DefaultFlow("nested");
|
||||
SimpleFlow nested = new JsrFlow("nested");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end1"));
|
||||
transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end1")));
|
||||
nested.setStateTransitions(transitions);
|
||||
nested.afterPropertiesSet();
|
||||
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "nested"));
|
||||
transitions.add(StateTransition.createStateTransition(new FlowState(nested, "nested"), "end0"));
|
||||
@@ -660,9 +661,9 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepSplitFlow() throws Exception {
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow1 = new DefaultFlow("flow1");
|
||||
SimpleFlow flow2 = new DefaultFlow("flow2");
|
||||
SimpleFlow flow = new JsrFlow("job");
|
||||
SimpleFlow flow1 = new JsrFlow("flow1");
|
||||
SimpleFlow flow2 = new JsrFlow("flow2");
|
||||
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "end0"));
|
||||
@@ -725,7 +726,7 @@ public class JsrFlowJobTests {
|
||||
public void execute(StepExecution stepExecution) throws JobInterruptedException {
|
||||
stepExecution.setStatus(BatchStatus.COMPLETED);
|
||||
try {
|
||||
stepExecution.setExitStatus(new ExitStatus(decider.decide(new javax.batch.runtime.StepExecution [] {new org.springframework.batch.core.jsr.StepExecution(stepExecution)})));
|
||||
stepExecution.setExitStatus(new ExitStatus(decider.decide(new javax.batch.runtime.StepExecution [] {new JsrStepExecution(stepExecution)})));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ import org.springframework.batch.core.job.flow.support.JobFlowExecutorSupport;
|
||||
import org.springframework.batch.core.job.flow.support.SimpleFlowTests;
|
||||
import org.springframework.batch.core.job.flow.support.StateTransition;
|
||||
|
||||
public class DefaultFlowTests extends SimpleFlowTests {
|
||||
public class JsrFlowTests extends SimpleFlowTests {
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() {
|
||||
flow = new DefaultFlow("flow1");
|
||||
flow = new JsrFlow("flow1");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -26,11 +26,11 @@ import org.junit.Test;
|
||||
import org.springframework.batch.core.jsr.JsrTestUtils;
|
||||
|
||||
/**
|
||||
* Tests for the JSR-352 version of {@link EndState}
|
||||
* Tests for the JSR-352 version of {@link JsrEndState}
|
||||
*
|
||||
* @author Michael Minella
|
||||
*/
|
||||
public class EndStateTests {
|
||||
public class JsrEndStateTests {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@@ -9,17 +9,17 @@
|
||||
|
||||
<job id="job1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1" next="step2">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.SplitParsingTests$ExitStatusSettingBatchlet"/>
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.JsrSplitParsingTests$ExitStatusSettingBatchlet"/>
|
||||
</step>
|
||||
<split id="step2" next="step3">
|
||||
<flow id="step2a">
|
||||
<step id="step2aStep1">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.SplitParsingTests$ExitStatusSettingBatchlet"/>
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.JsrSplitParsingTests$ExitStatusSettingBatchlet"/>
|
||||
</step>
|
||||
</flow>
|
||||
<flow id="step2b">
|
||||
<step id="step2bStep1" next="step2bStep2">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.SplitParsingTests$ExitStatusSettingBatchlet"/>
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.JsrSplitParsingTests$ExitStatusSettingBatchlet"/>
|
||||
</step>
|
||||
<step id="step2bStep2">
|
||||
<chunk checkpoint-policy="item" item-count="3">
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<job id="job" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.job.flow.support.state.EndStateTests$EndStateBatchlet"/>
|
||||
<batchlet ref="org.springframework.batch.core.jsr.job.flow.support.state.JsrEndStateTests$EndStateBatchlet"/>
|
||||
<next on="UNUSED" to="step2"/>
|
||||
<end on="GOOD" exit-status="SUCCESS"/>
|
||||
<fail on="UNUSED"/>
|
||||
</step>
|
||||
<step id="step2">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.job.flow.support.state.EndStateTests$EndStateBatchlet"/>
|
||||
<batchlet ref="org.springframework.batch.core.jsr.job.flow.support.state.JsrEndStateTests$EndStateBatchlet"/>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jsrDecider" class="org.springframework.batch.core.jsr.configuration.xml.DecisionParsingTests.JsrDecider"/>
|
||||
<bean id="jsrDecider" class="org.springframework.batch.core.jsr.configuration.xml.JsrDecisionParsingTests.JsrDecider"/>
|
||||
|
||||
<bean id="step1Ref" class="org.springframework.batch.core.step.tasklet.TaskletSupport"/>
|
||||
</beans>
|
||||
Reference in New Issue
Block a user