Class TestSourceReader<T>

  • Type Parameters:
    T - The type of records produced by this reader
    All Implemented Interfaces:
    AutoCloseable, org.apache.flink.api.common.state.CheckpointListener, org.apache.flink.api.connector.source.SourceReader<T,​TestSplit>

    @PublicEvolving
    public class TestSourceReader<T>
    extends Object
    implements org.apache.flink.api.connector.source.SourceReader<T,​TestSplit>
    Base class for test source readers that provides default implementations for all SourceReader methods. Tests can extend this class and override only the methods they need to customize, typically just pollNext(ReaderOutput).

    By default, this reader:

    • Field Detail

      • context

        protected final org.apache.flink.api.connector.source.SourceReaderContext context
    • Constructor Detail

      • TestSourceReader

        public TestSourceReader​(org.apache.flink.api.connector.source.SourceReaderContext context)
    • Method Detail

      • start

        public void start()
        Specified by:
        start in interface org.apache.flink.api.connector.source.SourceReader<T,​TestSplit>
      • pollNext

        public org.apache.flink.core.io.InputStatus pollNext​(org.apache.flink.api.connector.source.ReaderOutput<T> output)
                                                      throws Exception
        Specified by:
        pollNext in interface org.apache.flink.api.connector.source.SourceReader<T,​TestSplit>
        Throws:
        Exception
      • snapshotState

        public List<TestSplit> snapshotState​(long checkpointId)
        Specified by:
        snapshotState in interface org.apache.flink.api.connector.source.SourceReader<T,​TestSplit>
      • isAvailable

        public CompletableFuture<Void> isAvailable()
        Specified by:
        isAvailable in interface org.apache.flink.api.connector.source.SourceReader<T,​TestSplit>
      • addSplits

        public void addSplits​(List<TestSplit> splits)
        Specified by:
        addSplits in interface org.apache.flink.api.connector.source.SourceReader<T,​TestSplit>
      • notifyNoMoreSplits

        public void notifyNoMoreSplits()
        Specified by:
        notifyNoMoreSplits in interface org.apache.flink.api.connector.source.SourceReader<T,​TestSplit>