Search in sources :

Example 6 with SdxDeletionFailedEvent

use of com.sequenceiq.datalake.flow.delete.event.SdxDeletionFailedEvent in project cloudbreak by hortonworks.

the class StackDeletionHandlerTest method acceptTestPollerStackOtherError.

@Test
void acceptTestPollerStackOtherError() {
    long id = 2L;
    StackDeletionWaitRequest stackCreationWaitRequest = new StackDeletionWaitRequest(id, userId, true);
    Event receivedEvent = new Event<>(stackCreationWaitRequest);
    doThrow(new PollerException("stack deletion error")).when(provisionerService).waitCloudbreakClusterDeletion(eq(id), any(PollingConfig.class));
    stackDeletionHandler.accept(receivedEvent);
    verify(provisionerService, times(1)).waitCloudbreakClusterDeletion(eq(id), any(PollingConfig.class));
    final ArgumentCaptor<String> eventSelector = ArgumentCaptor.forClass(String.class);
    final ArgumentCaptor<Event> sentEvent = ArgumentCaptor.forClass(Event.class);
    verify(eventBus, times(1)).notify(eventSelector.capture(), sentEvent.capture());
    String eventNotified = eventSelector.getValue();
    Event event = sentEvent.getValue();
    Assertions.assertEquals("SdxDeletionFailedEvent", eventNotified);
    Assertions.assertEquals(SdxDeletionFailedEvent.class, event.getData().getClass());
    Assertions.assertEquals(id, ((SdxDeletionFailedEvent) event.getData()).getResourceId());
}
Also used : PollerException(com.dyngr.exception.PollerException) Event(reactor.bus.Event) SdxDeletionFailedEvent(com.sequenceiq.datalake.flow.delete.event.SdxDeletionFailedEvent) StackDeletionSuccessEvent(com.sequenceiq.datalake.flow.delete.event.StackDeletionSuccessEvent) StackDeletionWaitRequest(com.sequenceiq.datalake.flow.delete.event.StackDeletionWaitRequest) PollingConfig(com.sequenceiq.datalake.service.sdx.PollingConfig) Test(org.junit.jupiter.api.Test)

Aggregations

SdxDeletionFailedEvent (com.sequenceiq.datalake.flow.delete.event.SdxDeletionFailedEvent)6 StackDeletionSuccessEvent (com.sequenceiq.datalake.flow.delete.event.StackDeletionSuccessEvent)4 StackDeletionWaitRequest (com.sequenceiq.datalake.flow.delete.event.StackDeletionWaitRequest)4 PollingConfig (com.sequenceiq.datalake.service.sdx.PollingConfig)4 PollerException (com.dyngr.exception.PollerException)3 PollerStoppedException (com.dyngr.exception.PollerStoppedException)3 UserBreakException (com.dyngr.exception.UserBreakException)3 Test (org.junit.jupiter.api.Test)3 Event (reactor.bus.Event)3 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)2 NotFoundException (com.sequenceiq.cloudbreak.common.exception.NotFoundException)2 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)1 SdxContext (com.sequenceiq.datalake.flow.SdxContext)1 RdsDeletionSuccessEvent (com.sequenceiq.datalake.flow.delete.event.RdsDeletionSuccessEvent)1 RdsDeletionWaitRequest (com.sequenceiq.datalake.flow.delete.event.RdsDeletionWaitRequest)1 AbstractSdxAction (com.sequenceiq.datalake.service.AbstractSdxAction)1 FlowParameters (com.sequenceiq.flow.core.FlowParameters)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Bean (org.springframework.context.annotation.Bean)1