Package org.springframework.batch.test
Class MetaDataInstanceFactory
java.lang.Object
org.springframework.batch.test.MetaDataInstanceFactory
- Author:
- Dave Syer, Mahmoud Ben Hassine
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
The default id for a job execution (123L)static final long
The default id for a job instance (12L)static final String
The default name for a job ("job")static final long
The default id for a step execution (1234L)static final String
The default name for a step ("step") -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic JobExecution
Create aJobExecution
with default parameters.static JobExecution
createJobExecution
(Long executionId) Create aJobExecution
with the parameters provided.static JobExecution
createJobExecution
(String jobName, Long instanceId, Long executionId) Create aJobExecution
with the parameters provided.static JobExecution
createJobExecution
(String jobName, Long instanceId, Long executionId, String jobParameters) Deprecated, for removal: This API element is subject to removal in a future version.static JobExecution
createJobExecution
(String jobName, Long instanceId, Long executionId, JobParameters jobParameters) Create aJobExecution
with the parameters provided.static JobExecution
createJobExecutionWithStepExecutions
(Long executionId, Collection<String> stepNames) Create aJobExecution
with the parameters provided with attached step executions.static JobInstance
Create aJobInstance
with default parameters.static JobInstance
createJobInstance
(String jobName, Long instanceId) Create aJobInstance
with the parameters provided.static StepExecution
Create aStepExecution
with default parameters.static StepExecution
createStepExecution
(String stepName, Long executionId) Create aStepExecution
with the parameters provided.static StepExecution
createStepExecution
(JobExecution jobExecution, String stepName, Long executionId) Create aStepExecution
with the parameters provided.static StepExecution
createStepExecution
(JobParameters jobParameters) Create aStepExecution
and all its parent entities with default values, but using theJobParameters
provided.static StepExecution
createStepExecution
(JobParameters jobParameters, ExecutionContext executionContext) Create aStepExecution
and all its parent entities with default values, but using theExecutionContext
andJobParameters
provided.static StepExecution
createStepExecution
(ExecutionContext executionContext) Create aStepExecution
and all its parent entities with default values, but using theExecutionContext
provided.
-
Field Details
-
DEFAULT_JOB_NAME
The default name for a job ("job")- See Also:
-
DEFAULT_JOB_INSTANCE_ID
public static final long DEFAULT_JOB_INSTANCE_IDThe default id for a job instance (12L)- See Also:
-
DEFAULT_JOB_EXECUTION_ID
public static final long DEFAULT_JOB_EXECUTION_IDThe default id for a job execution (123L)- See Also:
-
DEFAULT_STEP_NAME
The default name for a step ("step")- See Also:
-
DEFAULT_STEP_EXECUTION_ID
public static final long DEFAULT_STEP_EXECUTION_IDThe default id for a step execution (1234L)- See Also:
-
-
Constructor Details
-
MetaDataInstanceFactory
public MetaDataInstanceFactory()
-
-
Method Details
-
createJobInstance
Create aJobInstance
with the parameters provided.- Parameters:
jobName
- the name of the jobinstanceId
- the Id of theJobInstance
- Returns:
- a
JobInstance
with emptyJobParameters
-
createJobInstance
Create aJobInstance
with default parameters.- Returns:
- a
JobInstance
with name=DEFAULT_JOB_NAME, id=DEFAULT_JOB_INSTANCE_ID and empty parameters
-
createJobExecution
Create aJobExecution
with default parameters.- Returns:
- a
JobExecution
with id=DEFAULT_JOB_EXECUTION_ID
-
createJobExecution
Create aJobExecution
with the parameters provided.- Parameters:
executionId
- the id for theJobExecution
- Returns:
- a
JobExecution
with validJobInstance
-
createJobExecution
Create aJobExecution
with the parameters provided.- Parameters:
jobName
- the name of the jobinstanceId
- the id for theJobInstance
executionId
- the id for theJobExecution
- Returns:
- a
JobExecution
with emptyJobParameters
-
createJobExecution
@Deprecated(since="5.0.1", forRemoval=true) public static JobExecution createJobExecution(String jobName, Long instanceId, Long executionId, String jobParameters) Deprecated, for removal: This API element is subject to removal in a future version.use {createJobExecution(String, Long, Long, JobParameters)
} instead. Will be removed in v5.2Create aJobExecution
with the parameters provided.- Parameters:
jobName
- the name of the jobinstanceId
- the Id of theJobInstance
executionId
- the id for theJobExecution
jobParameters
- new line separated key=value pairs- Returns:
- a
JobExecution
-
createJobExecution
public static JobExecution createJobExecution(String jobName, Long instanceId, Long executionId, JobParameters jobParameters) Create aJobExecution
with the parameters provided.- Parameters:
jobName
- the name of the jobinstanceId
- the Id of theJobInstance
executionId
- the id for theJobExecution
jobParameters
- an instance ofJobParameters
- Returns:
- a
JobExecution
-
createStepExecution
Create aStepExecution
with default parameters.- Returns:
- a
StepExecution
with stepName="step" and id=DEFAULT_STEP_EXECUTION_ID
-
createStepExecution
Create aStepExecution
with the parameters provided.- Parameters:
stepName
- the stepName for theStepExecution
executionId
- the id for theStepExecution
- Returns:
- a
StepExecution
with aJobExecution
having default properties
-
createStepExecution
public static StepExecution createStepExecution(JobExecution jobExecution, String stepName, Long executionId) Create aStepExecution
with the parameters provided.- Parameters:
jobExecution
- instance ofJobExecution
.stepName
- the name for theStepExecution
.executionId
- the id for theStepExecution
.- Returns:
- a
StepExecution
with the givenJobExecution
.
-
createJobExecutionWithStepExecutions
public static JobExecution createJobExecutionWithStepExecutions(Long executionId, Collection<String> stepNames) Create aJobExecution
with the parameters provided with attached step executions.- Parameters:
executionId
- theJobExecution
idstepNames
- the names of the step executions- Returns:
- a
JobExecution
with step executions as specified, each with a unique id
-
createStepExecution
public static StepExecution createStepExecution(JobParameters jobParameters, ExecutionContext executionContext) Create aStepExecution
and all its parent entities with default values, but using theExecutionContext
andJobParameters
provided.- Parameters:
jobParameters
- comeJobParameters
executionContext
- someExecutionContext
- Returns:
- a
StepExecution
with the execution context provided
-
createStepExecution
Create aStepExecution
and all its parent entities with default values, but using theJobParameters
provided.- Parameters:
jobParameters
- someJobParameters
- Returns:
- a
StepExecution
with the job parameters provided
-
createStepExecution
Create aStepExecution
and all its parent entities with default values, but using theExecutionContext
provided.- Parameters:
executionContext
- someExecutionContext
- Returns:
- a
StepExecution
with the execution context provided
-
createJobExecution(String, Long, Long, JobParameters)
} instead.