org.springframework.batch.core.scope.context.StepContext Java Examples

The following examples show how to use org.springframework.batch.core.scope.context.StepContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskLauncherTaskletTests.java    From composed-task-runner with Apache License 2.0 5 votes vote down vote up
private ChunkContext chunkContext ()
{
	final long JOB_EXECUTION_ID = 123L;
	final String STEP_NAME = "myTestStep";

	JobExecution jobExecution = new JobExecution(JOB_EXECUTION_ID);
	StepExecution stepExecution = new StepExecution(STEP_NAME, jobExecution);
	StepContext stepContext = new StepContext(stepExecution);
	return new ChunkContext(stepContext);
}
 
Example #2
Source File: TaskLauncherTaskletTests.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
private ChunkContext chunkContext ()
{
	final long JOB_EXECUTION_ID = 123L;
	final String STEP_NAME = "myTestStep";

	JobExecution jobExecution = new JobExecution(JOB_EXECUTION_ID);
	StepExecution stepExecution = new StepExecution(STEP_NAME, jobExecution);
	StepContext stepContext = new StepContext(stepExecution);
	return new ChunkContext(stepContext);
}
 
Example #3
Source File: EventListenerTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
private ChunkContext getChunkContext() {
	JobExecution jobExecution = getJobExecution();
	StepExecution stepExecution = new StepExecution("STEP1", jobExecution);
	StepContext stepContext = new StepContext(stepExecution);
	ChunkContext chunkContext = new ChunkContext(stepContext);
	return chunkContext;
}
 
Example #4
Source File: JobResultsTaskletTest.java    From batchers with Apache License 2.0 5 votes vote down vote up
@Test
public void testExecuteCallsService() throws Exception {
    when(chunkContextMock.getStepContext()).thenReturn(new StepContext(new StepExecution("stepName", new JobExecution(JOB_EXECUTION_ID), 123L)));

    setInternalState(jobResultsTasklet, "month", 2L);
    setInternalState(jobResultsTasklet, "year", 2015L);

    jobResultsTasklet.execute(stepContributionMock, chunkContextMock);

    verify(monthlyTaxReportServiceMock).generateReport(12345L, 2015, 2);
}
 
Example #5
Source File: AbstractBatchMetricsAspect.java    From spring-boot-starter-batch-web with Apache License 2.0 4 votes vote down vote up
private String getStepIdentifier() {
	StepContext stepContext = StepSynchronizationManager.getContext();
	StepExecution stepExecution = StepSynchronizationManager.getContext().getStepExecution();
	return stepContext.getJobName() + "." + stepExecution.getStepName();
}