Search in sources :

Example 6 with DynamicEventTimeSessionWindows

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

the class DynamicEventTimeSessionWindowsTest method testProperties.

@Test
public void testProperties() {
    SessionWindowTimeGapExtractor extractor = mock(SessionWindowTimeGapExtractor.class);
    when(extractor.extract(any())).thenReturn(5000L);
    DynamicEventTimeSessionWindows assigner = DynamicEventTimeSessionWindows.withDynamicGap(extractor);
    assertTrue(assigner.isEventTime());
    assertEquals(new TimeWindow.Serializer(), assigner.getWindowSerializer(new ExecutionConfig()));
    assertThat(assigner.getDefaultTrigger(mock(StreamExecutionEnvironment.class)), instanceOf(EventTimeTrigger.class));
}
Also used : DynamicEventTimeSessionWindows(org.apache.flink.streaming.api.windowing.assigners.DynamicEventTimeSessionWindows) ExecutionConfig(org.apache.flink.api.common.ExecutionConfig) TimeWindow(org.apache.flink.streaming.api.windowing.windows.TimeWindow) EventTimeTrigger(org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger) SessionWindowTimeGapExtractor(org.apache.flink.streaming.api.windowing.assigners.SessionWindowTimeGapExtractor) Test(org.junit.Test)

Aggregations

DynamicEventTimeSessionWindows (org.apache.flink.streaming.api.windowing.assigners.DynamicEventTimeSessionWindows)6 SessionWindowTimeGapExtractor (org.apache.flink.streaming.api.windowing.assigners.SessionWindowTimeGapExtractor)6 Test (org.junit.Test)6 MergingWindowAssigner (org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner)5 TimeWindow (org.apache.flink.streaming.api.windowing.windows.TimeWindow)5 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)1 WindowAssigner (org.apache.flink.streaming.api.windowing.assigners.WindowAssigner)1 EventTimeTrigger (org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger)1