Search in sources :

Example 1 with GlobalWindows

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

the class GlobalWindowsTest method testWindowAssignment.

@Test
public void testWindowAssignment() {
    WindowAssigner.WindowAssignerContext mockContext = mock(WindowAssigner.WindowAssignerContext.class);
    GlobalWindows assigner = GlobalWindows.create();
    assertThat(assigner.assignWindows("String", 0L, mockContext), contains(GlobalWindow.get()));
    assertThat(assigner.assignWindows("String", 4999L, mockContext), contains(GlobalWindow.get()));
    assertThat(assigner.assignWindows("String", 5000L, mockContext), contains(GlobalWindow.get()));
}
Also used : WindowAssigner(org.apache.flink.streaming.api.windowing.assigners.WindowAssigner) GlobalWindows(org.apache.flink.streaming.api.windowing.assigners.GlobalWindows) Test(org.junit.Test)

Example 2 with GlobalWindows

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

the class GlobalWindowsTest method testProperties.

@Test
public void testProperties() {
    GlobalWindows assigner = GlobalWindows.create();
    assertFalse(assigner.isEventTime());
    assertEquals(new GlobalWindow.Serializer(), assigner.getWindowSerializer(new ExecutionConfig()));
    assertThat(assigner.getDefaultTrigger(mock(StreamExecutionEnvironment.class)), instanceOf(GlobalWindows.NeverTrigger.class));
}
Also used : GlobalWindows(org.apache.flink.streaming.api.windowing.assigners.GlobalWindows) ExecutionConfig(org.apache.flink.api.common.ExecutionConfig) GlobalWindow(org.apache.flink.streaming.api.windowing.windows.GlobalWindow) Test(org.junit.Test)

Aggregations

GlobalWindows (org.apache.flink.streaming.api.windowing.assigners.GlobalWindows)2 Test (org.junit.Test)2 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)1 WindowAssigner (org.apache.flink.streaming.api.windowing.assigners.WindowAssigner)1 GlobalWindow (org.apache.flink.streaming.api.windowing.windows.GlobalWindow)1