use of com.sequenceiq.freeipa.flow.stack.StackFailureEvent in project cloudbreak by hortonworks.
the class CreateFullBackupHandlerTest method testDefaultFailureEvent.
@Test
public void testDefaultFailureEvent() {
Exception e = new Exception();
StackFailureEvent result = (StackFailureEvent) underTest.defaultFailureEvent(2L, e, new Event<>(new CreateFullBackupEvent(3L)));
assertEquals(2L, result.getResourceId());
assertEquals(e, result.getException());
assertEquals(FullBackupEvent.FULL_BACKUP_FAILED_EVENT.event(), result.selector());
}
use of com.sequenceiq.freeipa.flow.stack.StackFailureEvent in project cloudbreak by hortonworks.
the class StackProvisionActions method stackCreationFailureAction.
@Bean(name = "STACK_CREATION_FAILED_STATE")
public Action<?, ?> stackCreationFailureAction() {
return new AbstractStackFailureAction<StackProvisionState, StackProvisionEvent>() {
@Override
protected StackFailureContext createFlowContext(FlowParameters flowParameters, StateContext<StackProvisionState, StackProvisionEvent> stateContext, StackFailureEvent payload) {
Flow flow = getFlow(flowParameters.getFlowId());
Stack stack = stackService.getStackById(payload.getResourceId());
MDCBuilder.buildMdcContext(stack);
flow.setFlowFailed(payload.getException());
return new StackFailureContext(flowParameters, stack);
}
@Override
protected void doExecute(StackFailureContext context, StackFailureEvent payload, Map<Object, Object> variables) {
stackProvisionService.handleStackCreationFailure(context.getStack(), payload.getException());
sendEvent(context);
}
@Override
protected Selectable createRequest(StackFailureContext context) {
return new StackEvent(StackProvisionEvent.STACKCREATION_FAILURE_HANDLED_EVENT.event(), context.getStack().getId());
}
};
}
Aggregations