Class CollectingSourceOutput<T>
java.lang.Object
io.github.flink.gcp.connector.testutils.CollectingSourceOutput<T>
- All Implemented Interfaces:
org.apache.flink.api.common.eventtime.WatermarkOutput,org.apache.flink.api.connector.source.SourceOutput<T>
@Internal
public final class CollectingSourceOutput<T>
extends Object
implements org.apache.flink.api.connector.source.SourceOutput<T>
SourceOutput recording emitted records and their timestamps — what a
RecordEmitter is handed, and what a test driving one asserts against.
Written here rather than taken from Flink because flink-connector-base's test jar is
not a dependency of any module in this repository.
timestamps() is padded rather than sparse: a record emitted without a timestamp
appears as null rather than not appearing at all, so an assertion on it distinguishes
"one record, no timestamp" from "no record".
Not thread-safe, and it does not need to be: a SourceReaderBase hands its record
emitter the output on the thread that called pollNext, never on a fetcher thread. A test
collecting from more than one thread has to synchronize itself.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidemitWatermark(org.apache.flink.api.common.eventtime.Watermark watermark) voidfailAfterCollects(int successfulCollects, Error failure) Makes collect throw an error after the requested number of successful calls.voidfailAfterCollects(int successfulCollects, RuntimeException failure) Makes collect throw after the requested number of successful calls.voidfailOnCollect(Error failure) Makes every subsequent collect throw, standing in for a failing chained operator.voidfailOnCollect(RuntimeException failure) Makes every subsequent collect throw, standing in for a failing chained operator.voidvoidmarkIdle()records()
-
Constructor Details
-
CollectingSourceOutput
public CollectingSourceOutput()
-
-
Method Details
-
failOnCollect
Makes every subsequent collect throw, standing in for a failing chained operator. -
failOnCollect
Makes every subsequent collect throw, standing in for a failing chained operator. -
failAfterCollects
Makes collect throw after the requested number of successful calls. -
failAfterCollects
Makes collect throw an error after the requested number of successful calls. -
records
-
timestamps
-
collect
- Specified by:
collectin interfaceorg.apache.flink.api.connector.source.SourceOutput<T>
-
collect
- Specified by:
collectin interfaceorg.apache.flink.api.connector.source.SourceOutput<T>
-
emitWatermark
public void emitWatermark(org.apache.flink.api.common.eventtime.Watermark watermark) - Specified by:
emitWatermarkin interfaceorg.apache.flink.api.common.eventtime.WatermarkOutput
-
markIdle
public void markIdle()- Specified by:
markIdlein interfaceorg.apache.flink.api.common.eventtime.WatermarkOutput
-
markActive
public void markActive()- Specified by:
markActivein interfaceorg.apache.flink.api.common.eventtime.WatermarkOutput
-