Search in sources :

Example 1 with ProducerFailedException

use of org.apache.flink.runtime.io.network.partition.ProducerFailedException in project flink by apache.

the class RemoteInputChannelTest method testProducerFailedException.

@Test(expected = CancelTaskException.class)
public void testProducerFailedException() throws Exception {
    ConnectionManager connManager = mock(ConnectionManager.class);
    when(connManager.createPartitionRequestClient(any(ConnectionID.class))).thenReturn(mock(PartitionRequestClient.class));
    final SingleInputGate gate = createSingleInputGate(1);
    final RemoteInputChannel ch = InputChannelTestUtils.createRemoteInputChannel(gate, 0, connManager);
    ch.onError(new ProducerFailedException(new RuntimeException("Expected test exception.")));
    ch.requestSubpartition();
    // Should throw an instance of CancelTaskException.
    ch.getNextBuffer();
}
Also used : ConnectionID(org.apache.flink.runtime.io.network.ConnectionID) TestingConnectionManager(org.apache.flink.runtime.io.network.TestingConnectionManager) ConnectionManager(org.apache.flink.runtime.io.network.ConnectionManager) PartitionRequestClient(org.apache.flink.runtime.io.network.PartitionRequestClient) TestingPartitionRequestClient(org.apache.flink.runtime.io.network.TestingPartitionRequestClient) InputChannelTestUtils.createSingleInputGate(org.apache.flink.runtime.io.network.partition.InputChannelTestUtils.createSingleInputGate) ProducerFailedException(org.apache.flink.runtime.io.network.partition.ProducerFailedException) Test(org.junit.Test)

Aggregations

ConnectionID (org.apache.flink.runtime.io.network.ConnectionID)1 ConnectionManager (org.apache.flink.runtime.io.network.ConnectionManager)1 PartitionRequestClient (org.apache.flink.runtime.io.network.PartitionRequestClient)1 TestingConnectionManager (org.apache.flink.runtime.io.network.TestingConnectionManager)1 TestingPartitionRequestClient (org.apache.flink.runtime.io.network.TestingPartitionRequestClient)1 InputChannelTestUtils.createSingleInputGate (org.apache.flink.runtime.io.network.partition.InputChannelTestUtils.createSingleInputGate)1 ProducerFailedException (org.apache.flink.runtime.io.network.partition.ProducerFailedException)1 Test (org.junit.Test)1