use of org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorStateManager.SeekableStreamExceptionEvent in project druid by druid-io.
the class SeekableStreamSupervisorStateManagerTest method testGetThrowableEvents.
@Test
public void testGetThrowableEvents() {
List<Exception> exceptions = ImmutableList.of(new StreamException(new UnsupportedOperationException("oof")), new NullPointerException("oof"), new RuntimeException(new StreamException(new Exception("oof"))), new RuntimeException(new IllegalArgumentException("oof")));
for (Exception exception : exceptions) {
stateManager.recordThrowableEvent(exception);
stateManager.markRunFinished();
}
Assert.assertEquals(BasicState.UNHEALTHY_SUPERVISOR, stateManager.getSupervisorState());
List<Pair<String, Boolean>> expected = ImmutableList.of(Pair.of("java.lang.UnsupportedOperationException", true), Pair.of("java.lang.NullPointerException", false), Pair.of("java.lang.Exception", true), Pair.of("java.lang.IllegalArgumentException", false));
Iterator<SupervisorStateManager.ExceptionEvent> it = stateManager.getExceptionEvents().iterator();
expected.forEach(x -> {
SupervisorStateManager.ExceptionEvent event = it.next();
Assert.assertNotNull(event.getMessage());
Assert.assertEquals(x.lhs, event.getExceptionClass());
Assert.assertEquals(x.rhs, ((SeekableStreamExceptionEvent) event).isStreamException());
});
Assert.assertFalse(it.hasNext());
}
Aggregations