use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.SetupRecoveryFailed in project cloudbreak by hortonworks.
the class RecoverySetupHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SetupRecoveryRequest> event) {
Long stackId = event.getData().getResourceId();
try {
if (event.getData().getProvisionType() == ProvisionType.RECOVERY) {
LOGGER.debug("Provision type is recovery, so running recovery setup state.");
rdsRecoverySetupService.addRecoverRole(stackId);
} else {
LOGGER.debug("Provision type is not recovery, skipping recovery specific logic..");
}
return new SetupRecoverySuccess(stackId);
} catch (Exception e) {
LOGGER.error("Recovery setup failed", e);
return new SetupRecoveryFailed(stackId, e);
}
}
use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.SetupRecoveryFailed in project cloudbreak by hortonworks.
the class RecoverySetupHandlerTest method testDoAcceptWhenExceptionThenFailure.
@Test
void testDoAcceptWhenExceptionThenFailure() throws CloudbreakOrchestratorFailedException {
doThrow(new CloudbreakOrchestratorFailedException(EXCEPTION_MESSAGE)).when(rdsRecoverySetupService).addRecoverRole(STACK_ID);
Selectable nextFlowStepSelector = underTest.doAccept(getHandlerEvent(ProvisionType.RECOVERY));
assertEquals(EventSelectorUtil.selector(SetupRecoveryFailed.class), nextFlowStepSelector.selector());
SetupRecoveryFailed failureEvent = (SetupRecoveryFailed) nextFlowStepSelector;
assertEquals(EXCEPTION_MESSAGE, failureEvent.getException().getMessage());
}
Aggregations