Updated to correctly handle state management on restarts per JSR-352
* Added a JSR-352 specific StepHandler implementation (DefaultStepHandler) * Added logic to DefaultFlow to correctly lookup where to restart a job that was previously stopped.
This commit is contained in:
@@ -79,6 +79,13 @@ public class SimpleStepHandler implements StepHandler, InitializingBean {
|
||||
Assert.state(jobRepository != null, "A JobRepository must be provided");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the used jobRepository
|
||||
*/
|
||||
protected JobRepository getJobRepository() {
|
||||
return this.jobRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jobRepository the jobRepository to set
|
||||
*/
|
||||
@@ -116,7 +123,7 @@ public class SimpleStepHandler implements StepHandler, InitializingBean {
|
||||
}
|
||||
StepExecution currentStepExecution = lastStepExecution;
|
||||
|
||||
if (shouldStart(lastStepExecution, jobInstance, step)) {
|
||||
if (shouldStart(lastStepExecution, execution, step)) {
|
||||
|
||||
currentStepExecution = execution.createStepExecution(step.getName());
|
||||
|
||||
@@ -184,7 +191,7 @@ public class SimpleStepHandler implements StepHandler, InitializingBean {
|
||||
* @throws JobRestartException if the job is in an inconsistent state from
|
||||
* an earlier failure
|
||||
*/
|
||||
private boolean shouldStart(StepExecution lastStepExecution, JobInstance jobInstance, Step step)
|
||||
protected boolean shouldStart(StepExecution lastStepExecution, JobExecution jobExecution, Step step)
|
||||
throws JobRestartException, StartLimitExceededException {
|
||||
|
||||
BatchStatus stepStatus;
|
||||
@@ -209,7 +216,7 @@ public class SimpleStepHandler implements StepHandler, InitializingBean {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (jobRepository.getStepExecutionCount(jobInstance, step.getName()) < step.getStartLimit()) {
|
||||
if (jobRepository.getStepExecutionCount(jobExecution.getJobInstance(), step.getName()) < step.getStartLimit()) {
|
||||
// step start count is less than start max, return true
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -380,11 +380,11 @@ public class FlowBuilder<Q> {
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
private void stop(String pattern) {
|
||||
protected void stop(String pattern) {
|
||||
addTransition(pattern, stoppedState);
|
||||
}
|
||||
|
||||
private void stop(String pattern, State restart) {
|
||||
protected void stop(String pattern, State restart) {
|
||||
EndState next = new EndState(FlowExecutionStatus.STOPPED, "STOPPED", prefix + "stop" + (endCounter++), true);
|
||||
addTransition(pattern, next);
|
||||
currentState = next;
|
||||
|
||||
@@ -202,6 +202,7 @@ public class SimpleFlow implements Flow, InitializingBean {
|
||||
|
||||
String next = null;
|
||||
String exitCode = status.getName();
|
||||
|
||||
for (StateTransition stateTransition : set) {
|
||||
if (stateTransition.matches(exitCode) || (exitCode.equals("PENDING") && stateTransition.matches("STOPPED"))) {
|
||||
if (stateTransition.isEnd()) {
|
||||
@@ -224,7 +225,6 @@ public class SimpleFlow implements Flow, InitializingBean {
|
||||
}
|
||||
|
||||
State state = stateMap.get(next);
|
||||
|
||||
return state;
|
||||
|
||||
}
|
||||
|
||||
@@ -67,6 +67,18 @@ public class EndState extends AbstractState {
|
||||
this.abandon = abandon;
|
||||
}
|
||||
|
||||
protected FlowExecutionStatus getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
protected boolean isAbandon() {
|
||||
return this.abandon;
|
||||
}
|
||||
|
||||
protected String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link FlowExecutionStatus} stored.
|
||||
*
|
||||
|
||||
@@ -203,11 +203,9 @@ public class FlowParser extends AbstractFlowParser {
|
||||
if (!StringUtils.hasText(nextAttribute)) {
|
||||
nextAttribute = restartAttribute;
|
||||
}
|
||||
|
||||
boolean abandon = stateId != null && StringUtils.hasText(restartAttribute) && !restartAttribute.equals(stateId);
|
||||
String exitCodeAttribute = transitionElement.getAttribute(EXIT_STATUS_ATTRIBUTE);
|
||||
|
||||
return createTransition(status, onAttribute, nextAttribute, exitCodeAttribute, stateDef, parserContext, abandon);
|
||||
return createTransition(status, onAttribute, nextAttribute, restartAttribute, exitCodeAttribute, stateDef, parserContext, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,7 +224,7 @@ public class FlowParser extends AbstractFlowParser {
|
||||
* references
|
||||
*/
|
||||
protected static Collection<BeanDefinition> createTransition(FlowExecutionStatus status, String on, String next,
|
||||
String exitCode, BeanDefinition stateDef, ParserContext parserContext, boolean abandon) {
|
||||
String restart, String exitCode, BeanDefinition stateDef, ParserContext parserContext, boolean abandon) {
|
||||
|
||||
BeanDefinition endState = null;
|
||||
|
||||
@@ -246,8 +244,12 @@ public class FlowParser extends AbstractFlowParser {
|
||||
+ (endCounter++);
|
||||
endBuilder.addConstructorArgValue(endName);
|
||||
|
||||
endBuilder.addConstructorArgValue(restart);
|
||||
|
||||
endBuilder.addConstructorArgValue(abandon);
|
||||
|
||||
endBuilder.addConstructorArgReference("jobRepository");
|
||||
|
||||
String nextOnEnd = exitCodeExists ? null : next;
|
||||
endState = getStateTransitionReference(parserContext, endBuilder.getBeanDefinition(), null, nextOnEnd);
|
||||
next = endName;
|
||||
@@ -256,6 +258,11 @@ public class FlowParser extends AbstractFlowParser {
|
||||
|
||||
Collection<BeanDefinition> list = new ArrayList<BeanDefinition>();
|
||||
list.add(getStateTransitionReference(parserContext, stateDef, on, next));
|
||||
|
||||
if(StringUtils.hasText(restart)) {
|
||||
list.add(getStateTransitionReference(parserContext, stateDef, on + ".RESTART", restart));
|
||||
}
|
||||
|
||||
if (endState != null) {
|
||||
//
|
||||
// Must be added after the state to ensure that the state is the
|
||||
|
||||
@@ -20,6 +20,7 @@ import javax.batch.api.listener.JobListener;
|
||||
import org.springframework.batch.core.JobExecutionListener;
|
||||
import org.springframework.batch.core.JobParametersIncrementer;
|
||||
import org.springframework.batch.core.JobParametersValidator;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.job.flow.Flow;
|
||||
import org.springframework.batch.core.job.flow.FlowJob;
|
||||
import org.springframework.batch.core.jsr.JobListenerAdapter;
|
||||
@@ -54,6 +55,8 @@ public class JobFactoryBean implements SmartFactoryBean<FlowJob> {
|
||||
|
||||
private Flow flow;
|
||||
|
||||
private JobExplorer jobExplorer;
|
||||
|
||||
public JobFactoryBean(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@@ -61,7 +64,8 @@ public class JobFactoryBean implements SmartFactoryBean<FlowJob> {
|
||||
@Override
|
||||
public final FlowJob getObject() throws Exception {
|
||||
Assert.isTrue(StringUtils.hasText(name), "The job must have an id.");
|
||||
FlowJob flowJob = new JsrFlowJob(name);
|
||||
JsrFlowJob flowJob = new JsrFlowJob(name);
|
||||
flowJob.setJobExplorer(jobExplorer);
|
||||
|
||||
if (restartable != null) {
|
||||
flowJob.setRestartable(restartable);
|
||||
@@ -91,6 +95,10 @@ public class JobFactoryBean implements SmartFactoryBean<FlowJob> {
|
||||
return flowJob;
|
||||
}
|
||||
|
||||
public void setJobExplorer(JobExplorer jobExplorer) {
|
||||
this.jobExplorer = jobExplorer;
|
||||
}
|
||||
|
||||
public void setRestartable(Boolean restartable) {
|
||||
this.restartable = restartable;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
builder.addConstructorArgValue(jobName);
|
||||
|
||||
builder.addPropertyReference("jobExplorer", "jobExplorer");
|
||||
|
||||
String restartableAttribute = element.getAttribute(RESTARTABLE_ATTRIBUTE);
|
||||
if (StringUtils.hasText(restartableAttribute)) {
|
||||
builder.addPropertyValue("restartable", restartableAttribute);
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.job;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.StartLimitExceededException;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.job.SimpleStepHandler;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.JobRestartException;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Extends {@link SimpleStepHandler} to apply JSR-352 specific logic for whether to
|
||||
* start a step.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @since 3.0
|
||||
*/
|
||||
public class DefaultStepHandler extends SimpleStepHandler {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DefaultStepHandler.class);
|
||||
|
||||
private JobExplorer jobExplorer;
|
||||
|
||||
/**
|
||||
* @param jobRepository
|
||||
*/
|
||||
public DefaultStepHandler(JobRepository jobRepository, JobExplorer jobExplorer) {
|
||||
super(jobRepository, new ExecutionContext());
|
||||
this.jobExplorer = jobExplorer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.state(jobExplorer != null, "A JobExplorer must be provided");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given a step and configuration, return true if the step should start,
|
||||
* false if it should not, and throw an exception if the job should finish.
|
||||
* @param lastStepExecution the last step execution
|
||||
* @param jobInstance
|
||||
* @param step
|
||||
*
|
||||
* @throws StartLimitExceededException if the start limit has been exceeded
|
||||
* for this step
|
||||
* @throws JobRestartException if the job is in an inconsistent state from
|
||||
* an earlier failure
|
||||
*/
|
||||
@Override
|
||||
protected boolean shouldStart(StepExecution lastStepExecution, JobExecution jobExecution, Step step)
|
||||
throws JobRestartException, StartLimitExceededException {
|
||||
|
||||
BatchStatus stepStatus;
|
||||
String restartStep = null;
|
||||
if (lastStepExecution == null) {
|
||||
stepStatus = BatchStatus.STARTING;
|
||||
}
|
||||
else {
|
||||
stepStatus = lastStepExecution.getStatus();
|
||||
|
||||
JobExecution lastJobExecution = getLastJobExecution(jobExecution);
|
||||
|
||||
if(lastJobExecution.getExecutionContext().containsKey("batch.restartStep")) {
|
||||
restartStep = lastJobExecution.getExecutionContext().getString("batch.restartStep");
|
||||
|
||||
if(lastJobExecution.getStatus() == BatchStatus.STOPPED && StringUtils.hasText(restartStep) && !restartStep.equals(step.getName())) {
|
||||
logger.info("Job was stopped and should restart at step " + restartStep + ". The current step is " + step.getName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stepStatus == BatchStatus.UNKNOWN) {
|
||||
throw new JobRestartException("Cannot restart step from UNKNOWN status. "
|
||||
+ "The last execution ended with a failure that could not be rolled back, "
|
||||
+ "so it may be dangerous to proceed. Manual intervention is probably necessary.");
|
||||
}
|
||||
|
||||
if ((stepStatus == BatchStatus.COMPLETED && step.isAllowStartIfComplete() == false)
|
||||
|| stepStatus == BatchStatus.ABANDONED) {
|
||||
// step is complete, false should be returned, indicating that the
|
||||
// step should not be started
|
||||
logger.info("Step already complete or not restartable, so no action to execute: " + lastStepExecution);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getJobRepository().getStepExecutionCount(jobExecution.getJobInstance(), step.getName()) < step.getStartLimit()) {
|
||||
// step start count is less than start max, return true
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// start max has been exceeded, throw an exception.
|
||||
throw new StartLimitExceededException("Maximum start limit exceeded for step: " + step.getName()
|
||||
+ "StartMax: " + step.getStartLimit());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Since all JSR-352 jobs are run asynchronously, {@link JobRepository#getLastJobExecution(String, org.springframework.batch.core.JobParameters)}
|
||||
* could return the currently running {@link JobExecution}. To get around this, we use the {@link JobExplorer}
|
||||
* to get a list of the executions and get the most recent one that is <em>not</em> the currently running
|
||||
* {@link JobExecution}.
|
||||
*
|
||||
* @param jobExecution
|
||||
* @return the last executed JobExecution.
|
||||
*/
|
||||
private JobExecution getLastJobExecution(JobExecution jobExecution) {
|
||||
List<JobExecution> jobExecutions = jobExplorer.getJobExecutions(jobExecution.getJobInstance());
|
||||
JobExecution lastJobExecution = null;
|
||||
|
||||
for (JobExecution curJobExecution : jobExecutions) {
|
||||
if(lastJobExecution == null && curJobExecution.getId() != jobExecution.getId()) {
|
||||
lastJobExecution = curJobExecution;
|
||||
} else if(lastJobExecution != null && curJobExecution.getId() > lastJobExecution.getId() && curJobExecution.getId() != jobExecution.getId()) {
|
||||
lastJobExecution = curJobExecution;
|
||||
}
|
||||
}
|
||||
return lastJobExecution;
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,12 @@ import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobExecutionException;
|
||||
import org.springframework.batch.core.JobInterruptedException;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.job.AbstractJob;
|
||||
import org.springframework.batch.core.job.SimpleStepHandler;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionException;
|
||||
import org.springframework.batch.core.job.flow.FlowJob;
|
||||
import org.springframework.batch.core.job.flow.JobFlowExecutor;
|
||||
import org.springframework.batch.core.jsr.job.DefaultStepHandler;
|
||||
import org.springframework.batch.core.launch.NoSuchJobException;
|
||||
import org.springframework.batch.core.launch.support.ExitCodeMapper;
|
||||
|
||||
@@ -35,6 +36,8 @@ import org.springframework.batch.core.launch.support.ExitCodeMapper;
|
||||
*/
|
||||
public class JsrFlowJob extends FlowJob {
|
||||
|
||||
private JobExplorer jobExplorer;
|
||||
|
||||
/**
|
||||
* No arg constructor (invalid state)
|
||||
*/
|
||||
@@ -51,6 +54,10 @@ public class JsrFlowJob extends FlowJob {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void setJobExplorer(JobExplorer jobExplorer) {
|
||||
this.jobExplorer = jobExplorer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractJob#doExecute(JobExecution)
|
||||
*/
|
||||
@@ -58,7 +65,7 @@ public class JsrFlowJob extends FlowJob {
|
||||
protected void doExecute(final JobExecution execution) throws JobExecutionException {
|
||||
try {
|
||||
JobFlowExecutor executor = new JsrFlowExecutor(getJobRepository(),
|
||||
new SimpleStepHandler(getJobRepository()), execution);
|
||||
new DefaultStepHandler(getJobRepository(), jobExplorer), execution);
|
||||
executor.updateJobExecutionStatus(flow.start(executor).getStatus());
|
||||
}
|
||||
catch (FlowExecutionException e) {
|
||||
|
||||
@@ -26,6 +26,8 @@ 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.item.ExecutionContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Implements JSR-352 specific logic around the execution of a flow. Specifically, this
|
||||
@@ -46,12 +48,31 @@ public class DefaultFlow extends SimpleFlow {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State nextState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException {
|
||||
State nextState = findState(stateName, status, stepExecution);
|
||||
|
||||
if(stepExecution != null) {
|
||||
ExecutionContext executionContext = stepExecution.getJobExecution().getExecutionContext();
|
||||
if(executionContext.containsKey("batch.stoppedStep")) {
|
||||
String stepName = executionContext.getString("batch.stoppedStep");
|
||||
|
||||
if(stateName.endsWith(stepName)) {
|
||||
if(nextState != null && executionContext.containsKey("batch.restartStep") && StringUtils.hasText(executionContext.getString("batch.restartStep"))) {
|
||||
nextState = findState(stateName, new FlowExecutionStatus(status.getName() + ".RESTART"), stepExecution);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nextState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the next {@link Step} (or null if this is the end)
|
||||
* @throws JobExecutionException
|
||||
*/
|
||||
@Override
|
||||
protected State nextState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException {
|
||||
private State findState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException {
|
||||
Set<StateTransition> set = getTransitionMap().get(stateName);
|
||||
|
||||
if (set == null) {
|
||||
|
||||
@@ -15,11 +15,15 @@
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.job.flow.support.state;
|
||||
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionStatus;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutor;
|
||||
import org.springframework.batch.core.job.flow.State;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
|
||||
/**
|
||||
* {@link State} implementation for ending a job per JSR-352 rules if it is
|
||||
@@ -30,6 +34,9 @@ import org.springframework.batch.core.job.flow.State;
|
||||
*/
|
||||
public class EndState extends org.springframework.batch.core.job.flow.support.state.EndState {
|
||||
|
||||
private JobRepository jobRepository;
|
||||
private String restart;
|
||||
|
||||
/**
|
||||
* @param status The {@link FlowExecutionStatus} to end with
|
||||
* @param name The name of the state
|
||||
@@ -57,6 +64,60 @@ public class EndState extends org.springframework.batch.core.job.flow.support.st
|
||||
super(status, code, name, abandon);
|
||||
}
|
||||
|
||||
public EndState(FlowExecutionStatus status, String code, String name, String restart, boolean abandon, JobRepository jobRepository) {
|
||||
super(status, code, name, abandon);
|
||||
this.jobRepository = jobRepository;
|
||||
this.restart = restart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowExecutionStatus handle(FlowExecutor executor)
|
||||
throws Exception {
|
||||
synchronized (executor) {
|
||||
|
||||
// Special case. If the last step execution could not complete we
|
||||
// are in an unknown state (possibly unrecoverable).
|
||||
StepExecution stepExecution = executor.getStepExecution();
|
||||
if (stepExecution != null && executor.getStepExecution().getStatus() == BatchStatus.UNKNOWN) {
|
||||
return FlowExecutionStatus.UNKNOWN;
|
||||
}
|
||||
|
||||
if (getStatus().isStop()) {
|
||||
JobExecution jobExecution = stepExecution.getJobExecution();
|
||||
ExecutionContext executionContext = jobExecution.getExecutionContext();
|
||||
executionContext.put("batch.restartStep", restart);
|
||||
executionContext.put("batch.stoppedStep", stepExecution.getStepName());
|
||||
jobRepository.updateExecutionContext(jobExecution);
|
||||
|
||||
if (!executor.isRestart()) {
|
||||
/*
|
||||
* If there are step executions, then we are not at the
|
||||
* beginning of a restart.
|
||||
*/
|
||||
if (isAbandon()) {
|
||||
/*
|
||||
* Only if instructed to do so, upgrade the status of
|
||||
* last step execution so it is not replayed on a
|
||||
* restart...
|
||||
*/
|
||||
executor.abandonStepExecution();
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* If we are a stop state and we got this far then it must
|
||||
* be a restart, so return COMPLETED.
|
||||
*/
|
||||
return FlowExecutionStatus.COMPLETED;
|
||||
}
|
||||
}
|
||||
|
||||
setExitStatus(executor, getCode());
|
||||
|
||||
return getStatus();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.job.flow.support.state.EndState#setExitStatus(org.springframework.batch.core.job.flow.FlowExecutor, java.lang.String)
|
||||
*/
|
||||
|
||||
@@ -233,8 +233,10 @@ public class SimpleJobRepository implements JobRepository {
|
||||
}
|
||||
|
||||
if (latest != null) {
|
||||
ExecutionContext executionContext = ecDao.getExecutionContext(latest);
|
||||
latest.setExecutionContext(executionContext);
|
||||
ExecutionContext stepExecutionContext = ecDao.getExecutionContext(latest);
|
||||
latest.setExecutionContext(stepExecutionContext);
|
||||
ExecutionContext jobExecutionContext = ecDao.getExecutionContext(latest.getJobExecution());
|
||||
latest.getJobExecution().setExecutionContext(jobExecutionContext);
|
||||
}
|
||||
|
||||
return latest;
|
||||
|
||||
@@ -75,6 +75,7 @@ public class SplitParsingTests {
|
||||
RuntimeBeanReference runtimeBeanReferenceValue = (RuntimeBeanReference) propertyValue.getValue();
|
||||
|
||||
Assert.assertTrue("RuntimeBeanReference should have a name of jsr352splitTaskExecutor" , "jsr352splitTaskExecutor".equals(runtimeBeanReferenceValue.getBeanName()));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -83,6 +84,7 @@ public class SplitParsingTests {
|
||||
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) context.getBeanFactory();
|
||||
PropertyValue propertyValue = new SplitParser(null).getSplitTaskExecutorPropertyValue(registry);
|
||||
Assert.assertTrue("Task executor not an instance of SimpleAsyncTaskExecutor" , (propertyValue.getValue() instanceof SimpleAsyncTaskExecutor));
|
||||
context.close();
|
||||
}
|
||||
|
||||
public static class ExitStatusSettingBatchlet extends AbstractBatchlet {
|
||||
|
||||
@@ -37,6 +37,8 @@ import org.springframework.batch.core.JobInterruptedException;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean;
|
||||
import org.springframework.batch.core.job.flow.Flow;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionStatus;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutor;
|
||||
@@ -50,6 +52,7 @@ 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.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.dao.JobExecutionDao;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
@@ -67,6 +70,8 @@ public class JsrFlowJobTests {
|
||||
|
||||
private JobRepository jobRepository;
|
||||
|
||||
private JobExplorer jobExplorer;
|
||||
|
||||
private boolean fail = false;
|
||||
|
||||
private JobExecutionDao jobExecutionDao;
|
||||
@@ -74,17 +79,22 @@ public class JsrFlowJobTests {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
job = new JsrFlowJob();
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
factory.afterPropertiesSet();
|
||||
jobExecutionDao = factory.getJobExecutionDao();
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
MapJobRepositoryFactoryBean jobRepositoryFactory = new MapJobRepositoryFactoryBean();
|
||||
jobRepositoryFactory.afterPropertiesSet();
|
||||
jobExecutionDao = jobRepositoryFactory.getJobExecutionDao();
|
||||
jobRepository = (JobRepository) jobRepositoryFactory.getObject();
|
||||
job.setJobRepository(jobRepository);
|
||||
jobExecution = jobRepository.createJobExecution("job", new JobParameters());
|
||||
|
||||
MapJobExplorerFactoryBean jobExplorerFactory = new MapJobExplorerFactoryBean(jobRepositoryFactory);
|
||||
jobExplorerFactory.afterPropertiesSet();
|
||||
jobExplorer = (JobExplorer) jobExplorerFactory.getObject();
|
||||
job.setJobExplorer(jobExplorer);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSteps() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("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"));
|
||||
@@ -98,7 +108,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testTwoSteps() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
StepState step2 = new StepState(new StubStep("step2"));
|
||||
@@ -117,7 +127,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testFailedStep() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StateSupport("step1", FlowExecutionStatus.FAILED),
|
||||
"step2"));
|
||||
@@ -138,14 +148,15 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testFailedStepRestarted() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
State step2State = new StateSupport("step2") {
|
||||
@Override
|
||||
public FlowExecutionStatus handle(FlowExecutor executor) throws Exception {
|
||||
JobExecution jobExecution = executor.getJobExecution();
|
||||
jobExecution.createStepExecution(getName());
|
||||
StepExecution stepExecution = jobExecution.createStepExecution(getName());
|
||||
jobRepository.add(stepExecution);
|
||||
if (fail) {
|
||||
return FlowExecutionStatus.FAILED;
|
||||
}
|
||||
@@ -175,7 +186,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testStoppingStep() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
|
||||
State state2 = new StateSupport("step2", FlowExecutionStatus.FAILED);
|
||||
@@ -196,7 +207,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testInterrupted() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
|
||||
@Override
|
||||
@@ -219,7 +230,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testUnknownStatusStopsJob() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
|
||||
@Override
|
||||
@@ -244,9 +255,9 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testInterruptedSplit() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow1 = new SimpleFlow("flow1");
|
||||
SimpleFlow flow2 = new SimpleFlow("flow2");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow1 = new DefaultFlow("flow1");
|
||||
SimpleFlow flow2 = new DefaultFlow("flow2");
|
||||
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
|
||||
@@ -290,7 +301,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testInterruptedException() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
|
||||
@Override
|
||||
@@ -312,9 +323,9 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testInterruptedSplitException() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow1 = new SimpleFlow("flow1");
|
||||
SimpleFlow flow2 = new SimpleFlow("flow2");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow1 = new DefaultFlow("flow1");
|
||||
SimpleFlow flow2 = new DefaultFlow("flow2");
|
||||
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
|
||||
@@ -347,7 +358,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testEndStateStopped() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "end"));
|
||||
transitions.add(StateTransition
|
||||
@@ -366,7 +377,7 @@ public class JsrFlowJobTests {
|
||||
}
|
||||
|
||||
public void testEndStateFailed() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "end"));
|
||||
transitions
|
||||
@@ -387,7 +398,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testEndStateStoppedWithRestart() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "end"));
|
||||
transitions.add(StateTransition
|
||||
@@ -415,7 +426,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testBranching() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
StepState step1 = new StepState(new StubStep("step1"));
|
||||
transitions.add(StateTransition.createStateTransition(step1, "step2"));
|
||||
@@ -441,7 +452,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testBasicFlow() throws Throwable {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("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")));
|
||||
@@ -457,7 +468,7 @@ public class JsrFlowJobTests {
|
||||
@Test
|
||||
public void testDecisionFlow() throws Throwable {
|
||||
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
Decider decider = new Decider() {
|
||||
|
||||
@Override
|
||||
@@ -501,7 +512,7 @@ public class JsrFlowJobTests {
|
||||
@Test
|
||||
public void testDecisionFlowWithExceptionInDecider() throws Throwable {
|
||||
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
JobExecutionDecider decider = new JobExecutionDecider() {
|
||||
@Override
|
||||
public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) {
|
||||
@@ -544,7 +555,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepExists() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("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"));
|
||||
@@ -561,7 +572,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepExistsWithPrefix() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("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")));
|
||||
@@ -578,7 +589,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepNamesWithPrefix() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("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")));
|
||||
@@ -593,7 +604,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepNotExists() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("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"));
|
||||
@@ -609,7 +620,7 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepNotStepState() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("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"));
|
||||
@@ -625,14 +636,14 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepNestedFlow() throws Exception {
|
||||
SimpleFlow nested = new SimpleFlow("nested");
|
||||
SimpleFlow nested = new DefaultFlow("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 SimpleFlow("job");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "nested"));
|
||||
transitions.add(StateTransition.createStateTransition(new FlowState(nested, "nested"), "end0"));
|
||||
@@ -649,9 +660,9 @@ public class JsrFlowJobTests {
|
||||
|
||||
@Test
|
||||
public void testGetStepSplitFlow() throws Exception {
|
||||
SimpleFlow flow = new SimpleFlow("job");
|
||||
SimpleFlow flow1 = new SimpleFlow("flow1");
|
||||
SimpleFlow flow2 = new SimpleFlow("flow2");
|
||||
SimpleFlow flow = new DefaultFlow("job");
|
||||
SimpleFlow flow1 = new DefaultFlow("flow1");
|
||||
SimpleFlow flow2 = new DefaultFlow("flow2");
|
||||
|
||||
List<StateTransition> transitions = new ArrayList<StateTransition>();
|
||||
transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "end0"));
|
||||
|
||||
@@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -14,7 +13,6 @@ import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionStatus;
|
||||
import org.springframework.batch.core.job.flow.JobExecutionDecider;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
@@ -37,22 +35,12 @@ public class RestartInPriorStepTests {
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private JobExplorer jobExplorer;
|
||||
|
||||
@Autowired
|
||||
private JobLauncher jobLauncher;
|
||||
|
||||
@Autowired
|
||||
private Job job;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<job id="job_partitioned_1step" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<job id="fullPartitionParserTests" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.PartitionParserTests$MyBatchlet"/>
|
||||
<partition>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<job id="job_partitioned_1step" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<job id="fullPartitionParserWithHardcodedPropertiesTests" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.PartitionParserTests$MyBatchlet">
|
||||
<properties>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<job id="job_partitioned_1step" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<job id="fullPartitionParserWithMapperPropertiesTests" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.PartitionParserTests$MyBatchlet">
|
||||
<properties>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<job id="job_partitioned_1step" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<job id="fullPartitionParserWithPropertiesTests" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.PartitionParserTests$MyBatchlet">
|
||||
<properties>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<job id="brokeJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<job id="jsrJobOperatorTestBeanCreationException" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1" >
|
||||
<batchlet ref="org.springframework.batch.core.jsr.step.batchlet.NonExistent" />
|
||||
</step>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<job id="nonRestartableJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0" restartable="false">
|
||||
<job id="jsrJobOperatorTestNonRestartableJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0" restartable="false">
|
||||
<step id="step1">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.launch.JsrJobOperatorTests$FailingBatchlet" />
|
||||
</step>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<job id="failingJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<job id="jsrJobOperatorTestRestartAbandonJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1" >
|
||||
<batchlet ref="failingBatchlet" />
|
||||
</step>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<job id="myJob3" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<job id="jsrJobOperatorTestRestartJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1" >
|
||||
<batchlet ref="restartBatchlet" />
|
||||
</step>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<job id="job_partitioned_1step" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<job id="partitionParserTestsBatchlet" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.configuration.xml.PartitionParserTests$MyBatchlet" />
|
||||
<partition>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<job id="job_partitioned_1step" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<job id="partitionParserTestsChunk" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<step id="step1">
|
||||
<chunk item-count="3">
|
||||
<reader ref="org.springframework.batch.core.jsr.configuration.xml.PartitionParserTests$ItemReader"/>
|
||||
|
||||
@@ -47,6 +47,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="generatingItemReader1" class="org.springframework.batch.item.support.ListItemReader">
|
||||
<constructor-arg>
|
||||
<list>
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jsrDecider" class="org.springframework.batch.core.jsr.configuration.xml.DecisionParsingTests.JsrDecider"/>
|
||||
|
||||
<bean id="step1Ref" class="org.springframework.batch.core.step.tasklet.TaskletSupport"/>
|
||||
|
||||
@@ -37,15 +37,19 @@
|
||||
</chunk>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
|
||||
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="generatingItemReader1" class="org.springframework.batch.item.support.ListItemReader">
|
||||
<constructor-arg>
|
||||
<list>
|
||||
@@ -54,7 +58,7 @@
|
||||
</list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="generatingItemReader2" class="org.springframework.batch.item.support.ListItemReader">
|
||||
<constructor-arg>
|
||||
<list>
|
||||
@@ -63,7 +67,7 @@
|
||||
</list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="generatingItemReader3" class="org.springframework.batch.item.support.ListItemReader">
|
||||
<constructor-arg>
|
||||
<list>
|
||||
@@ -72,16 +76,16 @@
|
||||
</list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="countingItemProcessor" class="org.springframework.batch.core.jsr.configuration.xml.CountingItemProcessor"/>
|
||||
|
||||
|
||||
<bean id="sysoutItemWriter" class="org.springframework.batch.item.adapter.ItemWriterAdapter">
|
||||
<property name="targetObject">
|
||||
<util:constant static-field="java.lang.System.out"/>
|
||||
</property>
|
||||
<property name="targetMethod" value="println"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="springItemListener" class="org.springframework.batch.core.jsr.configuration.xml.ItemListenerParsingTests.SpringItemListener"/>
|
||||
|
||||
<bean id="jsrItemListener" class="org.springframework.batch.core.jsr.configuration.xml.ItemListenerParsingTests.JsrItemListener"/>
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="springJobListener" class="org.springframework.batch.core.jsr.configuration.xml.JobListenerParsingTests.SpringJobListener"/>
|
||||
|
||||
<bean id="jsrJobListener" class="org.springframework.batch.core.jsr.configuration.xml.JobListenerParsingTests.JsrJobListener"/>
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="testReader" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertySubstitutionTests$TestItemReader"
|
||||
scope="step"/>
|
||||
|
||||
|
||||
@@ -29,4 +29,8 @@
|
||||
</bean>
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
@@ -44,6 +44,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="generatingItemReader1" class="org.springframework.batch.item.support.ListItemReader">
|
||||
<constructor-arg>
|
||||
<list>
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="batchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
|
||||
<bean id="step1Ref" class="org.springframework.batch.core.step.tasklet.TaskletSupport"/>
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="step1Ref" class="org.springframework.batch.core.step.tasklet.TaskletSupport"/>
|
||||
|
||||
<bean id="springStepListener" class="org.springframework.batch.core.jsr.configuration.xml.StepListenerParsingTests.SpringStepListener"/>
|
||||
|
||||
@@ -57,6 +57,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
|
||||
@@ -57,6 +57,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="failureDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$FailureDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:util="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
@@ -8,7 +8,7 @@
|
||||
http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/batch
|
||||
http://www.springframework.org/schema/batch/spring-batch-2.2.xsd">
|
||||
|
||||
|
||||
<bean id="step1ItemReader" class="org.springframework.batch.item.support.ListItemReader">
|
||||
<constructor-arg>
|
||||
<util:list>
|
||||
@@ -16,9 +16,9 @@
|
||||
</util:list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="step1ItemWriter" class="org.springframework.batch.core.configuration.xml.DummyItemWriter"/>
|
||||
|
||||
|
||||
<bean id="step2ItemReader" class="org.springframework.batch.item.support.ListItemReader">
|
||||
<constructor-arg>
|
||||
<util:list>
|
||||
@@ -27,9 +27,9 @@
|
||||
</util:list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="step2ItemWriter" class="org.springframework.batch.core.configuration.xml.DummyItemWriter"/>
|
||||
|
||||
|
||||
<bean id="step3ItemReader" class="org.springframework.batch.item.support.ListItemReader">
|
||||
<constructor-arg>
|
||||
<util:list>
|
||||
@@ -39,13 +39,13 @@
|
||||
</util:list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="step3ItemWriter" class="org.springframework.batch.core.configuration.xml.DummyItemWriter"/>
|
||||
|
||||
|
||||
<bean id="decidingTasklet" class="org.springframework.batch.core.step.RestartInPriorStepTests$DecidingTasklet"/>
|
||||
|
||||
|
||||
<bean id="completionDecider" class="org.springframework.batch.core.step.RestartInPriorStepTests$CompletionDecider"/>
|
||||
|
||||
|
||||
<job id="restartJob" xmlns="http://www.springframework.org/schema/batch">
|
||||
<step id="step1" next="step2">
|
||||
<tasklet allow-start-if-complete="true">
|
||||
@@ -72,15 +72,11 @@
|
||||
<end on="END"/>
|
||||
</decision>
|
||||
</job>
|
||||
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
|
||||
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
Reference in New Issue
Block a user