类 JobRepositoryTestUtils
- java.lang.Object
- org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
- org.springframework.batch.test.JobRepositoryTestUtils
- 所有已实现的接口:
org.springframework.beans.factory.InitializingBean
public class JobRepositoryTestUtils extends AbstractJdbcBatchMetadataDao implements org.springframework.beans.factory.InitializingBean
Convenience class for creating and removingJobExecutioninstances from a database. Typical usage in test case would be to create instances before a transaction, save the result, and then use it to remove them after the transaction.- 作者:
- Dave Syer, Mahmoud Ben Hassine
字段概要
从类继承的字段 org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
DEFAULT_EXIT_MESSAGE_LENGTH, DEFAULT_TABLE_PREFIX
构造器概要
构造器 构造器 说明 JobRepositoryTestUtils()Default constructor.JobRepositoryTestUtils(JobRepository jobRepository, javax.sql.DataSource dataSource)Create aJobRepositoryTestUtilswith all its mandatory properties.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidafterPropertiesSet()java.util.List<JobExecution>createJobExecutions(int count)Use theJobRepositoryto create someJobExecutioninstances each with a single step execution.java.util.List<JobExecution>createJobExecutions(java.lang.String jobName, java.lang.String[] stepNames, int count)Use theJobRepositoryto create someJobExecutioninstances each with the given job name and each having step executions with the given step names.voidremoveJobExecutions()Remove all theJobExecutioninstances, and all associatedJobInstanceandStepExecutioninstances from the standard RDBMS locations used by Spring Batch.voidremoveJobExecutions(java.util.Collection<JobExecution> list)Remove theJobExecutioninstances, and all associatedJobInstanceandStepExecutioninstances from the standard RDBMS locations used by Spring Batch.voidsetDataSource(javax.sql.DataSource dataSource)voidsetJobParametersIncrementer(JobParametersIncrementer jobParametersIncrementer)voidsetJobRepository(JobRepository jobRepository)从类继承的方法 org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
getClobTypeToUse, getJdbcTemplate, getQuery, getTablePrefix, setClobTypeToUse, setJdbcTemplate, setTablePrefix
构造器详细资料
JobRepositoryTestUtils
public JobRepositoryTestUtils()
Default constructor.
JobRepositoryTestUtils
public JobRepositoryTestUtils(JobRepository jobRepository, javax.sql.DataSource dataSource)
Create aJobRepositoryTestUtilswith all its mandatory properties.- 参数:
jobRepository- aJobRepositorybacked by a databasedataSource- aDataSource
方法详细资料
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- 指定者:
afterPropertiesSet在接口中org.springframework.beans.factory.InitializingBean- 覆盖:
afterPropertiesSet在类中AbstractJdbcBatchMetadataDao- 抛出:
java.lang.Exception- 另请参阅:
InitializingBean.afterPropertiesSet()
setDataSource
@Autowired public final void setDataSource(javax.sql.DataSource dataSource)
setJobParametersIncrementer
public void setJobParametersIncrementer(JobParametersIncrementer jobParametersIncrementer)
- 参数:
jobParametersIncrementer- the jobParametersIncrementer to set
setJobRepository
@Autowired public void setJobRepository(JobRepository jobRepository)
- 参数:
jobRepository- the jobRepository to set
createJobExecutions
public java.util.List<JobExecution> createJobExecutions(java.lang.String jobName, java.lang.String[] stepNames, int count) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException
Use theJobRepositoryto create someJobExecutioninstances each with the given job name and each having step executions with the given step names.- 参数:
jobName- the name of the jobstepNames- the names of the step executionscount- the required number of instances ofJobExecutionto create- 返回:
- a collection of
JobExecution - 抛出:
JobExecutionAlreadyRunningException- thrown if Job is already running.JobRestartException- thrown if Job is not restartable.JobInstanceAlreadyCompleteException- thrown if Job Instance is already complete.
createJobExecutions
public java.util.List<JobExecution> createJobExecutions(int count) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException
Use theJobRepositoryto create someJobExecutioninstances each with a single step execution.- 参数:
count- the required number of instances ofJobExecutionto create- 返回:
- a collection of
JobExecution - 抛出:
JobExecutionAlreadyRunningException- thrown if Job is already running.JobRestartException- thrown if Job is not restartable.JobInstanceAlreadyCompleteException- thrown if Job Instance is already complete.
removeJobExecutions
public void removeJobExecutions(java.util.Collection<JobExecution> list) throws org.springframework.dao.DataAccessException
Remove theJobExecutioninstances, and all associatedJobInstanceandStepExecutioninstances from the standard RDBMS locations used by Spring Batch.- 参数:
list- a list ofJobExecution- 抛出:
org.springframework.dao.DataAccessException- if there is a problem
removeJobExecutions
public void removeJobExecutions() throws org.springframework.dao.DataAccessException
Remove all theJobExecutioninstances, and all associatedJobInstanceandStepExecutioninstances from the standard RDBMS locations used by Spring Batch.- 抛出:
org.springframework.dao.DataAccessException- if there is a problem