类 JsrTestUtils
- java.lang.Object
- org.springframework.batch.test.JsrTestUtils
public class JsrTestUtils extends java.lang.Object
Provides testing utilities to execute JSR-352 jobs and block until they are complete (since all JSR-352 based jobs are executed asynchronously).- 从以下版本开始:
- 3.0
- 作者:
- Michael Minella, Mahmoud Ben Hassine
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static javax.batch.runtime.Metric
getMetric(javax.batch.runtime.StepExecution stepExecution, javax.batch.runtime.Metric.MetricType type)
static javax.batch.runtime.JobExecution
restartJob(long executionId, java.util.Properties properties, long timeout)
Restarts a job and waits for it's status to be any ofBatchStatus.STOPPED
,BatchStatus.COMPLETED
, orBatchStatus.FAILED
.static javax.batch.runtime.JobExecution
runJob(java.lang.String jobName, java.util.Properties properties, long timeout)
Executes a job and waits for it's status to be any ofBatchStatus.STOPPED
,BatchStatus.COMPLETED
, orBatchStatus.FAILED
.
方法详细资料
runJob
public static javax.batch.runtime.JobExecution runJob(java.lang.String jobName, java.util.Properties properties, long timeout) throws java.util.concurrent.TimeoutException
Executes a job and waits for it's status to be any ofBatchStatus.STOPPED
,BatchStatus.COMPLETED
, orBatchStatus.FAILED
. If the job does not reach one of those statuses within the given timeout, aTimeoutException
is thrown.- 参数:
jobName
- the name of the job.properties
- job parameters to be associated with the job.timeout
- maximum amount of time to wait in milliseconds.- 返回:
- the
JobExecution
for the final state of the job - 抛出:
java.util.concurrent.TimeoutException
- if the timeout occurs
restartJob
public static javax.batch.runtime.JobExecution restartJob(long executionId, java.util.Properties properties, long timeout) throws java.util.concurrent.TimeoutException
Restarts a job and waits for it's status to be any ofBatchStatus.STOPPED
,BatchStatus.COMPLETED
, orBatchStatus.FAILED
. If the job does not reach one of those statuses within the given timeout, aTimeoutException
is thrown.- 参数:
executionId
- the id of the job execution to restart.properties
- job parameters to be associated with the job.timeout
- maximum amount of time to wait in milliseconds.- 返回:
- the
JobExecution
for the final state of the job - 抛出:
java.util.concurrent.TimeoutException
- if the timeout occurs
getMetric
@Nullable public static javax.batch.runtime.Metric getMetric(javax.batch.runtime.StepExecution stepExecution, javax.batch.runtime.Metric.MetricType type)