类 StepRunner
- java.lang.Object
- org.springframework.batch.test.StepRunner
public class StepRunner extends java.lang.Object
Utility class for executing steps outside of aJob
. This is useful in end to end testing in order to allow for the testing of a step individually without running every Step in a job.- launchStep(Step step): Launch the step with new parameters each time. (The current system time will be used)
- launchStep(Step step, JobParameters jobParameters): Launch the specified step with the provided JobParameters. This may be useful if your step requires a certain parameter during runtime.
- 从以下版本开始:
- 2.0
- 作者:
- Dan Garrette, Lucas Ward, Mahmoud Ben Hassine
- 另请参阅:
SimpleJob
字段概要
字段 修饰符和类型 字段 说明 protected org.apache.commons.logging.Log
logger
Logger
构造器概要
构造器 构造器 说明 StepRunner(JobLauncher launcher, JobRepository jobRepository)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 JobExecution
launchStep(Step step)
Launch just the specified step as its own job.JobExecution
launchStep(Step step, JobParameters jobParameters)
Launch just the specified step as its own job.JobExecution
launchStep(Step step, JobParameters jobParameters, ExecutionContext jobExecutionContext)
Launch just the specified step as its own job.JobExecution
launchStep(Step step, ExecutionContext jobExecutionContext)
Launch just the specified step as its own job.
字段详细资料
logger
protected final org.apache.commons.logging.Log logger
Logger
构造器详细资料
StepRunner
public StepRunner(JobLauncher launcher, JobRepository jobRepository)
方法详细资料
launchStep
public JobExecution launchStep(Step step)
Launch just the specified step as its own job. A unique set of JobParameters will automatically be generated. An IllegalStateException is thrown if there is no Step with the given name.- 参数:
step
- The step to launch- 返回:
- JobExecution
launchStep
public JobExecution launchStep(Step step, @Nullable ExecutionContext jobExecutionContext)
Launch just the specified step as its own job. A unique set of JobParameters will automatically be generated. An IllegalStateException is thrown if there is no Step with the given name.- 参数:
step
- The step to launchjobExecutionContext
- An ExecutionContext whose values will be loaded into the Job ExecutionContext prior to launching the step.- 返回:
- JobExecution
launchStep
public JobExecution launchStep(Step step, JobParameters jobParameters)
Launch just the specified step as its own job. An IllegalStateException is thrown if there is no Step with the given name.- 参数:
step
- The step to launchjobParameters
- The JobParameters to use during the launch- 返回:
- JobExecution
launchStep
public JobExecution launchStep(Step step, JobParameters jobParameters, @Nullable ExecutionContext jobExecutionContext)
Launch just the specified step as its own job. An IllegalStateException is thrown if there is no Step with the given name.- 参数:
step
- The step to launchjobParameters
- The JobParameters to use during the launchjobExecutionContext
- An ExecutionContext whose values will be loaded into the Job ExecutionContext prior to launching the step.- 返回:
- JobExecution