Class TestReaderOutput<T>
- java.lang.Object
-
- org.apache.flink.test.util.source.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 Summary
Constructors Constructor Description TestReaderOutput()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears all collected records.voidcollect(T record)voidcollect(T record, long timestamp)org.apache.flink.api.connector.source.ReaderOutput<T>createOutputForSplit(String splitId)voidemitWatermark(org.apache.flink.api.common.eventtime.Watermark watermark)List<T>getCollected()Returns all records collected by this output.intgetCollectedCount()Returns the number of records collected.TgetLastEmitted()Returns the last emitted record, or null if no records have been emitted.voidmarkActive()voidmarkIdle()voidreleaseOutputForSplit(String splitId)
-
-
-
Method Detail
-
collect
public void collect(T record)
-
collect
public void collect(T record, long timestamp)
-
releaseOutputForSplit
public void releaseOutputForSplit(String splitId)
- Specified by:
releaseOutputForSplitin interfaceorg.apache.flink.api.connector.source.ReaderOutput<T>
-
createOutputForSplit
public org.apache.flink.api.connector.source.ReaderOutput<T> createOutputForSplit(String splitId)
- Specified by:
createOutputForSplitin interfaceorg.apache.flink.api.connector.source.ReaderOutput<T>
-
markIdle
public void markIdle()
- Specified by:
markIdlein interfaceorg.apache.flink.api.connector.source.ReaderOutput<T>- Specified by:
markIdlein interfaceorg.apache.flink.api.common.eventtime.WatermarkOutput
-
emitWatermark
public void emitWatermark(org.apache.flink.api.common.eventtime.Watermark watermark)
- Specified by:
emitWatermarkin interfaceorg.apache.flink.api.connector.source.ReaderOutput<T>- Specified by:
emitWatermarkin interfaceorg.apache.flink.api.common.eventtime.WatermarkOutput
-
markActive
public void markActive()
- Specified by:
markActivein interfaceorg.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.
-
-