File tree 3 files changed +42
-1
lines changed
flink-streaming-java/src/main/java/org/apache/flink/streaming/api
flink-test-utils-parent/flink-connector-test-utils/src/main/java/org/apache/flink/connector/testframe
3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -77,5 +77,17 @@ public enum CheckpointingMode {
77
77
* scenarios, where a sustained very-low latency (such as few milliseconds) is needed, and where
78
78
* occasional duplicate messages (on recovery) do not matter.
79
79
*/
80
- AT_LEAST_ONCE
80
+ AT_LEAST_ONCE ;
81
+
82
+ public static org .apache .flink .core .execution .CheckpointingMode convertToCheckpointingMode (
83
+ org .apache .flink .streaming .api .CheckpointingMode semantic ) {
84
+ switch (semantic ) {
85
+ case EXACTLY_ONCE :
86
+ return org .apache .flink .core .execution .CheckpointingMode .EXACTLY_ONCE ;
87
+ case AT_LEAST_ONCE :
88
+ return org .apache .flink .core .execution .CheckpointingMode .AT_LEAST_ONCE ;
89
+ default :
90
+ throw new IllegalArgumentException ("Unsupported semantic: " + semantic );
91
+ }
92
+ }
81
93
}
Original file line number Diff line number Diff line change 87
87
import static org .apache .flink .runtime .testutils .CommonTestUtils .waitForAllTaskRunning ;
88
88
import static org .apache .flink .runtime .testutils .CommonTestUtils .waitForJobStatus ;
89
89
import static org .apache .flink .runtime .testutils .CommonTestUtils .waitUntilCondition ;
90
+ import static org .apache .flink .streaming .api .CheckpointingMode .convertToCheckpointingMode ;
90
91
import static org .apache .flink .util .Preconditions .checkNotNull ;
91
92
92
93
/**
@@ -513,6 +514,20 @@ protected void checkResultWithSemantic(
513
514
});
514
515
}
515
516
517
+ /**
518
+ * This method is required for downstream projects e.g. Flink connectors extending this test for
519
+ * the case when there should be supported Flink versions below 1.20. Could be removed together
520
+ * with dropping support for Flink 1.19.
521
+ */
522
+ @ Deprecated
523
+ protected void checkResultWithSemantic (
524
+ ExternalSystemDataReader <T > reader ,
525
+ List <T > testData ,
526
+ org .apache .flink .streaming .api .CheckpointingMode semantic )
527
+ throws Exception {
528
+ checkResultWithSemantic (reader , testData , convertToCheckpointingMode (semantic ));
529
+ }
530
+
516
531
/** Compare the metrics. */
517
532
private boolean compareSinkMetrics (
518
533
MetricQuerier metricQuerier ,
Original file line number Diff line number Diff line change 27
27
import java .util .LinkedList ;
28
28
import java .util .List ;
29
29
30
+ import static org .apache .flink .streaming .api .CheckpointingMode .convertToCheckpointingMode ;
31
+
30
32
/**
31
33
* This assertion used to compare records in the collect iterator to the target test data with
32
34
* different semantic(AT_LEAST_ONCE, EXACTLY_ONCE).
@@ -51,6 +53,18 @@ public CollectIteratorAssert<T> withNumRecordsLimit(int limit) {
51
53
return this ;
52
54
}
53
55
56
+ /**
57
+ * This method is required for downstream projects e.g. Flink connectors extending this test for
58
+ * the case when there should be supported Flink versions below 1.20. Could be removed together
59
+ * with dropping support for Flink 1.19.
60
+ */
61
+ @ Deprecated
62
+ public void matchesRecordsFromSource (
63
+ List <List <T >> recordsBySplitsFromSource ,
64
+ org .apache .flink .streaming .api .CheckpointingMode semantic ) {
65
+ matchesRecordsFromSource (recordsBySplitsFromSource , convertToCheckpointingMode (semantic ));
66
+ }
67
+
54
68
public void matchesRecordsFromSource (
55
69
List <List <T >> recordsBySplitsFromSource , CheckpointingMode semantic ) {
56
70
for (List <T > recordsFromSplit : recordsBySplitsFromSource ) {
You can’t perform that action at this time.
0 commit comments