You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by fp...@apache.org on 2025/08/20 13:50:48 UTC

(flink) branch master updated: [FLINK-32695] Moved TestSource in TypeFillTest to SourceV2

This is an automated email from the ASF dual-hosted git repository.

fpaul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new a5160140be0 [FLINK-32695] Moved TestSource in TypeFillTest to SourceV2
a5160140be0 is described below

commit a5160140be02dcbd2061c04c6fcc193dda1b17c7
Author: Poorvank <po...@uber.com>
AuthorDate: Thu Jul 31 13:29:28 2025 +0530

    [FLINK-32695] Moved TestSource in TypeFillTest to SourceV2
---
 flink-runtime/pom.xml                              |  7 +++++++
 .../apache/flink/streaming/api/TypeFillTest.java   | 24 +++++++++++-----------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/flink-runtime/pom.xml b/flink-runtime/pom.xml
index 9165992ff4e..61a2a5beac4 100644
--- a/flink-runtime/pom.xml
+++ b/flink-runtime/pom.xml
@@ -92,6 +92,13 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<dependency>
+			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-test-utils-connector</artifactId>
+			<version>${project.version}</version>
+			<scope>test</scope>
+		</dependency>
+
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-queryable-state-client-java</artifactId>
diff --git a/flink-runtime/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java b/flink-runtime/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java
index 24583373750..54a012deb96 100644
--- a/flink-runtime/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.flink.streaming.api;
 
+import org.apache.flink.api.common.eventtime.WatermarkStrategy;
 import org.apache.flink.api.common.functions.FlatMapFunction;
 import org.apache.flink.api.common.functions.InvalidTypesException;
 import org.apache.flink.api.common.functions.MapFunction;
@@ -30,7 +31,7 @@ import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.api.functions.co.CoFlatMapFunction;
 import org.apache.flink.streaming.api.functions.co.CoMapFunction;
 import org.apache.flink.streaming.api.functions.co.ProcessJoinFunction;
-import org.apache.flink.streaming.api.functions.source.legacy.SourceFunction;
+import org.apache.flink.test.util.source.AbstractTestSource;
 import org.apache.flink.util.Collector;
 
 import org.junit.jupiter.api.Test;
@@ -51,7 +52,13 @@ class TypeFillTest {
     void test() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
-        assertThatThrownBy(() -> env.addSource(new TestSource<Integer>()).print())
+        assertThatThrownBy(
+                        () ->
+                                env.fromSource(
+                                                new TestSource<Integer>(),
+                                                WatermarkStrategy.noWatermarks(),
+                                                "")
+                                        .print())
                 .isInstanceOf(InvalidTypesException.class);
 
         DataStream<Long> source = env.fromSequence(1, 10);
@@ -110,7 +117,8 @@ class TypeFillTest {
                                         .print())
                 .isInstanceOf(InvalidTypesException.class);
 
-        env.addSource(new TestSource<Integer>()).returns(Integer.class);
+        env.fromSource(new TestSource<Integer>(), WatermarkStrategy.noWatermarks(), "")
+                .returns(Integer.class);
         source.map(new TestMap<Long, Long>()).returns(Long.class).print();
         source.flatMap(new TestFlatMap<Long, Long>()).returns(new TypeHint<Long>() {}).print();
         source.connect(source)
@@ -157,15 +165,7 @@ class TypeFillTest {
                 .isInstanceOf(IllegalStateException.class);
     }
 
-    private static class TestSource<T> implements SourceFunction<T> {
-        private static final long serialVersionUID = 1L;
-
-        @Override
-        public void run(SourceContext<T> ctx) throws Exception {}
-
-        @Override
-        public void cancel() {}
-    }
+    private static class TestSource<T> extends AbstractTestSource<T> {}
 
     private static class TestMap<T, O> implements MapFunction<T, O> {
         @Override