use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.
the class DiagnosticsUploadHandler method executeOperation.
@Override
public Selectable executeOperation(HandlerEvent<DiagnosticsCollectionEvent> event) throws Exception {
DiagnosticsCollectionEvent data = event.getData();
Long resourceId = data.getResourceId();
String resourceCrn = data.getResourceCrn();
DiagnosticParameters parameters = data.getParameters();
Map<String, Object> parameterMap = parameters.toMap();
LOGGER.debug("Diagnostics upload started. resourceCrn: '{}', parameters: '{}'", resourceCrn, parameterMap);
diagnosticsOperationsService.upload(resourceId, parameters);
return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_CLEANUP_EVENT.selector()).withParameters(parameters).build();
}
use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters 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(), Set.of(), Set.of(), Set.of());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(diagnosticsOperationsService, times(1)).vmPreflightCheck(anyLong(), any());
}
use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.
the class DiagnosticsCleanupHandlerTest method testFailureEvent.
@Test
public void testFailureEvent() {
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(CLEANUP_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters(), Set.of(), Set.of(), Set.of());
Selectable result = underTest.defaultFailureEvent(STACK_ID, new IllegalArgumentException("ex"), new Event<>(event));
assertEquals(FAILED_DIAGNOSTICS_COLLECTION_EVENT.selector(), result.selector());
}
use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters 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(), Set.of(), Set.of(), Set.of());
Selectable result = underTest.defaultFailureEvent(STACK_ID, new IllegalArgumentException("ex"), new Event<>(event));
assertEquals(FAILED_DIAGNOSTICS_COLLECTION_EVENT.selector(), result.selector());
}
use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.
the class DiagnosticsEnsureMachineUserHandlerTest method testDoAcceptOnError.
@Test
public void testDoAcceptOnError() throws IOException {
// GIVEN
doThrow(new IOException("ex")).when(altusMachineUserService).getOrCreateDataBusCredentialIfNeeded(anyLong());
DiagnosticParameters diagnosticParameters = new DiagnosticParameters();
diagnosticParameters.setDestination(DiagnosticsDestination.SUPPORT);
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(ENSURE_MACHINE_USER_EVENT.selector(), STACK_ID, "crn", diagnosticParameters, Set.of(), Set.of(), Set.of());
DiagnosticsFlowException result = assertThrows(DiagnosticsFlowException.class, () -> underTest.doAccept(new HandlerEvent<>(new Event<>(event))));
// THEN
assertTrue(result.getMessage().contains("Error during diagnostics operation: UMS resource check"));
}
Aggregations