Package org.springframework.util.backoff

Examples of org.springframework.util.backoff.BackOff.start()


  @Test
  public void applyBackOff() {
    BackOff mock = mock(BackOff.class);
    BackOffExecution execution = mock(BackOffExecution.class);
    given(execution.nextBackOff()).willReturn(BackOffExecution.STOP);
    given(mock.start()).willReturn(execution);

    DefaultMessageListenerContainer container = createContainer(mock, createFailingContainerFactory());
    container.start();
    assertEquals(true, container.isRunning());
View Full Code Here


  @Test
  public void applyBackOffRetry() {
    BackOff mock = mock(BackOff.class);
    BackOffExecution execution = mock(BackOffExecution.class);
    given(execution.nextBackOff()).willReturn(50L, BackOffExecution.STOP);
    given(mock.start()).willReturn(execution);

    DefaultMessageListenerContainer container = createContainer(mock, createFailingContainerFactory());
    container.start();
    container.refreshConnectionUntilSuccessful();
View Full Code Here

  @Test
  public void recoverResetBackOff() {
    BackOff mock = mock(BackOff.class);
    BackOffExecution execution = mock(BackOffExecution.class);
    given(execution.nextBackOff()).willReturn(50L, 50L, 50L); // 3 attempts max
    given(mock.start()).willReturn(execution);

    DefaultMessageListenerContainer container = createContainer(mock, createRecoverableContainerFactory(1));
    container.start();
    container.refreshConnectionUntilSuccessful();
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.