use of org.apache.flink.connector.testutils.source.reader.TestingSplitEnumeratorContext in project flink by apache.
the class StaticFileSplitEnumeratorTest method testCheckpointNoSplitRequested.
@Test
public void testCheckpointNoSplitRequested() throws Exception {
final TestingSplitEnumeratorContext<FileSourceSplit> context = new TestingSplitEnumeratorContext<>(4);
final FileSourceSplit split = createRandomSplit();
final StaticFileSplitEnumerator enumerator = createEnumerator(context, split);
final PendingSplitsCheckpoint<FileSourceSplit> checkpoint = enumerator.snapshotState(1L);
assertThat(checkpoint.getSplits(), contains(split));
}
use of org.apache.flink.connector.testutils.source.reader.TestingSplitEnumeratorContext in project flink by apache.
the class StaticFileSplitEnumeratorTest method testNoMoreSplits.
@Test
public void testNoMoreSplits() throws Exception {
final TestingSplitEnumeratorContext<FileSourceSplit> context = new TestingSplitEnumeratorContext<>(4);
final FileSourceSplit split = createRandomSplit();
final StaticFileSplitEnumerator enumerator = createEnumerator(context, split);
// first split assignment
context.registerReader(1, "somehost");
enumerator.addReader(1);
enumerator.handleSplitRequest(1, "somehost");
// second request has no more split
enumerator.handleSplitRequest(1, "somehost");
assertThat(context.getSplitAssignments().get(1).getAssignedSplits(), contains(split));
assertTrue(context.getSplitAssignments().get(1).hasReceivedNoMoreSplitsSignal());
}
Aggregations