@Test void testStartPollerWhenFreeIpaNull() throws Exception { when(freeIpaService.describe(CRN)).thenReturn(Optional.empty()); AttemptResult<Void> result = underTest.startPoller(ENV_ID, CRN).process(); Assertions.assertEquals(AttemptState.FINISH, result.getState()); }
public AttemptMaker<Void> startPoller(Long envId, String envCrn) { return () -> { if (PollGroup.CANCELLED.equals(EnvironmentInMemoryStateStore.get(envId))) { LOGGER.info("FreeIpa polling cancelled in inmemory store, id: " + envId); return AttemptResults.breakFor("FreeIpa polling cancelled in inmemory store, id: " + envId); } Optional<DescribeFreeIpaResponse> freeIpaResponse = freeIpaService.describe(envCrn); if (freeIpaResponse.isEmpty() || freeipaAvailable(freeIpaResponse.get())) { return AttemptResults.finishWith(null); } else { return checkStartStatus(freeIpaResponse.get()); } }; }
FreeIpaPollerProvider { public AttemptMaker<Void> startPoller(Long envId, String envCrn) { return () -> { if (PollGroup.CANCELLED.equals(EnvironmentInMemoryStateStore.get(envId))) { LOGGER.info("FreeIpa polling cancelled in inmemory store, id: " + envId); return AttemptResults.breakFor("FreeIpa polling cancelled in inmemory store, id: " + envId); } Optional<DescribeFreeIpaResponse> freeIpaResponse = freeIpaService.describe(envCrn); if (freeIpaResponse.isEmpty() || freeipaAvailable(freeIpaResponse.get())) { return AttemptResults.finishWith(null); } else { return checkStartStatus(freeIpaResponse.get()); } }; } }
FreeIpaPollerProvider { public AttemptMaker<Void> startPoller(Long envId, String envCrn) { return () -> { if (PollGroup.CANCELLED.equals(EnvironmentInMemoryStateStore.get(envId))) { LOGGER.info("FreeIpa polling cancelled in inmemory store, id: " + envId); return AttemptResults.breakFor("FreeIpa polling cancelled in inmemory store, id: " + envId); } Optional<DescribeFreeIpaResponse> freeIpaResponse = freeIpaService.describe(envCrn); if (freeIpaResponse.isEmpty() || freeipaAvailable(freeIpaResponse.get())) { return AttemptResults.finishWith(null); } else { return checkStartStatus(freeIpaResponse.get()); } }; } FreeIpaPollerProvider(FreeIpaService freeIpaService); }
FreeIpaPollerProvider { public AttemptMaker<Void> startPoller(Long envId, String envCrn) { return () -> { if (PollGroup.CANCELLED.equals(EnvironmentInMemoryStateStore.get(envId))) { LOGGER.info("FreeIpa polling cancelled in inmemory store, id: " + envId); return AttemptResults.breakFor("FreeIpa polling cancelled in inmemory store, id: " + envId); } Optional<DescribeFreeIpaResponse> freeIpaResponse = freeIpaService.describe(envCrn); if (freeIpaResponse.isEmpty() || freeipaAvailable(freeIpaResponse.get())) { return AttemptResults.finishWith(null); } else { return checkStartStatus(freeIpaResponse.get()); } }; } FreeIpaPollerProvider(FreeIpaService freeIpaService); AttemptMaker<Void> startPoller(Long envId, String envCrn); AttemptMaker<Void> stopPoller(Long envId, String envCrn); AttemptMaker<Void> syncUsersPoller(Long envId, String envCrn, String operationId); }
FreeIpaPollerProvider { public AttemptMaker<Void> startPoller(Long envId, String envCrn) { return () -> { if (PollGroup.CANCELLED.equals(EnvironmentInMemoryStateStore.get(envId))) { LOGGER.info("FreeIpa polling cancelled in inmemory store, id: " + envId); return AttemptResults.breakFor("FreeIpa polling cancelled in inmemory store, id: " + envId); } Optional<DescribeFreeIpaResponse> freeIpaResponse = freeIpaService.describe(envCrn); if (freeIpaResponse.isEmpty() || freeipaAvailable(freeIpaResponse.get())) { return AttemptResults.finishWith(null); } else { return checkStartStatus(freeIpaResponse.get()); } }; } FreeIpaPollerProvider(FreeIpaService freeIpaService); AttemptMaker<Void> startPoller(Long envId, String envCrn); AttemptMaker<Void> stopPoller(Long envId, String envCrn); AttemptMaker<Void> syncUsersPoller(Long envId, String envCrn, String operationId);  }