Search in sources :

Example 1 with SeekableStreamExceptionEvent

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());
}
Also used : SeekableStreamExceptionEvent(org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorStateManager.SeekableStreamExceptionEvent) IOException(java.io.IOException) StreamException(org.apache.druid.indexing.seekablestream.common.StreamException) StreamException(org.apache.druid.indexing.seekablestream.common.StreamException) SupervisorStateManager(org.apache.druid.indexing.overlord.supervisor.SupervisorStateManager) Pair(org.apache.druid.java.util.common.Pair) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)1 SupervisorStateManager (org.apache.druid.indexing.overlord.supervisor.SupervisorStateManager)1 StreamException (org.apache.druid.indexing.seekablestream.common.StreamException)1 SeekableStreamExceptionEvent (org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorStateManager.SeekableStreamExceptionEvent)1 Pair (org.apache.druid.java.util.common.Pair)1 Test (org.junit.Test)1