use of com.sequenceiq.flow.service.flowlog.FlowLogDBService in project cloudbreak by hortonworks.
the class EventBusConfigTest method uncaughtErrorButFlowNotFound.
@Test
@DirtiesContext(methodMode = DirtiesContext.MethodMode.AFTER_METHOD)
public void uncaughtErrorButFlowNotFound() {
FlowLog flowLog = new FlowLog();
flowLog.setFlowId("123");
when(flowLogDBService.getLastFlowLog("123")).thenReturn(Optional.empty());
Event.Headers headers = new Event.Headers();
headers.set("FLOW_ID", "123");
eventBus.on(Selectors.regex("exampleselector"), (Consumer<Event<? extends Payload>>) event -> {
throw new RuntimeException("uncaught exception");
});
eventBus.notify("exampleselector", new Event<>(headers, null));
verify(flowLogDBService, timeout(2000).times(1)).getLastFlowLog("123");
verify(applicationFlowInformation, times(0)).handleFlowFail(any());
verify(flowLogDBService, times(0)).updateLastFlowLogStatus(any(), anyBoolean());
verify(flowLogDBService, times(0)).finalize(any());
}
use of com.sequenceiq.flow.service.flowlog.FlowLogDBService in project cloudbreak by hortonworks.
the class EventBusConfigTest method uncaughtErrorButFlowFound.
@Test
@DirtiesContext(methodMode = DirtiesContext.MethodMode.AFTER_METHOD)
public void uncaughtErrorButFlowFound() {
FlowLog flowLog = new FlowLog();
flowLog.setFlowId("123");
when(flowLogDBService.getLastFlowLog("123")).thenReturn(Optional.of(flowLog));
Event.Headers headers = new Event.Headers();
headers.set("FLOW_ID", "123");
eventBus.on(Selectors.regex("exampleselector"), (Consumer<Event<? extends Payload>>) event -> {
throw new RuntimeException("uncaught exception");
});
eventBus.notify("exampleselector", new Event<>(headers, null));
verify(flowLogDBService, timeout(2000).times(1)).getLastFlowLog("123");
verify(applicationFlowInformation, timeout(1000).times(1)).handleFlowFail(flowLog);
verify(flowLogDBService, timeout(1000).times(1)).updateLastFlowLogStatus(flowLog, true);
verify(flowLogDBService, timeout(1000).times(1)).finalize(flowLog.getFlowId());
}
Aggregations