Search in sources :

Example 6 with ProcessingTimeSessionWindows

use of org.apache.flink.streaming.api.windowing.assigners.ProcessingTimeSessionWindows in project flink by apache.

the class ProcessingTimeSessionWindowsTest method testMergeCoveringWindow.

@Test
public void testMergeCoveringWindow() {
    MergingWindowAssigner.MergeCallback callback = mock(MergingWindowAssigner.MergeCallback.class);
    ProcessingTimeSessionWindows assigner = ProcessingTimeSessionWindows.withGap(Time.milliseconds(5000));
    assigner.mergeWindows(Lists.newArrayList(new TimeWindow(1, 1), new TimeWindow(0, 2), new TimeWindow(4, 7), new TimeWindow(5, 6)), callback);
    verify(callback, times(1)).merge((Collection<TimeWindow>) argThat(containsInAnyOrder(new TimeWindow(1, 1), new TimeWindow(0, 2))), eq(new TimeWindow(0, 2)));
    verify(callback, times(1)).merge((Collection<TimeWindow>) argThat(containsInAnyOrder(new TimeWindow(5, 6), new TimeWindow(4, 7))), eq(new TimeWindow(4, 7)));
    verify(callback, times(2)).merge(anyCollection(), Matchers.anyObject());
}
Also used : ProcessingTimeSessionWindows(org.apache.flink.streaming.api.windowing.assigners.ProcessingTimeSessionWindows) MergingWindowAssigner(org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner) TimeWindow(org.apache.flink.streaming.api.windowing.windows.TimeWindow) Test(org.junit.Test)

Example 7 with ProcessingTimeSessionWindows

use of org.apache.flink.streaming.api.windowing.assigners.ProcessingTimeSessionWindows in project flink by apache.

the class ProcessingTimeSessionWindowsTest method testMergeSingleWindow.

@Test
public void testMergeSingleWindow() {
    MergingWindowAssigner.MergeCallback callback = mock(MergingWindowAssigner.MergeCallback.class);
    ProcessingTimeSessionWindows assigner = ProcessingTimeSessionWindows.withGap(Time.milliseconds(5000));
    assigner.mergeWindows(Lists.newArrayList(new TimeWindow(0, 1)), callback);
    verify(callback, never()).merge(anyCollection(), Matchers.anyObject());
}
Also used : ProcessingTimeSessionWindows(org.apache.flink.streaming.api.windowing.assigners.ProcessingTimeSessionWindows) MergingWindowAssigner(org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner) TimeWindow(org.apache.flink.streaming.api.windowing.windows.TimeWindow) Test(org.junit.Test)

Aggregations

ProcessingTimeSessionWindows (org.apache.flink.streaming.api.windowing.assigners.ProcessingTimeSessionWindows)7 Test (org.junit.Test)7 MergingWindowAssigner (org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner)6 TimeWindow (org.apache.flink.streaming.api.windowing.windows.TimeWindow)5 WindowAssigner (org.apache.flink.streaming.api.windowing.assigners.WindowAssigner)2 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)1 ProcessingTimeTrigger (org.apache.flink.streaming.api.windowing.triggers.ProcessingTimeTrigger)1