use of com.sequenceiq.flow.reactor.api.handler.HandlerEvent 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);
DiagnosticsFlowException result = assertThrows(DiagnosticsFlowException.class, () -> underTest.doAccept(new HandlerEvent<>(new Event<>(event))));
// THEN
assertTrue(result.getMessage().contains("Error during diagnostics operation: UMS resource check"));
}
use of com.sequenceiq.flow.reactor.api.handler.HandlerEvent in project cloudbreak by hortonworks.
the class DiagnosticsInitHandlerTest method testDoAccept.
@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException {
// GIVEN
doNothing().when(diagnosticsOperationsService).init(anyLong(), any());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(INIT_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(diagnosticsOperationsService, times(1)).init(anyLong(), any());
}
use of com.sequenceiq.flow.reactor.api.handler.HandlerEvent in project cloudbreak by hortonworks.
the class DiagnosticsSaltPillarUpdateHandlerTest method testDoAccept.
@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException {
// GIVEN
doNothing().when(telemetryUpgradeService).upgradeTelemetrySaltPillars(anyLong(), anySet());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(SALT_PILLAR_UPDATE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(telemetryUpgradeService, times(1)).upgradeTelemetrySaltPillars(anyLong(), anySet());
}
use of com.sequenceiq.flow.reactor.api.handler.HandlerEvent in project cloudbreak by hortonworks.
the class DiagnosticsSaltStateUpdateHandlerTest method testDoAcceptOnError.
@Test
public void testDoAcceptOnError() throws CloudbreakOrchestratorFailedException, IOException {
// GIVEN
doThrow(new CloudbreakOrchestratorFailedException("ex")).when(telemetryUpgradeService).upgradeTelemetrySaltStates(anyLong(), anySet());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(SALT_STATE_UPDATE_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: Salt state update"));
}
use of com.sequenceiq.flow.reactor.api.handler.HandlerEvent in project cloudbreak by hortonworks.
the class DiagnosticsSaltStateUpdateHandlerTest method testDoAccept.
@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException, IOException {
// GIVEN
doNothing().when(telemetryUpgradeService).upgradeTelemetrySaltStates(anyLong(), anySet());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(SALT_STATE_UPDATE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(telemetryUpgradeService, times(1)).upgradeTelemetrySaltStates(anyLong(), anySet());
}
Aggregations