Search in sources :

Example 6 with MockInputSplitProvider

use of org.apache.flink.runtime.operators.testutils.MockInputSplitProvider in project flink by apache.

the class StreamOperatorChainingTest method createMockTask.

private <IN, OT extends StreamOperator<IN>> StreamTask<IN, OT> createMockTask(StreamConfig streamConfig, String taskName) {
    final Object checkpointLock = new Object();
    final Environment env = new MockEnvironment(taskName, 3 * 1024 * 1024, new MockInputSplitProvider(), 1024);
    @SuppressWarnings("unchecked") StreamTask<IN, OT> mockTask = mock(StreamTask.class);
    when(mockTask.getName()).thenReturn("Mock Task");
    when(mockTask.getCheckpointLock()).thenReturn(checkpointLock);
    when(mockTask.getConfiguration()).thenReturn(streamConfig);
    when(mockTask.getEnvironment()).thenReturn(env);
    when(mockTask.getExecutionConfig()).thenReturn(new ExecutionConfig().enableObjectReuse());
    return mockTask;
}
Also used : MockEnvironment(org.apache.flink.runtime.operators.testutils.MockEnvironment) MockEnvironment(org.apache.flink.runtime.operators.testutils.MockEnvironment) Environment(org.apache.flink.runtime.execution.Environment) StreamExecutionEnvironment(org.apache.flink.streaming.api.environment.StreamExecutionEnvironment) ExecutionConfig(org.apache.flink.api.common.ExecutionConfig) MockInputSplitProvider(org.apache.flink.runtime.operators.testutils.MockInputSplitProvider)

Aggregations

MockInputSplitProvider (org.apache.flink.runtime.operators.testutils.MockInputSplitProvider)6 CheckpointMetaData (org.apache.flink.runtime.checkpoint.CheckpointMetaData)4 StreamConfig (org.apache.flink.streaming.api.graph.StreamConfig)4 Test (org.junit.Test)4 OneInputStreamTask (org.apache.flink.streaming.runtime.tasks.OneInputStreamTask)3 OneInputStreamTaskTestHarness (org.apache.flink.streaming.runtime.tasks.OneInputStreamTaskTestHarness)3 File (java.io.File)2 IOException (java.io.IOException)2 Field (java.lang.reflect.Field)2 URI (java.net.URI)2 CancellationException (java.util.concurrent.CancellationException)2 ExecutionException (java.util.concurrent.ExecutionException)2 ExecutorService (java.util.concurrent.ExecutorService)2 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)2 OneShotLatch (org.apache.flink.core.testutils.OneShotLatch)2 MockEnvironment (org.apache.flink.runtime.operators.testutils.MockEnvironment)2 TaskStateHandles (org.apache.flink.runtime.state.TaskStateHandles)2 AsynchronousException (org.apache.flink.streaming.runtime.tasks.AsynchronousException)2 StreamMockEnvironment (org.apache.flink.streaming.runtime.tasks.StreamMockEnvironment)2 Configuration (org.apache.hadoop.conf.Configuration)2