Class TestReaderOutput<T>

  • Type Parameters:
    T - The type of records emitted by the source
    All Implemented Interfaces:
    org.apache.flink.api.common.eventtime.WatermarkOutput, org.apache.flink.api.connector.source.ReaderOutput<T>, org.apache.flink.api.connector.source.SourceOutput<T>

    @PublicEvolving
    public class TestReaderOutput<T>
    extends Object
    implements org.apache.flink.api.connector.source.ReaderOutput<T>
    Test utility for capturing output from SourceReader implementations. Provides convenient methods to verify emitted records without implementing the full ReaderOutput interface.
    • Constructor Detail

      • TestReaderOutput

        public TestReaderOutput()
    • Method Detail

      • collect

        public void collect​(T record)
        Specified by:
        collect in interface org.apache.flink.api.connector.source.ReaderOutput<T>
        Specified by:
        collect in interface org.apache.flink.api.connector.source.SourceOutput<T>
      • collect

        public void collect​(T record,
                            long timestamp)
        Specified by:
        collect in interface org.apache.flink.api.connector.source.ReaderOutput<T>
        Specified by:
        collect in interface org.apache.flink.api.connector.source.SourceOutput<T>
      • releaseOutputForSplit

        public void releaseOutputForSplit​(String splitId)
        Specified by:
        releaseOutputForSplit in interface org.apache.flink.api.connector.source.ReaderOutput<T>
      • createOutputForSplit

        public org.apache.flink.api.connector.source.ReaderOutput<T> createOutputForSplit​(String splitId)
        Specified by:
        createOutputForSplit in interface org.apache.flink.api.connector.source.ReaderOutput<T>
      • markIdle

        public void markIdle()
        Specified by:
        markIdle in interface org.apache.flink.api.connector.source.ReaderOutput<T>
        Specified by:
        markIdle in interface org.apache.flink.api.common.eventtime.WatermarkOutput
      • emitWatermark

        public void emitWatermark​(org.apache.flink.api.common.eventtime.Watermark watermark)
        Specified by:
        emitWatermark in interface org.apache.flink.api.connector.source.ReaderOutput<T>
        Specified by:
        emitWatermark in interface org.apache.flink.api.common.eventtime.WatermarkOutput
      • markActive

        public void markActive()
        Specified by:
        markActive in interface org.apache.flink.api.common.eventtime.WatermarkOutput
      • getCollected

        public List<T> getCollected()
        Returns all records collected by this output.
        Returns:
        List of all collected records
      • getLastEmitted

        public T getLastEmitted()
        Returns the last emitted record, or null if no records have been emitted.
        Returns:
        The most recently emitted record
      • getCollectedCount

        public int getCollectedCount()
        Returns the number of records collected.
        Returns:
        Count of collected records
      • clear

        public void clear()
        Clears all collected records.