Examples of LimitCheckingItemSkipPolicy


Examples of org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy

  protected SkipPolicy createSkipPolicy() {
    SkipPolicy skipPolicy = this.skipPolicy;
    Map<Class<? extends Throwable>, Boolean> map = new HashMap<Class<? extends Throwable>, Boolean>(
        skippableExceptionClasses);
    map.put(ForceRollbackForWriteSkipException.class, true);
    LimitCheckingItemSkipPolicy limitCheckingItemSkipPolicy = new LimitCheckingItemSkipPolicy(skipLimit, map);
    if (skipPolicy == null) {
      Assert.state(!(skippableExceptionClasses.isEmpty() && skipLimit > 0),
          "If a skip limit is provided then skippable exceptions must also be specified");
      skipPolicy = limitCheckingItemSkipPolicy;
    }
View Full Code Here

Examples of org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy

   */
  @Test
  public void testReadSkipWithPolicy() throws Exception {
    // Should be ignored
    factory.setSkipLimit(0);
    factory.setSkipPolicy(new LimitCheckingItemSkipPolicy(2, Collections
        .<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true)));
    testReadSkip();
  }
View Full Code Here

Examples of org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy

      @Override
      public String read() throws Exception, UnexpectedInputException, ParseException {
        throw new RuntimeException("Planned");
      }
    }, new RepeatTemplate());
    provider.setSkipPolicy(new LimitCheckingItemSkipPolicy(Integer.MAX_VALUE, Collections.<Class<? extends Throwable>,Boolean>singletonMap(Exception.class, Boolean.TRUE)));
    provider.setMaxSkipsOnRead(10);
    Chunk<String> chunk = null;
    chunk = provider.provide(contribution);
    assertNotNull(chunk);
    assertEquals(0, chunk.getItems().size());
View Full Code Here

Examples of org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy

  // BATCH-1804
  public void testWriteRetryOnNonSkippableException() throws Exception {
    SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
    retryPolicy.setMaxAttempts(2);
    batchRetryTemplate.setRetryPolicy(retryPolicy);
    processor.setWriteSkipPolicy(new LimitCheckingItemSkipPolicy(1,
        Collections.<Class<? extends Throwable>, Boolean> singletonMap(
            IllegalArgumentException.class, true)));
    processor.setItemWriter(new ItemWriter<String>() {
      @Override
      public void write(List<? extends String> items) throws Exception {
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.