Search in sources :

Example 6 with SourceEvent

use of org.apache.flink.api.connector.source.SourceEvent in project flink by apache.

the class SourceOperatorTest method testHandleAddSourceEvent.

@Test
public void testHandleAddSourceEvent() throws Exception {
    operator.initializeState(context.createStateContext());
    operator.open();
    SourceEvent event = new SourceEvent() {
    };
    operator.handleOperatorEvent(new SourceEventWrapper(event));
    // The source reader should have been assigned two splits.
    assertEquals(Collections.singletonList(event), mockSourceReader.getReceivedSourceEvents());
}
Also used : SourceEventWrapper(org.apache.flink.runtime.source.event.SourceEventWrapper) SourceEvent(org.apache.flink.api.connector.source.SourceEvent) Test(org.junit.Test)

Aggregations

SourceEvent (org.apache.flink.api.connector.source.SourceEvent)6 SourceEventWrapper (org.apache.flink.runtime.source.event.SourceEventWrapper)6 Test (org.junit.Test)4 HashSet (java.util.HashSet)2 Set (java.util.Set)2 SourceReaderContext (org.apache.flink.api.connector.source.SourceReaderContext)2 MockSourceSplit (org.apache.flink.api.connector.source.mocks.MockSourceSplit)2 MockSplitEnumerator (org.apache.flink.api.connector.source.mocks.MockSplitEnumerator)2 MockSplitEnumeratorContext (org.apache.flink.api.connector.source.mocks.MockSplitEnumeratorContext)2 CoordinatorStoreImpl (org.apache.flink.runtime.operators.coordination.CoordinatorStoreImpl)2 RequestSplitEvent (org.apache.flink.runtime.source.event.RequestSplitEvent)2 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 Duration (java.time.Duration)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CountDownLatch (java.util.concurrent.CountDownLatch)1