Github user pnowojski commented on a diff in the pull request: https://github.com/apache/flink/pull/5481#discussion_r169060097 --- Diff: flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/KeyedProcessOperatorTest.java --- @@ -377,119 +375,114 @@ public T getKey(T value) throws Exception { } } - private static class QueryingFlatMapFunction extends ProcessFunction<Integer, String> { + private static class QueryingFlatMapFunction extends KeyedProcessFunction<Integer, Integer, String> { private static final long serialVersionUID = 1L; - private final TimeDomain timeDomain; + private final TimeDomain expectedTimeDomain; public QueryingFlatMapFunction(TimeDomain timeDomain) { - this.timeDomain = timeDomain; + this.expectedTimeDomain = timeDomain; } @Override public void processElement(Integer value, Context ctx, Collector<String> out) throws Exception { - if (timeDomain.equals(TimeDomain.EVENT_TIME)) { + if (expectedTimeDomain.equals(TimeDomain.EVENT_TIME)) { out.collect(value + "TIME:" + ctx.timerService().currentWatermark() + " TS:" + ctx.timestamp()); } else { out.collect(value + "TIME:" + ctx.timerService().currentProcessingTime() + " TS:" + ctx.timestamp()); } } @Override - public void onTimer( - long timestamp, - OnTimerContext ctx, - Collector<String> out) throws Exception { + public void onTimer(long timestamp, OnTimerContext<Integer> ctx, Collector<String> out) throws Exception { + // Do nothing } } - private static class TriggeringFlatMapFunction extends ProcessFunction<Integer, Integer> { + private static class TriggeringFlatMapFunction extends KeyedProcessFunction<Integer, Integer, Integer> { private static final long serialVersionUID = 1L; - private final TimeDomain timeDomain; + private final TimeDomain expectedTimeDomain; + + static final Integer EXPECTED_KEY = 17; --- End diff -- As in the second PR: does this have to be a static field? Or can we initialise it in the constructor? I think it should work with the `expectedKey` set in the constructor as long as this is not an `ITCase` - and it's not, it's using test harness.
---