@Test void testSyncUsersWhenFreeIpaAvailable() { DescribeFreeIpaResponse freeipaResponse = new DescribeFreeIpaResponse(); freeipaResponse.setStatus(Status.AVAILABLE); when(freeIpaService.describe(ENV_CRN)).thenReturn(Optional.of(freeipaResponse)); when(freeIpaService.synchronizeAllUsersInEnvironment(ENV_CRN)).thenReturn(createStatus(SynchronizationStatus.REQUESTED, "")); when(freeipaPollerProvider.syncUsersPoller(ENV_ID, ENV_CRN, OPERATION)).thenReturn(AttemptResults::justFinish); underTest.waitForSynchronizeUsers(ENV_ID, ENV_CRN); verify(freeIpaService, times(1)).synchronizeAllUsersInEnvironment(ENV_CRN); }
public void waitForSynchronizeUsers(Long envId, String envCrn) { executeFreeIpaSyncOperationAndStartPolling(envCrn, freeIpaService::synchronizeAllUsersInEnvironment, opId -> freeipaPollerProvider.syncUsersPoller(envId, envCrn, opId), Status::isAvailable); }
FreeIpaPollerService { public void waitForSynchronizeUsers(Long envId, String envCrn) { executeFreeIpaSyncOperationAndStartPolling(envCrn, freeIpaService::synchronizeAllUsersInEnvironment, opId -> freeipaPollerProvider.syncUsersPoller(envId, envCrn, opId), Status::isAvailable); } }
FreeIpaPollerService { public void waitForSynchronizeUsers(Long envId, String envCrn) { executeFreeIpaSyncOperationAndStartPolling(envCrn, freeIpaService::synchronizeAllUsersInEnvironment, opId -> freeipaPollerProvider.syncUsersPoller(envId, envCrn, opId), Status::isAvailable); } FreeIpaPollerService(FreeIpaService freeIpaService, FreeIpaPollerProvider freeipaPollerProvider); }
FreeIpaPollerService { public void waitForSynchronizeUsers(Long envId, String envCrn) { executeFreeIpaSyncOperationAndStartPolling(envCrn, freeIpaService::synchronizeAllUsersInEnvironment, opId -> freeipaPollerProvider.syncUsersPoller(envId, envCrn, opId), Status::isAvailable); } FreeIpaPollerService(FreeIpaService freeIpaService, FreeIpaPollerProvider freeipaPollerProvider); void startAttachedFreeipaInstances(Long envId, String envCrn); void stopAttachedFreeipaInstances(Long envId, String envCrn); void waitForSynchronizeUsers(Long envId, String envCrn); }
FreeIpaPollerService { public void waitForSynchronizeUsers(Long envId, String envCrn) { executeFreeIpaSyncOperationAndStartPolling(envCrn, freeIpaService::synchronizeAllUsersInEnvironment, opId -> freeipaPollerProvider.syncUsersPoller(envId, envCrn, opId), Status::isAvailable); } FreeIpaPollerService(FreeIpaService freeIpaService, FreeIpaPollerProvider freeipaPollerProvider); void startAttachedFreeipaInstances(Long envId, String envCrn); void stopAttachedFreeipaInstances(Long envId, String envCrn); void waitForSynchronizeUsers(Long envId, String envCrn);  }