Search in sources :

Example 1 with FunctionInitializationContext

use of org.apache.flink.runtime.state.FunctionInitializationContext in project flink by apache.

the class RMQSourceTest method beforeTest.

@Before
public void beforeTest() throws Exception {
    OperatorStateStore mockStore = Mockito.mock(OperatorStateStore.class);
    FunctionInitializationContext mockContext = Mockito.mock(FunctionInitializationContext.class);
    Mockito.when(mockContext.getOperatorStateStore()).thenReturn(mockStore);
    Mockito.when(mockStore.getSerializableListState(any(String.class))).thenReturn(null);
    source = new RMQTestSource();
    source.initializeState(mockContext);
    source.open(config);
    messageId = 0;
    generateCorrelationIds = true;
    sourceThread = new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                source.run(new DummySourceContext());
            } catch (Exception e) {
                exception = e;
            }
        }
    });
}
Also used : OperatorStateStore(org.apache.flink.api.common.state.OperatorStateStore) FunctionInitializationContext(org.apache.flink.runtime.state.FunctionInitializationContext) IOException(java.io.IOException) Before(org.junit.Before)

Aggregations

IOException (java.io.IOException)1 OperatorStateStore (org.apache.flink.api.common.state.OperatorStateStore)1 FunctionInitializationContext (org.apache.flink.runtime.state.FunctionInitializationContext)1 Before (org.junit.Before)1