use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsEnsureMachineUserHandlerTest method testDoAccept.
@Test
public void testDoAccept() throws IOException {
// GIVEN
given(altusMachineUserService.getOrCreateDataBusCredentialIfNeeded(anyLong())).willReturn(new DataBusCredential());
DiagnosticParameters diagnosticParameters = new DiagnosticParameters();
diagnosticParameters.setDestination(DiagnosticsDestination.SUPPORT);
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(ENSURE_MACHINE_USER_EVENT.selector(), STACK_ID, "crn", diagnosticParameters);
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(altusMachineUserService, times(1)).getOrCreateDataBusCredentialIfNeeded(anyLong());
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsInitHandlerTest method testDoAcceptOnError.
@Test
public void testDoAcceptOnError() throws CloudbreakOrchestratorFailedException {
// GIVEN
doThrow(new CloudbreakOrchestratorFailedException("ex")).when(diagnosticsOperationsService).init(anyLong(), any());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(INIT_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: Initialization"));
}
use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsInitHandlerTest method testFailureEvent.
@Test
public void testFailureEvent() {
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(INIT_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 DiagnosticsPreFlightCheckHandlerTest method testFailureEvent.
@Test
public void testFailureEvent() {
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(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 DiagnosticsPreFlightCheckHandlerTest method testDoAccept.
@Test
public void testDoAccept() throws FreeIpaClientException {
// GIVEN
given(stackService.getByIdWithListsInTransaction(STACK_ID)).willReturn(mock(Stack.class));
given(instanceMetaDataService.findNotTerminatedForStack(STACK_ID)).willReturn(metadataSet());
given(freeIpaNodeStatusService.nodeNetworkReport(any(), any())).willReturn(rpcResponse);
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(PREFLIGHT_CHECK_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(freeIpaNodeStatusService, times(1)).nodeNetworkReport(any(), any());
}
Aggregations