Package org.springframework.batch.repeat.context

Examples of org.springframework.batch.repeat.context.RepeatContextSupport


      add("f");
    }}));

    itemReader.setThrowExceptionOnRecordNumber(ITER_COUNT + 1);
   
    RepeatSynchronizationManager.register(new RepeatContextSupport(null));
   
    //call process method multiple times and verify whether exception is thrown when expected
    for (int i = 0; i <= ITER_COUNT; i++) {
      try {
        itemReader.read();
View Full Code Here


  @Test
  public void testContextClosedOnNormalCompletion() throws Exception {

    final List<String> list = new ArrayList<String>();

    final RepeatContext context = new RepeatContextSupport(null) {
            @Override
      public void close() {
        super.close();
        list.add("close");
      }
View Full Code Here

  @Test
  public void testContextClosedOnAbnormalCompletion() throws Exception {

    final List<String> list = new ArrayList<String>();

    final RepeatContext context = new RepeatContextSupport(null) {
            @Override
      public void close() {
        super.close();
        list.add("close");
      }
View Full Code Here

  @Test
  public void testDefaultBehaviour() throws Throwable {
    Throwable throwable = new RuntimeException("foo");
    try {
      handler.handleException(new RepeatContextSupport(null), throwable);
      fail("Exception was swallowed.");
    }
    catch (RuntimeException expected) {
      assertTrue("Exception is rethrown, ignoring the exception limit", true);
      assertSame(expected, throwable);
View Full Code Here

    handler.setLimit(MORE_THAN_ZERO);
    handler.setExceptionClasses(Collections.<Class<? extends Throwable>> singleton(IllegalArgumentException.class));
    handler.afterPropertiesSet();

    try {
      handler.handleException(new RepeatContextSupport(null), throwable);
      fail("Exception was swallowed.");
    }
    catch (RuntimeException expected) {
      assertTrue("Exception is rethrown, ignoring the exception limit", true);
      assertSame(expected, throwable);
View Full Code Here

    handler.setLimit(MORE_THAN_ZERO);
    handler.setExceptionClasses(Collections.<Class<? extends Throwable>> singleton(RuntimeException.class));
    handler.afterPropertiesSet();

    try {
      handler.handleException(new RepeatContextSupport(null), new RuntimeException("foo"));
    }
    catch (RuntimeException expected) {
      fail("Unexpected exception.");
    }
  }
View Full Code Here

    final int MORE_THAN_ZERO = 1;
    handler.setLimit(MORE_THAN_ZERO);
    handler.setExceptionClasses(Collections.<Class<? extends Throwable>> singleton(RuntimeException.class));
    handler.afterPropertiesSet();

    RepeatContextSupport parent = new RepeatContextSupport(null);

    try {
      RepeatContextSupport context = new RepeatContextSupport(parent);
      handler.handleException(context, throwable);
      context = new RepeatContextSupport(parent);
      handler.handleException(context, throwable);
    }
    catch (RuntimeException expected) {
      fail("Unexpected exception.");
    }
View Full Code Here

    handler.setLimit(MORE_THAN_ZERO);
    handler.setExceptionClasses(Collections.<Class<? extends Throwable>> singleton(RuntimeException.class));
    handler.setUseParent(true);
    handler.afterPropertiesSet();

    RepeatContextSupport parent = new RepeatContextSupport(null);

    try {
      RepeatContextSupport context = new RepeatContextSupport(parent);
      handler.handleException(context, throwable);
      context = new RepeatContextSupport(parent);
      handler.handleException(context, throwable);
      fail("Expected exception.");
    }
    catch (RuntimeException expected) {
      assertSame(throwable, expected);
View Full Code Here

          add(new RuntimeException("below exception limit"));
        }
      }
    };

    RepeatContextSupport context = new RepeatContextSupport(null);

    try {
      for (Throwable throwable : throwables) {

        handler.handleException(context, throwable);
View Full Code Here

      }
    };

    throwables.add(new RuntimeException("above exception limit"));

    RepeatContextSupport context = new RepeatContextSupport(null);

    try {
      for (Throwable throwable : throwables) {

        handler.handleException(context, throwable);
View Full Code Here

TOP

Related Classes of org.springframework.batch.repeat.context.RepeatContextSupport

Copyright © 2018 www.massapicom. 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.