Examples of AlwaysSkipItemSkipPolicy


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

    assertEquals(1, contribution.getFilterCount());
  }

  @Test
  public void testFilterCountOnSkip() throws Exception {
    processor.setProcessSkipPolicy(new AlwaysSkipItemSkipPolicy());
    processor.setItemProcessor(new ItemProcessor<String, String>() {
      @Override
      public String process(String item) throws Exception {
        if (item.equals("1")) {
          throw new RuntimeException("Skippable");
View Full Code Here

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

   *
   * @throws Exception
   */
  @Test
  public void testWriteSkipOnError() throws Exception {
    processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());
    processor.setItemWriter(new ItemWriter<String>() {
      @Override
      public void write(List<? extends String> items) throws Exception {
        if (items.contains("fail")) {
          assertFalse("Expected Error!", true);
View Full Code Here

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

    processor.process(contribution, inputs);
  }

  @Test
  public void testWriteSkipOnException() throws Exception {
    processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());
    processor.setItemWriter(new ItemWriter<String>() {
      @Override
      public void write(List<? extends String> items) throws Exception {
        if (items.contains("fail")) {
          throw new RuntimeException("Expected Exception!");
View Full Code Here

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

    assertEquals(0, contribution.getFilterCount());
  }

  @Test
  public void testWriteSkipOnExceptionWithTrivialChunk() throws Exception {
    processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());
    processor.setItemWriter(new ItemWriter<String>() {
      @Override
      public void write(List<? extends String> items) throws Exception {
        if (items.contains("fail")) {
          throw new RuntimeException("Expected Exception!");
View Full Code Here

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

          throw new DataIntegrityViolationException("Planned");
        }
        return item;
      }
    });
    processor.setProcessSkipPolicy(new AlwaysSkipItemSkipPolicy());
    processor
    .setRollbackClassifier(new BinaryExceptionClassifier(
        Collections
        .<Class<? extends Throwable>> singleton(DataIntegrityViolationException.class),
        false));
View Full Code Here

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

          @Override
          public void afterWrite(List<? extends String> item) {
            after.addAll(item);
          }
        }));
    processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());
    processAndExpectPlannedRuntimeException(chunk);
    processor.process(contribution, chunk);
    assertEquals(2, chunk.getItems().size());
    processAndExpectPlannedRuntimeException(chunk);
    assertEquals(1, chunk.getItems().size());
View Full Code Here

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

          @Override
          public void afterWrite(List<? extends String> item) {
            after.addAll(item);
          }
        }));
    processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());

    processAndExpectPlannedRuntimeException(chunk);
    processor.process(contribution, chunk);
    processor.process(contribution, chunk);
View Full Code Here

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

          public void onWriteError(Exception e,
              List<? extends String> item) {
            writeError.addAll(item);
          }
        }));
    processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());

    processAndExpectPlannedRuntimeException(chunk);// Process foo, fail
    processor.process(contribution, chunk);// Process foo
    processAndExpectPlannedRuntimeException(chunk);// Process fail
View Full Code Here

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

          public void onWriteError(Exception e,
              List<? extends String> item) {
            writeError.addAll(item);
          }
        }));
    processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());

    processAndExpectPlannedRuntimeException(chunk);// Process foo, bar
    processAndExpectPlannedRuntimeException(chunk);// Process foo
    processAndExpectPlannedRuntimeException(chunk);// Process bar
View Full Code Here

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

  @Test
  public void testWriteRetryOnException() throws Exception {
    SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
    retryPolicy.setMaxAttempts(2);
    batchRetryTemplate.setRetryPolicy(retryPolicy);
    processor.setWriteSkipPolicy(new AlwaysSkipItemSkipPolicy());
    processor.setItemWriter(new ItemWriter<String>() {
      @Override
      public void write(List<? extends String> items) throws Exception {
        if (items.contains("fail")) {
          throw new IllegalArgumentException("Expected 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.