@Test void synchronizeAllUsersInEnvironmentSuccess() { SyncOperationStatus status = createStatus(SynchronizationStatus.REQUESTED, ""); when(userV1Endpoint.synchronizeAllUsers(any(SynchronizeAllUsersRequest.class))).thenReturn(status); SyncOperationStatus result = underTest.synchronizeAllUsersInEnvironment(ENVCRN); assertThat(result).isEqualTo(status); }
SyncOperationStatus synchronizeAllUsersInEnvironment(String environmentCrn) { try { SynchronizeAllUsersRequest request = new SynchronizeAllUsersRequest(Set.of(environmentCrn), Set.of()); return userV1Endpoint.synchronizeAllUsers(request); } catch (WebApplicationException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.error(String.format("Failed to synchronize users with FreeIpa for environment '%s' due to: '%s'", environmentCrn, errorMessage), e); throw new FreeIpaOperationFailedException(errorMessage, e); } }
FreeIpaService { SyncOperationStatus synchronizeAllUsersInEnvironment(String environmentCrn) { try { SynchronizeAllUsersRequest request = new SynchronizeAllUsersRequest(Set.of(environmentCrn), Set.of()); return userV1Endpoint.synchronizeAllUsers(request); } catch (WebApplicationException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.error(String.format("Failed to synchronize users with FreeIpa for environment '%s' due to: '%s'", environmentCrn, errorMessage), e); throw new FreeIpaOperationFailedException(errorMessage, e); } } }
FreeIpaService { SyncOperationStatus synchronizeAllUsersInEnvironment(String environmentCrn) { try { SynchronizeAllUsersRequest request = new SynchronizeAllUsersRequest(Set.of(environmentCrn), Set.of()); return userV1Endpoint.synchronizeAllUsers(request); } catch (WebApplicationException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.error(String.format("Failed to synchronize users with FreeIpa for environment '%s' due to: '%s'", environmentCrn, errorMessage), e); throw new FreeIpaOperationFailedException(errorMessage, e); } } FreeIpaService(FreeIpaV1Endpoint freeIpaV1Endpoint,
            UserV1Endpoint userV1Endpoint,
            WebApplicationExceptionMessageExtractor webApplicationExceptionMessageExtractor); }
FreeIpaService { SyncOperationStatus synchronizeAllUsersInEnvironment(String environmentCrn) { try { SynchronizeAllUsersRequest request = new SynchronizeAllUsersRequest(Set.of(environmentCrn), Set.of()); return userV1Endpoint.synchronizeAllUsers(request); } catch (WebApplicationException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.error(String.format("Failed to synchronize users with FreeIpa for environment '%s' due to: '%s'", environmentCrn, errorMessage), e); throw new FreeIpaOperationFailedException(errorMessage, e); } } FreeIpaService(FreeIpaV1Endpoint freeIpaV1Endpoint,
            UserV1Endpoint userV1Endpoint,
            WebApplicationExceptionMessageExtractor webApplicationExceptionMessageExtractor); DescribeFreeIpaResponse create(CreateFreeIpaRequest createFreeIpaRequest); Optional<DescribeFreeIpaResponse> describe(String envCrn); void delete(String environmentCrn, boolean forced); void attachChildEnvironment(AttachChildEnvironmentRequest attachChildEnvironmentRequest); void detachChildEnvironment(DetachChildEnvironmentRequest detachChildEnvironmentRequest); SyncOperationStatus getSyncOperationStatus(String environmentCrn, String operationId); HealthDetailsFreeIpaResponse getHealthDetails(String environmentCrn); }
FreeIpaService { SyncOperationStatus synchronizeAllUsersInEnvironment(String environmentCrn) { try { SynchronizeAllUsersRequest request = new SynchronizeAllUsersRequest(Set.of(environmentCrn), Set.of()); return userV1Endpoint.synchronizeAllUsers(request); } catch (WebApplicationException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.error(String.format("Failed to synchronize users with FreeIpa for environment '%s' due to: '%s'", environmentCrn, errorMessage), e); throw new FreeIpaOperationFailedException(errorMessage, e); } } FreeIpaService(FreeIpaV1Endpoint freeIpaV1Endpoint,
            UserV1Endpoint userV1Endpoint,
            WebApplicationExceptionMessageExtractor webApplicationExceptionMessageExtractor); DescribeFreeIpaResponse create(CreateFreeIpaRequest createFreeIpaRequest); Optional<DescribeFreeIpaResponse> describe(String envCrn); void delete(String environmentCrn, boolean forced); void attachChildEnvironment(AttachChildEnvironmentRequest attachChildEnvironmentRequest); void detachChildEnvironment(DetachChildEnvironmentRequest detachChildEnvironmentRequest); SyncOperationStatus getSyncOperationStatus(String environmentCrn, String operationId); HealthDetailsFreeIpaResponse getHealthDetails(String environmentCrn);  }