Search in sources :

Example 56 with HandlerEvent

use of com.sequenceiq.flow.reactor.api.handler.HandlerEvent in project cloudbreak by hortonworks.

the class DiagnosticsCleanupHandlerTest method testDoAccept.

@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException {
    // GIVEN
    doNothing().when(diagnosticsOperationsService).cleanup(anyLong(), any());
    // WHEN
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(CLEANUP_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)).cleanup(anyLong(), any());
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) Event(reactor.bus.Event) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) Test(org.junit.jupiter.api.Test)

Example 57 with HandlerEvent

use of com.sequenceiq.flow.reactor.api.handler.HandlerEvent in project cloudbreak by hortonworks.

the class DiagnosticsCleanupHandlerTest method testDoAcceptOnError.

@Test
public void testDoAcceptOnError() throws CloudbreakOrchestratorFailedException {
    // GIVEN
    doThrow(new CloudbreakOrchestratorFailedException("ex")).when(diagnosticsOperationsService).cleanup(anyLong(), any());
    // WHEN
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(CLEANUP_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new 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: Cleanup"));
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsFlowException(com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException) Test(org.junit.jupiter.api.Test)

Example 58 with HandlerEvent

use of com.sequenceiq.flow.reactor.api.handler.HandlerEvent in project cloudbreak by hortonworks.

the class DiagnosticsCollectionHandlerTest method testDoAccept.

@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException {
    // GIVEN
    doNothing().when(diagnosticsOperationsService).collect(anyLong(), any());
    // WHEN
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(COLLECT_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)).collect(anyLong(), any());
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) Event(reactor.bus.Event) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) Test(org.junit.jupiter.api.Test)

Example 59 with HandlerEvent

use of com.sequenceiq.flow.reactor.api.handler.HandlerEvent in project cloudbreak by hortonworks.

the class DiagnosticsCollectionHandlerTest method testDoAcceptOnError.

@Test
public void testDoAcceptOnError() throws CloudbreakOrchestratorFailedException {
    // GIVEN
    doThrow(new CloudbreakOrchestratorFailedException("ex")).when(diagnosticsOperationsService).collect(anyLong(), any());
    // WHEN
    DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(COLLECT_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new 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: Collection"));
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsFlowException(com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsFlowException) Test(org.junit.jupiter.api.Test)

Example 60 with HandlerEvent

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(), Set.of(), Set.of(), Set.of());
    underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
    // THEN
    verify(diagnosticsOperationsService, times(1)).init(anyLong(), any());
}
Also used : DiagnosticParameters(com.sequenceiq.common.model.diagnostics.DiagnosticParameters) Event(reactor.bus.Event) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) Test(org.junit.jupiter.api.Test)

Aggregations

HandlerEvent (com.sequenceiq.flow.reactor.api.handler.HandlerEvent)85 Test (org.junit.jupiter.api.Test)77 Event (reactor.bus.Event)49 DiagnosticParameters (com.sequenceiq.common.model.diagnostics.DiagnosticParameters)45 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)27 DiagnosticsCollectionEvent (com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)23 DiagnosticsCollectionEvent (com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent)22 Set (java.util.Set)20 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)19 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)18 Collectors (java.util.stream.Collectors)18 List (java.util.List)17 Map (java.util.Map)17 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)16 StackService (com.sequenceiq.cloudbreak.service.stack.StackService)16 CloudbreakFlowMessageService (com.sequenceiq.cloudbreak.core.flow2.stack.CloudbreakFlowMessageService)15 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)15 HostGroup (com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup)15 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)15 ClusterApiConnectors (com.sequenceiq.cloudbreak.service.cluster.ClusterApiConnectors)15