Examples of ChunkContext


Examples of org.springframework.batch.core.scope.context.ChunkContext

        StepContribution contribution = Mockito.mock(StepContribution.class);
        StepExecution stepExecution = createStepExecution("testExecuteJob", "testExecuteStep");
        StepContext stepContext = Mockito.mock(StepContext.class);
        Mockito.when(stepContext.getStepExecution()).thenReturn(stepExecution);

        ChunkContext chunkContext = Mockito.mock(ChunkContext.class);
        Mockito.when(chunkContext.getStepContext()).thenReturn(stepContext);
        tasklet.execute(contribution, chunkContext);

        Operation op = assertOperationDetails(getFirstEntered(), "execute", stepExecution.getStepName());
        assertOperationPath(op, stepExecution);
    }
View Full Code Here

Examples of org.springframework.batch.core.scope.context.ChunkContext

    StepListener listener = (StepListener) factoryBean.getObject();
    ((StepExecutionListener) listener).beforeStep(stepExecution);
    ((StepExecutionListener) listener).afterStep(stepExecution);
    ((ChunkListener) listener).beforeChunk(null);
    ((ChunkListener) listener).afterChunk(null);
    ((ChunkListener) listener).afterChunkError(new ChunkContext(null));
    ((ItemReadListener<String>) listener).beforeRead();
    ((ItemReadListener<String>) listener).afterRead(readItem);
    ((ItemReadListener<String>) listener).onReadError(new Exception());
    ((ItemProcessListener<String, Integer>) listener).beforeProcess(readItem);
    ((ItemProcessListener<String, Integer>) listener).afterProcess(readItem, writeItem);
View Full Code Here

Examples of org.springframework.batch.core.scope.context.ChunkContext

    adapter = new BatchletAdapter(null);
  }

  @Test
  public void testExecuteNoExitStatus() throws Exception {
    assertEquals(RepeatStatus.FINISHED, adapter.execute(contribution, new ChunkContext(null)));

    verify(delegate).process();
  }
View Full Code Here

Examples of org.springframework.batch.core.scope.context.ChunkContext

  @Test
  public void testExecuteWithExitStatus() throws Exception {
    when(delegate.process()).thenReturn("my exit status");

    assertEquals(RepeatStatus.FINISHED, adapter.execute(contribution, new ChunkContext(null)));

    verify(delegate).process();
    verify(contribution).setExitStatus(new ExitStatus("my exit status"));
  }
View Full Code Here

Examples of org.springframework.batch.core.scope.context.ChunkContext

  CompositeChunkListener compositeListener;
  ChunkContext chunkContext;

  @Before
  public void setUp() throws Exception {
    chunkContext = new ChunkContext(null);
    listener = mock(ChunkListener.class);
    compositeListener = new CompositeChunkListener();
    compositeListener.register(listener);
  }
View Full Code Here

Examples of org.springframework.batch.core.scope.context.ChunkContext

    compositeListener.afterChunk(chunkContext);
  }

  @Test
  public void testAfterChunkFailed(){
    ChunkContext context = new ChunkContext(null);
    listener.afterChunkError(context);
    compositeListener.afterChunkError(context);
  }
View Full Code Here

Examples of org.springframework.batch.core.scope.context.ChunkContext

      }
    });

    adapter.setPartitionLock(new ReentrantLock());

    ChunkContext context = new ChunkContext(null);
    context.setComplete();

    adapter.afterChunk(context);
    adapter.afterChunkError(context);
    adapter.afterChunk(context);
View Full Code Here

Examples of org.springframework.batch.core.scope.context.ChunkContext

    StepExecution stepExecution = new StepExecution("foo", null);
    ExecutionContext stepExecutionContext = new ExecutionContext();
    stepExecutionContext.putString("filePath", "foo.txt");
    stepExecution.setExecutionContext(stepExecutionContext);
    StepContext stepContext = new StepContext(stepExecution);
    ChunkContext chunkContext = new ChunkContext(stepContext);

    RemoteFileTemplate template = new RemoteFileTemplate(factory);
    template.setBeanFactory(mock(BeanFactory.class));
    template.afterPropertiesSet();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.