Examples of RetryContext


Examples of org.springframework.retry.RetryContext

  @Test
  public void testTrivialPolicies() throws Exception {
    policy.setPolicyMap(Collections.<Class<? extends Throwable>, RetryPolicy> singletonMap(Exception.class,
        new MockRetryPolicySupport()));
    RetryContext context = policy.open(null);
    assertNotNull(context);
    assertTrue(policy.canRetry(context));
  }
View Full Code Here

Examples of org.springframework.retry.RetryContext

  }

  @Test
  public void testNullPolicies() throws Exception {
    policy.setPolicyMap(new HashMap<Class<? extends Throwable>, RetryPolicy>());
    RetryContext context = policy.open(null);
    assertNotNull(context);
  }
View Full Code Here

Examples of org.springframework.retry.RetryContext

  @Test
  public void testNullContext() throws Exception {
    policy.setPolicyMap(Collections.<Class<? extends Throwable>, RetryPolicy> singletonMap(Exception.class,
        new NeverRetryPolicy()));

    RetryContext context = policy.open(null);
    assertNotNull(context);

    assertTrue(policy.canRetry(context));
  }
View Full Code Here

Examples of org.springframework.retry.RetryContext

  }

  @Test
  public void testClassifierOperates() throws Exception {

    RetryContext context = policy.open(null);
    assertNotNull(context);

    assertTrue(policy.canRetry(context));
    policy.registerThrowable(context, new IllegalArgumentException());
    assertFalse(policy.canRetry(context)); // NeverRetryPolicy is the
View Full Code Here

Examples of org.springframework.retry.RetryContext

            count++;
          }
        };
      }
    });
    RetryContext context = policy.open(null);

    // The mapped (child) policy hasn't been used yet, so if we close now
    // we don't incur the possible expense of creating the child context.
    policy.close(context);
    assertEquals(0, count); // not classified yet
View Full Code Here

Examples of org.springframework.retry.RetryContext

  }

  @Test
  public void testRetryCount() throws Exception {
    ExceptionClassifierRetryPolicy policy = new ExceptionClassifierRetryPolicy();
    RetryContext context = policy.open(null);
    assertNotNull(context);
    policy.registerThrowable(context, null);
    assertEquals(0, context.getRetryCount());
    policy.registerThrowable(context, new RuntimeException("foo"));
    assertEquals(1, context.getRetryCount());
    assertEquals("foo", context.getLastThrowable().getMessage());
  }
View Full Code Here

Examples of org.springframework.retry.RetryContext

  }

  @Test
  public void testParent() throws Exception {
    ExceptionClassifierRetryPolicy policy = new ExceptionClassifierRetryPolicy();
    RetryContext context = policy.open(null);
    RetryContext child = policy.open(context);
    assertNotSame(child, context);
    assertSame(context, child.getParent());
  }
View Full Code Here

Examples of org.springframework.retry.RetryContext

  @Test
  public void testTimeoutPreventsRetry() throws Exception {
    TimeoutRetryPolicy policy = new TimeoutRetryPolicy();
    policy.setTimeout(100);
    RetryContext context = policy.open(null);
    policy.registerThrowable(context, new Exception());
    assertTrue(policy.canRetry(context));
    Thread.sleep(200);
    assertFalse(policy.canRetry(context));
    policy.close(context);
View Full Code Here

Examples of org.springframework.retry.RetryContext

  }

  @Test
  public void testRetryCount() throws Exception {
    TimeoutRetryPolicy policy = new TimeoutRetryPolicy();
    RetryContext context = policy.open(null);
    assertNotNull(context);
    policy.registerThrowable(context, null);
    assertEquals(0, context.getRetryCount());
    policy.registerThrowable(context, new RuntimeException("foo"));
    assertEquals(1, context.getRetryCount());
    assertEquals("foo", context.getLastThrowable().getMessage());
  }
View Full Code Here

Examples of org.springframework.retry.RetryContext

  }

  @Test
  public void testParent() throws Exception {
    TimeoutRetryPolicy policy = new TimeoutRetryPolicy();
    RetryContext context = policy.open(null);
    RetryContext child = policy.open(context);
    assertNotSame(child, context);
    assertSame(context, child.getParent());
  }
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.