Search in sources :

Example 1 with UserV1Endpoint

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());
}
Also used : SyncOperationStatus(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SyncOperationStatus) Test(org.junit.jupiter.api.Test)

Example 2 with UserV1Endpoint

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));
}
Also used : SyncOperationStatus(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SyncOperationStatus) EnvironmentUserSyncState(com.sequenceiq.freeipa.api.v1.freeipa.user.model.EnvironmentUserSyncState) UserV1Endpoint(com.sequenceiq.freeipa.api.v1.freeipa.user.UserV1Endpoint)

Aggregations

SyncOperationStatus (com.sequenceiq.freeipa.api.v1.freeipa.user.model.SyncOperationStatus)2 UserV1Endpoint (com.sequenceiq.freeipa.api.v1.freeipa.user.UserV1Endpoint)1 EnvironmentUserSyncState (com.sequenceiq.freeipa.api.v1.freeipa.user.model.EnvironmentUserSyncState)1 Test (org.junit.jupiter.api.Test)1