Search in sources :

Example 6 with OperatorEvent

use of org.apache.flink.runtime.operators.coordination.OperatorEvent in project flink by apache.

the class SourceOperatorAlignmentTest method assertLatestReportedWatermarkEvent.

private void assertLatestReportedWatermarkEvent(SourceOperatorTestContext context, long expectedWatermark) {
    List<OperatorEvent> events = context.getGateway().getEventsSent().stream().filter(event -> event instanceof ReportedWatermarkEvent).collect(Collectors.toList());
    assertFalse(events.isEmpty());
    assertEquals(new ReportedWatermarkEvent(expectedWatermark), events.get(events.size() - 1));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) BeforeEach(org.junit.jupiter.api.BeforeEach) ReportedWatermarkEvent(org.apache.flink.runtime.source.event.ReportedWatermarkEvent) WatermarkGenerator(org.apache.flink.api.common.eventtime.WatermarkGenerator) CompletableFuture(java.util.concurrent.CompletableFuture) ArrayList(java.util.ArrayList) MockSourceSplit(org.apache.flink.api.connector.source.mocks.MockSourceSplit) StreamRecord(org.apache.flink.streaming.runtime.streamrecord.StreamRecord) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) DataInputStatus(org.apache.flink.streaming.runtime.io.DataInputStatus) Duration(java.time.Duration) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) WatermarkAlignmentEvent(org.apache.flink.runtime.source.event.WatermarkAlignmentEvent) Nullable(javax.annotation.Nullable) WatermarkStrategy(org.apache.flink.api.common.eventtime.WatermarkStrategy) MockSourceSplitSerializer(org.apache.flink.api.connector.source.mocks.MockSourceSplitSerializer) AddSplitEvent(org.apache.flink.runtime.source.event.AddSplitEvent) WatermarkOutput(org.apache.flink.api.common.eventtime.WatermarkOutput) Collectors(java.util.stream.Collectors) StopMode(org.apache.flink.runtime.io.network.api.StopMode) Test(org.junit.jupiter.api.Test) AfterEach(org.junit.jupiter.api.AfterEach) List(java.util.List) Matchers.contains(org.hamcrest.Matchers.contains) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Watermark(org.apache.flink.api.common.eventtime.Watermark) CollectingDataOutput(org.apache.flink.streaming.api.operators.source.CollectingDataOutput) Collections(java.util.Collections) OperatorEvent(org.apache.flink.runtime.operators.coordination.OperatorEvent) OperatorEvent(org.apache.flink.runtime.operators.coordination.OperatorEvent) ReportedWatermarkEvent(org.apache.flink.runtime.source.event.ReportedWatermarkEvent)

Aggregations

OperatorEvent (org.apache.flink.runtime.operators.coordination.OperatorEvent)6 IOException (java.io.IOException)2 MockSourceSplit (org.apache.flink.api.connector.source.mocks.MockSourceSplit)2 MockSourceSplitSerializer (org.apache.flink.api.connector.source.mocks.MockSourceSplitSerializer)2 AddSplitEvent (org.apache.flink.runtime.source.event.AddSplitEvent)2 WatermarkAlignmentEvent (org.apache.flink.runtime.source.event.WatermarkAlignmentEvent)2 FlinkException (org.apache.flink.util.FlinkException)2 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CompletionException (java.util.concurrent.CompletionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 Collectors (java.util.stream.Collectors)1 Nullable (javax.annotation.Nullable)1 Watermark (org.apache.flink.api.common.eventtime.Watermark)1 WatermarkGenerator (org.apache.flink.api.common.eventtime.WatermarkGenerator)1 WatermarkOutput (org.apache.flink.api.common.eventtime.WatermarkOutput)1 WatermarkStrategy (org.apache.flink.api.common.eventtime.WatermarkStrategy)1