use of com.sequenceiq.freeipa.api.v1.operation.model.OperationState in project cloudbreak by hortonworks.
the class FreeIpaPollerProviderTest method testUpgradeCcmPoller.
@ParameterizedTest
@MethodSource("upgradeCcmStatuses")
void testUpgradeCcmPoller(OperationState operationState, AttemptState attemptState, String message) {
OperationStatus status = new OperationStatus("123", OperationType.UPGRADE_CCM, operationState, null, null, null, 0, null);
when(freeIpaService.getOperationStatus("123")).thenReturn(status);
AttemptResult<Void> result = underTest.upgradeCcmPoller(ENV_ID, CRN, "123");
Assertions.assertEquals(attemptState, result.getState());
Assertions.assertEquals(message, result.getMessage());
}
use of com.sequenceiq.freeipa.api.v1.operation.model.OperationState in project cloudbreak by hortonworks.
the class FreeIpaUpgradeCcmServiceTest method upgradeCcmTestWhenAvailableAndOperationNotRunning.
@ParameterizedTest(name = "{0}")
@EnumSource(value = OperationState.class, names = { "RUNNING" }, mode = EnumSource.Mode.EXCLUDE)
void upgradeCcmTestWhenAvailableAndOperationNotRunning(OperationState operationState) {
Stack stack = createStack(Status.AVAILABLE);
when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(ENVIRONMENT_CRN, ACCOUNT_ID)).thenReturn(stack);
Operation operation = createOperation(operationState);
when(operationService.startOperation(ACCOUNT_ID, OperationType.UPGRADE_CCM, List.of(ENVIRONMENT_CRN), List.of())).thenReturn(operation);
when(operationConverter.convert(operation)).thenReturn(operationStatus);
OperationStatus result = underTest.upgradeCcm(ENVIRONMENT_CRN, ACCOUNT_ID);
assertThat(result).isSameAs(operationStatus);
verifyNoInteractions(flowManager);
}
use of com.sequenceiq.freeipa.api.v1.operation.model.OperationState in project cloudbreak by hortonworks.
the class SyncOperationToOperationStatusConverterTest method convertFailed.
@Test
void convertFailed() {
OperationState operationState = OperationState.FAILED;
SynchronizationStatus synchronizationStatus = SynchronizationStatus.fromOperationState(operationState);
Operation operation = createSyncOperation(operationState);
String errorMessage = "error message";
operation.setError(errorMessage);
SyncOperationStatus actual = underTest.convert(operation);
assertEqualsDefaults(actual);
assertEquals(synchronizationStatus, actual.getStatus());
assertEquals(List.of(), actual.getSuccess());
assertEquals(List.of(), actual.getFailure());
assertEquals(errorMessage, actual.getError());
}
use of com.sequenceiq.freeipa.api.v1.operation.model.OperationState in project cloudbreak by hortonworks.
the class SyncOperationToOperationStatusConverterTest method convertCompleted.
@Test
void convertCompleted() {
OperationState operationState = OperationState.COMPLETED;
SynchronizationStatus synchronizationStatus = SynchronizationStatus.fromOperationState(operationState);
List<SuccessDetails> successDetails = List.of(new SuccessDetails("environment1"), new SuccessDetails("environment2"));
List<FailureDetails> failureDetails = List.of(new FailureDetails("environment3", "failure message1"), new FailureDetails("environment4", "failure message2"));
Operation operation = createSyncOperation(operationState);
operation.setSuccessList(successDetails);
operation.setFailureList(failureDetails);
SyncOperationStatus actual = underTest.convert(operation);
assertEqualsDefaults(actual);
assertEquals(synchronizationStatus, actual.getStatus());
assertEquals(successDetails, actual.getSuccess());
assertEquals(failureDetails, actual.getFailure());
assertNull(actual.getError());
}
use of com.sequenceiq.freeipa.api.v1.operation.model.OperationState in project cloudbreak by hortonworks.
the class SyncOperationToOperationStatusConverterTest method convertRunning.
@Test
void convertRunning() {
OperationState operationState = OperationState.RUNNING;
SynchronizationStatus synchronizationStatus = SynchronizationStatus.fromOperationState(operationState);
Operation operation = createSyncOperation(operationState);
SyncOperationStatus actual = underTest.convert(operation);
assertEqualsDefaults(actual);
assertEquals(synchronizationStatus, actual.getStatus());
assertEquals(List.of(), actual.getSuccess());
assertEquals(List.of(), actual.getFailure());
assertNull(actual.getError());
}
Aggregations