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());
}
Aggregations