Search in sources :

Example 1 with StreamTaskTestHarness

use of org.apache.flink.streaming.runtime.tasks.StreamTaskTestHarness in project flink by apache.

the class StreamIterationHeadTest method testIterationHeadWatermarkEmission.

@Test
public void testIterationHeadWatermarkEmission() throws Exception {
    StreamIterationHead<Integer> head = new StreamIterationHead<>();
    StreamTaskTestHarness<Integer> harness = new StreamTaskTestHarness<>(head, BasicTypeInfo.INT_TYPE_INFO);
    harness.setupOutputForSingletonOperatorChain();
    harness.getStreamConfig().setIterationId("1");
    harness.getStreamConfig().setIterationWaitTime(1);
    harness.invoke();
    harness.waitForTaskCompletion();
    assertEquals(1, harness.getOutput().size());
    assertEquals(new Watermark(Long.MAX_VALUE), harness.getOutput().peek());
}
Also used : StreamIterationHead(org.apache.flink.streaming.runtime.tasks.StreamIterationHead) StreamTaskTestHarness(org.apache.flink.streaming.runtime.tasks.StreamTaskTestHarness) Watermark(org.apache.flink.streaming.api.watermark.Watermark) Test(org.junit.Test)

Aggregations

Watermark (org.apache.flink.streaming.api.watermark.Watermark)1 StreamIterationHead (org.apache.flink.streaming.runtime.tasks.StreamIterationHead)1 StreamTaskTestHarness (org.apache.flink.streaming.runtime.tasks.StreamTaskTestHarness)1 Test (org.junit.Test)1