use of org.apache.flink.runtime.event.RuntimeEvent in project flink by apache.
the class UnalignedCheckpointsCancellationTest method test.
@Test
public void test() throws Exception {
TestInvokable invokable = new TestInvokable();
final SingleInputGate inputGate = new SingleInputGateBuilder().setNumberOfChannels(numChannels).setChannelFactory(InputChannelBuilder::buildLocalChannel).build();
SingleCheckpointBarrierHandler unaligner = SingleCheckpointBarrierHandler.createUnalignedCheckpointBarrierHandler(TestSubtaskCheckpointCoordinator.INSTANCE, "test", invokable, SystemClock.getInstance(), true, inputGate);
for (RuntimeEvent e : events) {
if (e instanceof CancelCheckpointMarker) {
unaligner.processCancellationBarrier((CancelCheckpointMarker) e, new InputChannelInfo(0, channel));
} else if (e instanceof CheckpointBarrier) {
unaligner.processBarrier((CheckpointBarrier) e, new InputChannelInfo(0, channel), false);
} else {
throw new IllegalArgumentException("unexpected event type: " + e);
}
}
assertEquals("expectAbortCheckpoint", expectAbortCheckpoint, invokable.checkpointAborted);
assertEquals("expectTriggerCheckpoint", expectTriggerCheckpoint, invokable.checkpointTriggered);
}
Aggregations