1919package org .apache .flink .state .changelog ;
2020
2121import org .apache .flink .api .common .JobID ;
22+ import org .apache .flink .api .common .eventtime .WatermarkStrategy ;
2223import org .apache .flink .api .common .functions .FlatMapFunction ;
2324import org .apache .flink .configuration .Configuration ;
2425import org .apache .flink .configuration .IllegalConfigurationException ;
4344import org .apache .flink .state .rocksdb .EmbeddedRocksDBStateBackend ;
4445import org .apache .flink .streaming .api .datastream .SingleOutputStreamOperator ;
4546import org .apache .flink .streaming .api .environment .StreamExecutionEnvironment ;
46- import org .apache .flink .streaming .api .functions .source .legacy .SourceFunction ;
4747import org .apache .flink .streaming .api .graph .StreamGraph ;
48+ import org .apache .flink .test .util .source .AbstractTestSource ;
4849import org .apache .flink .util .Collector ;
4950import org .apache .flink .util .TernaryBoolean ;
5051
@@ -262,19 +263,12 @@ private void testLoadingStateBackend(
262263
263264 private StreamExecutionEnvironment getEnvironment () {
264265 StreamExecutionEnvironment env = StreamExecutionEnvironment .getExecutionEnvironment ();
265- SourceFunction <Integer > srcFun =
266- new SourceFunction <Integer >() {
267- private static final long serialVersionUID = 1L ;
268-
269- @ Override
270- public void run (SourceContext <Integer > ctx ) throws Exception {}
271-
272- @ Override
273- public void cancel () {}
274- };
275266
276267 SingleOutputStreamOperator <Object > operator =
277- env .addSource (srcFun )
268+ env .fromSource (
269+ new EmptyTestSource (),
270+ WatermarkStrategy .noWatermarks (),
271+ "EmptyTestSource" )
278272 .flatMap (
279273 new FlatMapFunction <Integer , Object >() {
280274
@@ -288,6 +282,8 @@ public void flatMap(Integer value, Collector<Object> out)
288282 return env ;
289283 }
290284
285+ private static class EmptyTestSource extends AbstractTestSource <Integer > {}
286+
291287 private void assertStateBackendAndChangelogInStreamGraphAndJobGraph (
292288 StreamExecutionEnvironment env , TernaryBoolean isChangelogEnabled ) throws Exception {
293289 assertEquals (isChangelogEnabled , env .isChangelogStateBackendEnabled ());
0 commit comments