use of org.apache.flink.streaming.runtime.tasks.SourceStreamTask in project flink by apache.
the class StreamSourceOperatorWatermarksTest method setupSourceStreamTask.
private static <T> StreamTaskTestHarness<T> setupSourceStreamTask(StreamSource<T, ?> sourceOperator, TypeInformation<T> outputType, final boolean cancelImmediatelyAfterCreation) {
final StreamTaskTestHarness<T> testHarness = new StreamTaskTestHarness<>((env) -> {
SourceStreamTask<T, ?, ?> sourceTask = new SourceStreamTask<>(env);
if (cancelImmediatelyAfterCreation) {
try {
sourceTask.cancel();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return sourceTask;
}, outputType);
testHarness.setupOutputForSingletonOperatorChain();
StreamConfig streamConfig = testHarness.getStreamConfig();
streamConfig.setStreamOperator(sourceOperator);
streamConfig.setOperatorID(new OperatorID());
streamConfig.setTimeCharacteristic(TimeCharacteristic.EventTime);
return testHarness;
}
Aggregations