use of com.sequenceiq.freeipa.api.v1.freeipa.user.UserV1Endpoint in project cloudbreak by hortonworks.
the class FreeIpaServiceTest method synchronizeAllUsersInEnvironmentOngoing.
// @Test
// void getSyncOperationStatusSuccess() {
// SyncOperationStatus status = createStatus(SynchronizationStatus.COMPLETED, "nope");
// when(userV1Endpoint.getSyncOperationStatusInternal(any(), eq(OPERATION))).thenReturn(status);
// SyncOperationStatus result = ThreadBasedUserCrnProvider.doAsInternalActor(() ->
// underTest.getSyncOperationStatus(ENVCRN, OPERATION));
// assertThat(result).isEqualTo(status);
// }
// @Test
// void getSyncOperationStatusFailure() {
// when(webApplicationExceptionMessageExtractor.getErrorMessage(any())).thenReturn("custom error");
// when(userV1Endpoint.getSyncOperationStatusInternal(any(), eq(OPERATION))).thenThrow(new WebApplicationException("network error"));
// assertThatThrownBy(() -> ThreadBasedUserCrnProvider.doAsInternalActor(() ->
// underTest.getSyncOperationStatus(ENVCRN, OPERATION))).isInstanceOf(FreeIpaOperationFailedException.class);
// }
@Test
void synchronizeAllUsersInEnvironmentOngoing() {
SyncOperationStatus status = createStatus(SynchronizationStatus.RUNNING, "");
when(userV1Endpoint.getLastSyncOperationStatus(any())).thenReturn(status);
SyncOperationStatus result = underTest.synchronizeAllUsersInEnvironment(ENVCRN);
assertThat(result).isEqualTo(status);
verify(userV1Endpoint, times(0)).synchronizeAllUsers(any());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.user.UserV1Endpoint in project cloudbreak by hortonworks.
the class AwsYcloudHybridCloudTest method checkUserSyncState.
private void checkUserSyncState(String environmentCrn, com.sequenceiq.freeipa.api.client.FreeIpaClient freeIpaClient) throws JsonProcessingException {
UserV1Endpoint userV1Endpoint = freeIpaClient.getUserV1Endpoint();
EnvironmentUserSyncState userSyncState = userV1Endpoint.getUserSyncState(environmentCrn);
SyncOperationStatus syncOperationStatus = userV1Endpoint.getSyncOperationStatus(userSyncState.getLastUserSyncOperationId());
LOGGER.info("Last user sync is in state {}, last operation: {}", userSyncState.getState(), OBJECT_MAPPER.writeValueAsString(syncOperationStatus));
}
Aggregations