use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsCollectionFinishedAction.
@Bean(name = "DIAGNOSTICS_COLLECTION_FINISHED_STATE")
public Action<?, ?> diagnosticsCollectionFinishedAction() {
return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {
@Override
protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into DIAGNOSTICS_COLLECTION_FINISHED_STATE. resourceCrn: '{}'", resourceCrn);
InMemoryStateStore.deleteStack(payload.getResourceId());
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionStateSelectors.FINALIZE_DIAGNOSTICS_COLLECTION_EVENT.selector()).withParameters(payload.getParameters()).build();
diagnosticsOperationsService.vmDiagnosticsReport(resourceCrn, payload.getParameters());
sendEvent(context, event);
}
};
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsUpgradeTelemetryHandlerTest method testDoAcceptOnError.
@Test
public void testDoAcceptOnError() throws CloudbreakOrchestratorFailedException {
// GIVEN
doThrow(new CloudbreakOrchestratorFailedException("ex")).when(telemetryUpgradeService).upgradeTelemetryComponent(anyLong(), any(), any());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(UPGRADE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
DiagnosticsFlowException result = assertThrows(DiagnosticsFlowException.class, () -> underTest.doAccept(new HandlerEvent<>(new Event<>(event))));
// THEN
assertTrue(result.getMessage().contains("Error during diagnostics operation: Upgrade telemetry"));
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsVmPreFlightCheckHandlerTest method testFailureEvent.
@Test
public void testFailureEvent() {
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(VM_PREFLIGHT_CHECK_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
Selectable result = underTest.defaultFailureEvent(STACK_ID, new IllegalArgumentException("ex"), new Event<>(event));
assertEquals(FAILED_DIAGNOSTICS_COLLECTION_EVENT.selector(), result.selector());
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsVmPreFlightCheckHandlerTest method testDoAccept.
@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException {
// GIVEN
doNothing().when(diagnosticsOperationsService).vmPreflightCheck(anyLong(), any());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(VM_PREFLIGHT_CHECK_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(diagnosticsOperationsService, times(1)).vmPreflightCheck(anyLong(), any());
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsCollectionHandlerTest method testFailureEvent.
@Test
public void testFailureEvent() {
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(COLLECT_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
Selectable result = underTest.defaultFailureEvent(STACK_ID, new IllegalArgumentException("ex"), new Event<>(event));
assertEquals(FAILED_DIAGNOSTICS_COLLECTION_EVENT.selector(), result.selector());
}
Aggregations