Java源码示例:org.apache.flink.runtime.io.network.partition.ProducerFailedException
示例1
@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 RemoteInputChannel ch = new RemoteInputChannel(
mock(SingleInputGate.class),
0,
new ResultPartitionID(),
mock(ConnectionID.class),
connManager,
UnregisteredMetricGroups.createUnregisteredTaskMetricGroup().getIOMetricGroup());
ch.onError(new ProducerFailedException(new RuntimeException("Expected test exception.")));
ch.requestSubpartition(0);
// Should throw an instance of CancelTaskException.
ch.getNextBuffer();
}
示例2
@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(0);
// Should throw an instance of CancelTaskException.
ch.getNextBuffer();
}
示例3
@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 RemoteInputChannel ch = InputChannelTestUtils.createRemoteInputChannel(mock(SingleInputGate.class), 0, connManager);
ch.onError(new ProducerFailedException(new RuntimeException("Expected test exception.")));
ch.requestSubpartition(0);
// Should throw an instance of CancelTaskException.
ch.getNextBuffer();
}