@Test public void shouldRetryWhenRequestForDutiesFailsBecauseNodeDataIsUnavailable() { when(delegate.loadDutiesForEpoch(ONE)) .thenReturn(SafeFuture.failedFuture(new NodeDataUnavailableException("Sorry"))) .thenReturn(SafeFuture.completedFuture(scheduledDuties)); final SafeFuture<ScheduledDuties> result = dutyLoader.loadDutiesForEpoch(ONE); assertThat(result).isNotDone(); assertThat(asyncRunner.hasDelayedActions()).isTrue(); asyncRunner.executeQueuedActions(); assertThat(result).isCompletedWithValue(scheduledDuties); }
@Override public SafeFuture<ScheduledDuties> loadDutiesForEpoch(final UInt64 epoch) { final SafeFuture<ScheduledDuties> duties = new SafeFuture<>(); requestDuties(epoch, duties).propagateTo(duties); return duties; }
RetryingDutyLoader implements DutyLoader { @Override public SafeFuture<ScheduledDuties> loadDutiesForEpoch(final UInt64 epoch) { final SafeFuture<ScheduledDuties> duties = new SafeFuture<>(); requestDuties(epoch, duties).propagateTo(duties); return duties; } }
RetryingDutyLoader implements DutyLoader { @Override public SafeFuture<ScheduledDuties> loadDutiesForEpoch(final UInt64 epoch) { final SafeFuture<ScheduledDuties> duties = new SafeFuture<>(); requestDuties(epoch, duties).propagateTo(duties); return duties; } RetryingDutyLoader(final AsyncRunner asyncRunner, final DutyLoader delegate); }
RetryingDutyLoader implements DutyLoader { @Override public SafeFuture<ScheduledDuties> loadDutiesForEpoch(final UInt64 epoch) { final SafeFuture<ScheduledDuties> duties = new SafeFuture<>(); requestDuties(epoch, duties).propagateTo(duties); return duties; } RetryingDutyLoader(final AsyncRunner asyncRunner, final DutyLoader delegate); @Override SafeFuture<ScheduledDuties> loadDutiesForEpoch(final UInt64 epoch); }
RetryingDutyLoader implements DutyLoader { @Override public SafeFuture<ScheduledDuties> loadDutiesForEpoch(final UInt64 epoch) { final SafeFuture<ScheduledDuties> duties = new SafeFuture<>(); requestDuties(epoch, duties).propagateTo(duties); return duties; } RetryingDutyLoader(final AsyncRunner asyncRunner, final DutyLoader delegate); @Override SafeFuture<ScheduledDuties> loadDutiesForEpoch(final UInt64 epoch);  }