类 AbstractJobTests
- java.lang.Object
- org.springframework.batch.test.AbstractJobTests
- 所有已实现的接口:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
@Deprecated public abstract class AbstractJobTests extends java.lang.Object implements org.springframework.context.ApplicationContextAware
已过时。(from 2.1) useJobLauncherTestUtils
insteadBase class for testing batch jobs. It provides methods for launching an entire
AbstractJob
, allowing for end to end testing of individual steps, without having to run every step in the job. Any test classes inheriting from this class should make sure they are part of anApplicationContext
, which is generally expected to be done as part of the Spring test framework. Furthermore, theApplicationContext
in which it is a part of is expected to have oneJobLauncher
,JobRepository
, and a singleAbstractJob
implementation.This class also provides the ability to run
Step
s from aFlowJob
orSimpleJob
individually. By launchingStep
s within aJob
on their own, end to end testing of individual steps can be performed without having to run every step in the job.It should be noted that using any of the methods that don't contain
JobParameters
in their signature, will result in one being created with the current system time as a parameter. This will ensure restartability when no parameters are provided.- 从以下版本开始:
- 2.0
- 作者:
- Lucas Ward, Dan Garrette
字段概要
字段 修饰符和类型 字段 说明 protected org.apache.commons.logging.Log
logger
已过时。Logger
构造器概要
构造器 构造器 说明 AbstractJobTests()
已过时。
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 protected org.springframework.context.ApplicationContext
getApplicationContext()
已过时。AbstractJob
getJob()
已过时。protected JobLauncher
getJobLauncher()
已过时。JobRepository
getJobRepository()
已过时。protected StepRunner
getStepRunner()
已过时。Convenient method for subclasses to grab aStepRunner
for running steps by name.protected JobParameters
getUniqueJobParameters()
已过时。protected JobExecution
launchJob()
已过时。Launch the entire job, including all steps.protected JobExecution
launchJob(JobParameters jobParameters)
已过时。Launch the entire job, including all stepsJobExecution
launchStep(java.lang.String stepName)
已过时。Launch just the specified step in the job.JobExecution
launchStep(java.lang.String stepName, JobParameters jobParameters)
已过时。Launch just the specified step in the job.JobExecution
launchStep(java.lang.String stepName, JobParameters jobParameters, ExecutionContext jobExecutionContext)
已过时。Launch just the specified step in the job.JobExecution
launchStep(java.lang.String stepName, ExecutionContext jobExecutionContext)
已过时。Launch just the specified step in the job.void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
已过时。
字段详细资料
logger
protected final org.apache.commons.logging.Log logger
已过时。Logger
构造器详细资料
AbstractJobTests
public AbstractJobTests()
已过时。
方法详细资料
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
已过时。- 指定者:
setApplicationContext
在接口中org.springframework.context.ApplicationContextAware
- 抛出:
org.springframework.beans.BeansException
getApplicationContext
protected org.springframework.context.ApplicationContext getApplicationContext()
已过时。- 返回:
- the applicationContext
getJobRepository
public JobRepository getJobRepository()
已过时。- 返回:
- the job repository which is autowired by type
getJob
public AbstractJob getJob()
已过时。- 返回:
- the job which is autowired by type
getJobLauncher
protected JobLauncher getJobLauncher()
已过时。- 返回:
- the launcher
launchJob
protected JobExecution launchJob() throws java.lang.Exception
已过时。Launch the entire job, including all steps.- 返回:
- JobExecution, so that the test can validate the exit status
- 抛出:
java.lang.Exception
- is thrown if error occurs.
launchJob
protected JobExecution launchJob(JobParameters jobParameters) throws java.lang.Exception
已过时。Launch the entire job, including all steps- 参数:
jobParameters
- parameters for the job- 返回:
- JobExecution, so that the test can validate the exit status
- 抛出:
java.lang.Exception
- is thrown if error occurs.
getUniqueJobParameters
protected JobParameters getUniqueJobParameters()
已过时。- 返回:
- a new JobParameters object containing only a parameter for the current timestamp, to ensure that the job instance will be unique.
getStepRunner
protected StepRunner getStepRunner()
已过时。Convenient method for subclasses to grab aStepRunner
for running steps by name.- 返回:
- a
StepRunner
launchStep
public JobExecution launchStep(java.lang.String stepName)
已过时。Launch just the specified step in the job. A unique set of JobParameters will automatically be generated. An IllegalStateException is thrown if there is no Step with the given name.- 参数:
stepName
- The name of the step to launch- 返回:
- JobExecution
launchStep
public JobExecution launchStep(java.lang.String stepName, ExecutionContext jobExecutionContext)
已过时。Launch just the specified step in the job. A unique set of JobParameters will automatically be generated. An IllegalStateException is thrown if there is no Step with the given name.- 参数:
stepName
- The name of 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(java.lang.String stepName, JobParameters jobParameters)
已过时。Launch just the specified step in the job. An IllegalStateException is thrown if there is no Step with the given name.- 参数:
stepName
- The name of the step to launchjobParameters
- The JobParameters to use during the launch- 返回:
- JobExecution
launchStep
public JobExecution launchStep(java.lang.String stepName, JobParameters jobParameters, ExecutionContext jobExecutionContext)
已过时。Launch just the specified step in the job. An IllegalStateException is thrown if there is no Step with the given name.- 参数:
stepName
- The name of 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