use of com.sequenceiq.freeipa.api.v1.freeipa.user.model.EnvironmentUserSyncState in project cloudbreak by hortonworks.
the class EnvironmentUserSyncStateCalculatorTest method internalCalculateEnvironmentUserSyncStateLastSyncFailed.
@Test
void internalCalculateEnvironmentUserSyncStateLastSyncFailed() {
UserSyncStatus userSyncStatus = new UserSyncStatus();
Operation lastSync = new Operation();
lastSync.setOperationId(UUID.randomUUID().toString());
lastSync.setStatus(OperationState.FAILED);
userSyncStatus.setLastStartedFullSync(lastSync);
EnvironmentUserSyncState result = underTest.internalCalculateEnvironmentUserSyncState(ACCOUNT_ID, ENVIRONMENT_CRN, Optional.of(userSyncStatus));
assertEquals(UserSyncState.SYNC_FAILED, result.getState());
assertEquals(lastSync.getOperationId(), result.getLastUserSyncOperationId());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.user.model.EnvironmentUserSyncState in project cloudbreak by hortonworks.
the class EnvironmentUserSyncStateCalculatorTest method internalCalculateEnvironmentUserSyncStateLastSyncCompletedFailure.
@Test
void internalCalculateEnvironmentUserSyncStateLastSyncCompletedFailure() {
UserSyncStatus userSyncStatus = new UserSyncStatus();
Operation lastSync = new Operation();
lastSync.setOperationId(UUID.randomUUID().toString());
lastSync.setStatus(OperationState.COMPLETED);
lastSync.setFailureList(List.of(new FailureDetails(ENVIRONMENT_CRN, "failure message")));
userSyncStatus.setLastStartedFullSync(lastSync);
EnvironmentUserSyncState result = underTest.internalCalculateEnvironmentUserSyncState(ACCOUNT_ID, ENVIRONMENT_CRN, Optional.of(userSyncStatus));
assertEquals(UserSyncState.SYNC_FAILED, result.getState());
assertEquals(lastSync.getOperationId(), result.getLastUserSyncOperationId());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.user.model.EnvironmentUserSyncState in project cloudbreak by hortonworks.
the class EnvironmentUserSyncStateCalculatorTest method internalCalculateEnvironmentUserSyncStateLastSyncRunning.
@Test
void internalCalculateEnvironmentUserSyncStateLastSyncRunning() {
UserSyncStatus userSyncStatus = new UserSyncStatus();
Operation lastSync = new Operation();
lastSync.setOperationId(UUID.randomUUID().toString());
lastSync.setStatus(OperationState.RUNNING);
userSyncStatus.setLastStartedFullSync(lastSync);
EnvironmentUserSyncState result = underTest.internalCalculateEnvironmentUserSyncState(ACCOUNT_ID, ENVIRONMENT_CRN, Optional.of(userSyncStatus));
assertEquals(UserSyncState.SYNC_IN_PROGRESS, result.getState());
assertEquals(lastSync.getOperationId(), result.getLastUserSyncOperationId());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.user.model.EnvironmentUserSyncState in project cloudbreak by hortonworks.
the class EnvironmentUserSyncStateCalculatorTest method internalCalculateEnvironmentUserSyncStateNoLastSync.
@Test
void internalCalculateEnvironmentUserSyncStateNoLastSync() {
UserSyncStatus userSyncStatus = new UserSyncStatus();
EnvironmentUserSyncState result = underTest.internalCalculateEnvironmentUserSyncState(ACCOUNT_ID, ENVIRONMENT_CRN, Optional.of(userSyncStatus));
assertEquals(UserSyncState.STALE, result.getState());
assertNull(result.getLastUserSyncOperationId());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.user.model.EnvironmentUserSyncState in project cloudbreak by hortonworks.
the class EnvironmentUserSyncStateCalculatorTest method internalCalculateEnvironmentUserSyncStateLastSyncCompletedSuccessInSync.
@Test
void internalCalculateEnvironmentUserSyncStateLastSyncCompletedSuccessInSync() {
UserSyncStatus userSyncStatus = new UserSyncStatus();
Operation lastSync = new Operation();
lastSync.setOperationId(UUID.randomUUID().toString());
lastSync.setStatus(OperationState.COMPLETED);
lastSync.setSuccessList(List.of(new SuccessDetails(ENVIRONMENT_CRN)));
userSyncStatus.setLastStartedFullSync(lastSync);
UmsEventGenerationIds current = new UmsEventGenerationIds();
when(umsEventGenerationIdsProvider.getEventGenerationIds(eq(ACCOUNT_ID), any())).thenReturn(current);
when(eventGenerationIdsChecker.isInSync(userSyncStatus, current)).thenReturn(true);
EnvironmentUserSyncState result = underTest.internalCalculateEnvironmentUserSyncState(ACCOUNT_ID, ENVIRONMENT_CRN, Optional.of(userSyncStatus));
assertEquals(UserSyncState.UP_TO_DATE, result.getState());
assertEquals(lastSync.getOperationId(), result.getLastUserSyncOperationId());
}
Aggregations