Search in sources :

Example 11 with SerializedThrowable

use of org.apache.flink.util.SerializedThrowable in project flink by apache.

the class JobResultTest method testIsNotSuccess.

@Test
public void testIsNotSuccess() throws Exception {
    final JobResult jobResult = new JobResult.Builder().jobId(new JobID()).serializedThrowable(new SerializedThrowable(new RuntimeException())).netRuntime(Long.MAX_VALUE).build();
    assertThat(jobResult.isSuccess(), equalTo(false));
}
Also used : ArchivedExecutionGraphBuilder(org.apache.flink.runtime.rest.handler.legacy.utils.ArchivedExecutionGraphBuilder) JobID(org.apache.flink.api.common.JobID) SerializedThrowable(org.apache.flink.util.SerializedThrowable) Test(org.junit.Test)

Example 12 with SerializedThrowable

use of org.apache.flink.util.SerializedThrowable in project flink by apache.

the class SerializedThrowableTest method testSuppressedTransferring.

@Test
public void testSuppressedTransferring() {
    Exception root = new Exception("root");
    Exception suppressed = new Exception("suppressed");
    root.addSuppressed(suppressed);
    SerializedThrowable serializedThrowable = new SerializedThrowable(root);
    assertEquals(1, serializedThrowable.getSuppressed().length);
    Throwable actualSuppressed = serializedThrowable.getSuppressed()[0];
    assertTrue(actualSuppressed instanceof SerializedThrowable);
    assertEquals("suppressed", actualSuppressed.getMessage());
}
Also used : SerializedThrowable(org.apache.flink.util.SerializedThrowable) SerializedThrowable(org.apache.flink.util.SerializedThrowable) Test(org.junit.Test)

Example 13 with SerializedThrowable

use of org.apache.flink.util.SerializedThrowable in project flink by apache.

the class SerializedThrowableTest method testCopySuppressed.

@Test
public void testCopySuppressed() {
    Exception root = new Exception("root");
    Exception suppressed = new Exception("suppressed");
    root.addSuppressed(suppressed);
    SerializedThrowable serializedThrowable = new SerializedThrowable(root);
    SerializedThrowable copy = new SerializedThrowable(serializedThrowable);
    assertEquals(1, copy.getSuppressed().length);
    Throwable actualSuppressed = copy.getSuppressed()[0];
    assertTrue(actualSuppressed instanceof SerializedThrowable);
    assertEquals("suppressed", actualSuppressed.getMessage());
}
Also used : SerializedThrowable(org.apache.flink.util.SerializedThrowable) SerializedThrowable(org.apache.flink.util.SerializedThrowable) Test(org.junit.Test)

Example 14 with SerializedThrowable

use of org.apache.flink.util.SerializedThrowable in project flink by apache.

the class SerializedThrowableTest method testIdenticalMessageAndStack.

@Test
public void testIdenticalMessageAndStack() {
    try {
        IllegalArgumentException original = new IllegalArgumentException("test message");
        SerializedThrowable serialized = new SerializedThrowable(original);
        assertEquals(original.getMessage(), serialized.getMessage());
        assertEquals(original.toString(), serialized.toString());
        assertEquals(ExceptionUtils.stringifyException(original), ExceptionUtils.stringifyException(serialized));
        assertArrayEquals(original.getStackTrace(), serialized.getStackTrace());
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : SerializedThrowable(org.apache.flink.util.SerializedThrowable) Test(org.junit.Test)

Example 15 with SerializedThrowable

use of org.apache.flink.util.SerializedThrowable in project flink by apache.

the class SerializedThrowableTest method testCopyPreservesCause.

@Test
public void testCopyPreservesCause() {
    Exception original = new Exception("original message");
    Exception parent = new Exception("parent message", original);
    SerializedThrowable serialized = new SerializedThrowable(parent);
    assertNotNull(serialized.getCause());
    SerializedThrowable copy = new SerializedThrowable(serialized);
    assertEquals("parent message", copy.getMessage());
    assertNotNull(copy.getCause());
    assertEquals("original message", copy.getCause().getMessage());
}
Also used : SerializedThrowable(org.apache.flink.util.SerializedThrowable) Test(org.junit.Test)

Aggregations

SerializedThrowable (org.apache.flink.util.SerializedThrowable)30 Test (org.junit.Test)16 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)6 FlinkException (org.apache.flink.util.FlinkException)6 ExecutionException (java.util.concurrent.ExecutionException)5 Collection (java.util.Collection)4 StreamExecutionEnvironment (org.apache.flink.streaming.api.environment.StreamExecutionEnvironment)4 Optional (java.util.Optional)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 UnavailableDispatcherOperationException (org.apache.flink.runtime.dispatcher.UnavailableDispatcherOperationException)3 JobResult (org.apache.flink.runtime.jobmaster.JobResult)3 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Objects (java.util.Objects)2 Set (java.util.Set)2 RichFlatMapFunction (org.apache.flink.api.common.functions.RichFlatMapFunction)2 RichMapFunction (org.apache.flink.api.common.functions.RichMapFunction)2 ListState (org.apache.flink.api.common.state.ListState)2