You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by gr...@apache.org on 2017/05/22 21:50:20 UTC
[01/10] flink git commit: [FLINK-6603] [streaming] Enable checkstyle
on test sources
Repository: flink
Updated Branches:
refs/heads/master 7efa8ad34 -> 12b4185c6
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamMockEnvironment.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamMockEnvironment.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamMockEnvironment.java
index a9d2ddf..5b995c6 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamMockEnvironment.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamMockEnvironment.java
@@ -27,7 +27,6 @@ import org.apache.flink.core.fs.Path;
import org.apache.flink.core.memory.MemorySegmentFactory;
import org.apache.flink.runtime.accumulators.AccumulatorRegistry;
import org.apache.flink.runtime.broadcast.BroadcastVariableManager;
-import org.apache.flink.runtime.checkpoint.CheckpointMetaData;
import org.apache.flink.runtime.checkpoint.CheckpointMetrics;
import org.apache.flink.runtime.checkpoint.SubtaskState;
import org.apache.flink.runtime.event.AbstractEvent;
@@ -73,6 +72,9 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+/**
+ * Mock {@link Environment}.
+ */
public class StreamMockEnvironment implements Environment {
private final TaskInfo taskInfo;
@@ -106,7 +108,7 @@ public class StreamMockEnvironment implements Environment {
private volatile boolean wasFailedExternally = false;
public StreamMockEnvironment(Configuration jobConfig, Configuration taskConfig, ExecutionConfig executionConfig,
- long memorySize, MockInputSplitProvider inputSplitProvider, int bufferSize) {
+ long memorySize, MockInputSplitProvider inputSplitProvider, int bufferSize) {
this.taskInfo = new TaskInfo(
"", /* task name */
1, /* num key groups / max parallelism */
@@ -131,7 +133,7 @@ public class StreamMockEnvironment implements Environment {
}
public StreamMockEnvironment(Configuration jobConfig, Configuration taskConfig, long memorySize,
- MockInputSplitProvider inputSplitProvider, int bufferSize) {
+ MockInputSplitProvider inputSplitProvider, int bufferSize) {
this(jobConfig, taskConfig, new ExecutionConfig(), memorySize, inputSplitProvider, bufferSize);
}
@@ -183,7 +185,6 @@ public class StreamMockEnvironment implements Environment {
}
}).when(mockWriter).writeBufferToAllChannels(any(Buffer.class));
-
outputs.add(mockWriter);
}
catch (Throwable t) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskCancellationBarrierTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskCancellationBarrierTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskCancellationBarrierTest.java
index f8d5393..6e3c299 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskCancellationBarrierTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskCancellationBarrierTest.java
@@ -20,15 +20,16 @@ package org.apache.flink.streaming.runtime.tasks;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
+import org.apache.flink.runtime.checkpoint.CheckpointMetaData;
import org.apache.flink.runtime.checkpoint.CheckpointOptions;
import org.apache.flink.runtime.checkpoint.decline.CheckpointDeclineOnCancellationBarrierException;
-import org.apache.flink.runtime.checkpoint.CheckpointMetaData;
import org.apache.flink.runtime.io.network.api.CancelCheckpointMarker;
import org.apache.flink.streaming.api.functions.co.CoMapFunction;
import org.apache.flink.streaming.api.graph.StreamConfig;
import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.operators.StreamMap;
import org.apache.flink.streaming.api.operators.co.CoStreamMap;
+
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -41,6 +42,9 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+/**
+ * Test checkpoint cancellation barrier.
+ */
public class StreamTaskCancellationBarrierTest {
/**
@@ -71,9 +75,8 @@ public class StreamTaskCancellationBarrierTest {
/**
* This test verifies (for onw input tasks) that the Stream tasks react the following way to
* receiving a checkpoint cancellation barrier:
- *
* - send a "decline checkpoint" notification out (to the JobManager)
- * - emit a cancellation barrier downstream
+ * - emit a cancellation barrier downstream.
*/
@Test
public void testDeclineCallOnCancelBarrierOneInput() throws Exception {
@@ -115,11 +118,10 @@ public class StreamTaskCancellationBarrierTest {
}
/**
- * This test verifies (for onw input tasks) that the Stream tasks react the following way to
+ * This test verifies (for one input tasks) that the Stream tasks react the following way to
* receiving a checkpoint cancellation barrier:
- *
* - send a "decline checkpoint" notification out (to the JobManager)
- * - emit a cancellation barrier downstream
+ * - emit a cancellation barrier downstream.
*/
@Test
public void testDeclineCallOnCancelBarrierTwoInputs() throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
index 546188e..8957255 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.runtime.tasks;
-import akka.dispatch.Futures;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.JobID;
import org.apache.flink.api.common.TaskInfo;
@@ -88,6 +87,8 @@ import org.apache.flink.streaming.runtime.streamstatus.StreamStatusMaintainer;
import org.apache.flink.util.ExceptionUtils;
import org.apache.flink.util.SerializedValue;
import org.apache.flink.util.TestLogger;
+
+import akka.dispatch.Futures;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -137,13 +138,16 @@ import static org.mockito.Mockito.when;
import static org.mockito.Mockito.withSettings;
import static org.powermock.api.mockito.PowerMockito.whenNew;
+/**
+ * Tests for {@link StreamTask}.
+ */
@RunWith(PowerMockRunner.class)
@PrepareForTest(StreamTask.class)
@PowerMockIgnore("org.apache.log4j.*")
@SuppressWarnings("deprecation")
public class StreamTaskTest extends TestLogger {
- private static OneShotLatch SYNC_LATCH;
+ private static OneShotLatch syncLatch;
/**
* This test checks that cancel calls that are issued before the operator is
@@ -242,7 +246,7 @@ public class StreamTaskTest extends TestLogger {
@Test
public void testCancellationNotBlockedOnLock() throws Exception {
- SYNC_LATCH = new OneShotLatch();
+ syncLatch = new OneShotLatch();
StreamConfig cfg = new StreamConfig(new Configuration());
Task task = createTask(CancelLockingTask.class, cfg, new Configuration());
@@ -251,7 +255,7 @@ public class StreamTaskTest extends TestLogger {
// execution state RUNNING is not enough, we need to wait until the stream task's run() method
// is entered
task.startTaskThread();
- SYNC_LATCH.await();
+ syncLatch.await();
// cancel the execution - this should lead to smooth shutdown
task.cancelExecution();
@@ -262,7 +266,7 @@ public class StreamTaskTest extends TestLogger {
@Test
public void testCancellationFailsWithBlockingLock() throws Exception {
- SYNC_LATCH = new OneShotLatch();
+ syncLatch = new OneShotLatch();
StreamConfig cfg = new StreamConfig(new Configuration());
Task task = createTask(CancelFailingTask.class, cfg, new Configuration());
@@ -271,7 +275,7 @@ public class StreamTaskTest extends TestLogger {
// execution state RUNNING is not enough, we need to wait until the stream task's run() method
// is entered
task.startTaskThread();
- SYNC_LATCH.await();
+ syncLatch.await();
// cancel the execution - this should lead to smooth shutdown
task.cancelExecution();
@@ -422,7 +426,7 @@ public class StreamTaskTest extends TestLogger {
/**
* FLINK-5667
*
- * Tests that a concurrent cancel operation does not discard the state handles of an
+ * <p>Tests that a concurrent cancel operation does not discard the state handles of an
* acknowledged checkpoint. The situation can only happen if the cancel call is executed
* after Environment.acknowledgeCheckpoint() and before the
* CloseableRegistry.unregisterClosable() call.
@@ -534,7 +538,7 @@ public class StreamTaskTest extends TestLogger {
/**
* FLINK-5667
*
- * Tests that a concurrent cancel operation discards the state handles of a not yet
+ * <p>Tests that a concurrent cancel operation discards the state handles of a not yet
* acknowledged checkpoint and prevents sending an acknowledge message to the
* CheckpointCoordinator. The situation can only happen if the cancel call is executed
* before Environment.acknowledgeCheckpoint().
@@ -560,11 +564,11 @@ public class StreamTaskTest extends TestLogger {
completeSubtask.await();
return new SubtaskState(
- (ChainedStateHandle<StreamStateHandle>)invocation.getArguments()[0],
- (ChainedStateHandle<OperatorStateHandle>)invocation.getArguments()[1],
- (ChainedStateHandle<OperatorStateHandle>)invocation.getArguments()[2],
- (KeyedStateHandle)invocation.getArguments()[3],
- (KeyedStateHandle)invocation.getArguments()[4]);
+ (ChainedStateHandle<StreamStateHandle>) invocation.getArguments()[0],
+ (ChainedStateHandle<OperatorStateHandle>) invocation.getArguments()[1],
+ (ChainedStateHandle<OperatorStateHandle>) invocation.getArguments()[2],
+ (KeyedStateHandle) invocation.getArguments()[3],
+ (KeyedStateHandle) invocation.getArguments()[4]);
}
});
@@ -643,7 +647,7 @@ public class StreamTaskTest extends TestLogger {
/**
* FLINK-5985
*
- * This test ensures that empty snapshots (no op/keyed stated whatsoever) will be reported as stateless tasks. This
+ * <p>This test ensures that empty snapshots (no op/keyed stated whatsoever) will be reported as stateless tasks. This
* happens by translating an empty {@link SubtaskState} into reporting 'null' to #acknowledgeCheckpoint.
*/
@Test
@@ -819,7 +823,7 @@ public class StreamTaskTest extends TestLogger {
// Test operators
// ------------------------------------------------------------------------
- public static class SlowlyDeserializingOperator extends StreamSource<Long, SourceFunction<Long>> {
+ private static class SlowlyDeserializingOperator extends StreamSource<Long, SourceFunction<Long>> {
private static final long serialVersionUID = 1L;
private volatile boolean canceled = false;
@@ -955,7 +959,7 @@ public class StreamTaskTest extends TestLogger {
}
/**
- * A task that locks if cancellation attempts to cleanly shut down
+ * A task that locks if cancellation attempts to cleanly shut down.
*/
public static class CancelLockingTask extends StreamTask<String, AbstractStreamOperator<String>> {
@@ -973,7 +977,7 @@ public class StreamTaskTest extends TestLogger {
latch.await();
// we are at the point where cancelling can happen
- SYNC_LATCH.trigger();
+ syncLatch.trigger();
// just put this to sleep until it is interrupted
try {
@@ -999,7 +1003,7 @@ public class StreamTaskTest extends TestLogger {
}
/**
- * A task that locks if cancellation attempts to cleanly shut down
+ * A task that locks if cancellation attempts to cleanly shut down.
*/
public static class CancelFailingTask extends StreamTask<String, AbstractStreamOperator<String>> {
@@ -1021,7 +1025,7 @@ public class StreamTaskTest extends TestLogger {
latch.await();
// we are at the point where cancelling can happen
- SYNC_LATCH.trigger();
+ syncLatch.trigger();
// try to acquire the lock - this is not possible as long as the lock holder
// thread lives
@@ -1050,7 +1054,7 @@ public class StreamTaskTest extends TestLogger {
// ------------------------------------------------------------------------
/**
- * A thread that holds a lock as long as it lives
+ * A thread that holds a lock as long as it lives.
*/
private static final class LockHolder extends Thread implements Closeable {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTestHarness.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTestHarness.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTestHarness.java
index 0be85b1..a02fe4e 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTestHarness.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTestHarness.java
@@ -35,8 +35,8 @@ import org.apache.flink.streaming.api.graph.StreamNode;
import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.operators.StreamOperator;
import org.apache.flink.streaming.runtime.partitioner.BroadcastPartitioner;
-import org.apache.flink.streaming.runtime.streamrecord.StreamElementSerializer;
import org.apache.flink.streaming.runtime.streamrecord.StreamElement;
+import org.apache.flink.streaming.runtime.streamrecord.StreamElementSerializer;
import org.junit.Assert;
@@ -44,24 +44,20 @@ import java.io.IOException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.LinkedBlockingQueue;
/**
* Test harness for testing a {@link StreamTask}.
*
- * <p>
- * This mock Invokable provides the task with a basic runtime context and allows pushing elements
+ * <p>This mock Invokable provides the task with a basic runtime context and allows pushing elements
* and watermarks into the task. {@link #getOutput()} can be used to get the emitted elements
* and events. You are free to modify the retrieved list.
*
- * <p>
- * After setting up everything the Task can be invoked using {@link #invoke()}. This will start
+ * <p>After setting up everything the Task can be invoked using {@link #invoke()}. This will start
* a new Thread to execute the Task. Use {@link #waitForTaskCompletion()} to wait for the Task
* thread to finish.
*
- * <p>
- * When using this you need to add the following line to your test class to setup Powermock:
+ * <p>When using this you need to add the following line to your test class to setup Powermock:
* {@code {@literal @}PrepareForTest({ResultPartitionWriter.class})}
*/
public class StreamTaskTestHarness<OUT> {
@@ -135,7 +131,7 @@ public class StreamTaskTestHarness<OUT> {
* if there will only be a single operator to be tested. The method will setup the
* outgoing network connection for the operator.
*
- * For more advanced test cases such as testing chains of multiple operators with the harness,
+ * <p>For more advanced test cases such as testing chains of multiple operators with the harness,
* please manually configure the stream config.
*/
public void setupOutputForSingletonOperatorChain() {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeServiceTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeServiceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeServiceTest.java
index 1f8638e..890fc23 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeServiceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeServiceTest.java
@@ -37,6 +37,9 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+/**
+ * Tests for {@link SystemProcessingTimeService}.
+ */
public class SystemProcessingTimeServiceTest extends TestLogger {
@Test
@@ -74,7 +77,7 @@ public class SystemProcessingTimeServiceTest extends TestLogger {
}
/**
- * Tests that the schedule at fixed rate callback is called under the given lock
+ * Tests that the schedule at fixed rate callback is called under the given lock.
*/
@Test
public void testScheduleAtFixedRateHoldsLock() throws Exception {
@@ -123,7 +126,7 @@ public class SystemProcessingTimeServiceTest extends TestLogger {
* Tests that SystemProcessingTimeService#scheduleAtFixedRate is actually triggered multiple
* times.
*/
- @Test(timeout=10000)
+ @Test(timeout = 10000)
public void testScheduleAtFixedRate() throws Exception {
final Object lock = new Object();
final AtomicReference<Throwable> errorRef = new AtomicReference<>();
@@ -432,7 +435,7 @@ public class SystemProcessingTimeServiceTest extends TestLogger {
}
},
0L,
- 100L );
+ 100L);
latch.await();
assertTrue(exceptionWasThrown.get());
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTaskTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTaskTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTaskTest.java
index d465619..66531ac 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTaskTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTaskTest.java
@@ -42,8 +42,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
* Tests for {@link org.apache.flink.streaming.runtime.tasks.TwoInputStreamTask}. Theses tests
* implicitly also test the {@link org.apache.flink.streaming.runtime.io.StreamTwoInputProcessor}.
*
- * <p>
- * Note:<br>
+ * <p>Note:<br>
* We only use a {@link CoStreamMap} operator here. We also test the individual operators but Map is
* used as a representative to test TwoInputStreamTask, since TwoInputStreamTask is used for all
* TwoInputStreamOperators.
@@ -123,7 +122,6 @@ public class TwoInputStreamTaskTest {
testHarness.processElement(new Watermark(initialTime), 1, 0);
-
// now the output should still be empty
testHarness.waitForInputProcessing();
TestHarnessUtil.assertOutputEquals("Output was not correct.", expectedOutput, testHarness.getOutput());
@@ -155,7 +153,6 @@ public class TwoInputStreamTaskTest {
testHarness.waitForInputProcessing();
TestHarnessUtil.assertOutputEquals("Output was not correct.", expectedOutput, testHarness.getOutput());
-
// advance watermark from one of the inputs, now we should get a new one since the
// minimum increases
testHarness.processElement(new Watermark(initialTime + 4), 1, 1);
@@ -279,7 +276,6 @@ public class TwoInputStreamTaskTest {
expectedOutput,
testHarness.getOutput());
-
List<String> resultElements = TestHarnessUtil.getRawElementsFromOutput(testHarness.getOutput());
Assert.assertEquals(4, resultElements.size());
}
@@ -346,7 +342,6 @@ public class TwoInputStreamTaskTest {
expectedOutput,
testHarness.getOutput());
-
// Then give the earlier barrier, these should be ignored
testHarness.processEvent(new CheckpointBarrier(0, 0, CheckpointOptions.forFullCheckpoint()), 0, 1);
testHarness.processEvent(new CheckpointBarrier(0, 0, CheckpointOptions.forFullCheckpoint()), 1, 0);
@@ -354,7 +349,6 @@ public class TwoInputStreamTaskTest {
testHarness.waitForInputProcessing();
-
testHarness.endInput();
testHarness.waitForTaskCompletion();
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTaskTestHarness.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTaskTestHarness.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTaskTestHarness.java
index 7ce4ab7..9b9038f 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTaskTestHarness.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTaskTestHarness.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.tasks;
import org.apache.flink.api.common.typeinfo.TypeInformation;
@@ -35,13 +36,11 @@ import java.util.List;
/**
* Test harness for testing a {@link TwoInputStreamTask}.
*
- * <p>
- * This mock Invokable provides the task with a basic runtime context and allows pushing elements
+ * <p>This mock Invokable provides the task with a basic runtime context and allows pushing elements
* and watermarks into the task. {@link #getOutput()} can be used to get the emitted elements
* and events. You are free to modify the retrieved list.
*
- * <p>
- * After setting up everything the Task can be invoked using {@link #invoke()}. This will start
+ * <p>After setting up everything the Task can be invoked using {@link #invoke()}. This will start
* a new Thread to execute the Task. Use {@link #waitForTaskCompletion()} to wait for the Task
* thread to finish. Use {@link #processElement}
* to send elements to the task. Use
@@ -49,8 +48,7 @@ import java.util.List;
* Before waiting for the task to finish you must call {@link #endInput()} to signal to the task
* that data entry is finished.
*
- * <p>
- * When Elements or Events are offered to the Task they are put into a queue. The input gates
+ * <p>When Elements or Events are offered to the Task they are put into a queue. The input gates
* of the Task read from this queue. Use {@link #waitForInputProcessing()} to wait until all
* queues are empty. This must be used after entering some elements before checking the
* desired output.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractDeserializationSchemaTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractDeserializationSchemaTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractDeserializationSchemaTest.java
index 77178d7..b14492e 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractDeserializationSchemaTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractDeserializationSchemaTest.java
@@ -18,19 +18,23 @@
package org.apache.flink.streaming.util;
-import com.fasterxml.jackson.databind.util.JSONPObject;
import org.apache.flink.api.common.functions.InvalidTypesException;
import org.apache.flink.api.common.typeinfo.TypeHint;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.util.serialization.AbstractDeserializationSchema;
+import com.fasterxml.jackson.databind.util.JSONPObject;
import org.junit.Test;
import java.io.IOException;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+/**
+ * Tests for {@link AbstractDeserializationSchema}.
+ */
@SuppressWarnings("serial")
public class AbstractDeserializationSchemaTest {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractStreamOperatorTestHarness.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractStreamOperatorTestHarness.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractStreamOperatorTestHarness.java
index 7a8488f..0a517f0 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractStreamOperatorTestHarness.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractStreamOperatorTestHarness.java
@@ -15,12 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.JobID;
-import org.apache.flink.util.OutputTag;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.java.typeutils.TypeExtractor;
import org.apache.flink.configuration.Configuration;
@@ -48,9 +48,9 @@ import org.apache.flink.runtime.state.StreamStateHandle;
import org.apache.flink.runtime.state.memory.MemoryStateBackend;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.graph.StreamConfig;
+import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.operators.AbstractStreamOperatorTest;
import org.apache.flink.streaming.api.operators.OperatorSnapshotResult;
-import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.operators.Output;
import org.apache.flink.streaming.api.operators.StreamCheckpointedOperator;
import org.apache.flink.streaming.api.operators.StreamOperator;
@@ -64,7 +64,9 @@ import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.streaming.runtime.tasks.StreamTask;
import org.apache.flink.streaming.runtime.tasks.TestProcessingTimeService;
import org.apache.flink.util.FutureUtil;
+import org.apache.flink.util.OutputTag;
import org.apache.flink.util.Preconditions;
+
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -88,19 +90,19 @@ import static org.mockito.Mockito.when;
*/
public class AbstractStreamOperatorTestHarness<OUT> {
- final protected StreamOperator<OUT> operator;
+ protected final StreamOperator<OUT> operator;
- final protected ConcurrentLinkedQueue<Object> outputList;
+ protected final ConcurrentLinkedQueue<Object> outputList;
- final protected Map<OutputTag<?>, ConcurrentLinkedQueue<Object>> sideOutputLists;
+ protected final Map<OutputTag<?>, ConcurrentLinkedQueue<Object>> sideOutputLists;
- final protected StreamConfig config;
+ protected final StreamConfig config;
- final protected ExecutionConfig executionConfig;
+ protected final ExecutionConfig executionConfig;
- final protected TestProcessingTimeService processingTimeService;
+ protected final TestProcessingTimeService processingTimeService;
- final protected StreamTask<?, ?> mockTask;
+ protected final StreamTask<?, ?> mockTask;
final Environment environment;
@@ -291,16 +293,14 @@ public class AbstractStreamOperatorTestHarness<OUT> {
}
/**
- * Calls
- * {@link StreamOperator#setup(StreamTask, StreamConfig, Output)} ()}
+ * Calls {@link StreamOperator#setup(StreamTask, StreamConfig, Output)} ()}.
*/
public void setup() {
setup(null);
}
/**
- * Calls
- * {@link StreamOperator#setup(StreamTask, StreamConfig, Output)} ()}
+ * Calls {@link StreamOperator#setup(StreamTask, StreamConfig, Output)} ()}.
*/
public void setup(TypeSerializer<OUT> outputSerializer) {
operator.setup(mockTask, config, new MockOutput(outputSerializer));
@@ -416,17 +416,14 @@ public class AbstractStreamOperatorTestHarness<OUT> {
* and repacks them into a single {@link OperatorStateHandles} so that the parallelism of the test
* can change arbitrarily (i.e. be able to scale both up and down).
*
- * <p>
- * After repacking the partial states, use {@link #initializeState(OperatorStateHandles)} to initialize
+ * <p>After repacking the partial states, use {@link #initializeState(OperatorStateHandles)} to initialize
* a new instance with the resulting state. Bear in mind that for parallelism greater than one, you
* have to use the constructor {@link #AbstractStreamOperatorTestHarness(StreamOperator, int, int, int)}.
*
- * <p>
- * <b>NOTE: </b> each of the {@code handles} in the argument list is assumed to be from a single task of a single
+ * <p><b>NOTE: </b> each of the {@code handles} in the argument list is assumed to be from a single task of a single
* operator (i.e. chain length of one).
*
- * <p>
- * For an example of how to use it, have a look at
+ * <p>For an example of how to use it, have a look at
* {@link AbstractStreamOperatorTest#testStateAndTimerStateShufflingScalingDown()}.
*
* @param handles the different states to be merged.
@@ -540,7 +537,7 @@ public class AbstractStreamOperatorTestHarness<OUT> {
CheckpointStreamFactory.CheckpointStateOutputStream outStream = stateBackend.createStreamFactory(
new JobID(),
"test_op").createCheckpointStateOutputStream(checkpointId, timestamp);
- if(operator instanceof StreamCheckpointedOperator) {
+ if (operator instanceof StreamCheckpointedOperator) {
((StreamCheckpointedOperator) operator).snapshotState(outStream, checkpointId, timestamp);
return outStream.closeAndGetHandle();
} else {
@@ -549,7 +546,7 @@ public class AbstractStreamOperatorTestHarness<OUT> {
}
/**
- * Calls {@link org.apache.flink.streaming.api.operators.StreamOperator#notifyOfCompletedCheckpoint(long)} ()}
+ * Calls {@link org.apache.flink.streaming.api.operators.StreamOperator#notifyOfCompletedCheckpoint(long)} ()}.
*/
public void notifyOfCompletedCheckpoint(long checkpointId) throws Exception {
operator.notifyOfCompletedCheckpoint(checkpointId);
@@ -562,7 +559,7 @@ public class AbstractStreamOperatorTestHarness<OUT> {
@Deprecated
@SuppressWarnings("deprecation")
public void restore(StreamStateHandle snapshot) throws Exception {
- if(operator instanceof StreamCheckpointedOperator) {
+ if (operator instanceof StreamCheckpointedOperator) {
try (FSDataInputStream in = snapshot.openInputStream()) {
((StreamCheckpointedOperator) operator).restoreState(in);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/CollectingSourceContext.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/CollectingSourceContext.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/CollectingSourceContext.java
index fa68082..bd731b8 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/CollectingSourceContext.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/CollectingSourceContext.java
@@ -26,6 +26,9 @@ import java.io.IOException;
import java.io.Serializable;
import java.util.Collection;
+/**
+ * Collecting {@link SourceFunction.SourceContext}.
+ */
public class CollectingSourceContext<T extends Serializable> implements SourceFunction.SourceContext<T> {
private final Object lock;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/CollectorOutput.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/CollectorOutput.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/CollectorOutput.java
index bd929da..de84860 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/CollectorOutput.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/CollectorOutput.java
@@ -18,17 +18,20 @@
package org.apache.flink.streaming.util;
-import org.apache.commons.lang3.SerializationUtils;
import org.apache.flink.streaming.api.operators.Output;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.LatencyMarker;
import org.apache.flink.streaming.runtime.streamrecord.StreamElement;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import org.apache.flink.util.InstantiationUtil;
import org.apache.flink.util.OutputTag;
-import java.io.Serializable;
+import java.io.IOException;
import java.util.List;
+/**
+ * Collecting {@link Output} for {@link StreamRecord}.
+ */
public class CollectorOutput<T> implements Output<StreamRecord<T>> {
private final List<StreamElement> list;
@@ -49,8 +52,13 @@ public class CollectorOutput<T> implements Output<StreamRecord<T>> {
@Override
public void collect(StreamRecord<T> record) {
- T copied = SerializationUtils.deserialize(SerializationUtils.serialize((Serializable) record.getValue()));
- list.add(record.copy(copied));
+ try {
+ ClassLoader cl = record.getClass().getClassLoader();
+ T copied = InstantiationUtil.deserializeObject(InstantiationUtil.serializeObject(record.getValue()), cl);
+ list.add(record.copy(copied));
+ } catch (IOException | ClassNotFoundException ex) {
+ throw new RuntimeException("Unable to deserialize record: " + record, ex);
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/EvenOddOutputSelector.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/EvenOddOutputSelector.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/EvenOddOutputSelector.java
index 1745c46..26da5d3 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/EvenOddOutputSelector.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/EvenOddOutputSelector.java
@@ -15,12 +15,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
import org.apache.flink.streaming.api.collector.selector.OutputSelector;
import java.util.Arrays;
+/**
+ * Tests for {@link OutputSelector}.
+ */
public class EvenOddOutputSelector implements OutputSelector<Integer> {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/HDFSCopyUtilitiesTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/HDFSCopyUtilitiesTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/HDFSCopyUtilitiesTest.java
index f16750d..ca21c0c 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/HDFSCopyUtilitiesTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/HDFSCopyUtilitiesTest.java
@@ -15,10 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
import org.apache.flink.core.fs.Path;
import org.apache.flink.util.OperatingSystem;
+
import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
@@ -33,6 +35,9 @@ import java.io.FileOutputStream;
import static org.junit.Assert.assertTrue;
+/**
+ * Tests for {@link HDFSCopyFromLocal} and {@link HDFSCopyToLocal}.
+ */
public class HDFSCopyUtilitiesTest {
@Rule
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedOneInputStreamOperatorTestHarness.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedOneInputStreamOperatorTestHarness.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedOneInputStreamOperatorTestHarness.java
index c6d0bce..8f4908a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedOneInputStreamOperatorTestHarness.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedOneInputStreamOperatorTestHarness.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
import org.apache.flink.api.common.JobID;
@@ -28,16 +29,16 @@ import org.apache.flink.runtime.checkpoint.StateAssignmentOperation;
import org.apache.flink.runtime.state.AbstractKeyedStateBackend;
import org.apache.flink.runtime.state.CheckpointStreamFactory;
import org.apache.flink.runtime.state.KeyGroupRange;
-import org.apache.flink.runtime.state.KeyGroupsStateHandle;
import org.apache.flink.runtime.state.KeyedStateBackend;
import org.apache.flink.runtime.state.KeyedStateHandle;
-import org.apache.flink.runtime.state.heap.HeapKeyedStateBackend;
import org.apache.flink.runtime.state.StreamStateHandle;
+import org.apache.flink.runtime.state.heap.HeapKeyedStateBackend;
import org.apache.flink.runtime.state.memory.MemoryStateBackend;
import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
import org.apache.flink.streaming.api.operators.StreamCheckpointedOperator;
import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
import org.apache.flink.util.Migration;
+
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -84,7 +85,6 @@ public class KeyedOneInputStreamOperatorTestHarness<K, IN, OUT>
setupMockTaskCreateKeyedBackend();
}
-
public KeyedOneInputStreamOperatorTestHarness(
OneInputStreamOperator<IN, OUT> operator,
final KeySelector<IN, K> keySelector,
@@ -148,7 +148,7 @@ public class KeyedOneInputStreamOperatorTestHarness<K, IN, OUT>
timestamp,
streamFactory,
CheckpointOptions.forFullCheckpoint());
- if(!keyedSnapshotRunnable.isDone()) {
+ if (!keyedSnapshotRunnable.isDone()) {
Thread runner = new Thread(keyedSnapshotRunnable);
runner.start();
}
@@ -181,7 +181,6 @@ public class KeyedOneInputStreamOperatorTestHarness<K, IN, OUT>
}
}
-
private static boolean hasMigrationHandles(Collection<KeyedStateHandle> allKeyGroupsHandles) {
for (KeyedStateHandle handle : allKeyGroupsHandles) {
if (handle instanceof Migration) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedTwoInputStreamOperatorTestHarness.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedTwoInputStreamOperatorTestHarness.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedTwoInputStreamOperatorTestHarness.java
index 41a083a..10c79d0 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedTwoInputStreamOperatorTestHarness.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/KeyedTwoInputStreamOperatorTestHarness.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
import org.apache.flink.api.common.JobID;
@@ -24,11 +25,11 @@ import org.apache.flink.api.java.ClosureCleaner;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.runtime.state.AbstractKeyedStateBackend;
import org.apache.flink.runtime.state.KeyGroupRange;
-import org.apache.flink.runtime.state.KeyGroupsStateHandle;
import org.apache.flink.runtime.state.KeyedStateBackend;
import org.apache.flink.runtime.state.KeyedStateHandle;
import org.apache.flink.streaming.api.operators.TwoInputStreamOperator;
import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
+
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -91,7 +92,7 @@ public class KeyedTwoInputStreamOperatorTestHarness<K, IN1, IN2, OUT>
final int numberOfKeyGroups = (Integer) invocationOnMock.getArguments()[1];
final KeyGroupRange keyGroupRange = (KeyGroupRange) invocationOnMock.getArguments()[2];
- if(keyedStateBackend != null) {
+ if (keyedStateBackend != null) {
keyedStateBackend.close();
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/MockContext.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/MockContext.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/MockContext.java
index 5d73015..db4fe1c 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/MockContext.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/MockContext.java
@@ -17,17 +17,20 @@
package org.apache.flink.streaming.util;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
import org.apache.flink.streaming.api.operators.Output;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * Simple test context for stream operators.
+ */
public class MockContext<IN, OUT> {
private List<OUT> outputs;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/MockOutput.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/MockOutput.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/MockOutput.java
index 8c3226b..f19946c 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/MockOutput.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/MockOutput.java
@@ -17,16 +17,19 @@
package org.apache.flink.streaming.util;
-import java.io.Serializable;
-import java.util.Collection;
-
-import org.apache.commons.lang3.SerializationUtils;
import org.apache.flink.streaming.api.operators.Output;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.LatencyMarker;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import org.apache.flink.util.InstantiationUtil;
import org.apache.flink.util.OutputTag;
+import java.io.IOException;
+import java.util.Collection;
+
+/**
+ * Mock {@link Output} for {@link StreamRecord}.
+ */
public class MockOutput<T> implements Output<StreamRecord<T>> {
private Collection<T> outputs;
@@ -36,8 +39,13 @@ public class MockOutput<T> implements Output<StreamRecord<T>> {
@Override
public void collect(StreamRecord<T> record) {
- T copied = SerializationUtils.deserialize(SerializationUtils.serialize((Serializable) record.getValue()));
- outputs.add(copied);
+ try {
+ ClassLoader cl = record.getClass().getClassLoader();
+ T copied = InstantiationUtil.deserializeObject(InstantiationUtil.serializeObject(record.getValue()), cl);
+ outputs.add(copied);
+ } catch (IOException | ClassNotFoundException ex) {
+ throw new RuntimeException("Unable to deserialize record: " + record, ex);
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/NoOpIntMap.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/NoOpIntMap.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/NoOpIntMap.java
index 05de3d0..c82ec7c 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/NoOpIntMap.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/NoOpIntMap.java
@@ -15,10 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
import org.apache.flink.api.common.functions.MapFunction;
+/**
+ * Identity mapper for {@code Integer}.
+ */
public class NoOpIntMap implements MapFunction<Integer, Integer> {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OneInputStreamOperatorTestHarness.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OneInputStreamOperatorTestHarness.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OneInputStreamOperatorTestHarness.java
index ced8cca..652d016 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OneInputStreamOperatorTestHarness.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OneInputStreamOperatorTestHarness.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -86,7 +87,6 @@ public class OneInputStreamOperatorTestHarness<IN, OUT>
processElement(new StreamRecord<>(value, timestamp));
}
-
public void processElement(StreamRecord<IN> element) throws Exception {
operator.setKeyContextElement1(element);
oneInputOperator.processElement(element);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OperatorSnapshotUtil.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OperatorSnapshotUtil.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OperatorSnapshotUtil.java
index 8011279..7e32723 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OperatorSnapshotUtil.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OperatorSnapshotUtil.java
@@ -15,8 +15,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
+import org.apache.flink.runtime.checkpoint.savepoint.SavepointV1Serializer;
+import org.apache.flink.runtime.state.KeyedStateHandle;
+import org.apache.flink.runtime.state.OperatorStateHandle;
+import org.apache.flink.runtime.state.StreamStateHandle;
+import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
+
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
@@ -26,11 +33,6 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.apache.flink.runtime.checkpoint.savepoint.SavepointV1Serializer;
-import org.apache.flink.runtime.state.KeyedStateHandle;
-import org.apache.flink.runtime.state.OperatorStateHandle;
-import org.apache.flink.runtime.state.StreamStateHandle;
-import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
/**
* Util for writing/reading {@link org.apache.flink.streaming.runtime.tasks.OperatorStateHandles},
@@ -46,7 +48,7 @@ public class OperatorSnapshotUtil {
public static void writeStateHandle(OperatorStateHandles state, String path) throws IOException {
FileOutputStream out = new FileOutputStream(path);
-
+
try (DataOutputStream dos = new DataOutputStream(out)) {
dos.writeInt(state.getOperatorChainIndex());
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/SourceFunctionUtil.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/SourceFunctionUtil.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/SourceFunctionUtil.java
index 36ade8c..5f17467 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/SourceFunctionUtil.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/SourceFunctionUtil.java
@@ -17,11 +17,6 @@
package org.apache.flink.streaming.util;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.accumulators.Accumulator;
import org.apache.flink.api.common.functions.RichFunction;
@@ -33,8 +28,17 @@ import org.apache.flink.streaming.api.functions.source.SourceFunction;
import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.operators.StreamingRuntimeContext;
-import static org.mockito.Mockito.*;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Utilities for {@link SourceFunction}.
+ */
public class SourceFunctionUtil {
public static <T extends Serializable> List<T> runSourceFunction(SourceFunction<T> sourceFunction) throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TestHarnessUtil.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TestHarnessUtil.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TestHarnessUtil.java
index b46ea66..6489448 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TestHarnessUtil.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TestHarnessUtil.java
@@ -15,11 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
-import com.google.common.collect.Iterables;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
+import com.google.common.collect.Iterables;
import org.junit.Assert;
import java.util.ArrayList;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TwoInputStreamOperatorTestHarness.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TwoInputStreamOperatorTestHarness.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TwoInputStreamOperatorTestHarness.java
index 5fbe371..d0bbf8f 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TwoInputStreamOperatorTestHarness.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TwoInputStreamOperatorTestHarness.java
@@ -25,8 +25,7 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
/**
* A test harness for testing a {@link TwoInputStreamOperator}.
*
- * <p>
- * This mock task provides the operator with a basic runtime context and allows pushing elements
+ * <p>This mock task provides the operator with a basic runtime context and allows pushing elements
* and watermarks into the operator. {@link java.util.Deque}s containing the emitted elements
* and watermarks can be retrieved. you are free to modify these.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TypeInformationSerializationSchemaTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TypeInformationSerializationSchemaTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TypeInformationSerializationSchemaTest.java
index a14d113..317f2e3 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TypeInformationSerializationSchemaTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/TypeInformationSerializationSchemaTest.java
@@ -31,8 +31,12 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+/**
+ * Tests for {@link TypeInformationSerializationSchema}.
+ */
public class TypeInformationSerializationSchemaTest {
@Test
@@ -82,7 +86,7 @@ public class TypeInformationSerializationSchemaTest {
// Test data types
// ------------------------------------------------------------------------
- public static class MyPOJO {
+ private static class MyPOJO {
public int aField;
public List<Date> aList;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/keys/ArrayKeySelectorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/keys/ArrayKeySelectorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/keys/ArrayKeySelectorTest.java
index 5e363e9..637c4ba 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/keys/ArrayKeySelectorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/keys/ArrayKeySelectorTest.java
@@ -22,10 +22,15 @@ import org.apache.flink.api.common.typeinfo.BasicArrayTypeInfo;
import org.apache.flink.api.common.typeinfo.PrimitiveArrayTypeInfo;
import org.apache.flink.api.java.tuple.Tuple1;
import org.apache.flink.api.java.tuple.Tuple2;
+
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+/**
+ * Tests key selectors on arrays.
+ */
public class ArrayKeySelectorTest {
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/serialization/SimpleStringSchemaTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/serialization/SimpleStringSchemaTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/serialization/SimpleStringSchemaTest.java
index 74b1d18..6081ed1 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/serialization/SimpleStringSchemaTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/serialization/SimpleStringSchemaTest.java
@@ -19,12 +19,14 @@
package org.apache.flink.streaming.util.serialization;
import org.apache.flink.core.testutils.CommonTestUtils;
+
import org.junit.Test;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
/**
* Tests for the {@link SimpleStringSchema}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/typeutils/FieldAccessorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/typeutils/FieldAccessorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/typeutils/FieldAccessorTest.java
index 5e7dd35..2fb7964 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/typeutils/FieldAccessorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/util/typeutils/FieldAccessorTest.java
@@ -18,8 +18,6 @@
package org.apache.flink.streaming.util.typeutils;
-import static org.junit.Assert.*;
-
import org.apache.flink.api.common.typeinfo.BasicArrayTypeInfo;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
import org.apache.flink.api.common.typeinfo.PrimitiveArrayTypeInfo;
@@ -30,8 +28,14 @@ import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.api.java.typeutils.PojoTypeInfo;
import org.apache.flink.api.java.typeutils.TupleTypeInfo;
import org.apache.flink.api.java.typeutils.TypeExtractor;
+
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for field accessors.
+ */
public class FieldAccessorTest {
// Note, that AggregationFunctionTest indirectly also tests FieldAccessors.
@@ -59,7 +63,6 @@ public class FieldAccessorTest {
assertEquals("b", f0.get(t));
assertEquals("b", t.f0);
-
FieldAccessor<Tuple2<String, Integer>, Integer> f1n = FieldAccessorFactory.getAccessor(tpeInfo, 1, null);
assertEquals(7, (int) f1n.get(t));
assertEquals(7, (int) t.f1);
@@ -81,11 +84,11 @@ public class FieldAccessorTest {
assertEquals("b", t.f0);
// This is technically valid (the ".0" is selecting the 0th field of a basic type).
- FieldAccessor<Tuple2<String, Integer>, String> f0_0 = FieldAccessorFactory.getAccessor(tpeInfo, "f0.0", null);
- assertEquals("b", f0_0.get(t));
+ FieldAccessor<Tuple2<String, Integer>, String> f0f0 = FieldAccessorFactory.getAccessor(tpeInfo, "f0.0", null);
+ assertEquals("b", f0f0.get(t));
assertEquals("b", t.f0);
- t = f0_0.set(t, "cc");
- assertEquals("cc", f0_0.get(t));
+ t = f0f0.set(t, "cc");
+ assertEquals("cc", f0f0.get(t));
assertEquals("cc", t.f0);
}
@@ -103,7 +106,7 @@ public class FieldAccessorTest {
public void testTupleInTuple() {
Tuple2<String, Tuple3<Integer, Long, Double>> t = Tuple2.of("aa", Tuple3.of(5, 9L, 2.0));
TupleTypeInfo<Tuple2<String, Tuple3<Integer, Long, Double>>> tpeInfo =
- (TupleTypeInfo<Tuple2<String, Tuple3<Integer, Long, Double>>>)TypeExtractor.getForObject(t);
+ (TupleTypeInfo<Tuple2<String, Tuple3<Integer, Long, Double>>>) TypeExtractor.getForObject(t);
FieldAccessor<Tuple2<String, Tuple3<Integer, Long, Double>>, String> f0 = FieldAccessorFactory
.getAccessor(tpeInfo, "f0", null);
@@ -148,6 +151,9 @@ public class FieldAccessorTest {
FieldAccessorFactory.getAccessor(TupleTypeInfo.getBasicTupleTypeInfo(Integer.class, Integer.class), 2, null);
}
+ /**
+ * POJO.
+ */
public static class Foo {
public int x;
public Tuple2<String, Long> t;
@@ -203,6 +209,9 @@ public class FieldAccessorTest {
FieldAccessorFactory.getAccessor(tpeInfo, "illegal.illegal.illegal", null);
}
+ /**
+ * POJO for testing field access.
+ */
public static class Inner {
public long x;
public boolean b;
@@ -220,16 +229,19 @@ public class FieldAccessorTest {
@Override
public String toString() {
- return ((Long)x).toString() + ", " + b;
+ return ((Long) x).toString() + ", " + b;
}
}
+ /**
+ * POJO containing POJO.
+ */
public static class Outer {
public int a;
public Inner i;
public short b;
- public Outer(){}
+ public Outer() {}
public Outer(int a, Inner i, short b) {
this.a = a;
@@ -239,13 +251,13 @@ public class FieldAccessorTest {
@Override
public String toString() {
- return a+", "+i.toString()+", "+b;
+ return a + ", " + i.toString() + ", " + b;
}
}
@Test
public void testPojoInPojo() {
- Outer o = new Outer(10, new Inner(4L), (short)12);
+ Outer o = new Outer(10, new Inner(4L), (short) 12);
PojoTypeInfo<Outer> tpeInfo = (PojoTypeInfo<Outer>) TypeInformation.of(Outer.class);
FieldAccessor<Outer, Long> fix = FieldAccessorFactory.getAccessor(tpeInfo, "i.x", null);
@@ -268,21 +280,19 @@ public class FieldAccessorTest {
@Test
@SuppressWarnings("unchecked")
public void testArray() {
- int[] a = new int[]{3,5};
+ int[] a = new int[]{3, 5};
FieldAccessor<int[], Integer> fieldAccessor =
(FieldAccessor<int[], Integer>) (Object)
FieldAccessorFactory.getAccessor(PrimitiveArrayTypeInfo.getInfoFor(a.getClass()), 1, null);
assertEquals(Integer.class, fieldAccessor.getFieldType().getTypeClass());
- assertEquals((Integer)a[1], fieldAccessor.get(a));
+ assertEquals((Integer) a[1], fieldAccessor.get(a));
a = fieldAccessor.set(a, 6);
- assertEquals((Integer)a[1], fieldAccessor.get(a));
-
-
+ assertEquals((Integer) a[1], fieldAccessor.get(a));
- Integer[] b = new Integer[]{3,5};
+ Integer[] b = new Integer[]{3, 5};
FieldAccessor<Integer[], Integer> fieldAccessor2 =
(FieldAccessor<Integer[], Integer>) (Object)
FieldAccessorFactory.getAccessor(BasicArrayTypeInfo.getInfoFor(b.getClass()), 1, null);
@@ -295,6 +305,9 @@ public class FieldAccessorTest {
assertEquals(b[1], fieldAccessor2.get(b));
}
+ /**
+ * POJO with array.
+ */
public static class ArrayInPojo {
public long x;
public int[] arr;
@@ -311,8 +324,8 @@ public class FieldAccessorTest {
@Test
public void testArrayInPojo() {
- ArrayInPojo o = new ArrayInPojo(10L, new int[]{3,4,5}, 12);
- PojoTypeInfo<ArrayInPojo> tpeInfo = (PojoTypeInfo<ArrayInPojo>)TypeInformation.of(ArrayInPojo.class);
+ ArrayInPojo o = new ArrayInPojo(10L, new int[]{3, 4, 5}, 12);
+ PojoTypeInfo<ArrayInPojo> tpeInfo = (PojoTypeInfo<ArrayInPojo>) TypeInformation.of(ArrayInPojo.class);
FieldAccessor<ArrayInPojo, Integer> fix = FieldAccessorFactory.getAccessor(tpeInfo, "arr.1", null);
assertEquals(4, (int) fix.get(o));
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/tools/maven/strict-checkstyle.xml
----------------------------------------------------------------------
diff --git a/tools/maven/strict-checkstyle.xml b/tools/maven/strict-checkstyle.xml
index 9c58917..0c11aa9 100644
--- a/tools/maven/strict-checkstyle.xml
+++ b/tools/maven/strict-checkstyle.xml
@@ -36,7 +36,7 @@ This file is based on the checkstyle file of Apache Beam.
<!--</module>-->
<module name="NewlineAtEndOfFile">
- <!-- windows can use \n\r vs \n, so enforce the most used one ie UNIx style -->
+ <!-- windows can use \r\n vs \n, so enforce the most used one ie UNIx style -->
<property name="lineSeparator" value="lf" />
</module>
@@ -84,7 +84,7 @@ This file is based on the checkstyle file of Apache Beam.
-->
<module name="FileLength">
- <property name="max" value="2500"/>
+ <property name="max" value="3000"/>
</module>
<!-- All Java AST specific tests live under TreeWalker module. -->
@@ -197,9 +197,11 @@ This file is based on the checkstyle file of Apache Beam.
<module name="ImportOrder">
<!-- Checks for out of order import statements. -->
<property name="severity" value="error"/>
- <!-- This ensures that static imports go first. -->
- <property name="option" value="top"/>
+ <!-- Flink imports first, then other imports, then javax and java imports, then static imports. -->
+ <property name="groups" value="org.apache.flink,*,javax,java"/>
+ <property name="separated" value="true"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
+ <property name="option" value="bottom"/>
<property name="tokens" value="STATIC_IMPORT, IMPORT"/>
<message key="import.ordering"
value="Import {0} appears after other imports that it should precede"/>
@@ -478,6 +480,18 @@ This file is based on the checkstyle file of Apache Beam.
-->
+ <module name="EmptyLineSeparator">
+ <!-- Checks for empty line separator between tokens. The only
+ excluded token is VARIABLE_DEF, allowing class fields to
+ be declared on consecutive lines.
+ -->
+ <property name="allowMultipleEmptyLines" value="false"/>
+ <property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
+ <property name="tokens" value="PACKAGE_DEF, IMPORT, CLASS_DEF,
+ INTERFACE_DEF, ENUM_DEF, STATIC_INIT, INSTANCE_INIT, METHOD_DEF,
+ CTOR_DEF"/>
+ </module>
+
<module name="WhitespaceAround">
<!-- Checks that various tokens are surrounded by whitespace.
This includes most binary operators and keywords followed
[05/10] flink git commit: [FLINK-6603] [streaming] Enable checkstyle
on test sources
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamMapTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamMapTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamMapTest.java
index ce85b6a..71706d6 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamMapTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamMapTest.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.configuration.Configuration;
@@ -26,9 +24,12 @@ import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
+
import org.junit.Assert;
import org.junit.Test;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
/**
* Tests for {@link StreamMap}. These test that:
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamOperatorSnapshotRestoreTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamOperatorSnapshotRestoreTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamOperatorSnapshotRestoreTest.java
index 8a5c997..50dc4d4 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamOperatorSnapshotRestoreTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamOperatorSnapshotRestoreTest.java
@@ -39,12 +39,16 @@ import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness;
+
import org.junit.Assert;
import org.junit.Test;
import java.io.InputStream;
import java.util.BitSet;
+/**
+ * Tests for {@link StreamOperator} snapshot restoration.
+ */
public class StreamOperatorSnapshotRestoreTest {
private static final int MAX_PARALLELISM = 10;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamProjectTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamProjectTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamProjectTest.java
index 28cdf9d..2bae429 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamProjectTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamProjectTest.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.tuple.Tuple3;
@@ -34,6 +32,8 @@ import org.apache.flink.streaming.util.TestHarnessUtil;
import org.junit.Test;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
/**
* Tests for {@link StreamProject}. These test that:
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamSourceContextIdleDetectionTests.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamSourceContextIdleDetectionTests.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamSourceContextIdleDetectionTests.java
index 3695120..d2cf2e6 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamSourceContextIdleDetectionTests.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamSourceContextIdleDetectionTests.java
@@ -27,6 +27,7 @@ import org.apache.flink.streaming.runtime.streamstatus.StreamStatus;
import org.apache.flink.streaming.runtime.streamstatus.StreamStatusMaintainer;
import org.apache.flink.streaming.runtime.tasks.TestProcessingTimeService;
import org.apache.flink.streaming.util.CollectorOutput;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -39,19 +40,22 @@ import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+/**
+ * Tests for {@link StreamSource} awareness of source idleness.
+ */
@RunWith(Parameterized.class)
public class StreamSourceContextIdleDetectionTests {
/** The tests in this class will be parameterized with these enumerations.*/
private enum TestMethod {
- /** test idleness detection using the {@link SourceFunction.SourceContext#collect(Object)} method */
+ // test idleness detection using the {@link SourceFunction.SourceContext#collect(Object)} method
COLLECT,
- /** test idleness detection using the {@link SourceFunction.SourceContext#collectWithTimestamp(Object, long)} method */
+ // test idleness detection using the {@link SourceFunction.SourceContext#collectWithTimestamp(Object, long)} method
COLLECT_WITH_TIMESTAMP,
- /** test idleness detection using the {@link SourceFunction.SourceContext#emitWatermark(Watermark)} method */
+ // test idleness detection using the {@link SourceFunction.SourceContext#emitWatermark(Watermark)} method
EMIT_WATERMARK
}
@@ -73,7 +77,7 @@ public class StreamSourceContextIdleDetectionTests {
* (7) Advance time to 510 and trigger idleness detection. Since no records were collected in-between the two
* idleness detections, status should have been toggle back to IDLE.
*
- * Inline comments will refer to the corresponding tested steps in the scenario.
+ * <p>Inline comments will refer to the corresponding tested steps in the scenario.
*/
@Test
public void testManualWatermarkContext() throws Exception {
@@ -103,12 +107,12 @@ public class StreamSourceContextIdleDetectionTests {
assertTrue(mockStreamStatusMaintainer.getStreamStatus().isIdle());
// corresponds to step (3) of scenario (please see method-level Javadoc comment)
- processingTimeService.setCurrentTime(initialTime + 2*idleTimeout);
- processingTimeService.setCurrentTime(initialTime + 3*idleTimeout);
+ processingTimeService.setCurrentTime(initialTime + 2 * idleTimeout);
+ processingTimeService.setCurrentTime(initialTime + 3 * idleTimeout);
assertTrue(mockStreamStatusMaintainer.getStreamStatus().isIdle());
// corresponds to step (4) of scenario (please see method-level Javadoc comment)
- processingTimeService.setCurrentTime(initialTime + 3*idleTimeout + idleTimeout/10);
+ processingTimeService.setCurrentTime(initialTime + 3 * idleTimeout + idleTimeout / 10);
switch (testMethod) {
case COLLECT:
context.collect("msg");
@@ -123,7 +127,7 @@ public class StreamSourceContextIdleDetectionTests {
assertTrue(mockStreamStatusMaintainer.getStreamStatus().isActive());
// corresponds to step (5) of scenario (please see method-level Javadoc comment)
- processingTimeService.setCurrentTime(initialTime + 3*idleTimeout + 2*idleTimeout/10);
+ processingTimeService.setCurrentTime(initialTime + 3 * idleTimeout + 2 * idleTimeout / 10);
switch (testMethod) {
case COLLECT:
context.collect("msg");
@@ -138,11 +142,11 @@ public class StreamSourceContextIdleDetectionTests {
assertTrue(mockStreamStatusMaintainer.getStreamStatus().isActive());
// corresponds to step (6) of scenario (please see method-level Javadoc comment)
- processingTimeService.setCurrentTime(initialTime + 4*idleTimeout + idleTimeout/10);
+ processingTimeService.setCurrentTime(initialTime + 4 * idleTimeout + idleTimeout / 10);
assertTrue(mockStreamStatusMaintainer.getStreamStatus().isActive());
// corresponds to step (7) of scenario (please see method-level Javadoc comment)
- processingTimeService.setCurrentTime(initialTime + 5*idleTimeout + idleTimeout/10);
+ processingTimeService.setCurrentTime(initialTime + 5 * idleTimeout + idleTimeout / 10);
assertTrue(mockStreamStatusMaintainer.getStreamStatus().isIdle());
}
@@ -159,7 +163,7 @@ public class StreamSourceContextIdleDetectionTests {
* should have been "piggy-backed" in the task, allowing the status to be toggled to IDLE before the next
* actual idle detection task at 530.
*
- * Inline comments will refer to the corresponding tested steps in the scenario.
+ * <p>Inline comments will refer to the corresponding tested steps in the scenario.
*/
@Test
public void testAutomaticWatermarkContext() throws Exception {
@@ -189,24 +193,24 @@ public class StreamSourceContextIdleDetectionTests {
// corresponds to step (2) of scenario (please see method-level Javadoc comment)
processingTimeService.setCurrentTime(initialTime + watermarkInterval);
expectedOutput.add(new Watermark(processingTimeService.getCurrentProcessingTime() - (processingTimeService.getCurrentProcessingTime() % watermarkInterval)));
- processingTimeService.setCurrentTime(initialTime + 2*watermarkInterval);
+ processingTimeService.setCurrentTime(initialTime + 2 * watermarkInterval);
expectedOutput.add(new Watermark(processingTimeService.getCurrentProcessingTime() - (processingTimeService.getCurrentProcessingTime() % watermarkInterval)));
processingTimeService.setCurrentTime(initialTime + idleTimeout);
assertTrue(mockStreamStatusMaintainer.getStreamStatus().isIdle());
assertEquals(expectedOutput, output);
// corresponds to step (3) of scenario (please see method-level Javadoc comment)
- processingTimeService.setCurrentTime(initialTime + 3*watermarkInterval);
- processingTimeService.setCurrentTime(initialTime + 4*watermarkInterval);
- processingTimeService.setCurrentTime(initialTime + 2*idleTimeout);
- processingTimeService.setCurrentTime(initialTime + 6*watermarkInterval);
- processingTimeService.setCurrentTime(initialTime + 7*watermarkInterval);
- processingTimeService.setCurrentTime(initialTime + 3*idleTimeout);
+ processingTimeService.setCurrentTime(initialTime + 3 * watermarkInterval);
+ processingTimeService.setCurrentTime(initialTime + 4 * watermarkInterval);
+ processingTimeService.setCurrentTime(initialTime + 2 * idleTimeout);
+ processingTimeService.setCurrentTime(initialTime + 6 * watermarkInterval);
+ processingTimeService.setCurrentTime(initialTime + 7 * watermarkInterval);
+ processingTimeService.setCurrentTime(initialTime + 3 * idleTimeout);
assertTrue(mockStreamStatusMaintainer.getStreamStatus().isIdle());
assertEquals(expectedOutput, output);
// corresponds to step (4) of scenario (please see method-level Javadoc comment)
- processingTimeService.setCurrentTime(initialTime + 3*idleTimeout + idleTimeout/10);
+ processingTimeService.setCurrentTime(initialTime + 3 * idleTimeout + idleTimeout / 10);
switch (testMethod) {
case COLLECT:
context.collect("msg");
@@ -232,8 +236,8 @@ public class StreamSourceContextIdleDetectionTests {
}
// corresponds to step (5) of scenario (please see method-level Javadoc comment)
- processingTimeService.setCurrentTime(initialTime + 8*watermarkInterval);
- processingTimeService.setCurrentTime(initialTime + 3*idleTimeout + 3*idleTimeout/10);
+ processingTimeService.setCurrentTime(initialTime + 8 * watermarkInterval);
+ processingTimeService.setCurrentTime(initialTime + 3 * idleTimeout + 3 * idleTimeout / 10);
switch (testMethod) {
case COLLECT:
context.collect("msg");
@@ -266,7 +270,7 @@ public class StreamSourceContextIdleDetectionTests {
assertEquals(expectedOutput, output);
}
- processingTimeService.setCurrentTime(initialTime + 10*watermarkInterval);
+ processingTimeService.setCurrentTime(initialTime + 10 * watermarkInterval);
switch (testMethod) {
case COLLECT:
case COLLECT_WITH_TIMESTAMP:
@@ -280,7 +284,7 @@ public class StreamSourceContextIdleDetectionTests {
}
// corresponds to step (6) of scenario (please see method-level Javadoc comment)
- processingTimeService.setCurrentTime(initialTime + 4*idleTimeout + idleTimeout/10);
+ processingTimeService.setCurrentTime(initialTime + 4 * idleTimeout + idleTimeout / 10);
switch (testMethod) {
case COLLECT:
case COLLECT_WITH_TIMESTAMP:
@@ -293,7 +297,7 @@ public class StreamSourceContextIdleDetectionTests {
}
// corresponds to step (7) of scenario (please see method-level Javadoc comment)
- processingTimeService.setCurrentTime(initialTime + 11*watermarkInterval);
+ processingTimeService.setCurrentTime(initialTime + 11 * watermarkInterval);
assertTrue(mockStreamStatusMaintainer.getStreamStatus().isIdle());
assertEquals(expectedOutput, output);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContextTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContextTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContextTest.java
index 5ca9cb4..2e24f4c 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContextTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContextTest.java
@@ -33,8 +33,8 @@ import org.apache.flink.api.common.state.ReducingStateDescriptor;
import org.apache.flink.api.common.state.StateDescriptor;
import org.apache.flink.api.common.state.ValueStateDescriptor;
import org.apache.flink.api.common.typeutils.TypeSerializer;
-import org.apache.flink.api.common.typeutils.base.ListSerializer;
import org.apache.flink.api.common.typeutils.base.IntSerializer;
+import org.apache.flink.api.common.typeutils.base.ListSerializer;
import org.apache.flink.api.java.typeutils.runtime.kryo.KryoSerializer;
import org.apache.flink.core.fs.Path;
import org.apache.flink.runtime.execution.Environment;
@@ -48,6 +48,7 @@ import org.apache.flink.runtime.state.KeyedStateBackend;
import org.apache.flink.runtime.state.VoidNamespace;
import org.apache.flink.runtime.state.VoidNamespaceSerializer;
import org.apache.flink.runtime.state.memory.MemoryStateBackend;
+
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.invocation.InvocationOnMock;
@@ -66,6 +67,9 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+/**
+ * Tests for {@link StreamingRuntimeContext}.
+ */
public class StreamingRuntimeContextTest {
@Test
@@ -245,7 +249,7 @@ public class StreamingRuntimeContextTest {
AbstractStreamOperator<?> operatorMock = mock(AbstractStreamOperator.class);
- KeyedStateBackend keyedStateBackend= mock(KeyedStateBackend.class);
+ KeyedStateBackend keyedStateBackend = mock(KeyedStateBackend.class);
DefaultKeyedStateStore keyedStateStore = new DefaultKeyedStateStore(keyedStateBackend, config);
@@ -271,7 +275,7 @@ public class StreamingRuntimeContextTest {
AbstractStreamOperator<?> operatorMock = mock(AbstractStreamOperator.class);
ExecutionConfig config = new ExecutionConfig();
- KeyedStateBackend keyedStateBackend= mock(KeyedStateBackend.class);
+ KeyedStateBackend keyedStateBackend = mock(KeyedStateBackend.class);
DefaultKeyedStateStore keyedStateStore = new DefaultKeyedStateStore(keyedStateBackend, config);
@@ -307,7 +311,7 @@ public class StreamingRuntimeContextTest {
AbstractStreamOperator<?> operatorMock = mock(AbstractStreamOperator.class);
ExecutionConfig config = new ExecutionConfig();
- KeyedStateBackend keyedStateBackend= mock(KeyedStateBackend.class);
+ KeyedStateBackend keyedStateBackend = mock(KeyedStateBackend.class);
DefaultKeyedStateStore keyedStateStore = new DefaultKeyedStateStore(keyedStateBackend, config);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/TestInternalTimerService.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/TestInternalTimerService.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/TestInternalTimerService.java
index a03a4c5..f8b095c 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/TestInternalTimerService.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/TestInternalTimerService.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.operators;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/WrappingFunctionSnapshotRestoreTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/WrappingFunctionSnapshotRestoreTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/WrappingFunctionSnapshotRestoreTest.java
index b675cc5..6c93894 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/WrappingFunctionSnapshotRestoreTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/WrappingFunctionSnapshotRestoreTest.java
@@ -31,6 +31,7 @@ import org.apache.flink.streaming.api.checkpoint.ListCheckpointed;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
+
import org.junit.Assert;
import org.junit.Test;
@@ -38,9 +39,11 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+/**
+ * Test snapshot state with {@link WrappingFunction}.
+ */
public class WrappingFunctionSnapshotRestoreTest {
-
@Test
public void testSnapshotAndRestoreWrappedCheckpointedFunction() throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperatorTest.java
index 1d83229..f9a1cd0 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperatorTest.java
@@ -65,6 +65,7 @@ import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.util.Preconditions;
import org.apache.flink.util.TestLogger;
+
import org.junit.Assert;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@@ -72,6 +73,7 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import javax.annotation.Nonnull;
+
import java.util.ArrayDeque;
import java.util.Collections;
import java.util.Comparator;
@@ -91,7 +93,14 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
/**
* Tests for {@link AsyncWaitOperator}. These test that:
@@ -361,7 +370,7 @@ public class AsyncWaitOperatorTest extends TestLogger {
}
/**
- * Tests that the AsyncWaitOperator works together with chaining
+ * Tests that the AsyncWaitOperator works together with chaining.
*/
@Test
public void testOperatorChainWithProcessingTime() throws Exception {
@@ -601,7 +610,6 @@ public class AsyncWaitOperatorTest extends TestLogger {
super(jobConfig, taskConfig, executionConfig, memorySize, inputSplitProvider, bufferSize);
}
-
@Override
public void acknowledgeCheckpoint(
long checkpointId,
@@ -702,7 +710,7 @@ public class AsyncWaitOperatorTest extends TestLogger {
* emitter is currently waiting on the checkpoint lock (e.g. in the case of two chained async
* wait operators where the latter operator's queue is currently full).
*
- * Note that this test does not enforce the exact strict ordering because with the fix it is no
+ * <p>Note that this test does not enforce the exact strict ordering because with the fix it is no
* longer possible. However, it provokes the described situation without the fix.
*/
@Test(timeout = 10000L)
@@ -880,7 +888,7 @@ public class AsyncWaitOperatorTest extends TestLogger {
/**
* FLINK-6435
*
- * Tests that a user exception triggers the completion of a StreamElementQueueEntry and does not wait to until
+ * <p>Tests that a user exception triggers the completion of a StreamElementQueueEntry and does not wait to until
* another StreamElementQueueEntry is properly completed before it is collected.
*/
@Test(timeout = 2000)
@@ -891,7 +899,7 @@ public class AsyncWaitOperatorTest extends TestLogger {
/**
* FLINK-6435
*
- * Tests that a user exception triggers the completion of a StreamElementQueueEntry and does not wait to until
+ * <p>Tests that a user exception triggers the completion of a StreamElementQueueEntry and does not wait to until
* another StreamElementQueueEntry is properly completed before it is collected.
*/
@Test(timeout = 2000)
@@ -945,7 +953,7 @@ public class AsyncWaitOperatorTest extends TestLogger {
/**
* FLINK-6435
*
- * Tests that timeout exceptions are properly handled in ordered output mode. The proper handling means that
+ * <p>Tests that timeout exceptions are properly handled in ordered output mode. The proper handling means that
* a StreamElementQueueEntry is completed in case of a timeout exception.
*/
@Test
@@ -956,7 +964,7 @@ public class AsyncWaitOperatorTest extends TestLogger {
/**
* FLINK-6435
*
- * Tests that timeout exceptions are properly handled in ordered output mode. The proper handling means that
+ * <p>Tests that timeout exceptions are properly handled in ordered output mode. The proper handling means that
* a StreamElementQueueEntry is completed in case of a timeout exception.
*/
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/EmitterTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/EmitterTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/EmitterTest.java
index c3a47aa..da2d795 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/EmitterTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/EmitterTest.java
@@ -29,6 +29,7 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamElement;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.util.CollectorOutput;
import org.apache.flink.util.TestLogger;
+
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -46,6 +47,9 @@ import java.util.concurrent.TimeUnit;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
+/**
+ * Tests for {@link Emitter}.
+ */
public class EmitterTest extends TestLogger {
private static final long timeout = 10000L;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueueTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueueTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueueTest.java
index 0380512..5832b89 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueueTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueueTest.java
@@ -24,6 +24,7 @@ import org.apache.flink.streaming.api.operators.async.OperatorActions;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.TestLogger;
+
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -44,7 +45,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
/**
- * {@link OrderedStreamElementQueue} specific tests
+ * {@link OrderedStreamElementQueue} specific tests.
*/
public class OrderedStreamElementQueueTest extends TestLogger {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueTest.java
index c9e59c7..fe9db95 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueTest.java
@@ -25,6 +25,7 @@ import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.Preconditions;
import org.apache.flink.util.TestLogger;
+
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueueTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueueTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueueTest.java
index 0a57f92..ba6ce42 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueueTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueueTest.java
@@ -24,6 +24,7 @@ import org.apache.flink.streaming.api.operators.async.OperatorActions;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.TestLogger;
+
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -45,7 +46,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
/**
- * {@link UnorderedStreamElementQueue} specific tests
+ * {@link UnorderedStreamElementQueue} specific tests.
*/
public class UnorderedStreamElementQueueTest extends TestLogger {
private static final long timeout = 10000L;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoProcessOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoProcessOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoProcessOperatorTest.java
index c19eb37..beb5bf5 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoProcessOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoProcessOperatorTest.java
@@ -15,23 +15,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.api.operators.co;
+package org.apache.flink.streaming.api.operators.co;
-import org.apache.flink.streaming.api.TimeDomain;
import org.apache.flink.streaming.api.functions.co.CoProcessFunction;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
-import org.apache.flink.streaming.util.TwoInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
+import org.apache.flink.streaming.util.TwoInputStreamOperatorTestHarness;
import org.apache.flink.util.Collector;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import java.util.concurrent.ConcurrentLinkedQueue;
-import static org.junit.Assert.assertEquals;
-
/**
* Tests {@link CoProcessOperator}.
*/
@@ -97,7 +95,6 @@ public class CoProcessOperatorTest extends TestLogger {
testHarness.close();
}
-
private static class WatermarkQueryingProcessFunction extends CoProcessFunction<Integer, String, String> {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoStreamFlatMapTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoStreamFlatMapTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoStreamFlatMapTest.java
index 4dbf7b8..6f7d097 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoStreamFlatMapTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoStreamFlatMapTest.java
@@ -17,11 +17,6 @@
package org.apache.flink.streaming.api.operators.co;
-import static org.junit.Assert.fail;
-
-import java.io.Serializable;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.functions.co.CoFlatMapFunction;
import org.apache.flink.streaming.api.functions.co.RichCoFlatMapFunction;
@@ -30,9 +25,13 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.streaming.util.TwoInputStreamOperatorTestHarness;
import org.apache.flink.util.Collector;
+
import org.junit.Assert;
import org.junit.Test;
+import java.io.Serializable;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
/**
* Tests for {@link CoStreamFlatMap}. These test that:
*
@@ -45,7 +44,7 @@ import org.junit.Test;
public class CoStreamFlatMapTest implements Serializable {
private static final long serialVersionUID = 1L;
- private final static class MyCoFlatMap implements CoFlatMapFunction<String, Integer, String> {
+ private static final class MyCoFlatMap implements CoFlatMapFunction<String, Integer, String> {
private static final long serialVersionUID = 1L;
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoStreamMapTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoStreamMapTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoStreamMapTest.java
index 28ae664..6826c96 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoStreamMapTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoStreamMapTest.java
@@ -24,6 +24,7 @@ import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.streaming.util.TwoInputStreamOperatorTestHarness;
+
import org.junit.Assert;
import org.junit.Test;
@@ -42,7 +43,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
public class CoStreamMapTest implements Serializable {
private static final long serialVersionUID = 1L;
- private final static class MyCoMap implements CoMapFunction<Double, Integer, String> {
+ private static final class MyCoMap implements CoMapFunction<Double, Integer, String> {
private static final long serialVersionUID = 1L;
@Override
@@ -56,7 +57,6 @@ public class CoStreamMapTest implements Serializable {
}
}
-
@Test
public void testCoMap() throws Exception {
CoStreamMap<Double, Integer, String> operator = new CoStreamMap<Double, Integer, String>(new MyCoMap());
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperatorTest.java
index d8c9a61..3f590ff 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperatorTest.java
@@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.api.operators.co;
+package org.apache.flink.streaming.api.operators.co;
import org.apache.flink.api.common.state.ValueStateDescriptor;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
@@ -32,6 +32,7 @@ import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.streaming.util.TwoInputStreamOperatorTestHarness;
import org.apache.flink.util.Collector;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -324,7 +325,6 @@ public class KeyedCoProcessOperatorTest extends TestLogger {
testHarness.close();
}
-
private static class IntToStringKeySelector<T> implements KeySelector<Integer, String> {
private static final long serialVersionUID = 1L;
@@ -413,7 +413,6 @@ public class KeyedCoProcessOperatorTest extends TestLogger {
ctx.timerService().registerEventTimeTimer(ctx.timerService().currentWatermark() + 5);
}
-
@Override
public void onTimer(
long timestamp,
@@ -494,7 +493,6 @@ public class KeyedCoProcessOperatorTest extends TestLogger {
ctx.timerService().registerProcessingTimeTimer(ctx.timerService().currentProcessingTime() + 5);
}
-
@Override
public void onTimer(
long timestamp,
@@ -519,7 +517,6 @@ public class KeyedCoProcessOperatorTest extends TestLogger {
ctx.timerService().registerProcessingTimeTimer(5);
}
-
@Override
public void onTimer(
long timestamp,
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/windowing/functions/InternalWindowFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/windowing/functions/InternalWindowFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/windowing/functions/InternalWindowFunctionTest.java
index 4b0f5ab..7657ce7 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/windowing/functions/InternalWindowFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/windowing/functions/InternalWindowFunctionTest.java
@@ -26,7 +26,6 @@ import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.functions.windowing.ProcessAllWindowFunction;
import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction;
-import org.apache.flink.streaming.util.functions.StreamingFunctionUtils;
import org.apache.flink.streaming.api.functions.windowing.RichAllWindowFunction;
import org.apache.flink.streaming.api.functions.windowing.RichWindowFunction;
import org.apache.flink.streaming.api.operators.OutputTypeConfigurable;
@@ -42,7 +41,9 @@ import org.apache.flink.streaming.runtime.operators.windowing.functions.Internal
import org.apache.flink.streaming.runtime.operators.windowing.functions.InternalSingleValueProcessWindowFunction;
import org.apache.flink.streaming.runtime.operators.windowing.functions.InternalSingleValueWindowFunction;
import org.apache.flink.streaming.runtime.operators.windowing.functions.InternalWindowFunction;
+import org.apache.flink.streaming.util.functions.StreamingFunctionUtils;
import org.apache.flink.util.Collector;
+
import org.hamcrest.collection.IsIterableContainingInOrder;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
@@ -66,6 +67,9 @@ import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
+/**
+ * Tests for {@link InternalWindowFunction}.
+ */
public class InternalWindowFunctionTest {
@SuppressWarnings("unchecked")
@@ -98,12 +102,12 @@ public class InternalWindowFunctionTest {
// check apply
TimeWindow w = mock(TimeWindow.class);
- Iterable<Long> i = (Iterable<Long>)mock(Iterable.class);
+ Iterable<Long> i = (Iterable<Long>) mock(Iterable.class);
Collector<String> c = (Collector<String>) mock(Collector.class);
InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class);
- windowFunction.process(((byte)0), w, ctx, i, c);
+ windowFunction.process(((byte) 0), w, ctx, i, c);
verify(mock).apply(w, i, c);
// check close
@@ -141,11 +145,11 @@ public class InternalWindowFunctionTest {
// check apply
TimeWindow w = mock(TimeWindow.class);
- Iterable<Long> i = (Iterable<Long>)mock(Iterable.class);
+ Iterable<Long> i = (Iterable<Long>) mock(Iterable.class);
Collector<String> c = (Collector<String>) mock(Collector.class);
InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class);
- windowFunction.process(((byte)0), w, ctx, i, c);
+ windowFunction.process(((byte) 0), w, ctx, i, c);
verify(mock).process((ProcessAllWindowFunctionMock.Context) anyObject(), eq(i), eq(c));
// check close
@@ -183,7 +187,7 @@ public class InternalWindowFunctionTest {
// check apply
TimeWindow w = mock(TimeWindow.class);
- Iterable<Long> i = (Iterable<Long>)mock(Iterable.class);
+ Iterable<Long> i = (Iterable<Long>) mock(Iterable.class);
Collector<String> c = (Collector<String>) mock(Collector.class);
InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class);
@@ -225,7 +229,7 @@ public class InternalWindowFunctionTest {
// check apply
TimeWindow w = mock(TimeWindow.class);
- Iterable<Long> i = (Iterable<Long>)mock(Iterable.class);
+ Iterable<Long> i = (Iterable<Long>) mock(Iterable.class);
Collector<String> c = (Collector<String>) mock(Collector.class);
InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class);
@@ -288,7 +292,7 @@ public class InternalWindowFunctionTest {
InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class);
windowFunction.process(42L, w, ctx, 23L, c);
- verify(mock).apply(eq(42L), eq(w), (Iterable<Long>)argThat(IsIterableContainingInOrder.contains(23L)), eq(c));
+ verify(mock).apply(eq(42L), eq(w), (Iterable<Long>) argThat(IsIterableContainingInOrder.contains(23L)), eq(c));
// check close
windowFunction.close();
@@ -329,8 +333,8 @@ public class InternalWindowFunctionTest {
Collector<String> c = (Collector<String>) mock(Collector.class);
InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class);
- windowFunction.process(((byte)0), w, ctx, 23L, c);
- verify(mock).apply(eq(w), (Iterable<Long>)argThat(IsIterableContainingInOrder.contains(23L)), eq(c));
+ windowFunction.process(((byte) 0), w, ctx, 23L, c);
+ verify(mock).apply(eq(w), (Iterable<Long>) argThat(IsIterableContainingInOrder.contains(23L)), eq(c));
// check close
windowFunction.close();
@@ -371,8 +375,8 @@ public class InternalWindowFunctionTest {
Collector<String> c = (Collector<String>) mock(Collector.class);
InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class);
- windowFunction.process(((byte)0), w, ctx, 23L, c);
- verify(mock).process((ProcessAllWindowFunctionMock.Context) anyObject(), (Iterable<Long>)argThat(IsIterableContainingInOrder.contains(23L)), eq(c));
+ windowFunction.process(((byte) 0), w, ctx, 23L, c);
+ verify(mock).process((ProcessAllWindowFunctionMock.Context) anyObject(), (Iterable<Long>) argThat(IsIterableContainingInOrder.contains(23L)), eq(c));
// check close
windowFunction.close();
@@ -424,9 +428,9 @@ public class InternalWindowFunctionTest {
return null;
}
}).when(mock).process(eq(42L), (ProcessWindowFunctionMock.Context) anyObject(),
- (Iterable<Long>)argThat(IsIterableContainingInOrder.contains(23L)), eq(c));
+ (Iterable<Long>) argThat(IsIterableContainingInOrder.contains(23L)), eq(c));
- windowFunction.process(42L, w, ctx,23L, c);
+ windowFunction.process(42L, w, ctx, 23L, c);
verify(ctx).currentProcessingTime();
verify(ctx).currentWatermark();
verify(ctx).windowState();
@@ -597,7 +601,7 @@ public class InternalWindowFunctionTest {
args.add(24L);
InternalWindowFunction.InternalWindowContext ctx = mock(InternalWindowFunction.InternalWindowContext.class);
- windowFunction.process(((byte)0), w, ctx, args, c);
+ windowFunction.process(((byte) 0), w, ctx, args, c);
verify(mock).process(
(AggregateProcessAllWindowFunctionMock.Context) anyObject(),
(Iterable) argThat(containsInAnyOrder(allOf(
@@ -610,7 +614,7 @@ public class InternalWindowFunctionTest {
verify(mock).close();
}
- public static class ProcessWindowFunctionMock
+ private static class ProcessWindowFunctionMock
extends ProcessWindowFunction<Long, String, Long, TimeWindow>
implements OutputTypeConfigurable<String> {
@@ -624,7 +628,7 @@ public class InternalWindowFunctionTest {
}
}
- public static class AggregateProcessWindowFunctionMock
+ private static class AggregateProcessWindowFunctionMock
extends ProcessWindowFunction<Map<Long, Long>, String, Long, TimeWindow>
implements OutputTypeConfigurable<String> {
@@ -638,7 +642,7 @@ public class InternalWindowFunctionTest {
}
}
- public static class AggregateProcessAllWindowFunctionMock
+ private static class AggregateProcessAllWindowFunctionMock
extends ProcessAllWindowFunction<Map<Long, Long>, String, TimeWindow>
implements OutputTypeConfigurable<String> {
@@ -651,7 +655,7 @@ public class InternalWindowFunctionTest {
public void process(Context context, Iterable<Map<Long, Long>> input, Collector<String> out) throws Exception { }
}
- public static class WindowFunctionMock
+ private static class WindowFunctionMock
extends RichWindowFunction<Long, String, Long, TimeWindow>
implements OutputTypeConfigurable<String> {
@@ -664,7 +668,7 @@ public class InternalWindowFunctionTest {
public void apply(Long aLong, TimeWindow w, Iterable<Long> input, Collector<String> out) throws Exception { }
}
- public static class AllWindowFunctionMock
+ private static class AllWindowFunctionMock
extends RichAllWindowFunction<Long, String, TimeWindow>
implements OutputTypeConfigurable<String> {
@@ -677,7 +681,7 @@ public class InternalWindowFunctionTest {
public void apply(TimeWindow window, Iterable<Long> values, Collector<String> out) throws Exception { }
}
- public static class ProcessAllWindowFunctionMock
+ private static class ProcessAllWindowFunctionMock
extends ProcessAllWindowFunction<Long, String, TimeWindow>
implements OutputTypeConfigurable<String> {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/streamtask/MockRecordWriter.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/streamtask/MockRecordWriter.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/streamtask/MockRecordWriter.java
index 6ee7d38..781a216 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/streamtask/MockRecordWriter.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/streamtask/MockRecordWriter.java
@@ -17,14 +17,17 @@
package org.apache.flink.streaming.api.streamtask;
-import java.util.ArrayList;
-
-import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.api.java.tuple.Tuple1;
+import org.apache.flink.runtime.io.network.api.writer.RecordWriter;
import org.apache.flink.runtime.operators.DataSourceTask;
import org.apache.flink.runtime.plugable.SerializationDelegate;
-import org.apache.flink.runtime.io.network.api.writer.RecordWriter;
+import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
+import java.util.ArrayList;
+/**
+ * Mock {@link RecordWriter}.
+ */
public class MockRecordWriter extends RecordWriter<SerializationDelegate<StreamRecord<Tuple1<Integer>>>> {
public ArrayList<Integer> emittedRecords;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/streamtask/StreamIterationHeadTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/streamtask/StreamIterationHeadTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/streamtask/StreamIterationHeadTest.java
index dafdeed..4eda5ad 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/streamtask/StreamIterationHeadTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/streamtask/StreamIterationHeadTest.java
@@ -24,8 +24,11 @@ import org.apache.flink.streaming.runtime.tasks.StreamTaskTestHarness;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+/**
+ * Tests for {@link StreamIterationHead}.
+ */
public class StreamIterationHeadTest {
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/windowing/deltafunction/CosineDistanceTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/windowing/deltafunction/CosineDistanceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/windowing/deltafunction/CosineDistanceTest.java
index b640d6f..bedab97 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/windowing/deltafunction/CosineDistanceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/windowing/deltafunction/CosineDistanceTest.java
@@ -17,11 +17,15 @@
package org.apache.flink.streaming.api.windowing.deltafunction;
-import static org.junit.Assert.*;
-
import org.apache.flink.streaming.api.functions.windowing.delta.CosineDistance;
+
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link CosineDistance}.
+ */
public class CosineDistanceTest {
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -29,18 +33,18 @@ public class CosineDistanceTest {
public void testCosineDistance() {
//Reference calculated using wolfram alpha
- double[][][] testdata={
- {{0,0,0},{0,0,0}},
- {{0,0,0},{1,2,3}},
- {{1,2,3},{0,0,0}},
- {{1,2,3},{4,5,6}},
- {{1,2,3},{-4,-5,-6}},
- {{1,2,-3},{-4,5,-6}},
- {{1,2,3,4},{5,6,7,8}},
- {{1,2},{3,4}},
- {{1},{2}},
+ double[][][] testdata = {
+ {{0, 0, 0}, {0, 0, 0}},
+ {{0, 0, 0}, {1, 2, 3}},
+ {{1, 2, 3}, {0, 0, 0}},
+ {{1, 2, 3}, {4, 5, 6}},
+ {{1, 2, 3}, {-4, -5, -6}},
+ {{1, 2, -3}, {-4, 5, -6}},
+ {{1, 2, 3, 4}, {5, 6, 7, 8}},
+ {{1, 2}, {3, 4}},
+ {{1}, {2}},
};
- double[] referenceSolutions={
+ double[] referenceSolutions = {
0,
0,
0,
@@ -60,12 +64,15 @@ public class CosineDistanceTest {
}
private String arrayToString(double[] in){
- if (in.length==0) return "{}";
- String result="{";
- for (double d:in){
- result+=d+",";
+ if (in.length == 0) {
+ return "{}";
+ }
+
+ String result = "{";
+ for (double d:in) {
+ result += d + ",";
}
- return result.substring(0, result.length()-1)+"}";
+ return result.substring(0, result.length() - 1) + "}";
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/windowing/deltafunction/EuclideanDistanceTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/windowing/deltafunction/EuclideanDistanceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/windowing/deltafunction/EuclideanDistanceTest.java
index 1ba5f84..c534bf8 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/windowing/deltafunction/EuclideanDistanceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/windowing/deltafunction/EuclideanDistanceTest.java
@@ -17,11 +17,15 @@
package org.apache.flink.streaming.api.windowing.deltafunction;
-import static org.junit.Assert.*;
-
import org.apache.flink.streaming.api.functions.windowing.delta.EuclideanDistance;
+
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link EuclideanDistance}.
+ */
public class EuclideanDistanceTest {
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -29,18 +33,18 @@ public class EuclideanDistanceTest {
public void testEuclideanDistance() {
//Reference calculated using wolfram alpha
- double[][][] testdata={
- {{0,0,0},{0,0,0}},
- {{0,0,0},{1,2,3}},
- {{1,2,3},{0,0,0}},
- {{1,2,3},{4,5,6}},
- {{1,2,3},{-4,-5,-6}},
- {{1,2,-3},{-4,5,-6}},
- {{1,2,3,4},{5,6,7,8}},
- {{1,2},{3,4}},
- {{1},{2}},
+ double[][][] testdata = {
+ {{0, 0, 0}, {0, 0, 0}},
+ {{0, 0, 0}, {1, 2, 3}},
+ {{1, 2, 3}, {0, 0, 0}},
+ {{1, 2, 3}, {4, 5, 6}},
+ {{1, 2, 3}, {-4, -5, -6}},
+ {{1, 2, -3}, {-4, 5, -6}},
+ {{1, 2, 3, 4}, {5, 6, 7, 8}},
+ {{1, 2}, {3, 4}},
+ {{1}, {2}},
};
- double[] referenceSolutions={
+ double[] referenceSolutions = {
0,
3.741657,
3.741657,
@@ -61,12 +65,15 @@ public class EuclideanDistanceTest {
}
private String arrayToString(double[] in){
- if (in.length==0) return "{}";
- String result="{";
+ if (in.length == 0) {
+ return "{}";
+ }
+
+ String result = "{";
for (double d:in){
- result+=d+",";
+ result += d + ",";
}
- return result.substring(0, result.length()-1)+"}";
+ return result.substring(0, result.length() - 1) + "}";
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/StreamingJobGraphGeneratorNodeHashTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/StreamingJobGraphGeneratorNodeHashTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/StreamingJobGraphGeneratorNodeHashTest.java
index a897674..58898d8 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/StreamingJobGraphGeneratorNodeHashTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/StreamingJobGraphGeneratorNodeHashTest.java
@@ -32,6 +32,7 @@ import org.apache.flink.streaming.api.functions.source.ParallelSourceFunction;
import org.apache.flink.streaming.api.graph.StreamGraph;
import org.apache.flink.streaming.api.graph.StreamNode;
import org.apache.flink.util.TestLogger;
+
import org.junit.Assert;
import org.junit.Test;
@@ -166,7 +167,7 @@ public class StreamingJobGraphGeneratorNodeHashTest extends TestLogger {
* B (unchained): [ (src0) ] -> [ (map) -> (filter) -> (sink) ]
* </pre>
*
- * The hashes for the single vertex in A and the source vertex in B need to be different.
+ * <p>The hashes for the single vertex in A and the source vertex in B need to be different.
*/
@Test
public void testNodeHashAfterSourceUnchaining() throws Exception {
@@ -208,7 +209,7 @@ public class StreamingJobGraphGeneratorNodeHashTest extends TestLogger {
* B (unchained): [ (src0) ] -> [ (map) -> (filter) -> (sink) ]
* </pre>
*
- * The hashes for the single vertex in A and the source vertex in B need to be different.
+ * <p>The hashes for the single vertex in A and the source vertex in B need to be different.
*/
@Test
public void testNodeHashAfterIntermediateUnchaining() throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/TranslationTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/TranslationTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/TranslationTest.java
index 4175f18..e02ccdd 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/TranslationTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/TranslationTest.java
@@ -26,8 +26,12 @@ import org.apache.flink.streaming.api.graph.StreamConfig;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+/**
+ * Test translation of {@link CheckpointingMode}.
+ */
@SuppressWarnings("serial")
public class TranslationTest {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/WithMasterCheckpointHookConfigTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/WithMasterCheckpointHookConfigTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/WithMasterCheckpointHookConfigTest.java
index 8065cf1..5d606ee 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/WithMasterCheckpointHookConfigTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/WithMasterCheckpointHookConfigTest.java
@@ -28,17 +28,20 @@ import org.apache.flink.streaming.api.checkpoint.WithMasterCheckpointHook;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.sink.DiscardingSink;
import org.apache.flink.streaming.api.functions.source.SourceFunction;
-
import org.apache.flink.util.SerializedValue;
+
import org.junit.Test;
import javax.annotation.Nullable;
+
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Executor;
import static java.util.Arrays.asList;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests that when sources implement {@link WithMasterCheckpointHook} the hooks are properly
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferAlignmentLimitTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferAlignmentLimitTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferAlignmentLimitTest.java
index 4322748..b5ea866 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferAlignmentLimitTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferAlignmentLimitTest.java
@@ -20,10 +20,10 @@ package org.apache.flink.streaming.runtime.io;
import org.apache.flink.core.memory.MemorySegment;
import org.apache.flink.core.memory.MemorySegmentFactory;
+import org.apache.flink.runtime.checkpoint.CheckpointMetaData;
import org.apache.flink.runtime.checkpoint.CheckpointMetrics;
import org.apache.flink.runtime.checkpoint.CheckpointOptions;
import org.apache.flink.runtime.checkpoint.decline.AlignmentLimitExceededException;
-import org.apache.flink.runtime.checkpoint.CheckpointMetaData;
import org.apache.flink.runtime.io.disk.iomanager.IOManager;
import org.apache.flink.runtime.io.disk.iomanager.IOManagerAsync;
import org.apache.flink.runtime.io.network.api.CheckpointBarrier;
@@ -34,7 +34,6 @@ import org.apache.flink.runtime.jobgraph.tasks.StatefulTask;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
-
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -48,7 +47,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.argThat;
import static org.mockito.Mockito.eq;
@@ -57,7 +55,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
/**
- * Tests for the barrier buffer's maximum limit of buffered/spilled bytes
+ * Tests for the barrier buffer's maximum limit of buffered/spilled bytes.
*/
public class BarrierBufferAlignmentLimitTest {
@@ -65,7 +63,7 @@ public class BarrierBufferAlignmentLimitTest {
private static final Random RND = new Random();
- private static IOManager IO_MANAGER;
+ private static IOManager ioManager;
// ------------------------------------------------------------------------
// Setup
@@ -73,12 +71,12 @@ public class BarrierBufferAlignmentLimitTest {
@BeforeClass
public static void setup() {
- IO_MANAGER = new IOManagerAsync();
+ ioManager = new IOManagerAsync();
}
@AfterClass
public static void shutdownIOManager() {
- IO_MANAGER.shutdown();
+ ioManager.shutdown();
}
// ------------------------------------------------------------------------
@@ -86,7 +84,7 @@ public class BarrierBufferAlignmentLimitTest {
// ------------------------------------------------------------------------
/**
- * This tests that a single alignment that buffers too much data cancels
+ * This tests that a single alignment that buffers too much data cancels.
*/
@Test
public void testBreakCheckpointAtAlignmentLimit() throws Exception {
@@ -116,7 +114,7 @@ public class BarrierBufferAlignmentLimitTest {
// the barrier buffer has a limit that only 1000 bytes may be spilled in alignment
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER, 1000);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager, 1000);
StatefulTask toNotify = mock(StatefulTask.class);
buffer.registerCheckpointEventHandler(toNotify);
@@ -173,7 +171,7 @@ public class BarrierBufferAlignmentLimitTest {
* - an alignment starts
* - barriers from a second checkpoint queue before the first completes
* - together they are larger than the threshold
- * - after the first checkpoint (with second checkpoint data queued) aborts, the second completes
+ * - after the first checkpoint (with second checkpoint data queued) aborts, the second completes.
*/
@Test
public void testAlignmentLimitWithQueuedAlignments() throws Exception {
@@ -210,7 +208,7 @@ public class BarrierBufferAlignmentLimitTest {
// the barrier buffer has a limit that only 1000 bytes may be spilled in alignment
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER, 500);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager, 500);
StatefulTask toNotify = mock(StatefulTask.class);
buffer.registerCheckpointEventHandler(toNotify);
@@ -315,7 +313,7 @@ public class BarrierBufferAlignmentLimitTest {
private static void checkNoTempFilesRemain() {
// validate that all temp files have been removed
- for (File dir : IO_MANAGER.getSpillingDirectories()) {
+ for (File dir : ioManager.getSpillingDirectories()) {
for (String file : dir.list()) {
if (file != null && !(file.equals(".") || file.equals(".."))) {
fail("barrier buffer did not clean up temp files. remaining file: " + file);
@@ -325,7 +323,7 @@ public class BarrierBufferAlignmentLimitTest {
}
/**
- * A validation matcher for checkpoint metadata against checkpoint IDs
+ * A validation matcher for checkpoint metadata against checkpoint IDs.
*/
private static class CheckpointMatcher extends BaseMatcher<CheckpointMetaData> {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferMassiveRandomTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferMassiveRandomTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferMassiveRandomTest.java
index 3514f56..49d07b1 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferMassiveRandomTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferMassiveRandomTest.java
@@ -29,6 +29,7 @@ import org.apache.flink.runtime.io.network.buffer.NetworkBufferPool;
import org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent;
import org.apache.flink.runtime.io.network.partition.consumer.InputGate;
import org.apache.flink.runtime.io.network.partition.consumer.InputGateListener;
+
import org.junit.Test;
import java.io.IOException;
@@ -82,11 +83,11 @@ public class BarrierBufferMassiveRandomTest {
// Mocks and Generators
// ------------------------------------------------------------------------
- protected interface BarrierGenerator {
- public boolean isNextBarrier();
+ private interface BarrierGenerator {
+ boolean isNextBarrier();
}
- protected static class RandomBarrier implements BarrierGenerator {
+ private static class RandomBarrier implements BarrierGenerator {
private static final Random rnd = new Random();
@@ -117,7 +118,7 @@ public class BarrierBufferMassiveRandomTest {
}
}
- protected static class RandomGeneratingInputGate implements InputGate {
+ private static class RandomGeneratingInputGate implements InputGate {
private final int numChannels;
private final BufferPool[] bufferPools;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferTest.java
index fedf4fc..c2cf7f3 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferTest.java
@@ -35,6 +35,7 @@ import org.apache.flink.runtime.io.network.buffer.FreeingBufferRecycler;
import org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent;
import org.apache.flink.runtime.jobgraph.tasks.StatefulTask;
import org.apache.flink.runtime.state.TaskStateHandles;
+
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.junit.AfterClass;
@@ -67,19 +68,19 @@ public class BarrierBufferTest {
private static final int PAGE_SIZE = 512;
- private static int SIZE_COUNTER = 0;
+ private static int sizeCounter = 0;
- private static IOManager IO_MANAGER;
+ private static IOManager ioManager;
@BeforeClass
public static void setup() {
- IO_MANAGER = new IOManagerAsync();
- SIZE_COUNTER = 1;
+ ioManager = new IOManagerAsync();
+ sizeCounter = 1;
}
@AfterClass
public static void shutdownIOManager() {
- IO_MANAGER.shutdown();
+ ioManager.shutdown();
}
// ------------------------------------------------------------------------
@@ -99,7 +100,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 1, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
for (BufferOrEvent boe : sequence) {
assertEquals(boe, buffer.getNextNonBlocked());
@@ -134,7 +135,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 4, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
for (BufferOrEvent boe : sequence) {
assertEquals(boe, buffer.getNextNonBlocked());
@@ -173,7 +174,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 1, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
ValidatingCheckpointHandler handler = new ValidatingCheckpointHandler();
buffer.registerCheckpointEventHandler(handler);
@@ -239,7 +240,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
ValidatingCheckpointHandler handler = new ValidatingCheckpointHandler();
buffer.registerCheckpointEventHandler(handler);
@@ -348,7 +349,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
ValidatingCheckpointHandler handler = new ValidatingCheckpointHandler();
buffer.registerCheckpointEventHandler(handler);
@@ -439,7 +440,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
ValidatingCheckpointHandler handler = new ValidatingCheckpointHandler();
buffer.registerCheckpointEventHandler(handler);
@@ -547,7 +548,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
StatefulTask toNotify = mock(StatefulTask.class);
buffer.registerCheckpointEventHandler(toNotify);
@@ -647,7 +648,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
ValidatingCheckpointHandler handler = new ValidatingCheckpointHandler();
buffer.registerCheckpointEventHandler(handler);
@@ -752,7 +753,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
// checkpoint 1
check(sequence[0], buffer.getNextNonBlocked());
@@ -823,7 +824,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
ValidatingCheckpointHandler handler = new ValidatingCheckpointHandler();
buffer.registerCheckpointEventHandler(handler);
@@ -892,7 +893,7 @@ public class BarrierBufferTest {
MockInputGate gate = new MockInputGate(PAGE_SIZE, 4, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
// pre checkpoint 2
check(sequence[0], buffer.getNextNonBlocked());
@@ -958,7 +959,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
// data after first checkpoint
check(sequence[3], buffer.getNextNonBlocked());
@@ -1002,7 +1003,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 1, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
StatefulTask toNotify = mock(StatefulTask.class);
buffer.registerCheckpointEventHandler(toNotify);
@@ -1066,7 +1067,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
StatefulTask toNotify = mock(StatefulTask.class);
buffer.registerCheckpointEventHandler(toNotify);
@@ -1160,7 +1161,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
StatefulTask toNotify = mock(StatefulTask.class);
buffer.registerCheckpointEventHandler(toNotify);
@@ -1214,7 +1215,7 @@ public class BarrierBufferTest {
* This tests the where a replay of queued checkpoint barriers meets
* a canceled checkpoint.
*
- * The replayed newer checkpoint barrier must not try to cancel the
+ * <p>The replayed newer checkpoint barrier must not try to cancel the
* already canceled checkpoint.
*/
@Test
@@ -1251,7 +1252,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
StatefulTask toNotify = mock(StatefulTask.class);
buffer.registerCheckpointEventHandler(toNotify);
@@ -1336,7 +1337,7 @@ public class BarrierBufferTest {
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
- BarrierBuffer buffer = new BarrierBuffer(gate, IO_MANAGER);
+ BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
StatefulTask toNotify = mock(StatefulTask.class);
buffer.registerCheckpointEventHandler(toNotify);
@@ -1398,7 +1399,7 @@ public class BarrierBufferTest {
}
private static BufferOrEvent createBuffer(int channel) {
- final int size = SIZE_COUNTER++;
+ final int size = sizeCounter++;
byte[] bytes = new byte[size];
RND.nextBytes(bytes);
@@ -1436,7 +1437,7 @@ public class BarrierBufferTest {
private static void checkNoTempFilesRemain() {
// validate that all temp files have been removed
- for (File dir : IO_MANAGER.getSpillingDirectories()) {
+ for (File dir : ioManager.getSpillingDirectories()) {
for (String file : dir.list()) {
if (file != null && !(file.equals(".") || file.equals(".."))) {
fail("barrier buffer did not clean up temp files. remaining file: " + file);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierTrackerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierTrackerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierTrackerTest.java
index 8c66205..847db5c 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierTrackerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierTrackerTest.java
@@ -263,7 +263,7 @@ public class BarrierTrackerTest {
* discard a pending checkpoint as soon as it sees a barrier from a
* later checkpoint from some channel.
*
- * This behavior is crucial, otherwise topologies where different inputs
+ * <p>This behavior is crucial, otherwise topologies where different inputs
* have different latency (and that latency is close to or higher than the
* checkpoint interval) may skip many checkpoints, or fail to complete a
* checkpoint all together.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BufferSpillerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BufferSpillerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BufferSpillerTest.java
index 905bc59..4edb665 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BufferSpillerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BufferSpillerTest.java
@@ -31,7 +31,6 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,16 +39,23 @@ import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Random;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
-import static org.junit.Assert.*;
-
+/**
+ * Tests for {@link BufferSpiller}.
+ */
public class BufferSpillerTest {
private static final Logger LOG = LoggerFactory.getLogger(BufferSpillerTest.class);
private static final int PAGE_SIZE = 4096;
- private static IOManager IO_MANAGER;
+ private static IOManager ioManager;
private BufferSpiller spiller;
@@ -60,18 +66,18 @@ public class BufferSpillerTest {
@BeforeClass
public static void setupIOManager() {
- IO_MANAGER = new IOManagerAsync();
+ ioManager = new IOManagerAsync();
}
@AfterClass
public static void shutdownIOManager() {
- IO_MANAGER.shutdown();
+ ioManager.shutdown();
}
@Before
public void createSpiller() {
try {
- spiller = new BufferSpiller(IO_MANAGER, PAGE_SIZE);
+ spiller = new BufferSpiller(ioManager, PAGE_SIZE);
}
catch (Exception e) {
e.printStackTrace();
@@ -205,7 +211,7 @@ public class BufferSpillerTest {
int currentNumRecordAndEvents = 0;
// do multiple spilling / rolling over rounds
- for (int round = 0; round < 2*sequences; round++) {
+ for (int round = 0; round < 2 * sequences; round++) {
if (round % 2 == 1) {
// make this an empty sequence
@@ -392,7 +398,7 @@ public class BufferSpillerTest {
private static void checkNoTempFilesRemain() {
// validate that all temp files have been removed
- for (File dir : IO_MANAGER.getSpillingDirectories()) {
+ for (File dir : ioManager.getSpillingDirectories()) {
for (String file : dir.list()) {
if (file != null && !(file.equals(".") || file.equals(".."))) {
fail("barrier buffer did not clean up temp files. remaining file: " + file);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/MockInputGate.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/MockInputGate.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/MockInputGate.java
index 3e2a75a..77c938a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/MockInputGate.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/MockInputGate.java
@@ -28,6 +28,9 @@ import java.util.ArrayDeque;
import java.util.List;
import java.util.Queue;
+/**
+ * Mock {@link InputGate}.
+ */
public class MockInputGate implements InputGate {
private final int pageSize;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/SpilledBufferOrEventSequenceTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/SpilledBufferOrEventSequenceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/SpilledBufferOrEventSequenceTest.java
index a6e834c..adbe240 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/SpilledBufferOrEventSequenceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/SpilledBufferOrEventSequenceTest.java
@@ -37,7 +37,11 @@ import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Random;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Tests that validate the behavior of the {@link SpilledBufferOrEventSequence} in isolation,
@@ -46,12 +50,11 @@ import static org.junit.Assert.*;
public class SpilledBufferOrEventSequenceTest {
private final ByteBuffer buffer = ByteBuffer.allocateDirect(128 * 1024).order(ByteOrder.LITTLE_ENDIAN);
- private final int pageSize = 32*1024;
+ private final int pageSize = 32 * 1024;
private File tempFile;
private FileChannel fileChannel;
-
@Before
public void initTempChannel() {
try {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/StreamRecordWriterTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/StreamRecordWriterTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/StreamRecordWriterTest.java
index 54cd186..d114139 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/StreamRecordWriterTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/StreamRecordWriterTest.java
@@ -29,14 +29,16 @@ import org.apache.flink.runtime.io.network.buffer.FreeingBufferRecycler;
import org.apache.flink.types.LongValue;
import org.junit.Test;
-
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.io.IOException;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
/**
* This test uses the PowerMockRunner runner to work around the fact that the
@@ -99,7 +101,6 @@ public class StreamRecordWriterTest {
when(mockWriter.getBufferProvider()).thenReturn(mockProvider);
when(mockWriter.getNumberOfOutputChannels()).thenReturn(numPartitions);
-
return mockWriter;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/ContinuousFileProcessingRescalingTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/ContinuousFileProcessingRescalingTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/ContinuousFileProcessingRescalingTest.java
index 466ca65..2d0855a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/ContinuousFileProcessingRescalingTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/ContinuousFileProcessingRescalingTest.java
@@ -34,6 +34,7 @@ import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.util.Preconditions;
+
import org.junit.Assert;
import org.junit.Test;
@@ -41,6 +42,9 @@ import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Queue;
+/**
+ * Test processing files during rescaling.
+ */
public class ContinuousFileProcessingRescalingTest {
@Test
@@ -83,7 +87,6 @@ public class ContinuousFileProcessingRescalingTest {
testHarness1.getOutput().clear();
testHarness2.getOutput().clear();
-
// 2) and take the snapshots from the previous instances and merge them
// into a new one which will be then used to initialize a third instance
OperatorStateHandles mergedState = AbstractStreamOperatorTestHarness.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSinkTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSinkTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSinkTest.java
index 9bcd2e6..5085eb4 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSinkTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSinkTest.java
@@ -33,6 +33,9 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+/**
+ * Tests for {@link GenericWriteAheadSink}.
+ */
public class GenericWriteAheadSinkTest extends WriteAheadSinkTestBase<Tuple1<Integer>, GenericWriteAheadSinkTest.ListSink> {
@Override
@@ -50,7 +53,6 @@ public class GenericWriteAheadSinkTest extends WriteAheadSinkTestBase<Tuple1<Int
return new Tuple1<>(counter);
}
-
@Override
protected void verifyResultsIdealCircumstances(ListSink sink) {
@@ -182,7 +184,7 @@ public class GenericWriteAheadSinkTest extends WriteAheadSinkTestBase<Tuple1<Int
}
}
- public static class SimpleCommitter extends CheckpointCommitter {
+ private static class SimpleCommitter extends CheckpointCommitter {
private static final long serialVersionUID = 1L;
private List<Tuple2<Long, Integer>> checkpoints;
@@ -232,7 +234,7 @@ public class GenericWriteAheadSinkTest extends WriteAheadSinkTestBase<Tuple1<Int
}
}
- public static class FailingCommitter extends CheckpointCommitter {
+ private static class FailingCommitter extends CheckpointCommitter {
private static final long serialVersionUID = 1L;
private List<Tuple2<Long, Integer>> checkpoints;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamOperatorChainingTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamOperatorChainingTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamOperatorChainingTest.java
index c95a85e..8d99acd 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamOperatorChainingTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamOperatorChainingTest.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators;
import org.apache.flink.api.common.ExecutionConfig;
@@ -36,6 +37,7 @@ import org.apache.flink.streaming.api.operators.StreamOperator;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.OperatorChain;
import org.apache.flink.streaming.runtime.tasks.StreamTask;
+
import org.junit.Assert;
import org.junit.Test;
@@ -80,7 +82,7 @@ public class StreamOperatorChainingTest {
private void testMultiChaining(StreamExecutionEnvironment env) throws Exception {
// the actual elements will not be used
- DataStream<Integer> input = env.fromElements(1,2,3);
+ DataStream<Integer> input = env.fromElements(1, 2, 3);
sink1Results = new ArrayList<>();
sink2Results = new ArrayList<>();
@@ -188,7 +190,7 @@ public class StreamOperatorChainingTest {
private void testMultiChainingWithSplit(StreamExecutionEnvironment env) throws Exception {
// the actual elements will not be used
- DataStream<Integer> input = env.fromElements(1,2,3);
+ DataStream<Integer> input = env.fromElements(1, 2, 3);
sink1Results = new ArrayList<>();
sink2Results = new ArrayList<>();
[06/10] flink git commit: [FLINK-6603] [streaming] Enable checkstyle
on test sources
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/runtime/io/network/partition/consumer/StreamTestSingleInputGate.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/runtime/io/network/partition/consumer/StreamTestSingleInputGate.java b/flink-streaming-java/src/test/java/org/apache/flink/runtime/io/network/partition/consumer/StreamTestSingleInputGate.java
index 6dcb56b..e14430e 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/runtime/io/network/partition/consumer/StreamTestSingleInputGate.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/runtime/io/network/partition/consumer/StreamTestSingleInputGate.java
@@ -17,6 +17,7 @@
*/
// We have it in this package because we could not mock the methods otherwise
+
package org.apache.flink.runtime.io.network.partition.consumer;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -33,6 +34,7 @@ import org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID;
import org.apache.flink.runtime.plugable.SerializationDelegate;
import org.apache.flink.streaming.runtime.streamrecord.StreamElement;
import org.apache.flink.streaming.runtime.streamrecord.StreamElementSerializer;
+
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -92,7 +94,6 @@ public class StreamTestSingleInputGate<T> extends TestSingleInputGate {
inputQueues[channelIndex] = new ConcurrentLinkedQueue<InputValue<Object>>();
inputChannels[channelIndex] = new TestInputChannel(inputGate, i);
-
final Answer<BufferAndAvailability> answer = new Answer<BufferAndAvailability>() {
@Override
public BufferAndAvailability answer(InvocationOnMock invocationOnMock) throws Throwable {
@@ -178,7 +179,7 @@ public class StreamTestSingleInputGate<T> extends TestSingleInputGate {
return true;
}
- public static class InputValue<T> {
+ private static class InputValue<T> {
private Object elementOrEvent;
private boolean isStreamEnd;
private boolean isStreamRecord;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/AggregationFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/AggregationFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/AggregationFunctionTest.java
index 7dc889c..acb531d 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/AggregationFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/AggregationFunctionTest.java
@@ -17,23 +17,16 @@
package org.apache.flink.streaming.api;
-import static org.junit.Assert.assertEquals;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.ReduceFunction;
+import org.apache.flink.api.common.operators.Keys;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.functions.KeySelector;
-import org.apache.flink.api.common.operators.Keys;
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.api.java.typeutils.TypeExtractor;
+import org.apache.flink.streaming.api.functions.aggregation.AggregationFunction;
import org.apache.flink.streaming.api.functions.aggregation.AggregationFunction.AggregationType;
import org.apache.flink.streaming.api.functions.aggregation.ComparableAggregator;
import org.apache.flink.streaming.api.functions.aggregation.SumAggregator;
@@ -41,8 +34,18 @@ import org.apache.flink.streaming.api.operators.StreamGroupedReduce;
import org.apache.flink.streaming.util.MockContext;
import org.apache.flink.streaming.util.keys.KeySelectorUtil;
+import com.google.common.collect.ImmutableList;
import org.junit.Test;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link AggregationFunction}.
+ */
public class AggregationFunctionTest {
@Test
@@ -188,9 +191,9 @@ public class AggregationFunctionTest {
// preparing expected outputs
List<Tuple3<Integer, Integer, Integer>> maxByFirstExpected = ImmutableList.of(
- Tuple3.of(0,0,0), Tuple3.of(0,1,1), Tuple3.of(0,2,2),
- Tuple3.of(0,2,2), Tuple3.of(0,2,2), Tuple3.of(0,2,2),
- Tuple3.of(0,2,2), Tuple3.of(0,2,2), Tuple3.of(0,2,2));
+ Tuple3.of(0, 0, 0), Tuple3.of(0, 1, 1), Tuple3.of(0, 2, 2),
+ Tuple3.of(0, 2, 2), Tuple3.of(0, 2, 2), Tuple3.of(0, 2, 2),
+ Tuple3.of(0, 2, 2), Tuple3.of(0, 2, 2), Tuple3.of(0, 2, 2));
List<Tuple3<Integer, Integer, Integer>> maxByLastExpected = ImmutableList.of(
Tuple3.of(0, 0, 0), Tuple3.of(0, 1, 1), Tuple3.of(0, 2, 2),
@@ -198,9 +201,9 @@ public class AggregationFunctionTest {
Tuple3.of(0, 2, 5), Tuple3.of(0, 2, 5), Tuple3.of(0, 2, 8));
List<Tuple3<Integer, Integer, Integer>> minByFirstExpected = ImmutableList.of(
- Tuple3.of(0,0,0), Tuple3.of(0,0,0), Tuple3.of(0,0,0),
- Tuple3.of(0,0,0), Tuple3.of(0,0,0), Tuple3.of(0,0,0),
- Tuple3.of(0,0,0), Tuple3.of(0,0,0), Tuple3.of(0,0,0));
+ Tuple3.of(0, 0, 0), Tuple3.of(0, 0, 0), Tuple3.of(0, 0, 0),
+ Tuple3.of(0, 0, 0), Tuple3.of(0, 0, 0), Tuple3.of(0, 0, 0),
+ Tuple3.of(0, 0, 0), Tuple3.of(0, 0, 0), Tuple3.of(0, 0, 0));
List<Tuple3<Integer, Integer, Integer>> minByLastExpected = ImmutableList.of(
Tuple3.of(0, 0, 0), Tuple3.of(0, 0, 0), Tuple3.of(0, 0, 0),
@@ -209,7 +212,7 @@ public class AggregationFunctionTest {
// some necessary boiler plate
TypeInformation<Tuple3<Integer, Integer, Integer>> typeInfo = TypeExtractor
- .getForObject(Tuple3.of(0,0,0));
+ .getForObject(Tuple3.of(0, 0, 0));
ExecutionConfig config = new ExecutionConfig();
@@ -351,6 +354,9 @@ public class AggregationFunctionTest {
return inputList;
}
+ /**
+ * POJO.
+ */
public static class MyPojo implements Serializable {
private static final long serialVersionUID = 1L;
@@ -380,6 +386,9 @@ public class AggregationFunctionTest {
}
}
+ /**
+ * POJO.
+ */
public static class MyPojo3 implements Serializable {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java
index e5fbfda..ea0e139 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java
@@ -17,9 +17,6 @@
package org.apache.flink.streaming.api;
-import java.lang.reflect.Method;
-import java.util.List;
-
import org.apache.flink.api.common.InvalidProgramException;
import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.api.common.functions.FlatMapFunction;
@@ -57,18 +54,18 @@ import org.apache.flink.streaming.api.functions.windowing.AllWindowFunction;
import org.apache.flink.streaming.api.graph.StreamEdge;
import org.apache.flink.streaming.api.graph.StreamGraph;
import org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator;
+import org.apache.flink.streaming.api.operators.KeyedProcessOperator;
import org.apache.flink.streaming.api.operators.ProcessOperator;
import org.apache.flink.streaming.api.operators.StreamOperator;
-import org.apache.flink.streaming.api.operators.KeyedProcessOperator;
import org.apache.flink.streaming.api.windowing.assigners.GlobalWindows;
import org.apache.flink.streaming.api.windowing.triggers.CountTrigger;
import org.apache.flink.streaming.api.windowing.triggers.PurgingTrigger;
import org.apache.flink.streaming.api.windowing.windows.GlobalWindow;
import org.apache.flink.streaming.runtime.partitioner.BroadcastPartitioner;
import org.apache.flink.streaming.runtime.partitioner.CustomPartitionerWrapper;
-import org.apache.flink.streaming.runtime.partitioner.KeyGroupStreamPartitioner;
import org.apache.flink.streaming.runtime.partitioner.ForwardPartitioner;
import org.apache.flink.streaming.runtime.partitioner.GlobalPartitioner;
+import org.apache.flink.streaming.runtime.partitioner.KeyGroupStreamPartitioner;
import org.apache.flink.streaming.runtime.partitioner.RebalancePartitioner;
import org.apache.flink.streaming.runtime.partitioner.ShufflePartitioner;
import org.apache.flink.streaming.runtime.partitioner.StreamPartitioner;
@@ -80,8 +77,18 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import static org.junit.Assert.*;
+import java.lang.reflect.Method;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+/**
+ * Tests for {@link DataStream}.
+ */
@SuppressWarnings("serial")
public class DataStreamTest {
@@ -142,7 +149,7 @@ public class DataStreamTest {
}
}).setParallelism(2);
- DataStream<Long> unionDifferingParallelism= input2.union(input3).map(new MapFunction<Long, Long>() {
+ DataStream<Long> unionDifferingParallelism = input2.union(input3).map(new MapFunction<Long, Long>() {
@Override
public Long map(Long value) throws Exception {
return null;
@@ -578,6 +585,7 @@ public class DataStreamTest {
@Override
public void flatMap1(Long value, Collector<Long> out) throws Exception {
}
+
@Override
public void flatMap2(Long value, Collector<Long> out) throws Exception {
}
@@ -744,7 +752,6 @@ public class DataStreamTest {
assertTrue(getOperatorForDataStream(processed) instanceof ProcessOperator);
}
-
@Test
public void operatorTest() {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
@@ -761,7 +768,6 @@ public class DataStreamTest {
map.addSink(new DiscardingSink<Integer>());
assertEquals(mapFunction, getFunctionForDataStream(map));
-
FlatMapFunction<Long, Integer> flatMapFunction = new FlatMapFunction<Long, Integer>() {
private static final long serialVersionUID = 1L;
@@ -1090,7 +1096,7 @@ public class DataStreamTest {
expectedException.expect(InvalidProgramException.class);
expectedException.expectMessage(new StringStartsWith("Type " + expectedTypeInfo + " cannot be used as key."));
- input.keyBy(new KeySelector<Tuple2<Integer[],String>, Tuple2<Integer[],String>>() {
+ input.keyBy(new KeySelector<Tuple2<Integer[], String>, Tuple2<Integer[], String>>() {
@Override
public Tuple2<Integer[], String> getKey(Tuple2<Integer[], String> value) throws Exception {
return value;
@@ -1121,6 +1127,9 @@ public class DataStreamTest {
});
}
+ /**
+ * POJO without hashCode.
+ */
public static class POJOWithoutHashCode {
private int[] id;
@@ -1140,6 +1149,9 @@ public class DataStreamTest {
}
}
+ /**
+ * POJO with hashCode.
+ */
public static class POJOWithHashCode extends POJOWithoutHashCode {
public POJOWithHashCode() {
@@ -1244,7 +1256,7 @@ public class DataStreamTest {
}
}
- public static class CustomPOJO {
+ private static class CustomPOJO {
private String s;
private int i;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/RestartStrategyTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/RestartStrategyTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/RestartStrategyTest.java
index d6fcd61..b231bea 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/RestartStrategyTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/RestartStrategyTest.java
@@ -23,15 +23,19 @@ import org.apache.flink.runtime.jobgraph.JobGraph;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.graph.StreamGraph;
import org.apache.flink.util.TestLogger;
+
import org.junit.Assert;
import org.junit.Test;
+/**
+ * Tests for {@link RestartStrategies}.
+ */
public class RestartStrategyTest extends TestLogger {
/**
* Tests that in a streaming use case where checkpointing is enabled, a
* fixed delay with Integer.MAX_VALUE retries is instantiated if no other restart
- * strategy has been specified
+ * strategy has been specified.
*/
@Test
public void testAutomaticRestartingWhenCheckpointing() throws Exception {
@@ -53,7 +57,7 @@ public class RestartStrategyTest extends TestLogger {
/**
* Checks that in a streaming use case where checkpointing is enabled and the number
- * of execution retries is set to 0, restarting is deactivated
+ * of execution retries is set to 0, restarting is deactivated.
*/
@Test
public void testNoRestartingWhenCheckpointingAndExplicitExecutionRetriesZero() throws Exception {
@@ -94,7 +98,7 @@ public class RestartStrategyTest extends TestLogger {
Assert.assertNotNull(restartStrategy);
Assert.assertTrue(restartStrategy instanceof RestartStrategies.FixedDelayRestartStrategyConfiguration);
- Assert.assertEquals(42, ((RestartStrategies.FixedDelayRestartStrategyConfiguration)restartStrategy).getRestartAttempts());
- Assert.assertEquals(1337, ((RestartStrategies.FixedDelayRestartStrategyConfiguration)restartStrategy).getDelayBetweenAttemptsInterval().toMilliseconds());
+ Assert.assertEquals(42, ((RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategy).getRestartAttempts());
+ Assert.assertEquals(1337, ((RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategy).getDelayBetweenAttemptsInterval().toMilliseconds());
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/SourceFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/SourceFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/SourceFunctionTest.java
index dd4ff33..cabc7a1 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/SourceFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/SourceFunctionTest.java
@@ -17,18 +17,22 @@
package org.apache.flink.streaming.api;
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.List;
-
import org.apache.flink.api.common.typeutils.base.IntSerializer;
import org.apache.flink.core.testutils.CommonTestUtils;
import org.apache.flink.streaming.api.functions.source.FromElementsFunction;
-import org.apache.flink.streaming.api.functions.source.StatefulSequenceSource;
+import org.apache.flink.streaming.api.functions.source.SourceFunction;
import org.apache.flink.streaming.util.SourceFunctionUtil;
+
import org.junit.Test;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link SourceFunction}.
+ */
public class SourceFunctionTest {
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/StreamExecutionEnvironmentTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/StreamExecutionEnvironmentTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/StreamExecutionEnvironmentTest.java
index ff1eaaa..91cbe13 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/StreamExecutionEnvironmentTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/StreamExecutionEnvironmentTest.java
@@ -33,6 +33,7 @@ import org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator;
import org.apache.flink.streaming.api.operators.StreamOperator;
import org.apache.flink.util.Collector;
import org.apache.flink.util.SplittableIterator;
+
import org.junit.Assert;
import org.junit.Test;
@@ -45,6 +46,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+/**
+ * Tests for {@link StreamExecutionEnvironment}.
+ */
public class StreamExecutionEnvironmentTest {
@Test
@@ -143,7 +147,6 @@ public class StreamExecutionEnvironmentTest {
}
};
-
SingleOutputStreamOperator<Object> operator =
env.addSource(srcFun).flatMap(new FlatMapFunction<Integer, Object>() {
@@ -227,7 +230,6 @@ public class StreamExecutionEnvironmentTest {
// Utilities
/////////////////////////////////////////////////////////////
-
private static StreamOperator<?> getOperatorFromDataStream(DataStream<?> dataStream) {
StreamExecutionEnvironment env = dataStream.getExecutionEnvironment();
StreamGraph streamGraph = env.getStreamGraph();
@@ -242,7 +244,7 @@ public class StreamExecutionEnvironmentTest {
return (SourceFunction<T>) operator.getUserFunction();
}
- public static class DummySplittableIterator<T> extends SplittableIterator<T> {
+ private static class DummySplittableIterator<T> extends SplittableIterator<T> {
private static final long serialVersionUID = 1312752876092210499L;
@SuppressWarnings("unchecked")
@@ -272,7 +274,7 @@ public class StreamExecutionEnvironmentTest {
}
}
- public static class ParentClass {
+ private static class ParentClass {
int num;
String string;
public ParentClass(int num, String string) {
@@ -281,7 +283,7 @@ public class StreamExecutionEnvironmentTest {
}
}
- public static class SubClass extends ParentClass{
+ private static class SubClass extends ParentClass{
public SubClass(int num, String string) {
super(num, string);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java
index 83fb2f7..5baa980 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java
@@ -17,10 +17,6 @@
package org.apache.flink.streaming.api;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-
import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
@@ -35,6 +31,12 @@ import org.apache.flink.util.Collector;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests for {@link TypeFill}.
+ */
@SuppressWarnings("serial")
public class TypeFillTest {
@@ -47,7 +49,6 @@ public class TypeFillTest {
fail();
} catch (Exception ignored) {}
-
DataStream<Long> source = env.generateSequence(1, 10);
try {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java
index 51b9d9a..4d201f4 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java
@@ -22,6 +22,7 @@ import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.streaming.api.operators.StreamMap;
import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
+
import org.junit.Assert;
import org.junit.Test;
@@ -29,6 +30,9 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+/**
+ * Tests for {@link ListCheckpointed}.
+ */
public class ListCheckpointedTest {
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/collector/OutputSelectorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/collector/OutputSelectorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/collector/OutputSelectorTest.java
index 3194f9e..a2f8ed6 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/collector/OutputSelectorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/collector/OutputSelectorTest.java
@@ -17,17 +17,20 @@
package org.apache.flink.streaming.api.collector;
-import static org.junit.Assert.assertEquals;
+import org.apache.flink.api.java.tuple.Tuple1;
+import org.apache.flink.streaming.api.collector.selector.OutputSelector;
+
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.apache.flink.api.java.tuple.Tuple1;
-import org.apache.flink.streaming.api.collector.selector.OutputSelector;
-
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+/**
+ * Tests for {@link OutputSelector}.
+ */
public class OutputSelectorTest {
static final class MyOutputSelector implements OutputSelector<Tuple1<Integer>> {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironmentITCase.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironmentITCase.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironmentITCase.java
index d346fdc..c053598 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironmentITCase.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironmentITCase.java
@@ -20,12 +20,15 @@ package org.apache.flink.streaming.api.environment;
import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.streaming.api.datastream.DataStream;
-
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+/**
+ * Tests for {@link Flip6LocalStreamEnvironment}.
+ */
@SuppressWarnings("serial")
public class LocalStreamEnvironmentITCase extends TestLogger {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/AscendingTimestampExtractorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/AscendingTimestampExtractorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/AscendingTimestampExtractorTest.java
index 2e92807..16f87ea 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/AscendingTimestampExtractorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/AscendingTimestampExtractorTest.java
@@ -19,11 +19,15 @@
package org.apache.flink.streaming.api.functions;
import org.apache.flink.streaming.api.functions.timestamps.AscendingTimestampExtractor;
+
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+/**
+ * Tests for {@link AscendingTimestampExtractor}.
+ */
public class AscendingTimestampExtractorTest {
@Test
@@ -87,8 +91,6 @@ public class AscendingTimestampExtractorTest {
assertEquals(500L, extractor.extractTimestamp(500L, 0L));
assertEquals(Long.MAX_VALUE - 1, extractor.extractTimestamp(Long.MAX_VALUE - 1, 99999L));
-
-
}
private void runInvalidTest(AscendingTimestampExtractor<Long> extractor) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/BoundedOutOfOrdernessTimestampExtractorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/BoundedOutOfOrdernessTimestampExtractorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/BoundedOutOfOrdernessTimestampExtractorTest.java
index d9a3812..91931d4 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/BoundedOutOfOrdernessTimestampExtractorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/BoundedOutOfOrdernessTimestampExtractorTest.java
@@ -15,18 +15,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions;
import org.apache.flink.streaming.api.functions.timestamps.BoundedOutOfOrdernessTimestampExtractor;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.api.windowing.time.Time;
+
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+/**
+ * Tests for {@link BoundedOutOfOrdernessTimestampExtractor}.
+ */
public class BoundedOutOfOrdernessTimestampExtractorTest {
-
@Test
public void testInitializationAndRuntime() {
Time maxAllowedLateness = Time.milliseconds(10L);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/FromElementsFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/FromElementsFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/FromElementsFunctionTest.java
index 3744eb9..9268ef7 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/FromElementsFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/FromElementsFunctionTest.java
@@ -41,7 +41,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Tests for the {@link org.apache.flink.streaming.api.functions.source.FromElementsFunction}.
@@ -134,12 +136,12 @@ public class FromElementsFunctionTest {
@Test
public void testCheckpointAndRestore() {
try {
- final int NUM_ELEMENTS = 10000;
+ final int numElements = 10000;
- List<Integer> data = new ArrayList<Integer>(NUM_ELEMENTS);
- List<Integer> result = new ArrayList<Integer>(NUM_ELEMENTS);
+ List<Integer> data = new ArrayList<Integer>(numElements);
+ List<Integer> result = new ArrayList<Integer>(numElements);
- for (int i = 0; i < NUM_ELEMENTS; i++) {
+ for (int i = 0; i < numElements; i++) {
data.add(i);
}
@@ -171,7 +173,7 @@ public class FromElementsFunctionTest {
Thread.sleep(1000);
// make a checkpoint
- List<Integer> checkpointData = new ArrayList<>(NUM_ELEMENTS);
+ List<Integer> checkpointData = new ArrayList<>(numElements);
OperatorStateHandles handles = null;
synchronized (ctx.getCheckpointLock()) {
handles = testHarness.snapshot(566, System.currentTimeMillis());
@@ -215,7 +217,7 @@ public class FromElementsFunctionTest {
// Test Types
// ------------------------------------------------------------------------
- public static class MyPojo {
+ private static class MyPojo {
public long val1;
public int val2;
@@ -244,7 +246,7 @@ public class FromElementsFunctionTest {
}
}
- public static class SerializationErrorType implements Value {
+ private static class SerializationErrorType implements Value {
private static final long serialVersionUID = -6037206294939421807L;
@@ -259,7 +261,7 @@ public class FromElementsFunctionTest {
}
}
- public static class DeserializeTooMuchType implements Value {
+ private static class DeserializeTooMuchType implements Value {
private static final long serialVersionUID = -6037206294939421807L;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/IngestionTimeExtractorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/IngestionTimeExtractorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/IngestionTimeExtractorTest.java
index a976453..c1ca9a1 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/IngestionTimeExtractorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/IngestionTimeExtractorTest.java
@@ -19,10 +19,15 @@
package org.apache.flink.streaming.api.functions;
import org.apache.flink.streaming.api.watermark.Watermark;
+
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+/**
+ * Tests for {@link IngestionTimeExtractor}.
+ */
public class IngestionTimeExtractorTest {
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/ListSourceContext.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/ListSourceContext.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/ListSourceContext.java
index 55a0e7f..ee666df 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/ListSourceContext.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/ListSourceContext.java
@@ -36,7 +36,6 @@ public class ListSourceContext<T> implements SourceFunction.SourceContext<T> {
private final long delay;
-
public ListSourceContext(List<T> target) {
this(target, 0L);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/StatefulSequenceSourceTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/StatefulSequenceSourceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/StatefulSequenceSourceTest.java
index 9030e9d..de9f1c7 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/StatefulSequenceSourceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/StatefulSequenceSourceTest.java
@@ -25,6 +25,7 @@ import org.apache.flink.streaming.api.operators.StreamSource;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
+
import org.junit.Assert;
import org.junit.Test;
@@ -35,6 +36,9 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+/**
+ * Tests for {@link StatefulSequenceSource}.
+ */
public class StatefulSequenceSourceTest {
@Test
@@ -190,7 +194,7 @@ public class StatefulSequenceSourceTest {
private final List<Long> localOutput;
public BlockingSourceContext(String name, OneShotLatch latchToTrigger, OneShotLatch latchToWait,
- ConcurrentHashMap<String, List<Long>> output, int elemToFire) {
+ ConcurrentHashMap<String, List<Long>> output, int elemToFire) {
this.name = name;
this.lock = new Object();
this.latchToTrigger = latchToTrigger;
@@ -225,7 +229,6 @@ public class StatefulSequenceSourceTest {
}
}
-
@Override
public void emitWatermark(Watermark mark) {
throw new UnsupportedOperationException();
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunctionTest.java
index 562883d..224b376 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunctionTest.java
@@ -32,8 +32,8 @@ import org.apache.flink.api.common.state.ReducingStateDescriptor;
import org.apache.flink.api.common.state.ValueStateDescriptor;
import org.apache.flink.metrics.MetricGroup;
import org.apache.flink.streaming.api.functions.async.collector.AsyncCollector;
-import org.junit.Test;
+import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@@ -41,7 +41,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
- * Test cases for {@link RichAsyncFunction}
+ * Test cases for {@link RichAsyncFunction}.
*/
public class RichAsyncFunctionTest {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunctionTest.java
index d3a9d3d..afd1101 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunctionTest.java
@@ -21,9 +21,13 @@ package org.apache.flink.streaming.api.functions.sink;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.api.common.io.OutputFormat;
import org.apache.flink.api.common.io.RichOutputFormat;
+
import org.junit.Test;
import org.mockito.Mockito;
+/**
+ * Tests for {@link OutputFormatSinkFunction}.
+ */
public class OutputFormatSinkFunctionTest {
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
index 877e707..63e83d2 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
@@ -18,11 +18,12 @@
package org.apache.flink.streaming.api.functions.sink;
-import org.apache.commons.io.IOUtils;
import org.apache.flink.configuration.ConfigConstants;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.util.serialization.SerializationSchema;
import org.apache.flink.util.TestLogger;
+
+import org.apache.commons.io.IOUtils;
import org.junit.Test;
import java.io.BufferedReader;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunctionTest.java
index d81b440..08985bc 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunctionTest.java
@@ -30,8 +30,8 @@ public class FileMonitoringFunctionTest {
@Test
public void testForEmptyLocation() throws Exception {
- final FileMonitoringFunction fileMonitoringFunction
- = new FileMonitoringFunction("?non-existing-path", 1L, FileMonitoringFunction.WatchType.ONLY_NEW_FILES);
+ final FileMonitoringFunction fileMonitoringFunction =
+ new FileMonitoringFunction("?non-existing-path", 1L, FileMonitoringFunction.WatchType.ONLY_NEW_FILES);
new Thread() {
@Override
@@ -61,7 +61,9 @@ public class FileMonitoringFunctionTest {
public void markAsTemporarilyIdle() {}
@Override
- public Object getCheckpointLock() { return null; }
+ public Object getCheckpointLock() {
+ return null;
+ }
@Override
public void close() {}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunctionTest.java
index bb80228..b99119e 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunctionTest.java
@@ -34,12 +34,16 @@ import org.apache.flink.runtime.operators.testutils.MockEnvironment;
import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.operators.StreamingRuntimeContext;
import org.apache.flink.streaming.api.watermark.Watermark;
+
import org.junit.Assert;
import org.junit.Test;
import java.io.IOException;
import java.util.Collections;
+/**
+ * Tests for {@link InputFormatSourceFunction}.
+ */
public class InputFormatSourceFunctionTest {
@Test
@@ -81,8 +85,7 @@ public class InputFormatSourceFunctionTest {
Assert.assertTrue(!format.isInputFormatOpen);
}
-
- private static class LifeCycleTestInputFormat extends RichInputFormat<Integer,InputSplit> {
+ private static class LifeCycleTestInputFormat extends RichInputFormat<Integer, InputSplit> {
private static final long serialVersionUID = 7408902249499583273L;
private boolean isConfigured = false;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunctionTest.java
index 85fa30b..3d14544 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunctionTest.java
@@ -18,10 +18,9 @@
package org.apache.flink.streaming.api.functions.source;
-import org.apache.commons.io.IOUtils;
-
import org.apache.flink.streaming.api.watermark.Watermark;
+import org.apache.commons.io.IOUtils;
import org.junit.Test;
import java.io.EOFException;
@@ -29,7 +28,8 @@ import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
/**
* Tests for the {@link org.apache.flink.streaming.api.functions.source.SocketTextStreamFunction}.
@@ -38,7 +38,6 @@ public class SocketTextStreamFunctionTest {
private static final String LOCALHOST = "127.0.0.1";
-
@Test
public void testSocketSourceSimpleOutput() throws Exception {
ServerSocket server = new ServerSocket(0);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ArrayFromTupleTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ArrayFromTupleTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ArrayFromTupleTest.java
index c98a659..a110af0 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ArrayFromTupleTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ArrayFromTupleTest.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.functions.windowing.delta.extractor;
-import static org.junit.Assert.assertEquals;
-
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.api.java.tuple.Tuple1;
import org.apache.flink.api.java.tuple.Tuple10;
@@ -45,10 +43,15 @@ import org.apache.flink.api.java.tuple.Tuple6;
import org.apache.flink.api.java.tuple.Tuple7;
import org.apache.flink.api.java.tuple.Tuple8;
import org.apache.flink.api.java.tuple.Tuple9;
-import org.apache.flink.streaming.api.functions.windowing.delta.extractor.ArrayFromTuple;
+
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link Tuple} to {@code Array}.
+ */
public class ArrayFromTupleTest {
private String[] testStrings;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ConcatenatedExtractTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ConcatenatedExtractTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ConcatenatedExtractTest.java
index 3b098c3..bb2a3c3 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ConcatenatedExtractTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ConcatenatedExtractTest.java
@@ -17,12 +17,16 @@
package org.apache.flink.streaming.api.functions.windowing.delta.extractor;
-import static org.junit.Assert.*;
-
import org.apache.flink.api.java.tuple.Tuple2;
+
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link ConcatenatedExtract}.
+ */
public class ConcatenatedExtractTest {
private String[] testStringArray1 = { "1", "2", "3" };
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArrayTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArrayTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArrayTest.java
index d274f4e..a71c0b0 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArrayTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArrayTest.java
@@ -21,6 +21,9 @@ import org.junit.Test;
import static org.junit.Assert.assertEquals;
+/**
+ * Tests for {@link FieldFromArray}.
+ */
public class FieldFromArrayTest {
String[] testStringArray = { "0", "1", "2", "3", "4" };
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromTupleTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromTupleTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromTupleTest.java
index c05f281..89ccc45 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromTupleTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromTupleTest.java
@@ -43,11 +43,15 @@ import org.apache.flink.api.java.tuple.Tuple6;
import org.apache.flink.api.java.tuple.Tuple7;
import org.apache.flink.api.java.tuple.Tuple8;
import org.apache.flink.api.java.tuple.Tuple9;
+
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+/**
+ * Tests for {@link FieldFromTuple}.
+ */
public class FieldFromTupleTest {
private String[] testStrings;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArrayTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArrayTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArrayTest.java
index 7a9a716..4404cd8 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArrayTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArrayTest.java
@@ -17,11 +17,13 @@
package org.apache.flink.streaming.api.functions.windowing.delta.extractor;
-import static org.junit.Assert.assertEquals;
-
-import org.apache.flink.streaming.api.functions.windowing.delta.extractor.FieldsFromArray;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link FieldsFromArray}.
+ */
public class FieldsFromArrayTest {
String[] testStringArray = { "0", "1", "2", "3", "4" };
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromTupleTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromTupleTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromTupleTest.java
index 025ed8a..f46d5eb 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromTupleTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromTupleTest.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.functions.windowing.delta.extractor;
-import static org.junit.Assert.*;
-
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.api.java.tuple.Tuple1;
import org.apache.flink.api.java.tuple.Tuple10;
@@ -45,10 +43,15 @@ import org.apache.flink.api.java.tuple.Tuple6;
import org.apache.flink.api.java.tuple.Tuple7;
import org.apache.flink.api.java.tuple.Tuple8;
import org.apache.flink.api.java.tuple.Tuple9;
-import org.apache.flink.streaming.api.functions.windowing.delta.extractor.FieldsFromTuple;
+
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link FieldsFromTuple}.
+ */
public class FieldsFromTupleTest {
private double[] testDouble;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SlotAllocationTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SlotAllocationTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SlotAllocationTest.java
index cac59ae..6c8d5d2 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SlotAllocationTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SlotAllocationTest.java
@@ -17,20 +17,21 @@
package org.apache.flink.streaming.api.graph;
-import static org.junit.Assert.*;
-
-import java.util.List;
-
import org.apache.flink.api.common.functions.FilterFunction;
-import org.apache.flink.runtime.jobgraph.JobVertex;
import org.apache.flink.runtime.jobgraph.JobGraph;
+import org.apache.flink.runtime.jobgraph.JobVertex;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
-
import org.apache.flink.streaming.api.functions.co.CoMapFunction;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
/**
* This verifies that slot sharing groups are correctly forwarded from user job to JobGraph.
*
@@ -46,7 +47,9 @@ public class SlotAllocationTest extends TestLogger {
FilterFunction<Long> dummyFilter = new FilterFunction<Long>() {
@Override
- public boolean filter(Long value) { return false; }
+ public boolean filter(Long value) {
+ return false;
+ }
};
env.generateSequence(1, 10)
@@ -89,7 +92,9 @@ public class SlotAllocationTest extends TestLogger {
FilterFunction<Long> dummyFilter = new FilterFunction<Long>() {
@Override
- public boolean filter(Long value) { return false; }
+ public boolean filter(Long value) {
+ return false;
+ }
};
DataStream<Long> src1 = env.generateSequence(1, 10);
@@ -127,7 +132,9 @@ public class SlotAllocationTest extends TestLogger {
FilterFunction<Long> dummyFilter = new FilterFunction<Long>() {
@Override
- public boolean filter(Long value) { return false; }
+ public boolean filter(Long value) {
+ return false;
+ }
};
DataStream<Long> src1 = env.generateSequence(1, 10).slotSharingGroup("group-1");
@@ -144,7 +151,6 @@ public class SlotAllocationTest extends TestLogger {
assertNotEquals(vertices.get(1).getSlotSharingGroup(), vertices.get(2).getSlotSharingGroup());
}
-
@Test
public void testCoOperation() {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java
index 5fdacd4..8149d24 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java
@@ -44,6 +44,7 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.StreamTask;
import org.apache.flink.streaming.util.EvenOddOutputSelector;
import org.apache.flink.streaming.util.NoOpIntMap;
+
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -59,8 +60,7 @@ public class StreamGraphGeneratorTest {
/**
* This tests whether virtual Transformations behave correctly.
*
- * <p>
- * Verifies that partitioning, output selector, selected names are correctly set in the
+ * <p>Verifies that partitioning, output selector, selected names are correctly set in the
* StreamGraph when they are intermixed.
*/
@Test
@@ -111,7 +111,6 @@ public class StreamGraphGeneratorTest {
.select("even")
.shuffle();
-
SingleOutputStreamOperator<Integer> unionedMap = map1.union(map2).union(map3)
.map(new NoOpIntMap());
@@ -143,7 +142,7 @@ public class StreamGraphGeneratorTest {
/**
* This tests whether virtual Transformations behave correctly.
*
- * Checks whether output selector, partitioning works correctly when applied on a union.
+ * <p>Checks whether output selector, partitioning works correctly when applied on a union.
*/
@Test
public void testVirtualTransformations2() throws Exception {
@@ -270,7 +269,7 @@ public class StreamGraphGeneratorTest {
}
/**
- * Tests that the global and operator-wide max parallelism setting is respected
+ * Tests that the global and operator-wide max parallelism setting is respected.
*/
@Test
public void testMaxParallelismForwarding() {
@@ -387,13 +386,13 @@ public class StreamGraphGeneratorTest {
env.getConfig().setMaxParallelism(maxParallelism);
DataStream<Integer> keyedResult = input1.connect(input2).keyBy(
- new KeySelector<Integer, Integer>() {
- private static final long serialVersionUID = -6908614081449363419L;
+ new KeySelector<Integer, Integer>() {
+ private static final long serialVersionUID = -6908614081449363419L;
- @Override
- public Integer getKey(Integer value) throws Exception {
- return value;
- }
+ @Override
+ public Integer getKey(Integer value) throws Exception {
+ return value;
+ }
},
new KeySelector<Integer, Integer>() {
private static final long serialVersionUID = 3195683453223164931L;
@@ -501,6 +500,5 @@ public class StreamGraphGeneratorTest {
return value;
}
- };
-
+ }
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
index 6c5baca..6dd7de7 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
@@ -47,6 +47,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+/**
+ * Tests for {@link StreamingJobGraphGenerator}.
+ */
@SuppressWarnings("serial")
public class StreamingJobGraphGeneratorTest extends TestLogger {
@@ -158,7 +161,7 @@ public class StreamingJobGraphGeneratorTest extends TestLogger {
/**
* Verifies that the resources are merged correctly for chained operators (covers source and sink cases)
- * when generating job graph
+ * when generating job graph.
*/
@Test
public void testResourcesForChainedSourceSink() throws Exception {
@@ -230,7 +233,7 @@ public class StreamingJobGraphGeneratorTest extends TestLogger {
/**
* Verifies that the resources are merged correctly for chained operators (covers middle chaining and iteration cases)
- * when generating job graph
+ * when generating job graph.
*/
@Test
public void testResourcesForIteration() throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java
index 67004ea..798c81f 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java
@@ -15,11 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.operators;
import org.apache.flink.api.common.state.ValueStateDescriptor;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
-import org.apache.flink.api.common.typeutils.base.IntSerializer;
import org.apache.flink.api.common.typeutils.base.StringSerializer;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.api.java.tuple.Tuple2;
@@ -35,21 +35,19 @@ import org.apache.flink.runtime.state.OperatorStateHandle;
import org.apache.flink.runtime.state.StateSnapshotContextSynchronousImpl;
import org.apache.flink.runtime.state.VoidNamespace;
import org.apache.flink.runtime.state.VoidNamespaceSerializer;
-import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
import org.apache.flink.streaming.runtime.tasks.StreamTask;
import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
-import org.junit.Assert;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.internal.util.reflection.Whitebox;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@@ -261,18 +259,18 @@ public class AbstractStreamOperatorTest {
*/
@Test
public void testStateAndTimerStateShufflingScalingUp() throws Exception {
- final int MAX_PARALLELISM = 10;
+ final int maxParallelism = 10;
// first get two keys that will fall into different key-group ranges that go
// to different operator subtasks when we restore
// get two sub key-ranges so that we can restore two ranges separately
- KeyGroupRange subKeyGroupRange1 = new KeyGroupRange(0, (MAX_PARALLELISM / 2) - 1);
- KeyGroupRange subKeyGroupRange2 = new KeyGroupRange(subKeyGroupRange1.getEndKeyGroup() + 1, MAX_PARALLELISM - 1);
+ KeyGroupRange subKeyGroupRange1 = new KeyGroupRange(0, (maxParallelism / 2) - 1);
+ KeyGroupRange subKeyGroupRange2 = new KeyGroupRange(subKeyGroupRange1.getEndKeyGroup() + 1, maxParallelism - 1);
// get two different keys, one per sub range
- int key1 = getKeyInKeyGroupRange(subKeyGroupRange1, MAX_PARALLELISM);
- int key2 = getKeyInKeyGroupRange(subKeyGroupRange2, MAX_PARALLELISM);
+ int key1 = getKeyInKeyGroupRange(subKeyGroupRange1, maxParallelism);
+ int key2 = getKeyInKeyGroupRange(subKeyGroupRange2, maxParallelism);
TestOperator testOperator = new TestOperator();
@@ -281,7 +279,7 @@ public class AbstractStreamOperatorTest {
testOperator,
new TestKeySelector(),
BasicTypeInfo.INT_TYPE_INFO,
- MAX_PARALLELISM,
+ maxParallelism,
1, /* num subtasks */
0 /* subtask index */);
@@ -312,7 +310,7 @@ public class AbstractStreamOperatorTest {
testOperator1,
new TestKeySelector(),
BasicTypeInfo.INT_TYPE_INFO,
- MAX_PARALLELISM,
+ maxParallelism,
2, /* num subtasks */
0 /* subtask index */);
@@ -352,7 +350,7 @@ public class AbstractStreamOperatorTest {
testOperator2,
new TestKeySelector(),
BasicTypeInfo.INT_TYPE_INFO,
- MAX_PARALLELISM,
+ maxParallelism,
2, /* num subtasks */
1 /* subtask index */);
@@ -383,18 +381,18 @@ public class AbstractStreamOperatorTest {
@Test
public void testStateAndTimerStateShufflingScalingDown() throws Exception {
- final int MAX_PARALLELISM = 10;
+ final int maxParallelism = 10;
// first get two keys that will fall into different key-group ranges that go
// to different operator subtasks when we restore
// get two sub key-ranges so that we can restore two ranges separately
- KeyGroupRange subKeyGroupRange1 = new KeyGroupRange(0, (MAX_PARALLELISM / 2) - 1);
- KeyGroupRange subKeyGroupRange2 = new KeyGroupRange(subKeyGroupRange1.getEndKeyGroup() + 1, MAX_PARALLELISM - 1);
+ KeyGroupRange subKeyGroupRange1 = new KeyGroupRange(0, (maxParallelism / 2) - 1);
+ KeyGroupRange subKeyGroupRange2 = new KeyGroupRange(subKeyGroupRange1.getEndKeyGroup() + 1, maxParallelism - 1);
// get two different keys, one per sub range
- int key1 = getKeyInKeyGroupRange(subKeyGroupRange1, MAX_PARALLELISM);
- int key2 = getKeyInKeyGroupRange(subKeyGroupRange2, MAX_PARALLELISM);
+ int key1 = getKeyInKeyGroupRange(subKeyGroupRange1, maxParallelism);
+ int key2 = getKeyInKeyGroupRange(subKeyGroupRange2, maxParallelism);
TestOperator testOperator1 = new TestOperator();
@@ -403,7 +401,7 @@ public class AbstractStreamOperatorTest {
testOperator1,
new TestKeySelector(),
BasicTypeInfo.INT_TYPE_INFO,
- MAX_PARALLELISM,
+ maxParallelism,
2, /* num subtasks */
0 /* subtask index */);
@@ -420,11 +418,10 @@ public class AbstractStreamOperatorTest {
testOperator2,
new TestKeySelector(),
BasicTypeInfo.INT_TYPE_INFO,
- MAX_PARALLELISM,
+ maxParallelism,
2, /* num subtasks */
1 /* subtask index */);
-
testHarness2.setup();
testHarness2.open();
@@ -458,7 +455,7 @@ public class AbstractStreamOperatorTest {
testOperator3,
new TestKeySelector(),
BasicTypeInfo.INT_TYPE_INFO,
- MAX_PARALLELISM,
+ maxParallelism,
1, /* num subtasks */
0 /* subtask index */);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperatorLifecycleTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperatorLifecycleTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperatorLifecycleTest.java
index d331171..e8b4c9e 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperatorLifecycleTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperatorLifecycleTest.java
@@ -38,6 +38,7 @@ import org.apache.flink.streaming.runtime.streamstatus.StreamStatusMaintainer;
import org.apache.flink.streaming.runtime.tasks.SourceStreamTask;
import org.apache.flink.streaming.runtime.tasks.StreamTask;
import org.apache.flink.streaming.runtime.tasks.StreamTaskTest;
+
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/FoldApplyProcessWindowFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/FoldApplyProcessWindowFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/FoldApplyProcessWindowFunctionTest.java
index 90470ac..7dba4af 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/FoldApplyProcessWindowFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/FoldApplyProcessWindowFunctionTest.java
@@ -53,12 +53,16 @@ import org.apache.flink.streaming.runtime.operators.windowing.AccumulatingProces
import org.apache.flink.streaming.runtime.operators.windowing.functions.InternalIterableProcessAllWindowFunction;
import org.apache.flink.streaming.runtime.operators.windowing.functions.InternalIterableProcessWindowFunction;
import org.apache.flink.util.Collector;
+
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
+/**
+ * Tests for {@link FoldApplyProcessWindowFunction}.
+ */
public class FoldApplyProcessWindowFunctionTest {
/**
@@ -290,7 +294,7 @@ public class FoldApplyProcessWindowFunctionTest {
Assert.assertEquals(expected, result);
}
- public static class DummyKeyedStateStore implements KeyedStateStore {
+ private static class DummyKeyedStateStore implements KeyedStateStore {
@Override
public <T> ValueState<T> getState(ValueStateDescriptor<T> stateProperties) {
@@ -318,7 +322,7 @@ public class FoldApplyProcessWindowFunctionTest {
}
}
- public static class DummyStreamExecutionEnvironment extends StreamExecutionEnvironment {
+ private static class DummyStreamExecutionEnvironment extends StreamExecutionEnvironment {
@Override
public JobExecutionResult execute(String jobName) throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/FoldApplyWindowFunctionTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/FoldApplyWindowFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/FoldApplyWindowFunctionTest.java
index fecd440..7cf18dd 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/FoldApplyWindowFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/FoldApplyWindowFunctionTest.java
@@ -37,12 +37,16 @@ import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.streaming.runtime.operators.windowing.AccumulatingProcessingTimeWindowOperator;
import org.apache.flink.streaming.runtime.operators.windowing.functions.InternalIterableWindowFunction;
import org.apache.flink.util.Collector;
-import org.junit.Test;
+
import org.junit.Assert;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
+/**
+ * Tests for {@link FoldApplyWindowFunction}.
+ */
public class FoldApplyWindowFunctionTest {
/**
@@ -138,7 +142,7 @@ public class FoldApplyWindowFunctionTest {
Assert.assertEquals(expected, result);
}
- public static class DummyStreamExecutionEnvironment extends StreamExecutionEnvironment {
+ private static class DummyStreamExecutionEnvironment extends StreamExecutionEnvironment {
@Override
public JobExecutionResult execute(String jobName) throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/HeapInternalTimerServiceTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/HeapInternalTimerServiceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/HeapInternalTimerServiceTest.java
index 680f2ac..5a4f1c4 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/HeapInternalTimerServiceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/HeapInternalTimerServiceTest.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.operators;
import org.apache.flink.api.common.typeutils.base.IntSerializer;
@@ -26,6 +27,7 @@ import org.apache.flink.runtime.state.KeyGroupRangeAssignment;
import org.apache.flink.runtime.state.KeyGroupsList;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.streaming.runtime.tasks.TestProcessingTimeService;
+
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -46,7 +48,13 @@ import java.util.Set;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
/**
* Tests for {@link HeapInternalTimerService}.
@@ -111,7 +119,7 @@ public class HeapInternalTimerServiceTest {
for (int i = 0; i < totalNoOfTimers; i++) {
// create the timer to be registered
- InternalTimer<Integer, String> timer = new InternalTimer<>(10 + i, i, "hello_world_"+ i);
+ InternalTimer<Integer, String> timer = new InternalTimer<>(10 + i, i, "hello_world_" + i);
int keyGroupIdx = KeyGroupRangeAssignment.assignToKeyGroup(timer.getKey(), totalNoOfKeyGroups);
// add it in the adequate expected set of timers per keygroup
@@ -298,7 +306,6 @@ public class HeapInternalTimerServiceTest {
assertThat(processingTimeService.getActiveTimerTimestamps(), containsInAnyOrder(30L));
}
-
@Test
public void testCurrentProcessingTime() throws Exception {
@@ -673,7 +680,6 @@ public class HeapInternalTimerServiceTest {
@SuppressWarnings("unchecked")
Triggerable<Integer, String> mockTriggerable2 = mock(Triggerable.class);
-
TestKeyContext keyContext1 = new TestKeyContext();
TestKeyContext keyContext2 = new TestKeyContext();
@@ -696,7 +702,6 @@ public class HeapInternalTimerServiceTest {
subKeyGroupRange2,
maxParallelism);
-
processingTimeService1.setCurrentTime(10);
timerService1.advanceWatermark(10);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/KeyedProcessOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/KeyedProcessOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/KeyedProcessOperatorTest.java
index 32953fc..696acfa 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/KeyedProcessOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/KeyedProcessOperatorTest.java
@@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.api.operators;
+package org.apache.flink.streaming.api.operators;
import org.apache.flink.api.common.state.ValueStateDescriptor;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
@@ -32,6 +32,7 @@ import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.util.Collector;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import java.util.concurrent.ConcurrentLinkedQueue;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/OperatorSnapshotResultTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/OperatorSnapshotResultTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/OperatorSnapshotResultTest.java
index f57eed1..5a7e69e 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/OperatorSnapshotResultTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/OperatorSnapshotResultTest.java
@@ -21,6 +21,7 @@ package org.apache.flink.streaming.api.operators;
import org.apache.flink.runtime.state.KeyedStateHandle;
import org.apache.flink.runtime.state.OperatorStateHandle;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import java.util.concurrent.RunnableFuture;
@@ -29,6 +30,9 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.powermock.api.mockito.PowerMockito.when;
+/**
+ * Tests for {@link OperatorSnapshotResult}.
+ */
public class OperatorSnapshotResultTest extends TestLogger {
/**
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/ProcessOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/ProcessOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/ProcessOperatorTest.java
index c37fe48..35ab00c 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/ProcessOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/ProcessOperatorTest.java
@@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.api.operators;
+package org.apache.flink.streaming.api.operators;
import org.apache.flink.streaming.api.TimeDomain;
import org.apache.flink.streaming.api.functions.ProcessFunction;
@@ -26,6 +26,7 @@ import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.util.Collector;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -92,6 +93,7 @@ public class ProcessOperatorTest extends TestLogger {
testHarness.close();
}
+
private static class QueryingProcessFunction extends ProcessFunction<Integer, String> {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateDescriptorPassingTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateDescriptorPassingTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateDescriptorPassingTest.java
index 9b78b08..1e9b942 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateDescriptorPassingTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateDescriptorPassingTest.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.api.operators;
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.serializers.JavaSerializer;
-
import org.apache.flink.api.common.functions.FoldFunction;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.common.state.ListStateDescriptor;
@@ -43,17 +40,19 @@ import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.streaming.runtime.operators.windowing.WindowOperator;
import org.apache.flink.util.Collector;
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.serializers.JavaSerializer;
import org.junit.Test;
import java.io.File;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
/**
* Various tests around the proper passing of state descriptors to the operators
* and their serialization.
*
- * The tests use an arbitrary generic type to validate the behavior.
+ * <p>The tests use an arbitrary generic type to validate the behavior.
*/
@SuppressWarnings("serial")
public class StateDescriptorPassingTest {
@@ -266,7 +265,7 @@ public class StateDescriptorPassingTest {
assertTrue(descr instanceof ListStateDescriptor);
- ListStateDescriptor<?> listDescr = (ListStateDescriptor<?>)descr;
+ ListStateDescriptor<?> listDescr = (ListStateDescriptor<?>) descr;
// this would be the first statement to fail if state descriptors were not properly initialized
TypeSerializer<?> serializer = listDescr.getSerializer();
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateInitializationContextImplTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateInitializationContextImplTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateInitializationContextImplTest.java
index 3745031..1ba2e77 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateInitializationContextImplTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateInitializationContextImplTest.java
@@ -39,6 +39,7 @@ import org.apache.flink.runtime.state.StatePartitionStreamProvider;
import org.apache.flink.runtime.state.memory.ByteStreamStateHandle;
import org.apache.flink.runtime.util.LongArrayList;
import org.apache.flink.util.Preconditions;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -54,6 +55,9 @@ import java.util.Set;
import static org.mockito.Mockito.mock;
+/**
+ * Tests for {@link StateInitializationContextImpl}.
+ */
public class StateInitializationContextImplTest {
static final int NUM_HANDLES = 10;
@@ -67,7 +71,6 @@ public class StateInitializationContextImplTest {
@Before
public void setUp() throws Exception {
-
this.writtenKeyGroups = 0;
this.writtenOperatorStates = new HashSet<>();
@@ -204,7 +207,6 @@ public class StateInitializationContextImplTest {
int stopCount = NUM_HANDLES / 2;
boolean isClosed = false;
-
try {
for (KeyGroupStatePartitionStreamProvider stateStreamProvider
: initializationContext.getRawKeyedStateInputs()) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateSnapshotContextSynchronousImplTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateSnapshotContextSynchronousImplTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateSnapshotContextSynchronousImplTest.java
index 277ced5..099f1f9 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateSnapshotContextSynchronousImplTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StateSnapshotContextSynchronousImplTest.java
@@ -26,6 +26,7 @@ import org.apache.flink.runtime.state.OperatorStateCheckpointOutputStream;
import org.apache.flink.runtime.state.StateSnapshotContextSynchronousImpl;
import org.apache.flink.runtime.state.memory.MemCheckpointStreamFactory;
import org.apache.flink.util.TestLogger;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -40,6 +41,9 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.powermock.api.mockito.PowerMockito.when;
+/**
+ * Tests for {@link StateSnapshotContextSynchronousImpl}.
+ */
public class StateSnapshotContextSynchronousImplTest extends TestLogger {
private StateSnapshotContextSynchronousImpl snapshotContext;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamFilterTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamFilterTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamFilterTest.java
index 047aad8..8add242 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamFilterTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamFilterTest.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.api.common.functions.RichFilterFunction;
import org.apache.flink.configuration.Configuration;
@@ -26,9 +24,12 @@ import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
+
import org.junit.Assert;
import org.junit.Test;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
/**
* Tests for {@link StreamFilter}. These test that:
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamFlatMapTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamFlatMapTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamFlatMapTest.java
index e4e29c1..8ea1e12 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamFlatMapTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamFlatMapTest.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.common.functions.RichFlatMapFunction;
import org.apache.flink.configuration.Configuration;
@@ -27,9 +25,12 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.util.Collector;
+
import org.junit.Assert;
import org.junit.Test;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
/**
* Tests for {@link StreamMap}. These test that:
*
@@ -41,7 +42,7 @@ import org.junit.Test;
*/
public class StreamFlatMapTest {
- public static final class MyFlatMap implements FlatMapFunction<Integer, Integer> {
+ private static final class MyFlatMap implements FlatMapFunction<Integer, Integer> {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamGroupedFoldTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamGroupedFoldTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamGroupedFoldTest.java
index 05a910f..3ebb9ce 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamGroupedFoldTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamGroupedFoldTest.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.FoldFunction;
import org.apache.flink.api.common.functions.RichFoldFunction;
@@ -33,6 +31,8 @@ import org.apache.flink.streaming.util.TestHarnessUtil;
import org.junit.Test;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamGroupedReduceTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamGroupedReduceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamGroupedReduceTest.java
index b61c760..f1c9bca 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamGroupedReduceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/StreamGroupedReduceTest.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.common.functions.RichReduceFunction;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
@@ -31,9 +29,12 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
+
import org.junit.Assert;
import org.junit.Test;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
/**
* Tests for {@link StreamGroupedReduce}. These test that:
*
[07/10] flink git commit: [FLINK-6603] [streaming] Enable checkstyle
on test sources
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamRecordWriter.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamRecordWriter.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamRecordWriter.java
index 1c11a28..6775bc4 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamRecordWriter.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamRecordWriter.java
@@ -17,15 +17,16 @@
package org.apache.flink.streaming.runtime.io;
-import static org.apache.flink.util.Preconditions.checkArgument;
-
-import java.io.IOException;
import org.apache.flink.annotation.Internal;
import org.apache.flink.core.io.IOReadableWritable;
import org.apache.flink.runtime.io.network.api.writer.ChannelSelector;
import org.apache.flink.runtime.io.network.api.writer.RecordWriter;
import org.apache.flink.runtime.io.network.api.writer.ResultPartitionWriter;
+import java.io.IOException;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+
/**
* This record writer keeps data in buffers at most for a certain timeout. It spawns a separate thread
* that flushes the outputs in a defined interval, to make sure data does not linger in the buffers for too long.
@@ -48,8 +49,6 @@ public class StreamRecordWriter<T extends IOReadableWritable> extends RecordWrit
/** The exception encountered in the flushing thread. */
private Throwable flusherException;
-
-
public StreamRecordWriter(ResultPartitionWriter writer, ChannelSelector<T> channelSelector, long timeout) {
this(writer, channelSelector, timeout, null);
}
@@ -152,7 +151,6 @@ public class StreamRecordWriter<T extends IOReadableWritable> extends RecordWrit
private volatile boolean running = true;
-
OutputFlusher(String name, long timeout) {
super(name);
setDaemon(true);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamTwoInputProcessor.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamTwoInputProcessor.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamTwoInputProcessor.java
index 367b773..a25540d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamTwoInputProcessor.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamTwoInputProcessor.java
@@ -18,10 +18,6 @@
package org.apache.flink.streaming.runtime.io;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
-import java.io.IOException;
-import java.util.Collection;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.configuration.Configuration;
@@ -53,6 +49,11 @@ import org.apache.flink.streaming.runtime.streamstatus.StatusWatermarkValve;
import org.apache.flink.streaming.runtime.streamstatus.StreamStatus;
import org.apache.flink.streaming.runtime.streamstatus.StreamStatusMaintainer;
+import java.io.IOException;
+import java.util.Collection;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* Input reader for {@link org.apache.flink.streaming.runtime.tasks.TwoInputStreamTask}.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/CheckpointCommitter.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/CheckpointCommitter.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/CheckpointCommitter.java
index 455de3e..58139ba 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/CheckpointCommitter.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/CheckpointCommitter.java
@@ -15,12 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators;
-import java.io.Serializable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.Serializable;
+
/**
* This class is used to save information about which sink operator instance has committed checkpoints to a backend.
* <p/>
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java
index 35f420a..aed60e5 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java
@@ -15,14 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.UUID;
import org.apache.flink.api.common.state.ListState;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.core.fs.FSDataInputStream;
@@ -38,9 +33,17 @@ import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.Preconditions;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.UUID;
+
/**
* Generic Sink that emits its input elements into an arbitrary backend. This sink is integrated with Flink's checkpointing
* mechanism and can provide exactly-once guarantees; depending on the storage backend and sink/committer implementation.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPeriodicWatermarksOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPeriodicWatermarksOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPeriodicWatermarksOperator.java
index 8fe65cf..57e8321 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPeriodicWatermarksOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPeriodicWatermarksOperator.java
@@ -41,7 +41,6 @@ public class TimestampsAndPeriodicWatermarksOperator<T>
private transient long currentWatermark;
-
public TimestampsAndPeriodicWatermarksOperator(AssignerWithPeriodicWatermarks<T> assigner) {
super(assigner);
this.chainingStrategy = ChainingStrategy.ALWAYS;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPunctuatedWatermarksOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPunctuatedWatermarksOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPunctuatedWatermarksOperator.java
index 45a55de..0d39473 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPunctuatedWatermarksOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPunctuatedWatermarksOperator.java
@@ -38,7 +38,6 @@ public class TimestampsAndPunctuatedWatermarksOperator<T>
private long currentWatermark = Long.MIN_VALUE;
-
public TimestampsAndPunctuatedWatermarksOperator(AssignerWithPunctuatedWatermarks<T> assigner) {
super(assigner);
this.chainingStrategy = ChainingStrategy.ALWAYS;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/package-info.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/package-info.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/package-info.java
index ee5d7f1..3a6e33f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/package-info.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/package-info.java
@@ -19,4 +19,5 @@
* This package contains the operators that perform the stream transformations.
* One or more operators are bundled into a "chain" and executed in a stream task.
*/
+
package org.apache.flink.streaming.runtime.operators;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AbstractAlignedProcessingTimeWindowOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AbstractAlignedProcessingTimeWindowOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AbstractAlignedProcessingTimeWindowOperator.java
index 21e9e69..83a7528 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AbstractAlignedProcessingTimeWindowOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AbstractAlignedProcessingTimeWindowOperator.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.runtime.operators.windowing;
-import static java.util.Objects.requireNonNull;
-
-import org.apache.commons.math3.util.ArithmeticUtils;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.functions.Function;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -37,6 +34,10 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeCallback;
import org.apache.flink.util.MathUtils;
+import org.apache.commons.math3.util.ArithmeticUtils;
+
+import static java.util.Objects.requireNonNull;
+
/**
* Base class for special window operator implementation for windows that fire at the same time for
* all keys.
@@ -114,7 +115,6 @@ public abstract class AbstractAlignedProcessingTimeWindowOperator<KEY, IN, OUT,
this.numPanesPerWindow = MathUtils.checkedDownCast(windowLength / paneSlide);
}
-
protected abstract AbstractKeyedTimePanes<IN, KEY, STATE, OUT> createPanes(
KeySelector<IN, KEY> keySelector, Function function);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AbstractKeyedTimePanes.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AbstractKeyedTimePanes.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AbstractKeyedTimePanes.java
index b6affa6..f815107 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AbstractKeyedTimePanes.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AbstractKeyedTimePanes.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.runtime.operators.windowing;
-import java.io.IOException;
-import java.util.ArrayDeque;
-import java.util.Iterator;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.core.memory.DataInputView;
@@ -29,6 +26,10 @@ import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.Collector;
+import java.io.IOException;
+import java.util.ArrayDeque;
+import java.util.Iterator;
+
/**
* Base class for a multiple key/value maps organized in panes.
*/
@@ -51,7 +52,6 @@ public abstract class AbstractKeyedTimePanes<Type, Key, Aggregate, Result> {
public abstract void evaluateWindow(Collector<Result> out, TimeWindow window, AbstractStreamOperator<Result> operator) throws Exception;
-
public void dispose() {
// since all is heap data, there is no need to clean up anything
latestPane = null;
@@ -62,7 +62,6 @@ public abstract class AbstractKeyedTimePanes<Type, Key, Aggregate, Result> {
return previousPanes.size() + 1;
}
-
public void slidePanes(int panesToKeep) {
if (panesToKeep > 1) {
// the current pane becomes the latest previous pane
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingKeyedTimePanes.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingKeyedTimePanes.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingKeyedTimePanes.java
index 4511b6b..6892aaa 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingKeyedTimePanes.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingKeyedTimePanes.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.runtime.operators.windowing;
-import java.util.ArrayList;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.state.FoldingState;
import org.apache.flink.api.common.state.FoldingStateDescriptor;
@@ -39,6 +38,8 @@ import org.apache.flink.streaming.runtime.operators.windowing.functions.Internal
import org.apache.flink.util.Collector;
import org.apache.flink.util.UnionIterator;
+import java.util.ArrayList;
+
/**
* Key/value map organized in panes for accumulating windows (with a window function).
*/
@@ -129,7 +130,6 @@ public class AccumulatingKeyedTimePanes<Type, Key, Result> extends AbstractKeyed
this.context = context;
}
-
@Override
public void startNewKey(Key key) {
unionIterator.clear();
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingProcessingTimeWindowOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingProcessingTimeWindowOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingProcessingTimeWindowOperator.java
index 19474ec..d67121a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingProcessingTimeWindowOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingProcessingTimeWindowOperator.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.runtime.operators.windowing;
-import java.util.ArrayList;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.functions.Function;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -28,6 +27,8 @@ import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.streaming.runtime.operators.windowing.functions.InternalWindowFunction;
+import java.util.ArrayList;
+
/**
* Special window operator implementation for windows that fire at the same time for all keys with
* accumulating windows.
@@ -42,7 +43,6 @@ public class AccumulatingProcessingTimeWindowOperator<KEY, IN, OUT>
private static final long serialVersionUID = 7305948082830843475L;
-
public AccumulatingProcessingTimeWindowOperator(
InternalWindowFunction<Iterable<IN>, OUT, KEY, TimeWindow> function,
KeySelector<IN, KEY> keySelector,
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AggregatingProcessingTimeWindowOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AggregatingProcessingTimeWindowOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AggregatingProcessingTimeWindowOperator.java
index 724f306..6747383 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AggregatingProcessingTimeWindowOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/AggregatingProcessingTimeWindowOperator.java
@@ -38,7 +38,6 @@ public class AggregatingProcessingTimeWindowOperator<KEY, IN>
private static final long serialVersionUID = 7305948082830843475L;
-
public AggregatingProcessingTimeWindowOperator(
ReduceFunction<IN> function,
KeySelector<IN, KEY> keySelector,
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperator.java
index f9654e5..d78de09 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperator.java
@@ -15,14 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
-import static org.apache.flink.util.Preconditions.checkNotNull;
+package org.apache.flink.streaming.runtime.operators.windowing;
-import com.google.common.base.Function;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.Iterables;
-import java.util.Collection;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.api.common.state.AppendingState;
@@ -43,6 +38,14 @@ import org.apache.flink.streaming.runtime.operators.windowing.functions.Internal
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.OutputTag;
+import com.google.common.base.Function;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.Iterables;
+
+import java.util.Collection;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* A {@link WindowOperator} that also allows an {@link Evictor} to be used.
*
@@ -350,7 +353,6 @@ public class EvictingWindowOperator<K, IN, OUT, W extends Window>
userFunction.process(triggerContext.key, triggerContext.window, processContext, projectedContents, timestampedCollector);
evictorContext.evictAfter(recordsWithTimestamp, Iterables.size(recordsWithTimestamp));
-
//work around to fix FLINK-4369, remove the evicted elements from the windowState.
//this is inefficient, but there is no other way to remove elements from ListState, which is an AppendingState.
windowState.clear();
@@ -404,7 +406,6 @@ public class EvictingWindowOperator<K, IN, OUT, W extends Window>
return EvictingWindowOperator.this.getMetricGroup();
}
-
public K getKey() {
return key;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java
index 2fd1825..0595229 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java
@@ -18,13 +18,14 @@
package org.apache.flink.streaming.runtime.operators.windowing;
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.functions.ReduceFunction;
+import org.apache.flink.util.MathUtils;
+
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.NoSuchElementException;
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.api.common.functions.ReduceFunction;
-import org.apache.flink.util.MathUtils;
/**
* A special Hash Map implementation that can be traversed efficiently in sync with other
@@ -583,7 +584,6 @@ public class KeyMap<K, V> implements Iterable<KeyMap.Entry<K, V>> {
private CapacityDescendingComparator() {}
-
@Override
public int compare(KeyMap<?, ?> o1, KeyMap<?, ?> o2) {
// this sorts descending
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSet.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSet.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSet.java
index 5409571..10ac2a6 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSet.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSet.java
@@ -15,20 +15,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import org.apache.flink.api.common.state.ListState;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner;
import org.apache.flink.streaming.api.windowing.windows.Window;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* Utility for keeping track of merging {@link Window Windows} when using a
* {@link MergingWindowAssigner} in a {@link WindowOperator}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/TimestampedValue.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/TimestampedValue.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/TimestampedValue.java
index 108162b..4135cb0 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/TimestampedValue.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/TimestampedValue.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.annotation.PublicEvolving;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperator.java
index a62c9ff..880907d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperator.java
@@ -18,16 +18,6 @@
package org.apache.flink.streaming.runtime.operators.windowing;
-import static org.apache.flink.util.Preconditions.checkArgument;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-import java.util.PriorityQueue;
-import org.apache.commons.math3.util.ArithmeticUtils;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.api.common.state.AppendingState;
@@ -82,6 +72,18 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.OutputTag;
import org.apache.flink.util.Preconditions;
+import org.apache.commons.math3.util.ArithmeticUtils;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.List;
+import java.util.PriorityQueue;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* An operator that implements the logic for windowing based on a {@link WindowAssigner} and
* {@link Trigger}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessAllWindowFunction.java
index 2490d60..3d58156 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessAllWindowFunction.java
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
-import java.util.Collections;
import org.apache.flink.api.common.functions.AggregateFunction;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
import org.apache.flink.api.common.functions.RuntimeContext;
@@ -27,6 +27,8 @@ import org.apache.flink.streaming.api.functions.windowing.ProcessAllWindowFuncti
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* Internal window function for wrapping a {@link ProcessAllWindowFunction} that takes an
* {@code Iterable} and an {@link AggregateFunction}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessWindowFunction.java
index c69ec53..e2dfe3f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessWindowFunction.java
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
-import java.util.Collections;
import org.apache.flink.api.common.functions.AggregateFunction;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
import org.apache.flink.api.common.functions.RuntimeContext;
@@ -26,6 +26,8 @@ import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* Internal window function for wrapping a {@link ProcessWindowFunction} that takes an
* {@code Iterable} and an {@link AggregateFunction}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableAllWindowFunction.java
index f2507ed..5d92112 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableAllWindowFunction.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableProcessAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableProcessAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableProcessAllWindowFunction.java
index 47b7d55..6d4ce5c 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableProcessAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableProcessAllWindowFunction.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableProcessWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableProcessWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableProcessWindowFunction.java
index 7eb015e..cb64d85 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableProcessWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableProcessWindowFunction.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableWindowFunction.java
index e2f1517..1506b77 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalIterableWindowFunction.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalProcessAllWindowContext.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalProcessAllWindowContext.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalProcessAllWindowContext.java
index c70e161..66ec656 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalProcessAllWindowContext.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalProcessAllWindowContext.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalProcessWindowContext.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalProcessWindowContext.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalProcessWindowContext.java
index d575f01..9505332 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalProcessWindowContext.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalProcessWindowContext.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueAllWindowFunction.java
index 03ad0bd..9acef74 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueAllWindowFunction.java
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
-import java.util.Collections;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.api.java.operators.translation.WrappingFunction;
@@ -25,6 +25,8 @@ import org.apache.flink.streaming.api.functions.windowing.AllWindowFunction;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* Internal window function for wrapping an {@link AllWindowFunction} that takes an {@code Iterable}
* when the window state is a single value.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueProcessAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueProcessAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueProcessAllWindowFunction.java
index eeef8eb..ddadbdf 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueProcessAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueProcessAllWindowFunction.java
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
-import java.util.Collections;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.api.java.operators.translation.WrappingFunction;
@@ -26,6 +26,8 @@ import org.apache.flink.streaming.api.functions.windowing.ProcessAllWindowFuncti
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* Internal window function for wrapping a {@link ProcessAllWindowFunction} that takes an {@code Iterable}
* when the window state is a single value.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueProcessWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueProcessWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueProcessWindowFunction.java
index 490069c..52b95b1 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueProcessWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueProcessWindowFunction.java
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
-import java.util.Collections;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.api.java.operators.translation.WrappingFunction;
@@ -25,6 +25,8 @@ import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* Internal window function for wrapping a {@link ProcessWindowFunction} that takes an {@code Iterable}
* when the window state is a single value.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueWindowFunction.java
index a629c76..9b0eccf 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalSingleValueWindowFunction.java
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
-import java.util.Collections;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.api.java.operators.translation.WrappingFunction;
@@ -25,6 +25,8 @@ import org.apache.flink.streaming.api.functions.windowing.WindowFunction;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* Internal window function for wrapping a {@link WindowFunction} that takes an {@code Iterable}
* when the window state is a single value.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalWindowFunction.java
index ea64dda..0999565 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalWindowFunction.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing.functions;
import org.apache.flink.api.common.functions.Function;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/package-info.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/package-info.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/package-info.java
index 229812c..0944b16 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/package-info.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/package-info.java
@@ -19,4 +19,5 @@
* This package contains the operators that implement the various window operations
* on data streams.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitioner.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitioner.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitioner.java
index 87243fc..60c3fbc 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitioner.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitioner.java
@@ -17,12 +17,12 @@
package org.apache.flink.streaming.runtime.partitioner;
-import java.util.Random;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.plugable.SerializationDelegate;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import java.util.Random;
+
/**
* Partitioner that distributes the data equally by selecting one output channel
* randomly.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/StreamPartitioner.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/StreamPartitioner.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/StreamPartitioner.java
index 415a3c7..411aa8b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/StreamPartitioner.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/StreamPartitioner.java
@@ -14,15 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.partitioner;
-import java.io.Serializable;
+package org.apache.flink.streaming.runtime.partitioner;
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.io.network.api.writer.ChannelSelector;
import org.apache.flink.runtime.plugable.SerializationDelegate;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import java.io.Serializable;
+
/**
* A special {@link ChannelSelector} for use in streaming programs.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/LatencyMarker.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/LatencyMarker.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/LatencyMarker.java
index 131658d..84af297 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/LatencyMarker.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/LatencyMarker.java
@@ -65,7 +65,6 @@ public final class LatencyMarker extends StreamElement {
// ------------------------------------------------------------------------
-
@Override
public boolean equals(Object o) {
if (this == o) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializer.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializer.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializer.java
index 390ac9d..b3ecded 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializer.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializer.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.runtime.streamrecord;
-import static java.util.Objects.requireNonNull;
-
-import java.io.IOException;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.CompatibilityResult;
import org.apache.flink.api.common.typeutils.CompatibilityUtil;
@@ -35,6 +32,10 @@ import org.apache.flink.core.memory.DataOutputView;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamstatus.StreamStatus;
+import java.io.IOException;
+
+import static java.util.Objects.requireNonNull;
+
/**
* Serializer for {@link StreamRecord}, {@link Watermark}, {@link LatencyMarker}, and
* {@link StreamStatus}.
@@ -58,7 +59,6 @@ public final class StreamElementSerializer<T> extends TypeSerializer<StreamEleme
private final TypeSerializer<T> typeSerializer;
-
public StreamElementSerializer(TypeSerializer<T> serializer) {
if (serializer instanceof StreamElementSerializer) {
throw new RuntimeException("StreamRecordSerializer given to StreamRecordSerializer as value TypeSerializer: " + serializer);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValve.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValve.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValve.java
index 487fd8a..1444a9d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValve.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValve.java
@@ -18,12 +18,12 @@
package org.apache.flink.streaming.runtime.streamstatus;
-import static org.apache.flink.util.Preconditions.checkArgument;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.watermark.Watermark;
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* A {@code StatusWatermarkValve} embodies the logic of how {@link Watermark} and {@link StreamStatus} are propagated to
* downstream outputs, given a set of one or multiple input channels that continuously receive them. Usages of this
@@ -40,6 +40,7 @@ public class StatusWatermarkValve {
*/
public interface ValveOutputHandler {
void handleWatermark(Watermark watermark);
+
void handleStreamStatus(StreamStatus streamStatus);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusMaintainer.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusMaintainer.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusMaintainer.java
index d964cef..6854afd 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusMaintainer.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusMaintainer.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.streamstatus;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusProvider.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusProvider.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusProvider.java
index ae8d9af..afc572d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusProvider.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusProvider.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.streamstatus;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ExceptionInChainedOperatorException.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ExceptionInChainedOperatorException.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ExceptionInChainedOperatorException.java
index d4027bf..4f5f6d2 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ExceptionInChainedOperatorException.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ExceptionInChainedOperatorException.java
@@ -18,11 +18,11 @@
package org.apache.flink.streaming.runtime.tasks;
-import static java.util.Objects.requireNonNull;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.util.WrappingRuntimeException;
+import static java.util.Objects.requireNonNull;
+
/**
* A special exception that signifies that the cause exception came from a chained operator.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorChain.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorChain.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorChain.java
index 870c2ed..0f29b73 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorChain.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorChain.java
@@ -17,13 +17,6 @@
package org.apache.flink.streaming.runtime.tasks;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.java.tuple.Tuple2;
@@ -59,6 +52,13 @@ import org.apache.flink.util.XORShiftRandom;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
/**
* The {@code OperatorChain} contains all operators that are executed as one chain within a single
* {@link StreamTask}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorStateHandles.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorStateHandles.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorStateHandles.java
index 988ae7f..1a79f54 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorStateHandles.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorStateHandles.java
@@ -18,8 +18,6 @@
package org.apache.flink.streaming.runtime.tasks;
-import java.util.Collection;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.runtime.state.ChainedStateHandle;
@@ -30,6 +28,9 @@ import org.apache.flink.runtime.state.TaskStateHandles;
import org.apache.flink.util.CollectionUtil;
import org.apache.flink.util.Preconditions;
+import java.util.Collection;
+import java.util.List;
+
/**
* This class holds all state handles for one operator.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTask.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTask.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTask.java
index 31cd7c1..a36e015 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTask.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTask.java
@@ -89,7 +89,6 @@ public class SourceStreamTask<OUT, SRC extends SourceFunction<OUT>, OP extends S
// does not hold any resources, so no cleanup needed
}
-
@Override
protected void run() throws Exception {
headOperator.run(getCheckpointLock(), getStreamStatusMaintainer());
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StoppableSourceStreamTask.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StoppableSourceStreamTask.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StoppableSourceStreamTask.java
index 7ff39b7..d2a3f4d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StoppableSourceStreamTask.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StoppableSourceStreamTask.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.tasks;
import org.apache.flink.api.common.functions.StoppableFunction;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java
index 859e32e..b800206 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java
@@ -17,18 +17,20 @@
package org.apache.flink.streaming.runtime.tasks;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.TimeUnit;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.JobID;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.io.BlockingQueueBroker;
import org.apache.flink.streaming.runtime.io.RecordWriterOutput;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+
/**
* A special {@link StreamTask} that is used for executing feedback edges. This is used in
* combination with {@link StreamIterationTail}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationTail.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationTail.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationTail.java
index df5edb1..d2ec08f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationTail.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationTail.java
@@ -17,9 +17,6 @@
package org.apache.flink.streaming.runtime.tasks;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.TimeUnit;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
@@ -29,9 +26,13 @@ import org.apache.flink.streaming.runtime.io.BlockingQueueBroker;
import org.apache.flink.streaming.runtime.streamrecord.LatencyMarker;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.OutputTag;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+
/**
* A special {@link StreamTask} that is used for executing feedback edges. This is used in
* combination with {@link StreamIterationHead}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
index bc66751..4dd708f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
@@ -17,17 +17,6 @@
package org.apache.flink.streaming.runtime.tasks;
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.RunnableFuture;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicReference;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.accumulators.Accumulator;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -68,9 +57,22 @@ import org.apache.flink.util.CollectionUtil;
import org.apache.flink.util.ExceptionUtils;
import org.apache.flink.util.FutureUtil;
import org.apache.flink.util.Preconditions;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.RunnableFuture;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicReference;
+
/**
* Base class for all streaming tasks. A task is the unit of local processing that is deployed
* and executed by the TaskManagers. Each task runs one or more {@link StreamOperator}s which form
@@ -833,7 +835,6 @@ public abstract class StreamTask<OUT, OP extends StreamOperator<OUT>>
// Utilities
// ------------------------------------------------------------------------
-
@Override
public String toString() {
return getName();
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeService.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeService.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeService.java
index 139c619..d00c1b9 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeService.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeService.java
@@ -17,7 +17,10 @@
package org.apache.flink.streaming.runtime.tasks;
-import static org.apache.flink.util.Preconditions.checkNotNull;
+import org.apache.flink.annotation.VisibleForTesting;
+import org.apache.flink.util.Preconditions;
+
+import javax.annotation.Nonnull;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CancellationException;
@@ -29,9 +32,8 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
-import javax.annotation.Nonnull;
-import org.apache.flink.annotation.VisibleForTesting;
-import org.apache.flink.util.Preconditions;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
/**
* A {@link ProcessingTimeService} which assigns as current processing time the result of calling
@@ -56,7 +58,6 @@ public class SystemProcessingTimeService extends ProcessingTimeService {
private final AtomicInteger status;
-
public SystemProcessingTimeService(AsyncExceptionHandler failureHandler, Object checkpointLock) {
this(failureHandler, checkpointLock, null);
}
@@ -273,7 +274,6 @@ public class SystemProcessingTimeService extends ProcessingTimeService {
private volatile boolean canceled;
-
private NeverCompleteFuture(long delayMillis) {
this.delayMillis = delayMillis;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TestProcessingTimeService.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TestProcessingTimeService.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TestProcessingTimeService.java
index 7beba5c..a9d5205 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TestProcessingTimeService.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TestProcessingTimeService.java
@@ -17,6 +17,9 @@
package org.apache.flink.streaming.runtime.tasks;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.util.Preconditions;
+
import java.util.Comparator;
import java.util.HashSet;
import java.util.PriorityQueue;
@@ -27,8 +30,6 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.flink.api.java.tuple.Tuple2;
-import org.apache.flink.util.Preconditions;
/**
* This is a {@link ProcessingTimeService} used <b>strictly for testing</b> the
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TimerException.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TimerException.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TimerException.java
index 0bd78ac..9b1b721 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TimerException.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TimerException.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.tasks;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTask.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTask.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTask.java
index 7214201..68722db 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTask.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TwoInputStreamTask.java
@@ -17,9 +17,6 @@
package org.apache.flink.streaming.runtime.tasks;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.runtime.io.network.partition.consumer.InputGate;
@@ -28,6 +25,9 @@ import org.apache.flink.streaming.api.graph.StreamEdge;
import org.apache.flink.streaming.api.operators.TwoInputStreamOperator;
import org.apache.flink.streaming.runtime.io.StreamTwoInputProcessor;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* A {@link StreamTask} for executing a {@link TwoInputStreamOperator}.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/package-info.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/package-info.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/package-info.java
index a1179ff..1a97f23 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/package-info.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/package-info.java
@@ -24,4 +24,5 @@
* <p>The tasks merely set up the distributed stream coordination and the checkpointing.
* Internally, the tasks create one or more operators, perform the stream transformations.
*/
+
package org.apache.flink.streaming.runtime.tasks;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/HDFSCopyFromLocal.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/HDFSCopyFromLocal.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/HDFSCopyFromLocal.java
index 1f44dc6..833c13b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/HDFSCopyFromLocal.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/HDFSCopyFromLocal.java
@@ -15,16 +15,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
-import java.io.File;
-import java.net.URI;
import org.apache.flink.api.java.tuple.Tuple1;
import org.apache.flink.runtime.fs.hdfs.HadoopFileSystem;
+
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
+import java.io.File;
+import java.net.URI;
+
/**
* Utility for copying from local file system to a HDFS {@link FileSystem}.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/HDFSCopyToLocal.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/HDFSCopyToLocal.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/HDFSCopyToLocal.java
index 0a006f1..e3b45ed 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/HDFSCopyToLocal.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/HDFSCopyToLocal.java
@@ -15,16 +15,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.util;
-import java.io.File;
-import java.net.URI;
import org.apache.flink.api.java.tuple.Tuple1;
import org.apache.flink.runtime.fs.hdfs.HadoopFileSystem;
+
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
+import java.io.File;
+import java.net.URI;
+
/**
* Utility for copying from a HDFS {@link FileSystem} to the local file system.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/functions/StreamingFunctionUtils.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/functions/StreamingFunctionUtils.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/functions/StreamingFunctionUtils.java
index 36abd47..4482431 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/functions/StreamingFunctionUtils.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/functions/StreamingFunctionUtils.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.util.functions;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.Function;
@@ -36,6 +33,10 @@ import org.apache.flink.streaming.api.checkpoint.ListCheckpointed;
import org.apache.flink.streaming.api.operators.OutputTypeConfigurable;
import org.apache.flink.util.Preconditions;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Utility class that contains helper methods to work with Flink Streaming
* {@link Function Functions}. This is similar to
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/keys/KeySelectorUtil.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/keys/KeySelectorUtil.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/keys/KeySelectorUtil.java
index e148a0b..27ce573 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/keys/KeySelectorUtil.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/keys/KeySelectorUtil.java
@@ -17,10 +17,6 @@
package org.apache.flink.streaming.util.keys;
-import static java.util.Objects.requireNonNull;
-
-import java.lang.reflect.Array;
-import java.util.Arrays;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.InvalidTypesException;
@@ -36,6 +32,11 @@ import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.api.java.typeutils.ResultTypeQueryable;
import org.apache.flink.api.java.typeutils.TupleTypeInfo;
+import java.lang.reflect.Array;
+import java.util.Arrays;
+
+import static java.util.Objects.requireNonNull;
+
/**
* Utility class that contains helper methods to manipulating {@link KeySelector} for streaming.
*/
@@ -89,7 +90,6 @@ public final class KeySelectorUtil {
return new ArrayKeySelector<>(positions, new TupleTypeInfo<>(primitiveInfos));
}
-
public static <X, K> KeySelector<X, K> getSelectorForOneKey(
Keys<X> keys, Partitioner<K> partitioner, TypeInformation<X> typeInfo, ExecutionConfig executionConfig) {
if (!(typeInfo instanceof CompositeType)) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/AbstractDeserializationSchema.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/AbstractDeserializationSchema.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/AbstractDeserializationSchema.java
index d394e9b..02ea004 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/AbstractDeserializationSchema.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/AbstractDeserializationSchema.java
@@ -18,10 +18,11 @@
package org.apache.flink.streaming.util.serialization;
-import java.io.IOException;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.typeutils.TypeExtractor;
+import java.io.IOException;
+
/**
* The deserialization schema describes how to turn the byte messages delivered by certain
* data sources (for example Apache Kafka) into data types (Java/Scala objects) that are
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/DeserializationSchema.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/DeserializationSchema.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/DeserializationSchema.java
index 57cb27e..15ecb2c 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/DeserializationSchema.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/DeserializationSchema.java
@@ -17,12 +17,12 @@
package org.apache.flink.streaming.util.serialization;
-import java.io.IOException;
-import java.io.Serializable;
-
import org.apache.flink.annotation.Public;
import org.apache.flink.api.java.typeutils.ResultTypeQueryable;
+import java.io.IOException;
+import java.io.Serializable;
+
/**
* The deserialization schema describes how to turn the byte messages delivered by certain
* data sources (for example Apache Kafka) into data types (Java/Scala objects) that are
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/SerializationSchema.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/SerializationSchema.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/SerializationSchema.java
index 95428f6..986cfb3 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/SerializationSchema.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/SerializationSchema.java
@@ -17,9 +17,10 @@
package org.apache.flink.streaming.util.serialization;
-import java.io.Serializable;
import org.apache.flink.annotation.Public;
+import java.io.Serializable;
+
/**
* The serialization schema describes how to turn a data object into a different serialized
* representation. Most data sinks (for example Apache Kafka) require the data to be handed
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/SimpleStringSchema.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/SimpleStringSchema.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/SimpleStringSchema.java
index e25daeb..27ba9e9 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/SimpleStringSchema.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/SimpleStringSchema.java
@@ -17,15 +17,16 @@
package org.apache.flink.streaming.util.serialization;
-import static org.apache.flink.util.Preconditions.checkNotNull;
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
-import org.apache.flink.annotation.PublicEvolving;
-import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
-import org.apache.flink.api.common.typeinfo.TypeInformation;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
/**
* Very simple serialization schema for strings.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/TypeInformationSerializationSchema.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/TypeInformationSerializationSchema.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/TypeInformationSerializationSchema.java
index 49ad52f..b187b04 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/TypeInformationSerializationSchema.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/serialization/TypeInformationSerializationSchema.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.util.serialization;
-import java.io.IOException;
import org.apache.flink.annotation.Public;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeinfo.TypeInformation;
@@ -26,6 +25,8 @@ import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.runtime.util.DataInputDeserializer;
import org.apache.flink.runtime.util.DataOutputSerializer;
+import java.io.IOException;
+
/**
* A serialization and deserialization schema that uses Flink's serialization stack to
* transform typed from and to byte arrays.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/typeutils/FieldAccessor.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/typeutils/FieldAccessor.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/typeutils/FieldAccessor.java
index 90c89ac..d165e25 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/typeutils/FieldAccessor.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/typeutils/FieldAccessor.java
@@ -17,14 +17,6 @@
package org.apache.flink.streaming.util.typeutils;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
@@ -35,8 +27,18 @@ import org.apache.flink.api.java.typeutils.TupleTypeInfo;
import org.apache.flink.api.java.typeutils.TupleTypeInfoBase;
import org.apache.flink.api.java.typeutils.runtime.FieldSerializer;
import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase;
+
import scala.Product;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* These classes encapsulate the logic of accessing a field specified by the user as either an index
@@ -333,7 +335,6 @@ public abstract class FieldAccessor<T, F> implements Serializable {
}
}
-
static final class RecursiveProductFieldAccessor<T, R, F> extends FieldAccessor<T, F> {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/typeutils/FieldAccessorFactory.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/typeutils/FieldAccessorFactory.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/typeutils/FieldAccessorFactory.java
index c46422f..4447829 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/typeutils/FieldAccessorFactory.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/util/typeutils/FieldAccessorFactory.java
@@ -17,9 +17,6 @@
package org.apache.flink.streaming.util.typeutils;
-import java.io.Serializable;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.operators.Keys;
@@ -33,6 +30,10 @@ import org.apache.flink.api.java.typeutils.PojoTypeInfo;
import org.apache.flink.api.java.typeutils.TupleTypeInfo;
import org.apache.flink.api.java.typeutils.TupleTypeInfoBase;
+import java.io.Serializable;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* Static factories for the {@link FieldAccessor} utilities.
[08/10] flink git commit: [FLINK-6603] [streaming] Enable checkstyle
on test sources
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/Output.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/Output.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/Output.java
index 7035d28..cabfebb 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/Output.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/Output.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.operators;
import org.apache.flink.annotation.PublicEvolving;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/ProcessOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/ProcessOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/ProcessOperator.java
index bbb1cb7..f08c1ee 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/ProcessOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/ProcessOperator.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import static org.apache.flink.util.Preconditions.checkState;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.TimerService;
import org.apache.flink.streaming.api.functions.ProcessFunction;
@@ -27,6 +25,8 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.util.OutputTag;
+import static org.apache.flink.util.Preconditions.checkState;
+
/**
* A {@link org.apache.flink.streaming.api.operators.StreamOperator} for executing
* {@link ProcessFunction ProcessFunctions}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedFold.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedFold.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedFold.java
index 07c5c90..29439a2 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedFold.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedFold.java
@@ -17,10 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.FoldFunction;
@@ -32,6 +28,10 @@ import org.apache.flink.core.memory.DataInputViewStreamWrapper;
import org.apache.flink.core.memory.DataOutputViewStreamWrapper;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
/**
* A {@link StreamOperator} for executing a {@link FoldFunction} on a
* {@link org.apache.flink.streaming.api.datastream.KeyedStream}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedReduce.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedReduce.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedReduce.java
index fb5a789..7338e1c 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedReduce.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedReduce.java
@@ -41,7 +41,6 @@ public class StreamGroupedReduce<IN> extends AbstractUdfStreamOperator<IN, Reduc
private TypeSerializer<IN> serializer;
-
public StreamGroupedReduce(ReduceFunction<IN> reducer, TypeSerializer<IN> serializer) {
super(reducer);
this.serializer = serializer;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamOperator.java
index 1894ca2..61578b2 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamOperator.java
@@ -17,7 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import java.io.Serializable;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.metrics.MetricGroup;
import org.apache.flink.runtime.checkpoint.CheckpointOptions;
@@ -27,6 +26,8 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
import org.apache.flink.streaming.runtime.tasks.StreamTask;
+import java.io.Serializable;
+
/**
* Basic interface for stream operators. Implementers would implement one of
* {@link org.apache.flink.streaming.api.operators.OneInputStreamOperator} or
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamProject.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamProject.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamProject.java
index acc84d0..6cc08b4 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamProject.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamProject.java
@@ -46,7 +46,6 @@ public class StreamProject<IN, OUT extends Tuple>
chainingStrategy = ChainingStrategy.ALWAYS;
}
-
@Override
public void processElement(StreamRecord<IN> element) throws Exception {
for (int i = 0; i < this.numFields; i++) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java
index b7f0d80..744c90a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java
@@ -17,7 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import java.util.concurrent.ScheduledFuture;
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.functions.source.SourceFunction;
@@ -28,6 +27,8 @@ import org.apache.flink.streaming.runtime.streamstatus.StreamStatusMaintainer;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeCallback;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
+import java.util.concurrent.ScheduledFuture;
+
/**
* {@link StreamOperator} for streaming sources.
*
@@ -44,7 +45,6 @@ public class StreamSource<OUT, SRC extends SourceFunction<OUT>>
private transient volatile boolean canceledOrStopped = false;
-
public StreamSource(SRC sourceFunction) {
super(sourceFunction);
@@ -55,7 +55,6 @@ public class StreamSource<OUT, SRC extends SourceFunction<OUT>>
run(lockingObject, streamStatusMaintainer, output);
}
-
public void run(final Object lockingObject,
final StreamStatusMaintainer streamStatusMaintainer,
final Output<StreamRecord<OUT>> collector) throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSourceContexts.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSourceContexts.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSourceContexts.java
index 3401eb9..e15aaca 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSourceContexts.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSourceContexts.java
@@ -17,7 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import java.util.concurrent.ScheduledFuture;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.functions.source.SourceFunction;
import org.apache.flink.streaming.api.watermark.Watermark;
@@ -28,6 +27,8 @@ import org.apache.flink.streaming.runtime.tasks.ProcessingTimeCallback;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.util.Preconditions;
+import java.util.concurrent.ScheduledFuture;
+
/**
* Source contexts for various stream time characteristics.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContext.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContext.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContext.java
index 0db1c68..bd3d500 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContext.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContext.java
@@ -18,8 +18,6 @@
package org.apache.flink.streaming.api.operators;
-import java.util.List;
-import java.util.Map;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.accumulators.Accumulator;
import org.apache.flink.api.common.functions.BroadcastVariableInitializer;
@@ -43,6 +41,9 @@ import org.apache.flink.streaming.api.graph.StreamConfig;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.util.Preconditions;
+import java.util.List;
+import java.util.Map;
+
/**
* Implementation of the {@link org.apache.flink.api.common.functions.RuntimeContext},
* for streaming operators.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/Triggerable.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/Triggerable.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/Triggerable.java
index 48b18b3..2c4a194 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/Triggerable.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/Triggerable.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.operators;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperator.java
index 17dec23..56c199d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperator.java
@@ -18,12 +18,6 @@
package org.apache.flink.streaming.api.operators.async;
-import java.util.Collection;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.state.ListState;
import org.apache.flink.api.common.state.ListStateDescriptor;
@@ -55,6 +49,13 @@ import org.apache.flink.streaming.runtime.tasks.StreamTask;
import org.apache.flink.util.ExceptionUtils;
import org.apache.flink.util.Preconditions;
+import java.util.Collection;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
/**
* The {@link AsyncWaitOperator} allows to asynchronously process incoming stream records. For that
* the operator creates an {@link AsyncCollector} which is passed to an {@link AsyncFunction}.
@@ -113,7 +114,6 @@ public class AsyncWaitOperator<IN, OUT>
/** Thread running the emitter. */
private transient Thread emitterThread;
-
public AsyncWaitOperator(
AsyncFunction<IN, OUT> asyncFunction,
long timeout,
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/Emitter.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/Emitter.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/Emitter.java
index d2f7725..2204109 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/Emitter.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/Emitter.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.api.operators.async;
-import java.util.Collection;
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.operators.Output;
import org.apache.flink.streaming.api.operators.TimestampedCollector;
@@ -28,9 +27,12 @@ import org.apache.flink.streaming.api.operators.async.queue.AsyncWatermarkResult
import org.apache.flink.streaming.api.operators.async.queue.StreamElementQueue;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.Preconditions;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.Collection;
+
/**
* Runnable responsible for consuming elements from the given queue and outputting them to the
* given output/timestampedCollector.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/AsyncCollectionResult.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/AsyncCollectionResult.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/AsyncCollectionResult.java
index 152b9fd..6226ae6 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/AsyncCollectionResult.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/AsyncCollectionResult.java
@@ -18,9 +18,10 @@
package org.apache.flink.streaming.api.operators.async.queue;
-import java.util.Collection;
import org.apache.flink.annotation.Internal;
+import java.util.Collection;
+
/**
* {@link AsyncResult} sub class for asynchronous result collections.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueue.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueue.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueue.java
index d326763..e573fc1 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueue.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueue.java
@@ -18,19 +18,21 @@
package org.apache.flink.streaming.api.operators.async.queue;
-import java.util.ArrayDeque;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.concurrent.Executor;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.concurrent.AcceptFunction;
import org.apache.flink.streaming.api.operators.async.OperatorActions;
import org.apache.flink.util.Preconditions;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.ArrayDeque;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.concurrent.Executor;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+
/**
* Ordered {@link StreamElementQueue} implementation. The ordered stream element queue emits
* asynchronous results in the order in which the {@link StreamElementQueueEntry} have been added
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueue.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueue.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueue.java
index cc637b5..e02b8b0 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueue.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueue.java
@@ -18,10 +18,11 @@
package org.apache.flink.streaming.api.operators.async.queue;
-import java.util.Collection;
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.operators.async.AsyncWaitOperator;
+import java.util.Collection;
+
/**
* Interface for blocking stream element queues for the {@link AsyncWaitOperator}.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueEntry.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueEntry.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueEntry.java
index 4a50201..67b1f0f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueEntry.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueEntry.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.api.operators.async.queue;
-import java.util.concurrent.Executor;
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.concurrent.AcceptFunction;
import org.apache.flink.runtime.concurrent.BiFunction;
@@ -26,6 +25,8 @@ import org.apache.flink.runtime.concurrent.Future;
import org.apache.flink.streaming.runtime.streamrecord.StreamElement;
import org.apache.flink.util.Preconditions;
+import java.util.concurrent.Executor;
+
/**
* Entry class for the {@link StreamElementQueue}. The stream element queue entry stores the
* {@link StreamElement} for which the stream element queue entry has been instantiated.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamRecordQueueEntry.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamRecordQueueEntry.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamRecordQueueEntry.java
index e71459a..708bf17 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamRecordQueueEntry.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamRecordQueueEntry.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.api.operators.async.queue;
-import java.util.Collection;
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.concurrent.CompletableFuture;
import org.apache.flink.runtime.concurrent.Future;
@@ -27,6 +26,8 @@ import org.apache.flink.streaming.api.functions.async.AsyncFunction;
import org.apache.flink.streaming.api.functions.async.collector.AsyncCollector;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import java.util.Collection;
+
/**
* {@link StreamElementQueueEntry} implementation for {@link StreamRecord}. This class also acts
* as the {@link AsyncCollector} implementation which is given to the {@link AsyncFunction}. The
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueue.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueue.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueue.java
index 6334c49..c9dc358 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueue.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueue.java
@@ -18,6 +18,14 @@
package org.apache.flink.streaming.api.operators.async.queue;
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.runtime.concurrent.AcceptFunction;
+import org.apache.flink.streaming.api.operators.async.OperatorActions;
+import org.apache.flink.util.Preconditions;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Collection;
@@ -27,12 +35,6 @@ import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.runtime.concurrent.AcceptFunction;
-import org.apache.flink.streaming.api.operators.async.OperatorActions;
-import org.apache.flink.util.Preconditions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Unordered implementation of the {@link StreamElementQueue}. The unordered stream element queue
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/CoProcessOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/CoProcessOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/CoProcessOperator.java
index 4d81f1e..63ddb3f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/CoProcessOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/CoProcessOperator.java
@@ -17,9 +17,6 @@
package org.apache.flink.streaming.api.operators.co;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-import static org.apache.flink.util.Preconditions.checkState;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.TimerService;
import org.apache.flink.streaming.api.functions.co.CoProcessFunction;
@@ -31,6 +28,9 @@ import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+import static org.apache.flink.util.Preconditions.checkState;
+
/**
* A {@link org.apache.flink.streaming.api.operators.StreamOperator} for executing
* {@link CoProcessFunction CoProcessFunctions}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperator.java
index 290bb3c..d125a79 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperator.java
@@ -17,9 +17,6 @@
package org.apache.flink.streaming.api.operators.co;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-import static org.apache.flink.util.Preconditions.checkState;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.state.VoidNamespace;
import org.apache.flink.runtime.state.VoidNamespaceSerializer;
@@ -35,6 +32,9 @@ import org.apache.flink.streaming.api.operators.Triggerable;
import org.apache.flink.streaming.api.operators.TwoInputStreamOperator;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+import static org.apache.flink.util.Preconditions.checkState;
+
/**
* A {@link org.apache.flink.streaming.api.operators.StreamOperator} for executing keyed
* {@link CoProcessFunction CoProcessFunctions}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/CoFeedbackTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/CoFeedbackTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/CoFeedbackTransformation.java
index 1de0152..b36ad22 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/CoFeedbackTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/CoFeedbackTransformation.java
@@ -15,15 +15,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.streaming.api.operators.ChainingStrategy;
+
import com.google.common.collect.Lists;
+
import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.api.common.typeinfo.TypeInformation;
-import org.apache.flink.streaming.api.operators.ChainingStrategy;
/**
* This represents a feedback point in a topology. The type of the feedback elements need not match
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/FeedbackTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/FeedbackTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/FeedbackTransformation.java
index be7a97c..e5d7c3a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/FeedbackTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/FeedbackTransformation.java
@@ -15,13 +15,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.streaming.api.operators.ChainingStrategy;
+
import com.google.common.collect.Lists;
+
import java.util.Collection;
import java.util.List;
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.streaming.api.operators.ChainingStrategy;
/**
* This represents a feedback point in a topology.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/OneInputTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/OneInputTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/OneInputTransformation.java
index 2df8e55..bc1be5b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/OneInputTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/OneInputTransformation.java
@@ -15,17 +15,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
-import com.google.common.collect.Lists;
-import java.util.Collection;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.streaming.api.operators.ChainingStrategy;
import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+import com.google.common.collect.Lists;
+
+import java.util.Collection;
+import java.util.List;
+
/**
* This Transformation represents the application of a
* {@link org.apache.flink.streaming.api.operators.OneInputStreamOperator} to one input
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/PartitionTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/PartitionTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/PartitionTransformation.java
index 56f574a..942d019 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/PartitionTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/PartitionTransformation.java
@@ -15,15 +15,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
-import com.google.common.collect.Lists;
-import java.util.Collection;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.operators.ChainingStrategy;
import org.apache.flink.streaming.runtime.partitioner.StreamPartitioner;
+import com.google.common.collect.Lists;
+
+import java.util.Collection;
+import java.util.List;
+
/**
* This transformation represents a change of partitioning of the input elements.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SelectTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SelectTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SelectTransformation.java
index eeff8fa..6f47264 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SelectTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SelectTransformation.java
@@ -15,13 +15,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.streaming.api.operators.ChainingStrategy;
+
import com.google.common.collect.Lists;
+
import java.util.Collection;
import java.util.List;
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.streaming.api.operators.ChainingStrategy;
/**
* This transformation represents a selection of only certain upstream elements. This must
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SideOutputTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SideOutputTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SideOutputTransformation.java
index 8d12ebf..faa01f4 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SideOutputTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SideOutputTransformation.java
@@ -15,15 +15,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
-import static java.util.Objects.requireNonNull;
+import org.apache.flink.streaming.api.operators.ChainingStrategy;
+import org.apache.flink.util.OutputTag;
import com.google.common.collect.Lists;
+
import java.util.Collection;
import java.util.List;
-import org.apache.flink.streaming.api.operators.ChainingStrategy;
-import org.apache.flink.util.OutputTag;
+
+import static java.util.Objects.requireNonNull;
/**
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SinkTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SinkTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SinkTransformation.java
index a2a05df..5534cb9 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SinkTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SinkTransformation.java
@@ -15,11 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
-import com.google.common.collect.Lists;
-import java.util.Collection;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.functions.KeySelector;
@@ -27,6 +25,11 @@ import org.apache.flink.api.java.typeutils.TypeExtractor;
import org.apache.flink.streaming.api.operators.ChainingStrategy;
import org.apache.flink.streaming.api.operators.StreamSink;
+import com.google.common.collect.Lists;
+
+import java.util.Collection;
+import java.util.List;
+
/**
* This Transformation represents a Sink.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SourceTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SourceTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SourceTransformation.java
index ca937e8..343a6df 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SourceTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SourceTransformation.java
@@ -15,15 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
-import java.util.Collection;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.streaming.api.operators.ChainingStrategy;
import org.apache.flink.streaming.api.operators.StreamSource;
+import java.util.Collection;
+import java.util.Collections;
+
/**
* This represents a Source. This does not actually transform anything since it has no inputs but
* it is the root {@code StreamTransformation} of any topology.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SplitTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SplitTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SplitTransformation.java
index 1678e45..148478a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SplitTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SplitTransformation.java
@@ -15,15 +15,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
-import com.google.common.collect.Lists;
-import java.util.Collection;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.collector.selector.OutputSelector;
import org.apache.flink.streaming.api.operators.ChainingStrategy;
+import com.google.common.collect.Lists;
+
+import java.util.Collection;
+import java.util.List;
+
/**
* This transformation represents a split of one
* {@link org.apache.flink.streaming.api.datastream.DataStream} into several {@code DataStreams}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java
index 77f4f84..8b2c204 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java
@@ -15,12 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.api.transformations;
-
-import static org.apache.flink.util.Preconditions.checkNotNull;
+package org.apache.flink.streaming.api.transformations;
-import java.util.Collection;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.functions.InvalidTypesException;
import org.apache.flink.api.common.operators.ResourceSpec;
@@ -31,6 +28,10 @@ import org.apache.flink.streaming.api.graph.StreamGraphGenerator;
import org.apache.flink.streaming.api.operators.ChainingStrategy;
import org.apache.flink.util.Preconditions;
+import java.util.Collection;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* A {@code StreamTransformation} represents the operation that creates a
* {@link org.apache.flink.streaming.api.datastream.DataStream}. Every
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/TwoInputTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/TwoInputTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/TwoInputTransformation.java
index df4eaa1..7f561c5 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/TwoInputTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/TwoInputTransformation.java
@@ -15,17 +15,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
-import com.google.common.collect.Lists;
-import java.util.Collection;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.streaming.api.operators.ChainingStrategy;
import org.apache.flink.streaming.api.operators.TwoInputStreamOperator;
+import com.google.common.collect.Lists;
+
+import java.util.Collection;
+import java.util.List;
+
/**
* This Transformation represents the application of a
* {@link org.apache.flink.streaming.api.operators.TwoInputStreamOperator} to two input
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/UnionTransformation.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/UnionTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/UnionTransformation.java
index c71ec53..bc522e7 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/UnionTransformation.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/UnionTransformation.java
@@ -15,13 +15,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.transformations;
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.streaming.api.operators.ChainingStrategy;
+
import com.google.common.collect.Lists;
+
import java.util.Collection;
import java.util.List;
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.streaming.api.operators.ChainingStrategy;
/**
* This transformation represents a union of several input
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/BaseAlignedWindowAssigner.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/BaseAlignedWindowAssigner.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/BaseAlignedWindowAssigner.java
index 4e74c23..06e85e4 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/BaseAlignedWindowAssigner.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/BaseAlignedWindowAssigner.java
@@ -15,15 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.assigners;
-import java.util.Collection;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
+import java.util.Collection;
+
/**
* A base {@link WindowAssigner} used to instantiate one of the deprecated
* {@link org.apache.flink.streaming.runtime.operators.windowing.AccumulatingProcessingTimeWindowOperator
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/EventTimeSessionWindows.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/EventTimeSessionWindows.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/EventTimeSessionWindows.java
index a8247e6..249f219 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/EventTimeSessionWindows.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/EventTimeSessionWindows.java
@@ -15,10 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.assigners;
-import java.util.Collection;
-import java.util.Collections;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
@@ -27,6 +26,9 @@ import org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger;
import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
+import java.util.Collection;
+import java.util.Collections;
+
/**
* A {@link WindowAssigner} that windows elements into sessions based on the timestamp of the
* elements. Windows cannot overlap.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/GlobalWindows.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/GlobalWindows.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/GlobalWindows.java
index 5b35b27..2b4b98b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/GlobalWindows.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/GlobalWindows.java
@@ -15,10 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.assigners;
-import java.util.Collection;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
@@ -28,6 +27,9 @@ import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.triggers.TriggerResult;
import org.apache.flink.streaming.api.windowing.windows.GlobalWindow;
+import java.util.Collection;
+import java.util.Collections;
+
/**
* A {@link WindowAssigner} that assigns all elements to the same {@link GlobalWindow}.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/MergingWindowAssigner.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/MergingWindowAssigner.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/MergingWindowAssigner.java
index 98223f4..e7049f6 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/MergingWindowAssigner.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/MergingWindowAssigner.java
@@ -15,12 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.assigners;
-import java.util.Collection;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.streaming.api.windowing.windows.Window;
+import java.util.Collection;
+
/**
* A {@code WindowAssigner} that can merge windows.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/ProcessingTimeSessionWindows.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/ProcessingTimeSessionWindows.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/ProcessingTimeSessionWindows.java
index db31788..e553310 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/ProcessingTimeSessionWindows.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/ProcessingTimeSessionWindows.java
@@ -15,10 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.assigners;
-import java.util.Collection;
-import java.util.Collections;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
@@ -27,6 +26,9 @@ import org.apache.flink.streaming.api.windowing.triggers.ProcessingTimeTrigger;
import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
+import java.util.Collection;
+import java.util.Collections;
+
/**
* A {@link WindowAssigner} that windows elements into sessions based on the current processing
* time. Windows cannot overlap.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingEventTimeWindows.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingEventTimeWindows.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingEventTimeWindows.java
index e45f2d9..b574c17 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingEventTimeWindows.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingEventTimeWindows.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.api.windowing.assigners;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -30,6 +27,10 @@ import org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger;
import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
/**
* A {@link WindowAssigner} that windows elements into sliding windows based on the timestamp of the
* elements. Windows can possibly overlap.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingProcessingTimeWindows.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingProcessingTimeWindows.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingProcessingTimeWindows.java
index 53e9a05..78cc8b2 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingProcessingTimeWindows.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingProcessingTimeWindows.java
@@ -15,11 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.assigners;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
@@ -28,6 +26,10 @@ import org.apache.flink.streaming.api.windowing.triggers.ProcessingTimeTrigger;
import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
/**
* A {@link WindowAssigner} that windows elements into sliding windows based on the current
* system time of the machine the operation is running on. Windows can possibly overlap.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/TumblingEventTimeWindows.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/TumblingEventTimeWindows.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/TumblingEventTimeWindows.java
index 93c1c37..88710c2 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/TumblingEventTimeWindows.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/TumblingEventTimeWindows.java
@@ -18,8 +18,6 @@
package org.apache.flink.streaming.api.windowing.assigners;
-import java.util.Collection;
-import java.util.Collections;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -29,6 +27,9 @@ import org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger;
import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
+import java.util.Collection;
+import java.util.Collections;
+
/**
* A {@link WindowAssigner} that windows elements into windows based on the timestamp of the
* elements. Windows cannot overlap.
@@ -57,6 +58,7 @@ public class TumblingEventTimeWindows extends WindowAssigner<Object, TimeWindow>
this.size = size;
this.offset = offset;
}
+
@Override
public Collection<TimeWindow> assignWindows(Object element, long timestamp, WindowAssignerContext context) {
if (timestamp > Long.MIN_VALUE) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/TumblingProcessingTimeWindows.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/TumblingProcessingTimeWindows.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/TumblingProcessingTimeWindows.java
index 4e579b7..6a401ef 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/TumblingProcessingTimeWindows.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/TumblingProcessingTimeWindows.java
@@ -15,10 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.assigners;
-import java.util.Collection;
-import java.util.Collections;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
@@ -27,6 +26,9 @@ import org.apache.flink.streaming.api.windowing.triggers.ProcessingTimeTrigger;
import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
+import java.util.Collection;
+import java.util.Collections;
+
/**
* A {@link WindowAssigner} that windows elements into windows based on the current
* system time of the machine the operation is running on. Windows cannot overlap.
@@ -46,7 +48,6 @@ public class TumblingProcessingTimeWindows extends WindowAssigner<Object, TimeWi
private final long offset;
-
private TumblingProcessingTimeWindows(long size, long offset) {
if (offset < 0 || offset >= size) {
throw new IllegalArgumentException("TumblingProcessingTimeWindows parameters must satisfy 0 <= offset < size");
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/WindowAssigner.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/WindowAssigner.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/WindowAssigner.java
index 58c0b1d..2ad53c5 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/WindowAssigner.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/WindowAssigner.java
@@ -18,8 +18,6 @@
package org.apache.flink.streaming.api.windowing.assigners;
-import java.io.Serializable;
-import java.util.Collection;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -27,6 +25,9 @@ import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.Window;
+import java.io.Serializable;
+import java.util.Collection;
+
/**
* A {@code WindowAssigner} assigns zero or more {@link Window Windows} to an element.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/CountEvictor.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/CountEvictor.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/CountEvictor.java
index 53ef759..6acb40c 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/CountEvictor.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/CountEvictor.java
@@ -15,13 +15,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.evictors;
-import java.util.Iterator;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue;
+import java.util.Iterator;
+
/**
* An {@link Evictor} that keeps up to a certain amount of elements.
*
@@ -51,7 +53,6 @@ public class CountEvictor<W extends Window> implements Evictor<Object, W> {
}
}
-
@Override
public void evictAfter(Iterable<TimestampedValue<Object>> elements, int size, W window, EvictorContext ctx) {
if (doEvictAfter) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/DeltaEvictor.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/DeltaEvictor.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/DeltaEvictor.java
index 737c9f5..57fec10 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/DeltaEvictor.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/DeltaEvictor.java
@@ -15,15 +15,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.evictors;
-import com.google.common.collect.Iterables;
-import java.util.Iterator;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.streaming.api.functions.windowing.delta.DeltaFunction;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue;
+import com.google.common.collect.Iterables;
+
+import java.util.Iterator;
+
/**
* An {@link Evictor} that keeps elements based on a {@link DeltaFunction} and a threshold.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/Evictor.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/Evictor.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/Evictor.java
index 67a862f..cac6e2e 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/Evictor.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/Evictor.java
@@ -15,15 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.evictors;
-import java.io.Serializable;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.metrics.MetricGroup;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue;
+import java.io.Serializable;
+
/**
* An {@code Evictor} can remove elements from a pane before/after the evaluation of WindowFunction
* and after the window evaluation gets triggered by a
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/TimeEvictor.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/TimeEvictor.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/TimeEvictor.java
index 725b0bd..0dba86d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/TimeEvictor.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/TimeEvictor.java
@@ -15,15 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.evictors;
-import java.util.Iterator;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue;
+import java.util.Iterator;
+
/**
* An {@link Evictor} that keeps elements for a certain amount of time. Elements older
* than {@code current_time - keep_time} are evicted. The current_time is time associated
@@ -48,7 +50,6 @@ public class TimeEvictor<W extends Window> implements Evictor<Object, W> {
this.doEvictAfter = doEvictAfter;
}
-
@Override
public void evictBefore(Iterable<TimestampedValue<Object>> elements, int size, W window, EvictorContext ctx) {
if (!doEvictAfter) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/time/Time.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/time/Time.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/time/Time.java
index f1760d5..d099286 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/time/Time.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/time/Time.java
@@ -18,10 +18,11 @@
package org.apache.flink.streaming.api.windowing.time;
-import static org.apache.flink.util.Preconditions.checkNotNull;
+import org.apache.flink.annotation.Public;
import java.util.concurrent.TimeUnit;
-import org.apache.flink.annotation.Public;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
/**
* The definition of a time interval for windowing. The time characteristic referred
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/CountTrigger.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/CountTrigger.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/CountTrigger.java
index ffe74b0..7dbd22f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/CountTrigger.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/CountTrigger.java
@@ -39,7 +39,6 @@ public class CountTrigger<W extends Window> extends Trigger<Object, W> {
private final ReducingStateDescriptor<Long> stateDesc =
new ReducingStateDescriptor<>("count", new Sum(), LongSerializer.INSTANCE);
-
private CountTrigger(long maxCount) {
this.maxCount = maxCount;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/EventTimeTrigger.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/EventTimeTrigger.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/EventTimeTrigger.java
index 0589751..2f8f16f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/EventTimeTrigger.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/EventTimeTrigger.java
@@ -86,6 +86,4 @@ public class EventTimeTrigger extends Trigger<Object, TimeWindow> {
public static EventTimeTrigger create() {
return new EventTimeTrigger();
}
-
-
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/PurgingTrigger.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/PurgingTrigger.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/PurgingTrigger.java
index fb4568c..5ca41bb 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/PurgingTrigger.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/PurgingTrigger.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.triggers;
import org.apache.flink.annotation.PublicEvolving;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/Trigger.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/Trigger.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/Trigger.java
index 746e4ac..1c47de3 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/Trigger.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/Trigger.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.api.windowing.triggers;
-import java.io.Serializable;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.api.common.state.MergingState;
@@ -29,6 +28,8 @@ import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.metrics.MetricGroup;
import org.apache.flink.streaming.api.windowing.windows.Window;
+import java.io.Serializable;
+
/**
* A {@code Trigger} determines when a pane of a window should be evaluated to emit the
* results for that part of the window.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/GlobalWindow.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/GlobalWindow.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/GlobalWindow.java
index cf5c74c..835197f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/GlobalWindow.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/GlobalWindow.java
@@ -15,15 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.windows;
-import java.io.IOException;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.common.typeutils.base.TypeSerializerSingleton;
import org.apache.flink.core.memory.DataInputView;
import org.apache.flink.core.memory.DataOutputView;
+import java.io.IOException;
+
/**
* The default window into which all data is placed (via
* {@link org.apache.flink.streaming.api.windowing.assigners.GlobalWindows}).
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/TimeWindow.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/TimeWindow.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/TimeWindow.java
index a7ea244..0e89294 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/TimeWindow.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/TimeWindow.java
@@ -15,8 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.windowing.windows;
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.api.common.typeutils.base.TypeSerializerSingleton;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.core.memory.DataInputView;
+import org.apache.flink.core.memory.DataOutputView;
+import org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner;
+import org.apache.flink.util.MathUtils;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -25,13 +34,6 @@ import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.flink.annotation.PublicEvolving;
-import org.apache.flink.api.common.typeutils.base.TypeSerializerSingleton;
-import org.apache.flink.api.java.tuple.Tuple2;
-import org.apache.flink.core.memory.DataInputView;
-import org.apache.flink.core.memory.DataOutputView;
-import org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner;
-import org.apache.flink.util.MathUtils;
/**
* A {@link Window} that represents a time interval from {@code start} (inclusive) to
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/Window.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/Window.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/Window.java
index b2f17fe..ec0093a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/Window.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/Window.java
@@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.api.windowing.windows;
+package org.apache.flink.streaming.api.windowing.windows;
import org.apache.flink.annotation.PublicEvolving;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierBuffer.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierBuffer.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierBuffer.java
index b9d3716..e66acec 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierBuffer.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierBuffer.java
@@ -17,10 +17,6 @@
package org.apache.flink.streaming.runtime.io;
-import static org.apache.flink.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import java.util.ArrayDeque;
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.checkpoint.CheckpointMetaData;
import org.apache.flink.runtime.checkpoint.CheckpointMetrics;
@@ -36,9 +32,15 @@ import org.apache.flink.runtime.io.network.api.EndOfPartitionEvent;
import org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent;
import org.apache.flink.runtime.io.network.partition.consumer.InputGate;
import org.apache.flink.runtime.jobgraph.tasks.StatefulTask;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.util.ArrayDeque;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+
/**
* The barrier buffer is {@link CheckpointBarrierHandler} that blocks inputs with barriers until
* all inputs have received the barrier for a given checkpoint.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierTracker.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierTracker.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierTracker.java
index 2e965dd..9d28a4f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierTracker.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierTracker.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.runtime.io;
-import java.util.ArrayDeque;
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.checkpoint.CheckpointMetaData;
import org.apache.flink.runtime.checkpoint.CheckpointMetrics;
@@ -29,9 +28,12 @@ import org.apache.flink.runtime.io.network.api.CheckpointBarrier;
import org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent;
import org.apache.flink.runtime.io.network.partition.consumer.InputGate;
import org.apache.flink.runtime.jobgraph.tasks.StatefulTask;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.ArrayDeque;
+
/**
* The BarrierTracker keeps track of what checkpoint barriers have been received from
* which input channels. Once it has observed all checkpoint barriers for a checkpoint ID,
@@ -196,7 +198,6 @@ public class BarrierTracker implements CheckpointBarrierHandler {
}
}
-
private void processCheckpointAbortBarrier(CancelCheckpointMarker barrier, int channelIndex) throws Exception {
final long checkpointId = barrier.getCheckpointId();
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BlockingQueueBroker.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BlockingQueueBroker.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BlockingQueueBroker.java
index 2acf141..20e097b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BlockingQueueBroker.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BlockingQueueBroker.java
@@ -17,11 +17,11 @@
package org.apache.flink.streaming.runtime.io;
-import java.util.concurrent.BlockingQueue;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.iterative.concurrent.Broker;
+import java.util.concurrent.BlockingQueue;
+
/**
* {@link Broker} for the {@link BlockingQueue} used in
* {@link org.apache.flink.streaming.runtime.tasks.StreamIterationHead} and
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BufferSpiller.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BufferSpiller.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BufferSpiller.java
index df60b75..98037cb 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BufferSpiller.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BufferSpiller.java
@@ -17,15 +17,6 @@
package org.apache.flink.streaming.runtime.io;
-import java.io.File;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.channels.FileChannel;
-import java.util.Random;
-import java.util.concurrent.atomic.AtomicInteger;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.core.memory.MemorySegment;
import org.apache.flink.core.memory.MemorySegmentFactory;
@@ -37,6 +28,15 @@ import org.apache.flink.runtime.io.network.buffer.FreeingBufferRecycler;
import org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent;
import org.apache.flink.util.StringUtils;
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.FileChannel;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicInteger;
+
/**
* The buffer spiller takes the buffers and events from a data stream and adds them to a spill file.
* After a number of elements have been spilled, the spiller can "roll over": It presents the spilled
@@ -348,7 +348,6 @@ public class BufferSpiller {
final int length = buffer.getInt();
final boolean isBuffer = buffer.get() == 0;
-
if (isBuffer) {
// deserialize buffer
if (length > pageSize) {
@@ -381,7 +380,6 @@ public class BufferSpiller {
}
}
-
Buffer buf = new Buffer(seg, FreeingBufferRecycler.INSTANCE);
buf.setSize(length);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierHandler.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierHandler.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierHandler.java
index c39f7df..0c676e0 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierHandler.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierHandler.java
@@ -18,11 +18,12 @@
package org.apache.flink.streaming.runtime.io;
-import java.io.IOException;
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent;
import org.apache.flink.runtime.jobgraph.tasks.StatefulTask;
+import java.io.IOException;
+
/**
* The CheckpointBarrierHandler reacts to checkpoint barrier arriving from the input channels.
* Different implementations may either simply track barriers, or block certain inputs on
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/InputGateUtil.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/InputGateUtil.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/InputGateUtil.java
index 48401d9..91c6f91 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/InputGateUtil.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/InputGateUtil.java
@@ -17,14 +17,14 @@
package org.apache.flink.streaming.runtime.io;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.io.network.partition.consumer.InputGate;
import org.apache.flink.runtime.io.network.partition.consumer.UnionInputGate;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
/**
* Utility for dealing with input gates. This will either just return
* the single {@link InputGate} that was passed in or create a {@link UnionInputGate} if several
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/RecordWriterOutput.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/RecordWriterOutput.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/RecordWriterOutput.java
index 92f0217..3b70be7 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/RecordWriterOutput.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/RecordWriterOutput.java
@@ -17,9 +17,6 @@
package org.apache.flink.streaming.runtime.io;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
-import java.io.IOException;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.runtime.event.AbstractEvent;
@@ -35,6 +32,10 @@ import org.apache.flink.streaming.runtime.streamstatus.StreamStatus;
import org.apache.flink.streaming.runtime.streamstatus.StreamStatusProvider;
import org.apache.flink.util.OutputTag;
+import java.io.IOException;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* Implementation of {@link Output} that sends data using a {@link RecordWriter}.
*/
@@ -145,7 +146,6 @@ public class RecordWriterOutput<OUT> implements Output<StreamRecord<OUT>> {
recordWriter.broadcastEvent(event);
}
-
public void flush() throws IOException {
recordWriter.flush();
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamInputProcessor.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamInputProcessor.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamInputProcessor.java
index 33b16d8..263077d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamInputProcessor.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamInputProcessor.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.runtime.io;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
-import java.io.IOException;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.configuration.Configuration;
@@ -52,6 +49,10 @@ import org.apache.flink.streaming.runtime.streamstatus.StatusWatermarkValve;
import org.apache.flink.streaming.runtime.streamstatus.StreamStatus;
import org.apache.flink.streaming.runtime.streamstatus.StreamStatusMaintainer;
+import java.io.IOException;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* Input reader for {@link org.apache.flink.streaming.runtime.tasks.OneInputStreamTask}.
*
[10/10] flink git commit: [FLINK-6603] [streaming] Enable checkstyle
on test sources
Posted by gr...@apache.org.
[FLINK-6603] [streaming] Enable checkstyle on test sources
Updates / reverts the import order by sections:
- org.apache.flink.*
- all other imports
- javax.*
- java.*
- static imports
Adds EmptyLineSeparator to enforce an extra newline (not enforced
between field or local variable declarations).
This closes #3941
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/12b4185c
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/12b4185c
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/12b4185c
Branch: refs/heads/master
Commit: 12b4185c6c09101b64e12a84c33dc4d28f95cff9
Parents: 7efa8ad
Author: Greg Hogan <co...@greghogan.com>
Authored: Wed May 17 08:01:04 2017 -0400
Committer: Greg Hogan <co...@greghogan.com>
Committed: Mon May 22 16:22:24 2017 -0400
----------------------------------------------------------------------
flink-streaming-java/pom.xml | 1 +
.../api/graph/StreamGraphHasherV1.java | 24 +-
.../MultiplexingStreamRecordSerializer.java | 9 +-
.../streamrecord/StreamRecordSerializer.java | 3 +-
.../flink/streaming/api/SimpleTimerService.java | 1 +
.../flink/streaming/api/TimeCharacteristic.java | 1 -
.../apache/flink/streaming/api/TimeDomain.java | 1 +
.../flink/streaming/api/TimerService.java | 1 +
.../streaming/api/checkpoint/Checkpointed.java | 3 +-
.../checkpoint/CheckpointedAsynchronously.java | 3 +-
.../api/checkpoint/CheckpointedRestoring.java | 3 +-
.../api/checkpoint/ListCheckpointed.java | 5 +-
.../selector/CopyingDirectedOutput.java | 7 +-
.../api/collector/selector/DirectedOutput.java | 21 +-
.../api/collector/selector/OutputSelector.java | 4 +-
.../api/datastream/AllWindowedStream.java | 6 +-
.../api/datastream/AsyncDataStream.java | 3 +-
.../api/datastream/CoGroupedStreams.java | 11 +-
.../api/datastream/ConnectedStreams.java | 4 +-
.../streaming/api/datastream/DataStream.java | 5 +-
.../api/datastream/IterativeStream.java | 3 +-
.../streaming/api/datastream/JoinedStreams.java | 4 +-
.../streaming/api/datastream/KeyedStream.java | 12 +-
.../datastream/SingleOutputStreamOperator.java | 9 +-
.../streaming/api/datastream/SplitStream.java | 3 +-
.../api/datastream/WindowedStream.java | 8 +-
.../api/environment/CheckpointConfig.java | 6 +-
.../api/environment/LocalStreamEnvironment.java | 2 +-
.../environment/RemoteStreamEnvironment.java | 21 +-
.../environment/StreamContextEnvironment.java | 1 -
.../environment/StreamExecutionEnvironment.java | 22 +-
.../AssignerWithPeriodicWatermarks.java | 3 +-
.../AssignerWithPunctuatedWatermarks.java | 3 +-
.../aggregation/ComparableAggregator.java | 1 -
.../api/functions/aggregation/Comparator.java | 4 +-
.../api/functions/aggregation/SumFunction.java | 3 +-
.../api/functions/async/AsyncFunction.java | 3 +-
.../api/functions/async/RichAsyncFunction.java | 8 +-
.../async/collector/AsyncCollector.java | 3 +-
.../api/functions/co/CoFlatMapFunction.java | 4 +-
.../api/functions/co/CoMapFunction.java | 4 +-
.../sink/OutputFormatSinkFunction.java | 4 +-
.../api/functions/sink/PrintSinkFunction.java | 4 +-
.../api/functions/sink/SinkFunction.java | 4 +-
.../api/functions/sink/SocketClientSink.java | 14 +-
.../api/functions/sink/WriteFormat.java | 3 +-
.../api/functions/sink/WriteFormatAsCsv.java | 3 +-
.../api/functions/sink/WriteFormatAsText.java | 3 +-
.../api/functions/sink/WriteSinkFunction.java | 3 +-
.../ContinuousFileMonitoringFunction.java | 19 +-
.../source/ContinuousFileReaderOperator.java | 25 +-
.../source/FileMonitoringFunction.java | 14 +-
.../functions/source/FileProcessingMode.java | 1 +
.../api/functions/source/FileReadFunction.java | 8 +-
.../functions/source/FromElementsFunction.java | 15 +-
.../functions/source/FromIteratorFunction.java | 3 +-
.../source/FromSplittableIteratorFunction.java | 3 +-
.../source/InputFormatSourceFunction.java | 5 +-
.../source/MessageAcknowledgingSourceBase.java | 15 +-
...ltipleIdsMessageAcknowledgingSourceBase.java | 13 +-
.../source/SocketTextStreamFunction.java | 15 +-
.../api/functions/source/SourceFunction.java | 3 +-
.../source/StatefulSequenceSource.java | 6 +-
.../source/TimestampedFileInputSplit.java | 3 +-
.../timestamps/AscendingTimestampExtractor.java | 5 +-
...BoundedOutOfOrdernessTimestampExtractor.java | 1 +
.../AggregateApplyAllWindowFunction.java | 3 +-
.../windowing/AggregateApplyWindowFunction.java | 4 +-
.../functions/windowing/AllWindowFunction.java | 3 +-
.../windowing/FoldApplyAllWindowFunction.java | 10 +-
.../FoldApplyProcessAllWindowFunction.java | 10 +-
.../FoldApplyProcessWindowFunction.java | 10 +-
.../windowing/FoldApplyWindowFunction.java | 10 +-
.../InternalProcessApplyAllWindowContext.java | 1 +
.../InternalProcessApplyWindowContext.java | 1 +
.../windowing/PassThroughAllWindowFunction.java | 1 +
.../windowing/PassThroughWindowFunction.java | 1 +
.../windowing/ReduceApplyAllWindowFunction.java | 4 +-
.../ReduceApplyProcessAllWindowFunction.java | 4 +-
.../ReduceApplyProcessWindowFunction.java | 4 +-
.../windowing/ReduceApplyWindowFunction.java | 4 +-
.../windowing/RichAllWindowFunction.java | 1 +
.../api/functions/windowing/WindowFunction.java | 3 +-
.../windowing/delta/DeltaFunction.java | 3 +-
.../windowing/delta/extractor/Extractor.java | 3 +-
.../delta/extractor/FieldFromArray.java | 3 +-
.../delta/extractor/FieldsFromArray.java | 3 +-
.../FunctionMasterCheckpointHookFactory.java | 4 +-
.../streaming/api/graph/JSONGenerator.java | 13 +-
.../flink/streaming/api/graph/StreamConfig.java | 15 +-
.../flink/streaming/api/graph/StreamEdge.java | 5 +-
.../flink/streaming/api/graph/StreamGraph.java | 28 +-
.../api/graph/StreamGraphGenerator.java | 20 +-
.../streaming/api/graph/StreamGraphHasher.java | 3 +-
.../api/graph/StreamGraphHasherV2.java | 20 +-
.../api/graph/StreamGraphUserHashHasher.java | 3 +-
.../flink/streaming/api/graph/StreamNode.java | 7 +-
.../api/graph/StreamingJobGraphGenerator.java | 25 +-
.../api/operators/AbstractStreamOperator.java | 23 +-
.../operators/AbstractUdfStreamOperator.java | 8 +-
.../api/operators/HeapInternalTimerService.java | 18 +-
.../operators/InternalTimeServiceManager.java | 7 +-
.../streaming/api/operators/InternalTimer.java | 4 +-
.../api/operators/InternalTimerService.java | 1 +
.../streaming/api/operators/KeyContext.java | 1 +
.../api/operators/KeyedProcessOperator.java | 6 +-
.../api/operators/OnWatermarkCallback.java | 3 +-
.../api/operators/OperatorSnapshotResult.java | 3 +-
.../flink/streaming/api/operators/Output.java | 1 +
.../api/operators/ProcessOperator.java | 4 +-
.../api/operators/StreamGroupedFold.java | 8 +-
.../api/operators/StreamGroupedReduce.java | 1 -
.../streaming/api/operators/StreamOperator.java | 3 +-
.../streaming/api/operators/StreamProject.java | 1 -
.../streaming/api/operators/StreamSource.java | 5 +-
.../api/operators/StreamSourceContexts.java | 3 +-
.../api/operators/StreamingRuntimeContext.java | 5 +-
.../streaming/api/operators/Triggerable.java | 1 +
.../api/operators/async/AsyncWaitOperator.java | 14 +-
.../streaming/api/operators/async/Emitter.java | 4 +-
.../async/queue/AsyncCollectionResult.java | 3 +-
.../async/queue/OrderedStreamElementQueue.java | 14 +-
.../async/queue/StreamElementQueue.java | 3 +-
.../async/queue/StreamElementQueueEntry.java | 3 +-
.../async/queue/StreamRecordQueueEntry.java | 3 +-
.../queue/UnorderedStreamElementQueue.java | 14 +-
.../api/operators/co/CoProcessOperator.java | 6 +-
.../operators/co/KeyedCoProcessOperator.java | 6 +-
.../CoFeedbackTransformation.java | 9 +-
.../transformations/FeedbackTransformation.java | 7 +-
.../transformations/OneInputTransformation.java | 9 +-
.../PartitionTransformation.java | 9 +-
.../transformations/SelectTransformation.java | 7 +-
.../SideOutputTransformation.java | 9 +-
.../api/transformations/SinkTransformation.java | 9 +-
.../transformations/SourceTransformation.java | 6 +-
.../transformations/SplitTransformation.java | 9 +-
.../transformations/StreamTransformation.java | 9 +-
.../transformations/TwoInputTransformation.java | 9 +-
.../transformations/UnionTransformation.java | 7 +-
.../assigners/BaseAlignedWindowAssigner.java | 4 +-
.../assigners/EventTimeSessionWindows.java | 6 +-
.../api/windowing/assigners/GlobalWindows.java | 6 +-
.../assigners/MergingWindowAssigner.java | 4 +-
.../assigners/ProcessingTimeSessionWindows.java | 6 +-
.../assigners/SlidingEventTimeWindows.java | 7 +-
.../assigners/SlidingProcessingTimeWindows.java | 8 +-
.../assigners/TumblingEventTimeWindows.java | 6 +-
.../TumblingProcessingTimeWindows.java | 7 +-
.../api/windowing/assigners/WindowAssigner.java | 5 +-
.../api/windowing/evictors/CountEvictor.java | 5 +-
.../api/windowing/evictors/DeltaEvictor.java | 7 +-
.../api/windowing/evictors/Evictor.java | 4 +-
.../api/windowing/evictors/TimeEvictor.java | 5 +-
.../streaming/api/windowing/time/Time.java | 5 +-
.../api/windowing/triggers/CountTrigger.java | 1 -
.../windowing/triggers/EventTimeTrigger.java | 2 -
.../api/windowing/triggers/PurgingTrigger.java | 1 +
.../api/windowing/triggers/Trigger.java | 3 +-
.../api/windowing/windows/GlobalWindow.java | 4 +-
.../api/windowing/windows/TimeWindow.java | 16 +-
.../streaming/api/windowing/windows/Window.java | 2 +-
.../streaming/runtime/io/BarrierBuffer.java | 10 +-
.../streaming/runtime/io/BarrierTracker.java | 5 +-
.../runtime/io/BlockingQueueBroker.java | 4 +-
.../streaming/runtime/io/BufferSpiller.java | 20 +-
.../runtime/io/CheckpointBarrierHandler.java | 3 +-
.../streaming/runtime/io/InputGateUtil.java | 8 +-
.../runtime/io/RecordWriterOutput.java | 8 +-
.../runtime/io/StreamInputProcessor.java | 7 +-
.../runtime/io/StreamRecordWriter.java | 10 +-
.../runtime/io/StreamTwoInputProcessor.java | 9 +-
.../runtime/operators/CheckpointCommitter.java | 4 +-
.../operators/GenericWriteAheadSink.java | 15 +-
...TimestampsAndPeriodicWatermarksOperator.java | 1 -
...mestampsAndPunctuatedWatermarksOperator.java | 1 -
.../runtime/operators/package-info.java | 1 +
...ractAlignedProcessingTimeWindowOperator.java | 8 +-
.../windowing/AbstractKeyedTimePanes.java | 9 +-
.../windowing/AccumulatingKeyedTimePanes.java | 4 +-
...ccumulatingProcessingTimeWindowOperator.java | 4 +-
...AggregatingProcessingTimeWindowOperator.java | 1 -
.../windowing/EvictingWindowOperator.java | 17 +-
.../runtime/operators/windowing/KeyMap.java | 8 +-
.../operators/windowing/MergingWindowSet.java | 13 +-
.../operators/windowing/TimestampedValue.java | 1 +
.../operators/windowing/WindowOperator.java | 22 +-
...ternalAggregateProcessAllWindowFunction.java | 4 +-
.../InternalAggregateProcessWindowFunction.java | 4 +-
.../InternalIterableAllWindowFunction.java | 1 +
...nternalIterableProcessAllWindowFunction.java | 1 +
.../InternalIterableProcessWindowFunction.java | 1 +
.../InternalIterableWindowFunction.java | 1 +
.../InternalProcessAllWindowContext.java | 1 +
.../functions/InternalProcessWindowContext.java | 1 +
.../InternalSingleValueAllWindowFunction.java | 4 +-
...rnalSingleValueProcessAllWindowFunction.java | 4 +-
...nternalSingleValueProcessWindowFunction.java | 4 +-
.../InternalSingleValueWindowFunction.java | 4 +-
.../functions/InternalWindowFunction.java | 1 +
.../operators/windowing/package-info.java | 1 +
.../runtime/partitioner/ShufflePartitioner.java | 4 +-
.../runtime/partitioner/StreamPartitioner.java | 5 +-
.../runtime/streamrecord/LatencyMarker.java | 1 -
.../streamrecord/StreamElementSerializer.java | 8 +-
.../streamstatus/StatusWatermarkValve.java | 7 +-
.../streamstatus/StreamStatusMaintainer.java | 1 +
.../streamstatus/StreamStatusProvider.java | 1 +
.../ExceptionInChainedOperatorException.java | 4 +-
.../streaming/runtime/tasks/OperatorChain.java | 14 +-
.../runtime/tasks/OperatorStateHandles.java | 5 +-
.../runtime/tasks/SourceStreamTask.java | 1 -
.../tasks/StoppableSourceStreamTask.java | 1 +
.../runtime/tasks/StreamIterationHead.java | 8 +-
.../runtime/tasks/StreamIterationTail.java | 7 +-
.../streaming/runtime/tasks/StreamTask.java | 25 +-
.../tasks/SystemProcessingTimeService.java | 12 +-
.../tasks/TestProcessingTimeService.java | 5 +-
.../streaming/runtime/tasks/TimerException.java | 1 +
.../runtime/tasks/TwoInputStreamTask.java | 6 +-
.../streaming/runtime/tasks/package-info.java | 1 +
.../flink/streaming/util/HDFSCopyFromLocal.java | 7 +-
.../flink/streaming/util/HDFSCopyToLocal.java | 7 +-
.../util/functions/StreamingFunctionUtils.java | 7 +-
.../streaming/util/keys/KeySelectorUtil.java | 10 +-
.../AbstractDeserializationSchema.java | 3 +-
.../serialization/DeserializationSchema.java | 6 +-
.../util/serialization/SerializationSchema.java | 3 +-
.../util/serialization/SimpleStringSchema.java | 9 +-
.../TypeInformationSerializationSchema.java | 3 +-
.../streaming/util/typeutils/FieldAccessor.java | 19 +-
.../util/typeutils/FieldAccessorFactory.java | 7 +-
.../consumer/StreamTestSingleInputGate.java | 5 +-
.../streaming/api/AggregationFunctionTest.java | 41 ++-
.../flink/streaming/api/DataStreamTest.java | 34 ++-
.../streaming/api/RestartStrategyTest.java | 12 +-
.../flink/streaming/api/SourceFunctionTest.java | 16 +-
.../api/StreamExecutionEnvironmentTest.java | 12 +-
.../flink/streaming/api/TypeFillTest.java | 11 +-
.../api/checkpoint/ListCheckpointedTest.java | 4 +
.../api/collector/OutputSelectorTest.java | 13 +-
.../LocalStreamEnvironmentITCase.java | 5 +-
.../AscendingTimestampExtractorTest.java | 6 +-
...dedOutOfOrdernessTimestampExtractorTest.java | 6 +-
.../api/functions/FromElementsFunctionTest.java | 20 +-
.../functions/IngestionTimeExtractorTest.java | 7 +-
.../api/functions/ListSourceContext.java | 1 -
.../functions/StatefulSequenceSourceTest.java | 7 +-
.../functions/async/RichAsyncFunctionTest.java | 4 +-
.../sink/OutputFormatSinkFunctionTest.java | 4 +
.../functions/sink/SocketClientSinkTest.java | 3 +-
.../source/FileMonitoringFunctionTest.java | 8 +-
.../source/InputFormatSourceFunctionTest.java | 7 +-
.../source/SocketTextStreamFunctionTest.java | 7 +-
.../delta/extractor/ArrayFromTupleTest.java | 9 +-
.../extractor/ConcatenatedExtractTest.java | 8 +-
.../delta/extractor/FieldFromArrayTest.java | 3 +
.../delta/extractor/FieldFromTupleTest.java | 4 +
.../delta/extractor/FieldsFromArrayTest.java | 8 +-
.../delta/extractor/FieldsFromTupleTest.java | 9 +-
.../streaming/api/graph/SlotAllocationTest.java | 26 +-
.../api/graph/StreamGraphGeneratorTest.java | 24 +-
.../graph/StreamingJobGraphGeneratorTest.java | 7 +-
.../operators/AbstractStreamOperatorTest.java | 39 ++-
.../AbstractUdfStreamOperatorLifecycleTest.java | 1 +
.../FoldApplyProcessWindowFunctionTest.java | 8 +-
.../operators/FoldApplyWindowFunctionTest.java | 8 +-
.../operators/HeapInternalTimerServiceTest.java | 15 +-
.../api/operators/KeyedProcessOperatorTest.java | 3 +-
.../operators/OperatorSnapshotResultTest.java | 4 +
.../api/operators/ProcessOperatorTest.java | 4 +-
.../operators/StateDescriptorPassingTest.java | 11 +-
.../StateInitializationContextImplTest.java | 6 +-
...StateSnapshotContextSynchronousImplTest.java | 4 +
.../api/operators/StreamFilterTest.java | 5 +-
.../api/operators/StreamFlatMapTest.java | 7 +-
.../api/operators/StreamGroupedFoldTest.java | 4 +-
.../api/operators/StreamGroupedReduceTest.java | 5 +-
.../streaming/api/operators/StreamMapTest.java | 5 +-
.../StreamOperatorSnapshotRestoreTest.java | 4 +
.../api/operators/StreamProjectTest.java | 4 +-
.../StreamSourceContextIdleDetectionTests.java | 52 ++--
.../operators/StreamingRuntimeContextTest.java | 12 +-
.../api/operators/TestInternalTimerService.java | 1 +
.../WrappingFunctionSnapshotRestoreTest.java | 5 +-
.../operators/async/AsyncWaitOperatorTest.java | 24 +-
.../api/operators/async/EmitterTest.java | 4 +
.../queue/OrderedStreamElementQueueTest.java | 3 +-
.../async/queue/StreamElementQueueTest.java | 1 +
.../queue/UnorderedStreamElementQueueTest.java | 3 +-
.../api/operators/co/CoProcessOperatorTest.java | 9 +-
.../api/operators/co/CoStreamFlatMapTest.java | 11 +-
.../api/operators/co/CoStreamMapTest.java | 4 +-
.../co/KeyedCoProcessOperatorTest.java | 7 +-
.../functions/InternalWindowFunctionTest.java | 46 +--
.../api/streamtask/MockRecordWriter.java | 11 +-
.../api/streamtask/StreamIterationHeadTest.java | 5 +-
.../deltafunction/CosineDistanceTest.java | 43 +--
.../deltafunction/EuclideanDistanceTest.java | 41 +--
.../StreamingJobGraphGeneratorNodeHashTest.java | 5 +-
.../flink/streaming/graph/TranslationTest.java | 6 +-
.../WithMasterCheckpointHookConfigTest.java | 7 +-
.../io/BarrierBufferAlignmentLimitTest.java | 24 +-
.../io/BarrierBufferMassiveRandomTest.java | 9 +-
.../streaming/runtime/io/BarrierBufferTest.java | 51 ++--
.../runtime/io/BarrierTrackerTest.java | 2 +-
.../streaming/runtime/io/BufferSpillerTest.java | 24 +-
.../streaming/runtime/io/MockInputGate.java | 3 +
.../io/SpilledBufferOrEventSequenceTest.java | 9 +-
.../runtime/io/StreamRecordWriterTest.java | 9 +-
.../ContinuousFileProcessingRescalingTest.java | 5 +-
.../operators/GenericWriteAheadSinkTest.java | 8 +-
.../operators/StreamOperatorChainingTest.java | 6 +-
.../operators/StreamSourceOperatorTest.java | 17 +-
.../runtime/operators/StreamTaskTimerTest.java | 14 +-
.../TestProcessingTimeServiceTest.java | 8 +-
...stampsAndPeriodicWatermarksOperatorTest.java | 7 +-
...ampsAndPunctuatedWatermarksOperatorTest.java | 3 +
.../operators/WriteAheadSinkTestBase.java | 3 +
...AlignedProcessingTimeWindowOperatorTest.java | 21 +-
...AlignedProcessingTimeWindowOperatorTest.java | 12 +-
.../windowing/AllWindowTranslationTest.java | 4 +-
.../ContinuousEventTimeTriggerTest.java | 6 +-
.../operators/windowing/CountTriggerTest.java | 4 +-
.../windowing/EventTimeSessionWindowsTest.java | 39 ++-
.../windowing/EventTimeTriggerTest.java | 4 +-
.../EvictingWindowOperatorContractTest.java | 1 +
.../windowing/EvictingWindowOperatorTest.java | 143 ++++-----
.../operators/windowing/GlobalWindowsTest.java | 9 +-
.../windowing/KeyMapPutIfAbsentTest.java | 5 +-
.../operators/windowing/KeyMapPutTest.java | 17 +-
.../runtime/operators/windowing/KeyMapTest.java | 12 +-
.../windowing/MergingWindowSetTest.java | 18 +-
.../ProcessingTimeSessionWindowsTest.java | 25 +-
.../windowing/ProcessingTimeTriggerTest.java | 4 +-
.../operators/windowing/PurgingTriggerTest.java | 11 +-
.../RegularWindowOperatorContractTest.java | 28 +-
.../windowing/SimpleTriggerTestHarness.java | 1 +
.../windowing/SlidingEventTimeWindowsTest.java | 12 +-
.../SlidingProcessingTimeWindowsTest.java | 11 +-
.../windowing/StreamRecordMatchers.java | 290 +++++++++----------
.../operators/windowing/TimeWindowTest.java | 44 +--
.../windowing/TimeWindowTranslationTest.java | 9 +-
.../operators/windowing/TriggerTestHarness.java | 5 +-
.../windowing/TumblingEventTimeWindowsTest.java | 10 +-
.../TumblingProcessingTimeWindowsTest.java | 10 +-
.../windowing/WindowOperatorContractTest.java | 77 +++--
.../WindowOperatorFrom11MigrationTest.java | 46 ++-
.../WindowOperatorFrom12MigrationTest.java | 77 ++---
.../operators/windowing/WindowOperatorTest.java | 264 ++++++++---------
.../windowing/WindowTranslationTest.java | 15 +-
.../operators/windowing/WindowedValue.java | 33 ++-
.../partitioner/BroadcastPartitionerTest.java | 8 +-
.../partitioner/ForwardPartitionerTest.java | 8 +-
.../partitioner/GlobalPartitionerTest.java | 8 +-
.../KeyGroupStreamPartitionerTest.java | 10 +-
.../partitioner/RebalancePartitionerTest.java | 8 +-
.../partitioner/RescalePartitionerTest.java | 12 +-
.../partitioner/ShufflePartitionerTest.java | 10 +-
.../StreamElementSerializerTest.java | 4 +-
.../runtime/streamrecord/StreamRecordTest.java | 11 +-
.../streamstatus/StatusWatermarkValveTest.java | 4 +-
.../runtime/streamstatus/StreamStatusTest.java | 5 +-
.../runtime/tasks/BlockingCheckpointsTest.java | 11 +-
.../tasks/InterruptSensitiveRestoreTest.java | 9 +-
.../runtime/tasks/OneInputStreamTaskTest.java | 34 ++-
.../tasks/OneInputStreamTaskTestHarness.java | 10 +-
.../SourceExternalCheckpointTriggerTest.java | 6 +-
.../runtime/tasks/SourceStreamTaskTest.java | 30 +-
.../runtime/tasks/StreamMockEnvironment.java | 9 +-
.../StreamTaskCancellationBarrierTest.java | 14 +-
.../streaming/runtime/tasks/StreamTaskTest.java | 44 +--
.../runtime/tasks/StreamTaskTestHarness.java | 14 +-
.../tasks/SystemProcessingTimeServiceTest.java | 9 +-
.../runtime/tasks/TwoInputStreamTaskTest.java | 8 +-
.../tasks/TwoInputStreamTaskTestHarness.java | 10 +-
.../util/AbstractDeserializationSchemaTest.java | 8 +-
.../util/AbstractStreamOperatorTestHarness.java | 41 ++-
.../streaming/util/CollectingSourceContext.java | 3 +
.../flink/streaming/util/CollectorOutput.java | 16 +-
.../streaming/util/EvenOddOutputSelector.java | 4 +
.../streaming/util/HDFSCopyUtilitiesTest.java | 5 +
.../KeyedOneInputStreamOperatorTestHarness.java | 9 +-
.../KeyedTwoInputStreamOperatorTestHarness.java | 5 +-
.../flink/streaming/util/MockContext.java | 13 +-
.../apache/flink/streaming/util/MockOutput.java | 20 +-
.../apache/flink/streaming/util/NoOpIntMap.java | 4 +
.../util/OneInputStreamOperatorTestHarness.java | 2 +-
.../streaming/util/OperatorSnapshotUtil.java | 14 +-
.../streaming/util/SourceFunctionUtil.java | 16 +-
.../flink/streaming/util/TestHarnessUtil.java | 4 +-
.../util/TwoInputStreamOperatorTestHarness.java | 3 +-
.../TypeInformationSerializationSchemaTest.java | 8 +-
.../util/keys/ArrayKeySelectorTest.java | 7 +-
.../serialization/SimpleStringSchemaTest.java | 4 +-
.../util/typeutils/FieldAccessorTest.java | 53 ++--
tools/maven/strict-checkstyle.xml | 22 +-
397 files changed, 2417 insertions(+), 1853 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/pom.xml
----------------------------------------------------------------------
diff --git a/flink-streaming-java/pom.xml b/flink-streaming-java/pom.xml
index 46142de..ab972a9 100644
--- a/flink-streaming-java/pom.xml
+++ b/flink-streaming-java/pom.xml
@@ -139,6 +139,7 @@ under the License.
<configuration>
<configLocation>/tools/maven/strict-checkstyle.xml</configLocation>
<suppressionsLocation>/tools/maven/suppressions.xml</suppressionsLocation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
<logViolationsToConsole>true</logViolationsToConsole>
<failOnViolation>true</failOnViolation>
</configuration>
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/api/graph/StreamGraphHasherV1.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/api/graph/StreamGraphHasherV1.java b/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/api/graph/StreamGraphHasherV1.java
index f468c93..cfaa4b1 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/api/graph/StreamGraphHasherV1.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/api/graph/StreamGraphHasherV1.java
@@ -18,11 +18,21 @@
package org.apache.flink.migration.streaming.api.graph;
-import static org.apache.flink.util.StringUtils.byteToHexString;
+import org.apache.flink.streaming.api.graph.StreamEdge;
+import org.apache.flink.streaming.api.graph.StreamGraph;
+import org.apache.flink.streaming.api.graph.StreamGraphHasher;
+import org.apache.flink.streaming.api.graph.StreamNode;
+import org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator;
+import org.apache.flink.streaming.api.operators.ChainingStrategy;
+import org.apache.flink.streaming.api.operators.StreamOperator;
+import org.apache.flink.streaming.runtime.partitioner.ForwardPartitioner;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.nio.charset.Charset;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -34,16 +44,8 @@ import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
-import org.apache.flink.streaming.api.graph.StreamEdge;
-import org.apache.flink.streaming.api.graph.StreamGraph;
-import org.apache.flink.streaming.api.graph.StreamGraphHasher;
-import org.apache.flink.streaming.api.graph.StreamNode;
-import org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator;
-import org.apache.flink.streaming.api.operators.ChainingStrategy;
-import org.apache.flink.streaming.api.operators.StreamOperator;
-import org.apache.flink.streaming.runtime.partitioner.ForwardPartitioner;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import static org.apache.flink.util.StringUtils.byteToHexString;
/**
* StreamGraphHasher from Flink 1.1. This contains duplicated code to ensure that the algorithm does not change with
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/runtime/streamrecord/MultiplexingStreamRecordSerializer.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/runtime/streamrecord/MultiplexingStreamRecordSerializer.java b/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/runtime/streamrecord/MultiplexingStreamRecordSerializer.java
index 81ba33a..b1471b2 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/runtime/streamrecord/MultiplexingStreamRecordSerializer.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/runtime/streamrecord/MultiplexingStreamRecordSerializer.java
@@ -18,10 +18,6 @@
package org.apache.flink.migration.streaming.runtime.streamrecord;
-import static java.util.Objects.requireNonNull;
-
-import java.io.IOException;
-
import org.apache.flink.api.common.typeutils.CompatibilityResult;
import org.apache.flink.api.common.typeutils.CompatibilityUtil;
import org.apache.flink.api.common.typeutils.CompositeTypeSerializerConfigSnapshot;
@@ -36,6 +32,10 @@ import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamElement;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import java.io.IOException;
+
+import static java.util.Objects.requireNonNull;
+
/**
* Legacy multiplexing {@link TypeSerializer} for stream records, watermarks and other stream
* elements.
@@ -52,7 +52,6 @@ public class MultiplexingStreamRecordSerializer<T> extends TypeSerializer<Stream
private final TypeSerializer<T> typeSerializer;
-
public MultiplexingStreamRecordSerializer(TypeSerializer<T> serializer) {
if (serializer instanceof MultiplexingStreamRecordSerializer || serializer instanceof StreamRecordSerializer) {
throw new RuntimeException("StreamRecordSerializer given to StreamRecordSerializer as value TypeSerializer: " + serializer);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/runtime/streamrecord/StreamRecordSerializer.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/runtime/streamrecord/StreamRecordSerializer.java b/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/runtime/streamrecord/StreamRecordSerializer.java
index 5c32c19..e018ba0 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/runtime/streamrecord/StreamRecordSerializer.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/migration/streaming/runtime/streamrecord/StreamRecordSerializer.java
@@ -18,7 +18,6 @@
package org.apache.flink.migration.streaming.runtime.streamrecord;
-import java.io.IOException;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.CompatibilityResult;
import org.apache.flink.api.common.typeutils.CompatibilityUtil;
@@ -33,6 +32,8 @@ import org.apache.flink.core.memory.DataOutputView;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.Preconditions;
+import java.io.IOException;
+
/**
* Serializer for {@link StreamRecord}. This version ignores timestamps and only deals with
* the element.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/SimpleTimerService.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/SimpleTimerService.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/SimpleTimerService.java
index 43d2659..427b86b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/SimpleTimerService.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/SimpleTimerService.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimeCharacteristic.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimeCharacteristic.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimeCharacteristic.java
index 9925608..d586ae7 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimeCharacteristic.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimeCharacteristic.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.api;
-
import org.apache.flink.annotation.PublicEvolving;
/**
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimeDomain.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimeDomain.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimeDomain.java
index 7cdfdc2..eedc7a5 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimeDomain.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimeDomain.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api;
/**
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimerService.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimerService.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimerService.java
index ef8b631..648d0e0 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimerService.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/TimerService.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api;
import org.apache.flink.annotation.PublicEvolving;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/Checkpointed.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/Checkpointed.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/Checkpointed.java
index 6de7329..7dedfbf 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/Checkpointed.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/Checkpointed.java
@@ -18,9 +18,10 @@
package org.apache.flink.streaming.api.checkpoint;
-import java.io.Serializable;
import org.apache.flink.annotation.PublicEvolving;
+import java.io.Serializable;
+
/**
* This method must be implemented by functions that have state that needs to be
* checkpointed. The functions get a call whenever a checkpoint should take place
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/CheckpointedAsynchronously.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/CheckpointedAsynchronously.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/CheckpointedAsynchronously.java
index b96c242..2230f59 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/CheckpointedAsynchronously.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/CheckpointedAsynchronously.java
@@ -18,9 +18,10 @@
package org.apache.flink.streaming.api.checkpoint;
-import java.io.Serializable;
import org.apache.flink.annotation.PublicEvolving;
+import java.io.Serializable;
+
/**
* This interface marks a function/operator as checkpointed similar to the
* {@link Checkpointed} interface, but gives the Flink framework the option to
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/CheckpointedRestoring.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/CheckpointedRestoring.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/CheckpointedRestoring.java
index f695418..cfaa505 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/CheckpointedRestoring.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/CheckpointedRestoring.java
@@ -18,9 +18,10 @@
package org.apache.flink.streaming.api.checkpoint;
-import java.io.Serializable;
import org.apache.flink.annotation.PublicEvolving;
+import java.io.Serializable;
+
/**
* This deprecated interface contains the methods for restoring from the legacy checkpointing mechanism of state.
* @param <T> type of the restored state.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointed.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointed.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointed.java
index 49ce3e3..0b8b1b6 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointed.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointed.java
@@ -18,13 +18,14 @@
package org.apache.flink.streaming.api.checkpoint;
-import java.io.Serializable;
-import java.util.List;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.functions.RichFunction;
import org.apache.flink.api.common.state.OperatorStateStore;
import org.apache.flink.configuration.Configuration;
+import java.io.Serializable;
+import java.util.List;
+
/**
* This interface can be implemented by functions that want to store state in checkpoints.
* It can be used in a similar way as the deprecated {@link Checkpointed} interface, but
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/CopyingDirectedOutput.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/CopyingDirectedOutput.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/CopyingDirectedOutput.java
index f74d652..5f7e278 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/CopyingDirectedOutput.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/CopyingDirectedOutput.java
@@ -17,14 +17,15 @@
package org.apache.flink.streaming.api.collector.selector;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.graph.StreamEdge;
import org.apache.flink.streaming.api.operators.Output;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
/**
* Special version of {@link DirectedOutput} that performs a shallow copy of the
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/DirectedOutput.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/DirectedOutput.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/DirectedOutput.java
index 660a077..ec4700f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/DirectedOutput.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/DirectedOutput.java
@@ -17,15 +17,6 @@
package org.apache.flink.streaming.api.collector.selector;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.graph.StreamEdge;
import org.apache.flink.streaming.api.operators.Output;
@@ -35,6 +26,15 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.OutputTag;
import org.apache.flink.util.XORShiftRandom;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+
/**
* Wrapping {@link Output} that forwards to other {@link Output Outputs } based on a list of
* {@link OutputSelector OutputSelectors}.
@@ -51,7 +51,6 @@ public class DirectedOutput<OUT> implements Output<StreamRecord<OUT>> {
private final Random random = new XORShiftRandom();
-
@SuppressWarnings({"unchecked", "rawtypes"})
public DirectedOutput(
List<OutputSelector<OUT>> outputSelectors,
@@ -63,7 +62,6 @@ public class DirectedOutput<OUT> implements Output<StreamRecord<OUT>> {
allOutputs[i] = outputs.get(i).f0;
}
-
HashSet<Output<StreamRecord<OUT>>> selectAllOutputs = new HashSet<Output<StreamRecord<OUT>>>();
HashMap<String, ArrayList<Output<StreamRecord<OUT>>>> outputMap = new HashMap<String, ArrayList<Output<StreamRecord<OUT>>>>();
@@ -100,7 +98,6 @@ public class DirectedOutput<OUT> implements Output<StreamRecord<OUT>> {
}
}
-
@Override
public void emitWatermark(Watermark mark) {
for (Output<StreamRecord<OUT>> out : allOutputs) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/OutputSelector.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/OutputSelector.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/OutputSelector.java
index b40f3f5..a8433fe 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/OutputSelector.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/collector/selector/OutputSelector.java
@@ -17,12 +17,12 @@
package org.apache.flink.streaming.api.collector.selector;
-import java.io.Serializable;
-
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.datastream.SplitStream;
+import java.io.Serializable;
+
/**
* Interface for defining an OutputSelector for a {@link SplitStream} using
* the {@link SingleOutputStreamOperator#split} call. Every output object of a
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java
index 7ea65fc..31dbb4f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.api.datastream;
-import static org.apache.flink.util.Preconditions.checkArgument;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.functions.AggregateFunction;
@@ -70,6 +67,9 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.OutputTag;
import org.apache.flink.util.Preconditions;
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* A {@code AllWindowedStream} represents a data stream where the stream of
* elements is split into windows based on a
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AsyncDataStream.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AsyncDataStream.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AsyncDataStream.java
index 759e32a..8461d2c 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AsyncDataStream.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AsyncDataStream.java
@@ -17,7 +17,6 @@
package org.apache.flink.streaming.api.datastream;
-import java.util.concurrent.TimeUnit;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.Utils;
@@ -25,6 +24,8 @@ import org.apache.flink.api.java.typeutils.TypeExtractor;
import org.apache.flink.streaming.api.functions.async.AsyncFunction;
import org.apache.flink.streaming.api.operators.async.AsyncWaitOperator;
+import java.util.concurrent.TimeUnit;
+
/**
* A helper class to apply {@link AsyncFunction} to a data stream.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/CoGroupedStreams.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/CoGroupedStreams.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/CoGroupedStreams.java
index f0c3dc2..d112260 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/CoGroupedStreams.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/CoGroupedStreams.java
@@ -17,11 +17,6 @@
package org.apache.flink.streaming.api.datastream;
-import static java.util.Objects.requireNonNull;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
@@ -44,6 +39,12 @@ import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static java.util.Objects.requireNonNull;
+
/**
*{@code CoGroupedStreams} represents two {@link DataStream DataStreams} that have been co-grouped.
* A streaming co-group operation is evaluated over elements in a window.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java
index 0a2b4e1..0b882c8 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.datastream;
-import static java.util.Objects.requireNonNull;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
@@ -37,6 +35,8 @@ import org.apache.flink.streaming.api.operators.co.CoStreamMap;
import org.apache.flink.streaming.api.operators.co.KeyedCoProcessOperator;
import org.apache.flink.streaming.api.transformations.TwoInputTransformation;
+import static java.util.Objects.requireNonNull;
+
/**
* ConnectedStreams represent two connected streams of (possibly) different data types.
* Connected streams are useful for cases where operations on one stream directly
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java
index c531987..0cdc9a1 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.datastream;
-import java.util.ArrayList;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
@@ -96,6 +94,9 @@ import org.apache.flink.streaming.util.keys.KeySelectorUtil;
import org.apache.flink.streaming.util.serialization.SerializationSchema;
import org.apache.flink.util.Preconditions;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* A DataStream represents a stream of elements of the same type. A DataStream
* can be transformed into another DataStream by applying a transformation as
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java
index b0be71f..7fa66db 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java
@@ -17,7 +17,6 @@
package org.apache.flink.streaming.api.datastream;
-import java.util.Collection;
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.typeinfo.TypeInformation;
@@ -28,6 +27,8 @@ import org.apache.flink.streaming.api.transformations.CoFeedbackTransformation;
import org.apache.flink.streaming.api.transformations.FeedbackTransformation;
import org.apache.flink.streaming.api.transformations.StreamTransformation;
+import java.util.Collection;
+
/**
* The iterative data stream represents the start of an iteration in a {@link DataStream}.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/JoinedStreams.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/JoinedStreams.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/JoinedStreams.java
index 77a252e..e1ffe86 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/JoinedStreams.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/JoinedStreams.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.datastream;
-import static java.util.Objects.requireNonNull;
-
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.functions.CoGroupFunction;
@@ -35,6 +33,8 @@ import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import static java.util.Objects.requireNonNull;
+
/**
*{@code JoinedStreams} represents two {@link DataStream DataStreams} that have been joined.
* A streaming join operation is evaluated over elements in a window.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java
index e3171c3..698deb8 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java
@@ -17,11 +17,6 @@
package org.apache.flink.streaming.api.datastream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Stack;
-import java.util.UUID;
-import org.apache.commons.lang3.StringUtils;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
@@ -72,6 +67,13 @@ import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.streaming.runtime.partitioner.KeyGroupStreamPartitioner;
import org.apache.flink.streaming.runtime.partitioner.StreamPartitioner;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+import java.util.UUID;
+
/**
* A {@code KeyedStream} represents a {@link DataStream} on which operator state is
* partitioned by key using a provided {@link KeySelector}. Typical operations supported by a
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java
index d033e98..e0deb9a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java
@@ -17,10 +17,6 @@
package org.apache.flink.streaming.api.datastream;
-import static java.util.Objects.requireNonNull;
-
-import java.util.HashMap;
-import java.util.Map;
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.functions.InvalidTypesException;
@@ -37,6 +33,11 @@ import org.apache.flink.streaming.runtime.partitioner.StreamPartitioner;
import org.apache.flink.util.OutputTag;
import org.apache.flink.util.Preconditions;
+import java.util.HashMap;
+import java.util.Map;
+
+import static java.util.Objects.requireNonNull;
+
/**
* {@code SingleOutputStreamOperator} represents a user defined transformation
* applied on a {@link DataStream} with one predefined output type.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SplitStream.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SplitStream.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SplitStream.java
index 9fcd2fc..4be6b6e 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SplitStream.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SplitStream.java
@@ -17,12 +17,13 @@
package org.apache.flink.streaming.api.datastream;
-import com.google.common.collect.Lists;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.streaming.api.collector.selector.OutputSelector;
import org.apache.flink.streaming.api.transformations.SelectTransformation;
import org.apache.flink.streaming.api.transformations.SplitTransformation;
+import com.google.common.collect.Lists;
+
/**
* The SplitStream represents an operator that has been split using an
* {@link OutputSelector}. Named outputs can be selected using the
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java
index 7913e95..f8a1914 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.api.datastream;
-import static org.apache.flink.util.Preconditions.checkArgument;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
@@ -79,6 +76,9 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.OutputTag;
import org.apache.flink.util.Preconditions;
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* A {@code WindowedStream} represents a data stream where elements are grouped by
* key, and for each key, the stream of elements is split into windows based on a
@@ -1709,7 +1709,6 @@ public class WindowedStream<T, K, W extends Window> {
InternalWindowFunction<Iterable<T>, R, K, TimeWindow> timeWindowFunction =
(InternalWindowFunction<Iterable<T>, R, K, TimeWindow>) function;
-
OneInputStreamOperator<T, R> op = new AccumulatingProcessingTimeWindowOperator<>(
timeWindowFunction, input.getKeySelector(),
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
@@ -1721,7 +1720,6 @@ public class WindowedStream<T, K, W extends Window> {
return null;
}
-
public StreamExecutionEnvironment getExecutionEnvironment() {
return input.getExecutionEnvironment();
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/CheckpointConfig.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/CheckpointConfig.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/CheckpointConfig.java
index 8d8abfb..da65147 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/CheckpointConfig.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/CheckpointConfig.java
@@ -18,15 +18,15 @@
package org.apache.flink.streaming.api.environment;
-import static java.util.Objects.requireNonNull;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.configuration.ConfigConstants;
import org.apache.flink.runtime.jobgraph.JobStatus;
import org.apache.flink.streaming.api.CheckpointingMode;
+import static java.util.Objects.requireNonNull;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* Configuration that captures all checkpointing related settings.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironment.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironment.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironment.java
index b4031fa..6b31ff8 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironment.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/LocalStreamEnvironment.java
@@ -26,8 +26,8 @@ import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.TaskManagerOptions;
import org.apache.flink.runtime.jobgraph.JobGraph;
import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster;
-
import org.apache.flink.streaming.api.graph.StreamGraph;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/RemoteStreamEnvironment.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/RemoteStreamEnvironment.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/RemoteStreamEnvironment.java
index 2ff45ba..042248b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/RemoteStreamEnvironment.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/RemoteStreamEnvironment.java
@@ -17,15 +17,6 @@
package org.apache.flink.streaming.api.environment;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
import org.apache.flink.annotation.Public;
import org.apache.flink.api.common.InvalidProgramException;
import org.apache.flink.api.common.JobExecutionResult;
@@ -36,11 +27,20 @@ import org.apache.flink.client.program.ProgramInvocationException;
import org.apache.flink.client.program.StandaloneClusterClient;
import org.apache.flink.configuration.ConfigConstants;
import org.apache.flink.configuration.Configuration;
-
import org.apache.flink.streaming.api.graph.StreamGraph;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
/**
* A {@link StreamExecutionEnvironment} for executing on a cluster.
*/
@@ -253,7 +253,6 @@ public class RemoteStreamEnvironment extends StreamExecutionEnvironment {
return port;
}
-
public Configuration getClientConfiguration() {
return clientConfiguration;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamContextEnvironment.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamContextEnvironment.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamContextEnvironment.java
index 52d2c4b..64c3a1f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamContextEnvironment.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamContextEnvironment.java
@@ -21,7 +21,6 @@ import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.JobExecutionResult;
import org.apache.flink.client.program.ContextEnvironment;
import org.apache.flink.client.program.DetachedEnvironment;
-
import org.apache.flink.configuration.ConfigConstants;
import org.apache.flink.configuration.GlobalConfiguration;
import org.apache.flink.streaming.api.graph.StreamGraph;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
index 97117d2..46c821e 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
@@ -17,16 +17,6 @@
package org.apache.flink.streaming.api.environment;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
-import com.esotericsoftware.kryo.Serializer;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
@@ -87,6 +77,18 @@ import org.apache.flink.streaming.api.transformations.StreamTransformation;
import org.apache.flink.util.Preconditions;
import org.apache.flink.util.SplittableIterator;
+import com.esotericsoftware.kryo.Serializer;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* The StreamExecutionEnvironment is the context in which a streaming program is executed. A
* {@link LocalStreamEnvironment} will cause execution in the current JVM, a
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/AssignerWithPeriodicWatermarks.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/AssignerWithPeriodicWatermarks.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/AssignerWithPeriodicWatermarks.java
index 4621988..823a5c3 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/AssignerWithPeriodicWatermarks.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/AssignerWithPeriodicWatermarks.java
@@ -18,10 +18,11 @@
package org.apache.flink.streaming.api.functions;
-import javax.annotation.Nullable;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.streaming.api.watermark.Watermark;
+import javax.annotation.Nullable;
+
/**
* The {@code AssignerWithPeriodicWatermarks} assigns event time timestamps to elements,
* and generates low watermarks that signal event time progress within the stream.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/AssignerWithPunctuatedWatermarks.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/AssignerWithPunctuatedWatermarks.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/AssignerWithPunctuatedWatermarks.java
index 2040e77..a69a839 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/AssignerWithPunctuatedWatermarks.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/AssignerWithPunctuatedWatermarks.java
@@ -18,9 +18,10 @@
package org.apache.flink.streaming.api.functions;
-import javax.annotation.Nullable;
import org.apache.flink.streaming.api.watermark.Watermark;
+import javax.annotation.Nullable;
+
/**
* The {@code AssignerWithPunctuatedWatermarks} assigns event time timestamps to elements,
* and generates low watermarks that signal event time progress within the stream.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/ComparableAggregator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/ComparableAggregator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/ComparableAggregator.java
index a2a84fe..6f13f5c 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/ComparableAggregator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/ComparableAggregator.java
@@ -67,7 +67,6 @@ public class ComparableAggregator<T> extends AggregationFunction<T> {
this(aggregationType, FieldAccessorFactory.getAccessor(typeInfo, field, config), first);
}
-
@SuppressWarnings("unchecked")
@Override
public T reduce(T value1, T value2) throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/Comparator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/Comparator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/Comparator.java
index 9202a49..14218ea 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/Comparator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/Comparator.java
@@ -17,11 +17,11 @@
package org.apache.flink.streaming.api.functions.aggregation;
-import java.io.Serializable;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.functions.aggregation.AggregationFunction.AggregationType;
+import java.io.Serializable;
+
/**
* Internal comparator implementation, for use with {@link ComparableAggregator}.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/SumFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/SumFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/SumFunction.java
index 9bbac3d..a177c58 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/SumFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/aggregation/SumFunction.java
@@ -17,9 +17,10 @@
package org.apache.flink.streaming.api.functions.aggregation;
-import java.io.Serializable;
import org.apache.flink.annotation.Internal;
+import java.io.Serializable;
+
/**
* Internal function for summing up contents of fields. This is used with {@link SumAggregator}.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/AsyncFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/AsyncFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/AsyncFunction.java
index c0cde30..5bb4459 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/AsyncFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/AsyncFunction.java
@@ -18,11 +18,12 @@
package org.apache.flink.streaming.api.functions.async;
-import java.io.Serializable;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.functions.Function;
import org.apache.flink.streaming.api.functions.async.collector.AsyncCollector;
+import java.io.Serializable;
+
/**
* A function to trigger Async I/O operation.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunction.java
index 3885b1c..84f9e53 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunction.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.api.functions.async;
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.accumulators.Accumulator;
@@ -50,6 +47,10 @@ import org.apache.flink.streaming.api.functions.async.collector.AsyncCollector;
import org.apache.flink.types.Value;
import org.apache.flink.util.Preconditions;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
/**
* Rich variant of the {@link AsyncFunction}. As a {@link RichFunction}, it gives access to the
* {@link RuntimeContext} and provides setup and teardown methods:
@@ -181,7 +182,6 @@ public abstract class RichAsyncFunction<IN, OUT> extends AbstractRichFunction im
throw new UnsupportedOperationException("State is not supported in rich async functions.");
}
-
@Override
public <V, A extends Serializable> void addAccumulator(String name, Accumulator<V, A> accumulator) {
throw new UnsupportedOperationException("Accumulators are not supported in rich async functions.");
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/collector/AsyncCollector.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/collector/AsyncCollector.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/collector/AsyncCollector.java
index 9c07d1a..964c13a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/collector/AsyncCollector.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/async/collector/AsyncCollector.java
@@ -18,9 +18,10 @@
package org.apache.flink.streaming.api.functions.async.collector;
-import java.util.Collection;
import org.apache.flink.annotation.PublicEvolving;
+import java.util.Collection;
+
/**
* {@link AsyncCollector} collects data / error in user codes while processing async i/o.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/co/CoFlatMapFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/co/CoFlatMapFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/co/CoFlatMapFunction.java
index 03bfcbd..d693ee4 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/co/CoFlatMapFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/co/CoFlatMapFunction.java
@@ -18,12 +18,12 @@
package org.apache.flink.streaming.api.functions.co;
-import java.io.Serializable;
-
import org.apache.flink.annotation.Public;
import org.apache.flink.api.common.functions.Function;
import org.apache.flink.util.Collector;
+import java.io.Serializable;
+
/**
* A CoFlatMapFunction implements a flat-map transformation over two
* connected streams.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/co/CoMapFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/co/CoMapFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/co/CoMapFunction.java
index 71fcbc8..3a3904a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/co/CoMapFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/co/CoMapFunction.java
@@ -18,11 +18,11 @@
package org.apache.flink.streaming.api.functions.co;
-import java.io.Serializable;
-
import org.apache.flink.annotation.Public;
import org.apache.flink.api.common.functions.Function;
+import java.io.Serializable;
+
/**
* A CoFlatMapFunction implements a map() transformation over two
* connected streams.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunction.java
index ed308c5..fbcc2d0 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunction.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.functions.sink;
-import java.io.IOException;
-
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.RuntimeContext;
@@ -32,6 +30,8 @@ import org.apache.flink.configuration.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+
/**
* Simple implementation of the SinkFunction writing tuples in the specified
* OutputFormat format.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/PrintSinkFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/PrintSinkFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/PrintSinkFunction.java
index bc47e9f..e646663 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/PrintSinkFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/PrintSinkFunction.java
@@ -17,12 +17,12 @@
package org.apache.flink.streaming.api.functions.sink;
-import java.io.PrintStream;
-
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.operators.StreamingRuntimeContext;
+import java.io.PrintStream;
+
/**
* Implementation of the SinkFunction writing every tuple to the standard
* output or standard error stream.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SinkFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SinkFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SinkFunction.java
index 68a630b..cb9e11d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SinkFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SinkFunction.java
@@ -17,11 +17,11 @@
package org.apache.flink.streaming.api.functions.sink;
-import java.io.Serializable;
-
import org.apache.flink.annotation.Public;
import org.apache.flink.api.common.functions.Function;
+import java.io.Serializable;
+
/**
* Interface for implementing user defined sink functionality.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java
index 88cd4df..c43345b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java
@@ -17,19 +17,21 @@
package org.apache.flink.streaming.api.functions.sink;
-import static org.apache.flink.util.Preconditions.checkArgument;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.Socket;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.runtime.util.SerializableObject;
import org.apache.flink.streaming.util.serialization.SerializationSchema;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.Socket;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* Socket client that acts as a streaming sink. The data is sent to a Socket as a byte array.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormat.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormat.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormat.java
index 270b7b5..65915af 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormat.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormat.java
@@ -17,9 +17,10 @@
package org.apache.flink.streaming.api.functions.sink;
+import org.apache.flink.annotation.PublicEvolving;
+
import java.io.Serializable;
import java.util.ArrayList;
-import org.apache.flink.annotation.PublicEvolving;
/**
* Abstract class for formatting the output of the writeAsText and writeAsCsv
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormatAsCsv.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormatAsCsv.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormatAsCsv.java
index ed1451b..234dd39 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormatAsCsv.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormatAsCsv.java
@@ -17,12 +17,13 @@
package org.apache.flink.streaming.api.functions.sink;
+import org.apache.flink.annotation.PublicEvolving;
+
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
-import org.apache.flink.annotation.PublicEvolving;
/**
* Writes tuples in csv format.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormatAsText.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormatAsText.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormatAsText.java
index eb9ddcd..e331ed9 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormatAsText.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteFormatAsText.java
@@ -17,12 +17,13 @@
package org.apache.flink.streaming.api.functions.sink;
+import org.apache.flink.annotation.PublicEvolving;
+
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
-import org.apache.flink.annotation.PublicEvolving;
/**
* Writes tuples in text format.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteSinkFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteSinkFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteSinkFunction.java
index 9c8f5bd..fa2bd8d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteSinkFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteSinkFunction.java
@@ -17,10 +17,11 @@
package org.apache.flink.streaming.api.functions.sink;
+import org.apache.flink.annotation.PublicEvolving;
+
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
-import org.apache.flink.annotation.PublicEvolving;
/**
* Simple implementation of the SinkFunction writing tuples as simple text to
[04/10] flink git commit: [FLINK-6603] [streaming] Enable checkstyle
on test sources
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamSourceOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamSourceOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamSourceOperatorTest.java
index 2a6a723..d9fcc12 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamSourceOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamSourceOperatorTest.java
@@ -37,11 +37,11 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamElement;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.streamstatus.StreamStatus;
import org.apache.flink.streaming.runtime.streamstatus.StreamStatusMaintainer;
+import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.streaming.runtime.tasks.StreamTask;
-
import org.apache.flink.streaming.runtime.tasks.TestProcessingTimeService;
-import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.streaming.util.CollectorOutput;
+
import org.junit.Assert;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
@@ -52,12 +52,15 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+/**
+ * Tests for {@link StreamSource} operators.
+ */
@SuppressWarnings("serial")
public class StreamSourceOperatorTest {
@@ -86,7 +89,6 @@ public class StreamSourceOperatorTest {
final StreamSource<String, InfiniteSource<String>> operator =
new StreamSource<>(new InfiniteSource<String>());
-
setupSourceOperator(operator, TimeCharacteristic.EventTime, 0, 0);
operator.cancel();
@@ -106,7 +108,6 @@ public class StreamSourceOperatorTest {
final StreamSource<String, InfiniteSource<String>> operator =
new StreamSource<>(new InfiniteSource<String>());
-
setupSourceOperator(operator, TimeCharacteristic.EventTime, 0, 0);
// trigger an async cancel in a bit
@@ -139,7 +140,6 @@ public class StreamSourceOperatorTest {
final StoppableStreamSource<String, InfiniteSource<String>> operator =
new StoppableStreamSource<>(new InfiniteSource<String>());
-
setupSourceOperator(operator, TimeCharacteristic.EventTime, 0, 0);
operator.stop();
@@ -158,7 +158,6 @@ public class StreamSourceOperatorTest {
final StoppableStreamSource<String, InfiniteSource<String>> operator =
new StoppableStreamSource<>(new InfiniteSource<String>());
-
setupSourceOperator(operator, TimeCharacteristic.EventTime, 0, 0);
// trigger an async cancel in a bit
@@ -179,7 +178,7 @@ public class StreamSourceOperatorTest {
}
/**
- * Test that latency marks are emitted
+ * Test that latency marks are emitted.
*/
@Test
public void testLatencyMarkEmission() throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamTaskTimerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamTaskTimerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamTaskTimerTest.java
index 6772db4..6e3be03 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamTaskTimerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/StreamTaskTimerTest.java
@@ -24,15 +24,16 @@ import org.apache.flink.streaming.api.graph.StreamConfig;
import org.apache.flink.streaming.api.operators.StreamMap;
import org.apache.flink.streaming.runtime.tasks.OneInputStreamTask;
import org.apache.flink.streaming.runtime.tasks.OneInputStreamTaskTestHarness;
-import org.apache.flink.streaming.runtime.tasks.StreamTask;
-import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeCallback;
+import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
+import org.apache.flink.streaming.runtime.tasks.StreamTask;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicReference;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
/**
* Tests for the timer service of {@link org.apache.flink.streaming.runtime.tasks.StreamTask}.
@@ -65,7 +66,6 @@ public class StreamTaskTimerTest {
assertEquals(1, StreamTask.TRIGGER_THREAD_GROUP.activeCount());
-
testHarness.endInput();
testHarness.waitForTaskCompletion();
@@ -109,8 +109,7 @@ public class StreamTaskTimerTest {
long deadline = System.currentTimeMillis() + 20000;
while (errorRef.get() == null &&
ValidatingProcessingTimeCallback.numInSequence < 4 &&
- System.currentTimeMillis() < deadline)
- {
+ System.currentTimeMillis() < deadline) {
Thread.sleep(100);
}
@@ -170,6 +169,9 @@ public class StreamTaskTimerTest {
// ------------------------------------------------------------------------
+ /**
+ * Identity mapper.
+ */
public static class DummyMapFunction<T> implements MapFunction<T, T> {
@Override
public T map(T value) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TestProcessingTimeServiceTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TestProcessingTimeServiceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TestProcessingTimeServiceTest.java
index 9897884..675ffa3 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TestProcessingTimeServiceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TestProcessingTimeServiceTest.java
@@ -24,8 +24,8 @@ import org.apache.flink.streaming.api.operators.StreamMap;
import org.apache.flink.streaming.runtime.tasks.AsyncExceptionHandler;
import org.apache.flink.streaming.runtime.tasks.OneInputStreamTask;
import org.apache.flink.streaming.runtime.tasks.OneInputStreamTaskTestHarness;
-import org.apache.flink.streaming.runtime.tasks.TestProcessingTimeService;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeCallback;
+import org.apache.flink.streaming.runtime.tasks.TestProcessingTimeService;
import org.junit.Test;
@@ -33,6 +33,9 @@ import java.util.concurrent.atomic.AtomicReference;
import static org.junit.Assert.assertEquals;
+/**
+ * Tests for {@link TestProcessingTimeService}.
+ */
public class TestProcessingTimeServiceTest {
@Test
@@ -90,6 +93,9 @@ public class TestProcessingTimeServiceTest {
// ------------------------------------------------------------------------
+ /**
+ * An {@link AsyncExceptionHandler} storing the handled exception.
+ */
public static class ReferenceSettingExceptionHandler implements AsyncExceptionHandler {
private final AtomicReference<Throwable> errorReference;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPeriodicWatermarksOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPeriodicWatermarksOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPeriodicWatermarksOperatorTest.java
index f129c20..51af116 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPeriodicWatermarksOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPeriodicWatermarksOperatorTest.java
@@ -28,8 +28,13 @@ import org.junit.Test;
import java.util.concurrent.ConcurrentLinkedQueue;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+/**
+ * Tests for {@link TimestampsAndPeriodicWatermarksOperator}.
+ */
public class TimestampsAndPeriodicWatermarksOperatorTest {
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPunctuatedWatermarksOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPunctuatedWatermarksOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPunctuatedWatermarksOperatorTest.java
index 0333e93..a422432 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPunctuatedWatermarksOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/TimestampsAndPunctuatedWatermarksOperatorTest.java
@@ -30,6 +30,9 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import static org.junit.Assert.assertEquals;
+/**
+ * Tests for {@link TimestampsAndPunctuatedWatermarksOperator}.
+ */
public class TimestampsAndPunctuatedWatermarksOperatorTest {
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/WriteAheadSinkTestBase.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/WriteAheadSinkTestBase.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/WriteAheadSinkTestBase.java
index 46d92af..d3fd585 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/WriteAheadSinkTestBase.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/WriteAheadSinkTestBase.java
@@ -27,6 +27,9 @@ import org.apache.flink.util.TestLogger;
import org.junit.Test;
+/**
+ * Test base for {@link GenericWriteAheadSink}.
+ */
public abstract class WriteAheadSinkTestBase<IN, S extends GenericWriteAheadSink<IN>> extends TestLogger {
protected abstract S createSink() throws Exception;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingAlignedProcessingTimeWindowOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingAlignedProcessingTimeWindowOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingAlignedProcessingTimeWindowOperatorTest.java
index 2f7e302..a57dcf1 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingAlignedProcessingTimeWindowOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingAlignedProcessingTimeWindowOperatorTest.java
@@ -68,6 +68,9 @@ import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+/**
+ * Tests for {@link AccumulatingProcessingTimeWindowOperator}.
+ */
@SuppressWarnings({"serial"})
@PrepareForTest(InternalIterableWindowFunction.class)
@RunWith(PowerMockRunner.class)
@@ -220,7 +223,6 @@ public class AccumulatingAlignedProcessingTimeWindowOperatorTest {
assertTrue(op.getNextEvaluationTime() % 1000 == 0);
testHarness.close();
-
op = new AccumulatingProcessingTimeWindowOperator<>(mockFunction, mockKeySelector,
StringSerializer.INSTANCE, StringSerializer.INSTANCE, 1500, 1000);
@@ -278,7 +280,6 @@ public class AccumulatingAlignedProcessingTimeWindowOperatorTest {
testHarness.setProcessingTime(currentTime);
}
-
List<Integer> result = extractFromStreamRecords(testHarness.extractOutputStreamRecords());
assertEquals(numElements, result.size());
@@ -322,7 +323,6 @@ public class AccumulatingAlignedProcessingTimeWindowOperatorTest {
testHarness.setProcessingTime(currentTime);
}
-
List<Integer> result = extractFromStreamRecords(testHarness.extractOutputStreamRecords());
assertEquals(numElements, result.size());
@@ -476,7 +476,6 @@ public class AccumulatingAlignedProcessingTimeWindowOperatorTest {
testHarness.setProcessingTime(200);
-
List<Integer> result = extractFromStreamRecords(testHarness.extractOutputStreamRecords());
assertEquals(6, result.size());
@@ -524,7 +523,6 @@ public class AccumulatingAlignedProcessingTimeWindowOperatorTest {
testHarness.setProcessingTime(200);
-
List<Integer> result = extractFromStreamRecords(testHarness.extractOutputStreamRecords());
assertEquals(6, result.size());
@@ -837,7 +835,6 @@ public class AccumulatingAlignedProcessingTimeWindowOperatorTest {
testHarness.restore(state);
testHarness.open();
-
// inject again the remaining elements
for (int i = numElementsFirst; i < numElements; i++) {
testHarness.processElement(new StreamRecord<>(i));
@@ -929,7 +926,6 @@ public class AccumulatingAlignedProcessingTimeWindowOperatorTest {
testHarness.restore(state);
testHarness.open();
-
// inject again the remaining elements
for (int i = numElementsFirst; i < numElements; i++) {
testHarness.processElement(new StreamRecord<>(i));
@@ -1040,7 +1036,7 @@ public class AccumulatingAlignedProcessingTimeWindowOperatorTest {
// we use a concurrent map here even though there is no concurrency, to
// get "volatile" style access to entries
- static final Map<Integer, Integer> globalCounts = new ConcurrentHashMap<>();
+ private static final Map<Integer, Integer> globalCounts = new ConcurrentHashMap<>();
private ValueState<Integer> state;
@@ -1053,9 +1049,9 @@ public class AccumulatingAlignedProcessingTimeWindowOperatorTest {
@Override
public void process(Integer key,
- Context context,
- Iterable<Integer> values,
- Collector<Integer> out) throws Exception {
+ Context context,
+ Iterable<Integer> values,
+ Collector<Integer> out) throws Exception {
for (Integer i : values) {
// we need to update this state before emitting elements. Else, the test's main
// thread will have received all output elements before the state is updated and
@@ -1093,8 +1089,7 @@ public class AccumulatingAlignedProcessingTimeWindowOperatorTest {
}
private static StreamTask<?, ?> createMockTaskWithTimer(
- final ProcessingTimeService timerService)
- {
+ final ProcessingTimeService timerService) {
StreamTask<?, ?> mockTask = createMockTask();
when(mockTask.getProcessingTimeService()).thenReturn(timerService);
return mockTask;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AggregatingAlignedProcessingTimeWindowOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AggregatingAlignedProcessingTimeWindowOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AggregatingAlignedProcessingTimeWindowOperatorTest.java
index 1875bbb..62f4f0b 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AggregatingAlignedProcessingTimeWindowOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AggregatingAlignedProcessingTimeWindowOperatorTest.java
@@ -35,9 +35,9 @@ import org.apache.flink.configuration.Configuration;
import org.apache.flink.runtime.state.StreamStateHandle;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.StreamTask;
-
import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
+
import org.junit.After;
import org.junit.Test;
@@ -56,6 +56,9 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
+/**
+ * Tests for aligned {@link AggregatingProcessingTimeWindowOperator}.
+ */
@SuppressWarnings("serial")
public class AggregatingAlignedProcessingTimeWindowOperatorTest {
@@ -66,9 +69,9 @@ public class AggregatingAlignedProcessingTimeWindowOperatorTest {
private final KeySelector<String, String> mockKeySelector = mock(KeySelector.class);
private final KeySelector<Tuple2<Integer, Integer>, Integer> fieldOneSelector =
- new KeySelector<Tuple2<Integer,Integer>, Integer>() {
+ new KeySelector<Tuple2<Integer, Integer>, Integer>() {
@Override
- public Integer getKey(Tuple2<Integer,Integer> value) {
+ public Integer getKey(Tuple2<Integer, Integer> value) {
return value.f0;
}
};
@@ -585,7 +588,6 @@ public class AggregatingAlignedProcessingTimeWindowOperatorTest {
IntSerializer.INSTANCE, tupleSerializer,
windowSize, windowSlide);
-
OneInputStreamOperatorTestHarness<Tuple2<Integer, Integer>, Tuple2<Integer, Integer>> testHarness =
new OneInputStreamOperatorTestHarness<>(op);
@@ -824,7 +826,7 @@ public class AggregatingAlignedProcessingTimeWindowOperatorTest {
private static class StatefulFunction extends RichReduceFunction<Tuple2<Integer, Integer>> {
- static final Map<Integer, Integer> globalCounts = new ConcurrentHashMap<>();
+ private static final Map<Integer, Integer> globalCounts = new ConcurrentHashMap<>();
private ValueState<Integer> state;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AllWindowTranslationTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AllWindowTranslationTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AllWindowTranslationTest.java
index 81a9275..a7c6f47 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AllWindowTranslationTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AllWindowTranslationTest.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.ExecutionConfig;
@@ -1244,7 +1245,6 @@ public class AllWindowTranslationTest {
}
-
@Test
@SuppressWarnings("rawtypes")
public void testReduceWithCustomTrigger() throws Exception {
@@ -1461,7 +1461,7 @@ public class AllWindowTranslationTest {
// UDFs
// ------------------------------------------------------------------------
- public static class DummyReducer implements ReduceFunction<Tuple2<String, Integer>> {
+ private static class DummyReducer implements ReduceFunction<Tuple2<String, Integer>> {
private static final long serialVersionUID = 1L;
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ContinuousEventTimeTriggerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ContinuousEventTimeTriggerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ContinuousEventTimeTriggerTest.java
index 0f65a88..9c14a9f 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ContinuousEventTimeTriggerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ContinuousEventTimeTriggerTest.java
@@ -15,15 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
-import com.google.common.collect.Lists;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.triggers.ContinuousEventTimeTrigger;
import org.apache.flink.streaming.api.windowing.triggers.TriggerResult;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
+import com.google.common.collect.Lists;
import org.junit.Test;
import java.util.Collection;
@@ -62,7 +64,7 @@ public class ContinuousEventTimeTriggerTest {
/**
- * Verify that state <TimeWindow>of separate windows does not leak into other windows.
+ * Verify that state <TimeWindow>of separate windows does not leak into other windows.
*/
@Test
public void testWindowSeparationAndFiring() throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/CountTriggerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/CountTriggerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/CountTriggerTest.java
index 16e353b..38dd01d 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/CountTriggerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/CountTriggerTest.java
@@ -15,13 +15,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
-import com.google.common.collect.Lists;
import org.apache.flink.streaming.api.windowing.triggers.CountTrigger;
import org.apache.flink.streaming.api.windowing.triggers.TriggerResult;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
+import com.google.common.collect.Lists;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeSessionWindowsTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeSessionWindowsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeSessionWindowsTest.java
index a46572b..23af838 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeSessionWindowsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeSessionWindowsTest.java
@@ -15,10 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
+package org.apache.flink.streaming.runtime.operators.windowing;
-import com.google.common.collect.Lists;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows;
@@ -28,6 +27,8 @@ import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.TestLogger;
+
+import com.google.common.collect.Lists;
import org.junit.Test;
import org.mockito.Matchers;
@@ -38,27 +39,35 @@ import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.instanceOf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.anyCollection;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.argThat;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
/**
- * Tests for {@link EventTimeSessionWindows}
+ * Tests for {@link EventTimeSessionWindows}.
*/
public class EventTimeSessionWindowsTest extends TestLogger {
@Test
public void testWindowAssignment() {
- final int SESSION_GAP = 5000;
+ final int sessionGap = 5000;
WindowAssigner.WindowAssignerContext mockContext =
mock(WindowAssigner.WindowAssignerContext.class);
- EventTimeSessionWindows assigner = EventTimeSessionWindows.withGap(Time.milliseconds(SESSION_GAP));
+ EventTimeSessionWindows assigner = EventTimeSessionWindows.withGap(Time.milliseconds(sessionGap));
- assertThat(assigner.assignWindows("String", 0L, mockContext), contains(timeWindow(0, 0 + SESSION_GAP)));
- assertThat(assigner.assignWindows("String", 4999L, mockContext), contains(timeWindow(4999, 4999 + SESSION_GAP)));
- assertThat(assigner.assignWindows("String", 5000L, mockContext), contains(timeWindow(5000, 5000 + SESSION_GAP)));
+ assertThat(assigner.assignWindows("String", 0L, mockContext), contains(timeWindow(0, 0 + sessionGap)));
+ assertThat(assigner.assignWindows("String", 4999L, mockContext), contains(timeWindow(4999, 4999 + sessionGap)));
+ assertThat(assigner.assignWindows("String", 5000L, mockContext), contains(timeWindow(5000, 5000 + sessionGap)));
}
@Test
@@ -138,16 +147,16 @@ public class EventTimeSessionWindowsTest extends TestLogger {
public void testTimeUnits() {
// sanity check with one other time unit
- final int SESSION_GAP = 5000;
+ final int sessionGap = 5000;
WindowAssigner.WindowAssignerContext mockContext =
mock(WindowAssigner.WindowAssignerContext.class);
- EventTimeSessionWindows assigner = EventTimeSessionWindows.withGap(Time.seconds(SESSION_GAP / 1000));
+ EventTimeSessionWindows assigner = EventTimeSessionWindows.withGap(Time.seconds(sessionGap / 1000));
- assertThat(assigner.assignWindows("String", 0L, mockContext), contains(timeWindow(0, 0 + SESSION_GAP)));
- assertThat(assigner.assignWindows("String", 4999L, mockContext), contains(timeWindow(4999, 4999 + SESSION_GAP)));
- assertThat(assigner.assignWindows("String", 5000L, mockContext), contains(timeWindow(5000, 5000 + SESSION_GAP)));
+ assertThat(assigner.assignWindows("String", 0L, mockContext), contains(timeWindow(0, 0 + sessionGap)));
+ assertThat(assigner.assignWindows("String", 4999L, mockContext), contains(timeWindow(4999, 4999 + sessionGap)));
+ assertThat(assigner.assignWindows("String", 5000L, mockContext), contains(timeWindow(5000, 5000 + sessionGap)));
}
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeTriggerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeTriggerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeTriggerTest.java
index 2d93ac0..2bcc192 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeTriggerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeTriggerTest.java
@@ -15,13 +15,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
-import com.google.common.collect.Lists;
import org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger;
import org.apache.flink.streaming.api.windowing.triggers.TriggerResult;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
+import com.google.common.collect.Lists;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperatorContractTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperatorContractTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperatorContractTest.java
index 7af4506..a89aec0 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperatorContractTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperatorContractTest.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.ExecutionConfig;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperatorTest.java
index e5d3ef0..8d65bb4 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EvictingWindowOperatorTest.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.ExecutionConfig;
@@ -50,6 +51,7 @@ import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.util.Collector;
+
import org.junit.Assert;
import org.junit.Test;
@@ -58,18 +60,21 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+/**
+ * Tests for {@link EvictingWindowOperator}.
+ */
public class EvictingWindowOperatorTest {
/**
- * Tests CountEvictor evictAfter behavior
+ * Tests CountEvictor evictAfter behavior.
* @throws Exception
*/
@Test
public void testCountEvictorEvictAfter() throws Exception {
AtomicInteger closeCalled = new AtomicInteger(0);
- final int WINDOW_SIZE = 4;
- final int TRIGGER_COUNT = 2;
- final boolean EVICT_AFTER = true;
+ final int windowSize = 4;
+ final int triggerCount = 2;
+ final boolean evictAfter = true;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -80,7 +85,6 @@ public class EvictingWindowOperatorTest {
ListStateDescriptor<StreamRecord<Tuple2<String, Integer>>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
-
EvictingWindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, GlobalWindow> operator = new EvictingWindowOperator<>(
GlobalWindows.create(),
new GlobalWindow.Serializer(),
@@ -88,16 +92,14 @@ public class EvictingWindowOperatorTest {
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new RichSumReducer<GlobalWindow>(closeCalled)),
- CountTrigger.of(TRIGGER_COUNT),
- CountEvictor.of(WINDOW_SIZE,EVICT_AFTER),
+ CountTrigger.of(triggerCount),
+ CountEvictor.of(windowSize, evictAfter),
0,
null /* late data output tag */);
-
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO);
-
long initialTime = 0L;
ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
@@ -114,8 +116,6 @@ public class EvictingWindowOperatorTest {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), initialTime + 1999));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), initialTime + 1000));
-
-
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 2), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 4), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key1", 2), Long.MAX_VALUE));
@@ -139,18 +139,17 @@ public class EvictingWindowOperatorTest {
testHarness.close();
Assert.assertEquals("Close was not called.", 1, closeCalled.get());
-
}
/**
- * Tests TimeEvictor evictAfter behavior
+ * Tests TimeEvictor evictAfter behavior.
* @throws Exception
*/
@Test
public void testTimeEvictorEvictAfter() throws Exception {
AtomicInteger closeCalled = new AtomicInteger(0);
- final int TRIGGER_COUNT = 2;
- final boolean EVICT_AFTER = true;
+ final int triggerCount = 2;
+ final boolean evictAfter = true;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -161,7 +160,6 @@ public class EvictingWindowOperatorTest {
ListStateDescriptor<StreamRecord<Tuple2<String, Integer>>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
-
EvictingWindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, GlobalWindow> operator = new EvictingWindowOperator<>(
GlobalWindows.create(),
new GlobalWindow.Serializer(),
@@ -169,12 +167,11 @@ public class EvictingWindowOperatorTest {
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new RichSumReducer<GlobalWindow>(closeCalled)),
- CountTrigger.of(TRIGGER_COUNT),
- TimeEvictor.of(Time.seconds(2), EVICT_AFTER),
+ CountTrigger.of(triggerCount),
+ TimeEvictor.of(Time.seconds(2), evictAfter),
0,
null /* late data output tag */);
-
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO);
@@ -194,13 +191,10 @@ public class EvictingWindowOperatorTest {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), initialTime + 2001));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), initialTime + 1001));
-
-
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 2), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key1", 2), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 3), Long.MAX_VALUE));
-
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new ResultSortComparator());
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 1), initialTime + 10999));
@@ -218,14 +212,14 @@ public class EvictingWindowOperatorTest {
}
/**
- * Tests TimeEvictor evictBefore behavior
+ * Tests TimeEvictor evictBefore behavior.
* @throws Exception
*/
@Test
public void testTimeEvictorEvictBefore() throws Exception {
AtomicInteger closeCalled = new AtomicInteger(0);
- final int TRIGGER_COUNT = 2;
- final int WINDOW_SIZE = 4;
+ final int triggerCount = 2;
+ final int windowSize = 4;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -236,20 +230,18 @@ public class EvictingWindowOperatorTest {
ListStateDescriptor<StreamRecord<Tuple2<String, Integer>>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
-
EvictingWindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new EvictingWindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new RichSumReducer<TimeWindow>(closeCalled)),
- CountTrigger.of(TRIGGER_COUNT),
+ CountTrigger.of(triggerCount),
TimeEvictor.of(Time.seconds(2)),
0,
null /* late data output tag */);
-
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO);
@@ -270,13 +262,10 @@ public class EvictingWindowOperatorTest {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), initialTime + 2001));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), initialTime + 1001));
-
-
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 1), 3999));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key1", 2), 3999));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 3), 3999));
-
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new ResultSortComparator());
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 1), initialTime + 6500));
@@ -290,19 +279,18 @@ public class EvictingWindowOperatorTest {
testHarness.close();
Assert.assertEquals("Close was not called.", 1, closeCalled.get());
-
}
/**
- * Tests time evictor, if no timestamp information in the StreamRecord
- * No element will be evicted from the window
+ * Tests time evictor, if no timestamp information in the StreamRecord.
+ * No element will be evicted from the window.
* @throws Exception
*/
@Test
public void testTimeEvictorNoTimestamp() throws Exception {
AtomicInteger closeCalled = new AtomicInteger(0);
- final int TRIGGER_COUNT = 2;
- final boolean EVICT_AFTER = true;
+ final int triggerCount = 2;
+ final boolean evictAfter = true;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -313,7 +301,6 @@ public class EvictingWindowOperatorTest {
ListStateDescriptor<StreamRecord<Tuple2<String, Integer>>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
-
EvictingWindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, GlobalWindow> operator = new EvictingWindowOperator<>(
GlobalWindows.create(),
new GlobalWindow.Serializer(),
@@ -321,12 +308,11 @@ public class EvictingWindowOperatorTest {
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new RichSumReducer<GlobalWindow>(closeCalled)),
- CountTrigger.of(TRIGGER_COUNT),
- TimeEvictor.of(Time.seconds(2), EVICT_AFTER),
+ CountTrigger.of(triggerCount),
+ TimeEvictor.of(Time.seconds(2), evictAfter),
0,
null /* late data output tag */);
-
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO);
@@ -345,13 +331,10 @@ public class EvictingWindowOperatorTest {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1)));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1)));
-
-
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 2), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key1", 2), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 4), Long.MAX_VALUE));
-
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new ResultSortComparator());
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 1)));
@@ -365,19 +348,18 @@ public class EvictingWindowOperatorTest {
testHarness.close();
Assert.assertEquals("Close was not called.", 1, closeCalled.get());
-
}
/**
- * Tests DeltaEvictor, evictBefore behavior
+ * Tests DeltaEvictor, evictBefore behavior.
* @throws Exception
*/
@Test
public void testDeltaEvictorEvictBefore() throws Exception {
AtomicInteger closeCalled = new AtomicInteger(0);
- final int TRIGGER_COUNT = 2;
- final boolean EVICT_AFTER = false;
- final int THRESHOLD = 2;
+ final int triggerCount = 2;
+ final boolean evictAfter = false;
+ final int threshold = 2;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -388,7 +370,6 @@ public class EvictingWindowOperatorTest {
ListStateDescriptor<StreamRecord<Tuple2<String, Integer>>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
-
EvictingWindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, GlobalWindow> operator = new EvictingWindowOperator<>(
GlobalWindows.create(),
new GlobalWindow.Serializer(),
@@ -396,18 +377,16 @@ public class EvictingWindowOperatorTest {
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new RichSumReducer<GlobalWindow>(closeCalled)),
- CountTrigger.of(TRIGGER_COUNT),
- DeltaEvictor.of(THRESHOLD, new DeltaFunction<Tuple2<String, Integer>>() {
+ CountTrigger.of(triggerCount),
+ DeltaEvictor.of(threshold, new DeltaFunction<Tuple2<String, Integer>>() {
@Override
public double getDelta(Tuple2<String, Integer> oldDataPoint, Tuple2<String, Integer> newDataPoint) {
return newDataPoint.f1 - oldDataPoint.f1;
}
- }, EVICT_AFTER),
+ }, evictAfter),
0,
null /* late data output tag */);
-
-
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO);
@@ -447,15 +426,15 @@ public class EvictingWindowOperatorTest {
}
/**
- * Tests DeltaEvictor, evictAfter behavior
+ * Tests DeltaEvictor, evictAfter behavior.
* @throws Exception
*/
@Test
public void testDeltaEvictorEvictAfter() throws Exception {
AtomicInteger closeCalled = new AtomicInteger(0);
- final int TRIGGER_COUNT = 2;
- final boolean EVICT_AFTER = true;
- final int THRESHOLD = 2;
+ final int triggerCount = 2;
+ final boolean evictAfter = true;
+ final int threshold = 2;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -466,7 +445,6 @@ public class EvictingWindowOperatorTest {
ListStateDescriptor<StreamRecord<Tuple2<String, Integer>>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
-
EvictingWindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, GlobalWindow> operator = new EvictingWindowOperator<>(
GlobalWindows.create(),
new GlobalWindow.Serializer(),
@@ -474,18 +452,16 @@ public class EvictingWindowOperatorTest {
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new RichSumReducer<GlobalWindow>(closeCalled)),
- CountTrigger.of(TRIGGER_COUNT),
- DeltaEvictor.of(THRESHOLD, new DeltaFunction<Tuple2<String, Integer>>() {
+ CountTrigger.of(triggerCount),
+ DeltaEvictor.of(threshold, new DeltaFunction<Tuple2<String, Integer>>() {
@Override
public double getDelta(Tuple2<String, Integer> oldDataPoint, Tuple2<String, Integer> newDataPoint) {
return newDataPoint.f1 - oldDataPoint.f1;
}
- }, EVICT_AFTER),
+ }, evictAfter),
0,
null /* late data output tag */);
-
-
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO);
@@ -528,8 +504,8 @@ public class EvictingWindowOperatorTest {
@SuppressWarnings("unchecked")
public void testCountTrigger() throws Exception {
- final int WINDOW_SIZE = 4;
- final int WINDOW_SLIDE = 2;
+ final int windowSize = 4;
+ final int windowSlide = 2;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -540,7 +516,6 @@ public class EvictingWindowOperatorTest {
ListStateDescriptor<StreamRecord<Tuple2<String, Integer>>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
-
EvictingWindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, GlobalWindow> operator = new EvictingWindowOperator<>(
GlobalWindows.create(),
new GlobalWindow.Serializer(),
@@ -552,12 +527,11 @@ public class EvictingWindowOperatorTest {
new SumReducer(),
// on some versions of Java we seem to need the explicit type
new PassThroughWindowFunction<String, GlobalWindow, Tuple2<String, Integer>>())),
- CountTrigger.of(WINDOW_SLIDE),
- CountEvictor.of(WINDOW_SIZE),
+ CountTrigger.of(windowSlide),
+ CountEvictor.of(windowSize),
0,
null /* late data output tag */);
-
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO);
@@ -580,8 +554,6 @@ public class EvictingWindowOperatorTest {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), initialTime + 1999));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), initialTime + 1000));
-
-
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 2), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 4), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key1", 2), Long.MAX_VALUE));
@@ -604,12 +576,11 @@ public class EvictingWindowOperatorTest {
public void testCountTriggerWithApply() throws Exception {
AtomicInteger closeCalled = new AtomicInteger(0);
- final int WINDOW_SIZE = 4;
- final int WINDOW_SLIDE = 2;
+ final int windowSize = 4;
+ final int windowSlide = 2;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
-
@SuppressWarnings({"unchecked", "rawtypes"})
TypeSerializer<StreamRecord<Tuple2<String, Integer>>> streamRecordSerializer =
(TypeSerializer<StreamRecord<Tuple2<String, Integer>>>) new StreamElementSerializer(inputType.createSerializer(new ExecutionConfig()));
@@ -617,7 +588,6 @@ public class EvictingWindowOperatorTest {
ListStateDescriptor<StreamRecord<Tuple2<String, Integer>>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
-
EvictingWindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, GlobalWindow> operator = new EvictingWindowOperator<>(
GlobalWindows.create(),
new GlobalWindow.Serializer(),
@@ -625,12 +595,11 @@ public class EvictingWindowOperatorTest {
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new RichSumReducer<GlobalWindow>(closeCalled)),
- CountTrigger.of(WINDOW_SLIDE),
- CountEvictor.of(WINDOW_SIZE),
+ CountTrigger.of(windowSlide),
+ CountEvictor.of(windowSize),
0,
null /* late data output tag */);
-
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO);
@@ -653,8 +622,6 @@ public class EvictingWindowOperatorTest {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), initialTime + 1999));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), initialTime + 1000));
-
-
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 2), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 4), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key1", 2), Long.MAX_VALUE));
@@ -679,7 +646,7 @@ public class EvictingWindowOperatorTest {
public void testTumblingWindowWithApply() throws Exception {
AtomicInteger closeCalled = new AtomicInteger(0);
- final int WINDOW_SIZE = 4;
+ final int windowSize = 4;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -691,14 +658,14 @@ public class EvictingWindowOperatorTest {
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
EvictingWindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new EvictingWindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new RichSumReducer<TimeWindow>(closeCalled)),
EventTimeTrigger.create(),
- CountEvictor.of(WINDOW_SIZE),
+ CountEvictor.of(windowSize),
0,
null /* late data output tag */);
@@ -731,7 +698,6 @@ public class EvictingWindowOperatorTest {
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 2), 3999));
expectedOutput.add(new Watermark(3999));
-
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(),
new EvictingWindowOperatorTest.ResultSortComparator());
testHarness.close();
@@ -741,10 +707,9 @@ public class EvictingWindowOperatorTest {
// UDFs
// ------------------------------------------------------------------------
- public static class SumReducer implements ReduceFunction<Tuple2<String, Integer>> {
+ private static class SumReducer implements ReduceFunction<Tuple2<String, Integer>> {
private static final long serialVersionUID = 1L;
-
@Override
public Tuple2<String, Integer> reduce(Tuple2<String, Integer> value1,
Tuple2<String, Integer> value2) throws Exception {
@@ -752,7 +717,7 @@ public class EvictingWindowOperatorTest {
}
}
- public static class RichSumReducer<W extends Window> extends RichWindowFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, String, W> {
+ private static class RichSumReducer<W extends Window> extends RichWindowFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, String, W> {
private static final long serialVersionUID = 1L;
private boolean openCalled = false;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/GlobalWindowsTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/GlobalWindowsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/GlobalWindowsTest.java
index 37fad7e..9292bfb 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/GlobalWindowsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/GlobalWindowsTest.java
@@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
+package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
@@ -24,15 +24,18 @@ import org.apache.flink.streaming.api.windowing.assigners.GlobalWindows;
import org.apache.flink.streaming.api.windowing.assigners.WindowAssigner;
import org.apache.flink.streaming.api.windowing.windows.GlobalWindow;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.instanceOf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
/**
- * Tests for {@link GlobalWindows}
+ * Tests for {@link GlobalWindows}.
*/
public class GlobalWindowsTest extends TestLogger {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapPutIfAbsentTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapPutIfAbsentTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapPutIfAbsentTest.java
index 8786c4e..8eb26ee 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapPutIfAbsentTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapPutIfAbsentTest.java
@@ -24,6 +24,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+/**
+ * Tests for {@link KeyMap}.
+ */
public class KeyMapPutIfAbsentTest {
@Test
@@ -38,7 +41,7 @@ public class KeyMapPutIfAbsentTest {
factory.set(2 * i + 1);
map.putIfAbsent(i, factory);
- assertEquals(i+1, map.size());
+ assertEquals(i + 1, map.size());
assertTrue(map.getCurrentTableCapacity() > map.size());
assertTrue(map.getCurrentTableCapacity() > map.getRehashThreshold());
assertTrue(map.size() <= map.getRehashThreshold());
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapPutTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapPutTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapPutTest.java
index 5b59bea..522c691 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapPutTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapPutTest.java
@@ -29,6 +29,9 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+/**
+ * Tests for {@link KeyMap}.
+ */
public class KeyMapPutTest {
@Test
@@ -41,7 +44,7 @@ public class KeyMapPutTest {
for (int i = 0; i < numElements; i++) {
map.put(i, 2 * i + 1);
- assertEquals(i+1, map.size());
+ assertEquals(i + 1, map.size());
assertTrue(map.getCurrentTableCapacity() > map.size());
assertTrue(map.getCurrentTableCapacity() > map.getRehashThreshold());
assertTrue(map.size() <= map.getRehashThreshold());
@@ -72,7 +75,6 @@ public class KeyMapPutTest {
assertEquals(numElements, numContained);
assertEquals(numElements, bitset.cardinality());
-
assertEquals(numElements, map.size());
assertEquals(numElements, map.traverseAndCountElements());
assertEquals(1 << 21, map.getCurrentTableCapacity());
@@ -91,18 +93,18 @@ public class KeyMapPutTest {
final int numElements = 1000000;
for (int i = 0; i < numElements; i++) {
- Integer put = map.put(i, 2*i+1);
+ Integer put = map.put(i, 2 * i + 1);
assertNull(put);
}
for (int i = 0; i < numElements; i += 3) {
- Integer put = map.put(i, 2*i);
+ Integer put = map.put(i, 2 * i);
assertNotNull(put);
- assertEquals(2*i+1, put.intValue());
+ assertEquals(2 * i + 1, put.intValue());
}
for (int i = 0; i < numElements; i++) {
- int expected = (i % 3 == 0) ? (2*i) : (2*i+1);
+ int expected = (i % 3 == 0) ? (2 * i) : (2 * i + 1);
assertEquals(expected, map.get(i).intValue());
}
@@ -111,14 +113,13 @@ public class KeyMapPutTest {
assertEquals(1 << 21, map.getCurrentTableCapacity());
assertTrue(map.getLongestChainLength() <= 7);
-
BitSet bitset = new BitSet();
int numContained = 0;
for (KeyMap.Entry<Integer, Integer> entry : map) {
numContained++;
int key = entry.getKey();
- int expected = key % 3 == 0 ? (2*key) : (2*key+1);
+ int expected = key % 3 == 0 ? (2 * key) : (2 * key + 1);
assertEquals(expected, entry.getValue().intValue());
assertFalse(bitset.get(key));
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapTest.java
index c7fb108..a442466 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMapTest.java
@@ -24,8 +24,15 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Random;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests for {@link KeyMap}.
+ */
public class KeyMapTest {
@Test
@@ -218,7 +225,6 @@ public class KeyMapTest {
nextKeyValue += keyRnd.nextInt(maxStride) + 1;
}
-
// check that all maps contain the total number of elements
int numContained = 0;
for (KeyMap<?, ?> map : maps) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSetTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSetTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSetTest.java
index aa9cb91..0c45d03 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSetTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSetTest.java
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
-import com.google.common.collect.Lists;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.state.ListState;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -25,11 +25,12 @@ import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows;
import org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner;
-import org.apache.flink.streaming.api.windowing.assigners.WindowAssigner;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger;
import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
+
+import com.google.common.collect.Lists;
import org.junit.Test;
import org.mockito.Matchers;
@@ -44,9 +45,16 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
/**
* Tests for verifying that {@link MergingWindowSet} correctly merges windows in various situations
@@ -152,7 +160,6 @@ public class MergingWindowSetTest {
assertEquals(new TimeWindow(11, 14), windowSet.addWindow(new TimeWindow(11, 14), mergeFunction));
assertFalse(mergeFunction.hasMerged());
-
assertEquals(new TimeWindow(0, 4), windowSet.getStateWindow(new TimeWindow(0, 6)));
assertEquals(new TimeWindow(11, 14), windowSet.getStateWindow(new TimeWindow(11, 14)));
@@ -179,7 +186,6 @@ public class MergingWindowSetTest {
assertEquals(new TimeWindow(10, 15), windowSet.addWindow(new TimeWindow(11, 14), mergeFunction));
assertFalse(mergeFunction.hasMerged());
-
assertEquals(new TimeWindow(0, 4), windowSet.getStateWindow(new TimeWindow(0, 6)));
assertEquals(new TimeWindow(11, 14), windowSet.getStateWindow(new TimeWindow(10, 15)));
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ProcessingTimeSessionWindowsTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ProcessingTimeSessionWindowsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ProcessingTimeSessionWindowsTest.java
index 461b5fc..ceda3b9 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ProcessingTimeSessionWindowsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ProcessingTimeSessionWindowsTest.java
@@ -15,19 +15,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
+package org.apache.flink.streaming.runtime.operators.windowing;
-import com.google.common.collect.Lists;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
-import org.apache.flink.streaming.api.windowing.assigners.ProcessingTimeSessionWindows;
import org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner;
+import org.apache.flink.streaming.api.windowing.assigners.ProcessingTimeSessionWindows;
import org.apache.flink.streaming.api.windowing.assigners.WindowAssigner;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.triggers.ProcessingTimeTrigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.TestLogger;
+
+import com.google.common.collect.Lists;
import org.junit.Test;
import org.mockito.Matchers;
@@ -36,13 +37,23 @@ import java.util.Collection;
import static org.apache.flink.streaming.runtime.operators.windowing.StreamRecordMatchers.timeWindow;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.anyCollection;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.argThat;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
/**
- * Tests for {@link ProcessingTimeSessionWindows}
+ * Tests for {@link ProcessingTimeSessionWindows}.
*/
public class ProcessingTimeSessionWindowsTest extends TestLogger {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ProcessingTimeTriggerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ProcessingTimeTriggerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ProcessingTimeTriggerTest.java
index a0c2347..791eb42 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ProcessingTimeTriggerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/ProcessingTimeTriggerTest.java
@@ -15,13 +15,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
-import com.google.common.collect.Lists;
import org.apache.flink.streaming.api.windowing.triggers.ProcessingTimeTrigger;
import org.apache.flink.streaming.api.windowing.triggers.TriggerResult;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
+import com.google.common.collect.Lists;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/PurgingTriggerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/PurgingTriggerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/PurgingTriggerTest.java
index 4302d4d..7139a44 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/PurgingTriggerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/PurgingTriggerTest.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.streaming.api.windowing.triggers.PurgingTrigger;
@@ -22,6 +23,7 @@ import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.triggers.TriggerResult;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.invocation.InvocationOnMock;
@@ -35,7 +37,12 @@ import static org.apache.flink.streaming.runtime.operators.windowing.WindowOpera
import static org.apache.flink.streaming.runtime.operators.windowing.WindowOperatorContractTest.anyTriggerContext;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.anyLong;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
/**
* Tests for {@link PurgingTrigger}.
@@ -51,7 +58,7 @@ public class PurgingTriggerTest {
for (Method triggerMethod : Trigger.class.getDeclaredMethods()) {
// try retrieving the method, this will throw an exception if we can't find it
- PurgingTrigger.class.getDeclaredMethod(triggerMethod.getName(),triggerMethod.getParameterTypes());
+ PurgingTrigger.class.getDeclaredMethod(triggerMethod.getName(), triggerMethod.getParameterTypes());
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/RegularWindowOperatorContractTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/RegularWindowOperatorContractTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/RegularWindowOperatorContractTest.java
index ff1cbdf..62c484d 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/RegularWindowOperatorContractTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/RegularWindowOperatorContractTest.java
@@ -15,19 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+package org.apache.flink.streaming.runtime.operators.windowing;
-import java.util.Arrays;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.FoldFunction;
import org.apache.flink.api.common.functions.ReduceFunction;
@@ -50,11 +40,24 @@ import org.apache.flink.streaming.runtime.operators.windowing.functions.Internal
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness;
import org.apache.flink.util.OutputTag;
+
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
/**
* These tests verify that {@link WindowOperator} correctly interacts with the other windowing
* components: {@link WindowAssigner},
@@ -72,7 +75,6 @@ public class RegularWindowOperatorContractTest extends WindowOperatorContractTes
Trigger<Integer, TimeWindow> mockTrigger = mockTrigger();
InternalWindowFunction<Integer, Void, Integer, TimeWindow> mockWindowFunction = mockWindowFunction();
-
ReducingStateDescriptor<Integer> intReduceSumDescriptor =
new ReducingStateDescriptor<>(
"int-reduce",
@@ -89,7 +91,6 @@ public class RegularWindowOperatorContractTest extends WindowOperatorContractTes
final ValueStateDescriptor<String> valueStateDescriptor =
new ValueStateDescriptor<>("string-state", StringSerializer.INSTANCE);
-
KeyedOneInputStreamOperatorTestHarness<Integer, Integer, Void> testHarness =
createWindowOperator(mockAssigner, mockTrigger, 0L, intReduceSumDescriptor, mockWindowFunction);
@@ -252,7 +253,6 @@ public class RegularWindowOperatorContractTest extends WindowOperatorContractTes
ListStateDescriptor<Integer> intListDescriptor =
new ListStateDescriptor<>("int-list", IntSerializer.INSTANCE);
-
@SuppressWarnings("unchecked")
WindowOperator<Integer, Integer, Iterable<Integer>, OUT, W> operator = new WindowOperator<>(
assigner,
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SimpleTriggerTestHarness.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SimpleTriggerTestHarness.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SimpleTriggerTestHarness.java
index 050178b..33f4747 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SimpleTriggerTestHarness.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SimpleTriggerTestHarness.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.typeutils.TypeSerializer;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SlidingEventTimeWindowsTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SlidingEventTimeWindowsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SlidingEventTimeWindowsTest.java
index 4599d19..95a8314 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SlidingEventTimeWindowsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SlidingEventTimeWindowsTest.java
@@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
+package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
@@ -26,18 +26,21 @@ import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import static org.apache.flink.streaming.runtime.operators.windowing.StreamRecordMatchers.timeWindow;
import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.instanceOf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
/**
- * Tests for {@link SlidingEventTimeWindows}
+ * Tests for {@link SlidingEventTimeWindows}.
*/
public class SlidingEventTimeWindowsTest extends TestLogger {
@@ -148,7 +151,6 @@ public class SlidingEventTimeWindowsTest extends TestLogger {
assertThat(e.toString(), containsString("0 <= offset < slide and size > 0"));
}
-
try {
SlidingEventTimeWindows.of(Time.seconds(20), Time.seconds(10), Time.seconds(-1));
fail("should fail");
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SlidingProcessingTimeWindowsTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SlidingProcessingTimeWindowsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SlidingProcessingTimeWindowsTest.java
index 20a9924..69b628a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SlidingProcessingTimeWindowsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/SlidingProcessingTimeWindowsTest.java
@@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
+package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
@@ -26,18 +26,22 @@ import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.triggers.ProcessingTimeTrigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import static org.apache.flink.streaming.runtime.operators.windowing.StreamRecordMatchers.timeWindow;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.instanceOf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
- * Tests for {@link SlidingProcessingTimeWindows}
+ * Tests for {@link SlidingProcessingTimeWindows}.
*/
public class SlidingProcessingTimeWindowsTest extends TestLogger {
@@ -157,7 +161,6 @@ public class SlidingProcessingTimeWindowsTest extends TestLogger {
assertThat(e.toString(), containsString("0 <= offset < slide and size > 0"));
}
-
try {
SlidingProcessingTimeWindows.of(Time.seconds(20), Time.seconds(10), Time.seconds(-1));
fail("should fail");
[03/10] flink git commit: [FLINK-6603] [streaming] Enable checkstyle
on test sources
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/StreamRecordMatchers.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/StreamRecordMatchers.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/StreamRecordMatchers.java
index bb07996..ada4d6f 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/StreamRecordMatchers.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/StreamRecordMatchers.java
@@ -15,11 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
@@ -30,150 +32,146 @@ import org.hamcrest.TypeSafeMatcher;
*/
public class StreamRecordMatchers {
- public static <T> Matcher<StreamRecord<? extends T>> isStreamRecord(
- T value) {
-
- return isStreamRecord(Matchers.equalTo(value));
- }
-
- public static <T> Matcher<StreamRecord<? extends T>> isStreamRecord(
- T value,
- long timestamp) {
-
- return isStreamRecord(Matchers.equalTo(value), Matchers.equalTo(timestamp));
- }
-
- public static <T> Matcher<StreamRecord<? extends T>> isStreamRecord(
- Matcher<? super T> valueMatcher) {
- return new StreamRecordMatcher<>(valueMatcher, Matchers.anything());
- }
-
- public static <T> Matcher<StreamRecord<? extends T>> isStreamRecord(
- Matcher<? super T> valueMatcher, Matcher<? super Long> timestampMatcher) {
- return new StreamRecordMatcher<>(valueMatcher, timestampMatcher);
- }
-
- public static Matcher<TimeWindow> timeWindow(long start, long end) {
- return Matchers.equalTo(new TimeWindow(start, end));
- }
-
- @SuppressWarnings({"unchecked", "rawtypes"})
- @SafeVarargs
- public static <W extends Window> Matcher<Iterable<W>> ofWindows(Matcher<W>... windows) {
- return (Matcher) Matchers.containsInAnyOrder(windows);
- }
-
- public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
- T value) {
- return isWindowedValue(Matchers.equalTo(value));
- }
-
- public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
- T value,
- long timestamp) {
- return isWindowedValue(Matchers.equalTo(value), Matchers.equalTo(timestamp));
- }
-
- public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
- T value,
- long timestamp,
- W window) {
- return isWindowedValue(Matchers.equalTo(value), Matchers.equalTo(timestamp), Matchers.equalTo(window));
- }
-
-
- public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
- Matcher<? super T> valueMatcher, long timestamp) {
- return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), Matchers.anything());
- }
-
- public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
- Matcher<? super T> valueMatcher, long timestamp, W window) {
- return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), Matchers.equalTo(window));
- }
-
-
- public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
- Matcher<? super T> valueMatcher) {
- return new WindowedValueMatcher<>(valueMatcher, Matchers.anything(), Matchers.anything());
- }
-
-
- public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
- Matcher<? super T> valueMatcher, Matcher<? super Long> timestampMatcher) {
- return new WindowedValueMatcher<>(valueMatcher, timestampMatcher, Matchers.anything());
- }
-
- public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
- Matcher<? super T> valueMatcher, long timestamp, Matcher<? super W> windowMatcher) {
- return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), windowMatcher);
- }
-
- public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
- Matcher<? super T> valueMatcher, Matcher<? super Long> timestampMatcher, Matcher<? super W> windowMatcher) {
- return new WindowedValueMatcher<>(valueMatcher, timestampMatcher, windowMatcher);
- }
-
-
- private StreamRecordMatchers() {}
-
- private static class StreamRecordMatcher<T> extends TypeSafeMatcher<StreamRecord<? extends T>> {
-
- private Matcher<? super T> valueMatcher;
- private Matcher<? super Long> timestampMatcher;
-
- private StreamRecordMatcher(
- Matcher<? super T> valueMatcher,
- Matcher<? super Long> timestampMatcher) {
- this.valueMatcher = valueMatcher;
- this.timestampMatcher = timestampMatcher;
- }
-
- @Override
- public void describeTo(Description description) {
- description
- .appendText("a StreamRecordValue(").appendValue(valueMatcher)
- .appendText(", ").appendValue(timestampMatcher)
- .appendText(")");
- }
-
- @Override
- protected boolean matchesSafely(StreamRecord<? extends T> streamRecord) {
- return valueMatcher.matches(streamRecord.getValue())
- && timestampMatcher.matches(streamRecord.getTimestamp());
- }
- }
-
- private static class WindowedValueMatcher<T, W extends Window> extends TypeSafeMatcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> {
-
- private Matcher<? super T> valueMatcher;
- private Matcher<? super Long> timestampMatcher;
- private Matcher<? super W> windowMatcher;
-
-
- private WindowedValueMatcher(
- Matcher<? super T> valueMatcher,
- Matcher<? super Long> timestampMatcher,
- Matcher<? super W> windowMatcher) {
- this.valueMatcher = valueMatcher;
- this.timestampMatcher = timestampMatcher;
- this.windowMatcher = windowMatcher;
- }
-
- @Override
- public void describeTo(Description description) {
- description
- .appendText("a WindowedValue(").appendValue(valueMatcher)
- .appendText(", ").appendValue(timestampMatcher)
- .appendText(", ").appendValue(timestampMatcher)
- .appendText(")");
- }
-
- @Override
- protected boolean matchesSafely(StreamRecord<? extends WindowedValue<? extends T, ? extends W>> streamRecord) {
- return valueMatcher.matches(streamRecord.getValue().value())
- && timestampMatcher.matches(streamRecord.getTimestamp())
- && windowMatcher.matches(streamRecord.getValue().window());
- }
- }
+ public static <T> Matcher<StreamRecord<? extends T>> isStreamRecord(
+ T value) {
+
+ return isStreamRecord(Matchers.equalTo(value));
+ }
+
+ public static <T> Matcher<StreamRecord<? extends T>> isStreamRecord(
+ T value,
+ long timestamp) {
+
+ return isStreamRecord(Matchers.equalTo(value), Matchers.equalTo(timestamp));
+ }
+
+ public static <T> Matcher<StreamRecord<? extends T>> isStreamRecord(
+ Matcher<? super T> valueMatcher) {
+ return new StreamRecordMatcher<>(valueMatcher, Matchers.anything());
+ }
+
+ public static <T> Matcher<StreamRecord<? extends T>> isStreamRecord(
+ Matcher<? super T> valueMatcher, Matcher<? super Long> timestampMatcher) {
+ return new StreamRecordMatcher<>(valueMatcher, timestampMatcher);
+ }
+
+ public static Matcher<TimeWindow> timeWindow(long start, long end) {
+ return Matchers.equalTo(new TimeWindow(start, end));
+ }
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ @SafeVarargs
+ public static <W extends Window> Matcher<Iterable<W>> ofWindows(Matcher<W>... windows) {
+ return (Matcher) Matchers.containsInAnyOrder(windows);
+ }
+
+ public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
+ T value) {
+ return isWindowedValue(Matchers.equalTo(value));
+ }
+
+ public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
+ T value,
+ long timestamp) {
+ return isWindowedValue(Matchers.equalTo(value), Matchers.equalTo(timestamp));
+ }
+
+ public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
+ T value,
+ long timestamp,
+ W window) {
+ return isWindowedValue(Matchers.equalTo(value), Matchers.equalTo(timestamp), Matchers.equalTo(window));
+ }
+
+ public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
+ Matcher<? super T> valueMatcher, long timestamp) {
+ return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), Matchers.anything());
+ }
+
+ public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
+ Matcher<? super T> valueMatcher, long timestamp, W window) {
+ return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), Matchers.equalTo(window));
+ }
+
+ public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
+ Matcher<? super T> valueMatcher) {
+ return new WindowedValueMatcher<>(valueMatcher, Matchers.anything(), Matchers.anything());
+ }
+
+ public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
+ Matcher<? super T> valueMatcher, Matcher<? super Long> timestampMatcher) {
+ return new WindowedValueMatcher<>(valueMatcher, timestampMatcher, Matchers.anything());
+ }
+
+ public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
+ Matcher<? super T> valueMatcher, long timestamp, Matcher<? super W> windowMatcher) {
+ return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), windowMatcher);
+ }
+
+ public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
+ Matcher<? super T> valueMatcher, Matcher<? super Long> timestampMatcher, Matcher<? super W> windowMatcher) {
+ return new WindowedValueMatcher<>(valueMatcher, timestampMatcher, windowMatcher);
+ }
+
+ private StreamRecordMatchers() {
+ }
+
+ private static class StreamRecordMatcher<T> extends TypeSafeMatcher<StreamRecord<? extends T>> {
+
+ private Matcher<? super T> valueMatcher;
+ private Matcher<? super Long> timestampMatcher;
+
+ private StreamRecordMatcher(
+ Matcher<? super T> valueMatcher,
+ Matcher<? super Long> timestampMatcher) {
+ this.valueMatcher = valueMatcher;
+ this.timestampMatcher = timestampMatcher;
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description
+ .appendText("a StreamRecordValue(").appendValue(valueMatcher)
+ .appendText(", ").appendValue(timestampMatcher)
+ .appendText(")");
+ }
+
+ @Override
+ protected boolean matchesSafely(StreamRecord<? extends T> streamRecord) {
+ return valueMatcher.matches(streamRecord.getValue())
+ && timestampMatcher.matches(streamRecord.getTimestamp());
+ }
+ }
+
+ private static class WindowedValueMatcher<T, W extends Window> extends TypeSafeMatcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> {
+
+ private Matcher<? super T> valueMatcher;
+ private Matcher<? super Long> timestampMatcher;
+ private Matcher<? super W> windowMatcher;
+
+ private WindowedValueMatcher(
+ Matcher<? super T> valueMatcher,
+ Matcher<? super Long> timestampMatcher,
+ Matcher<? super W> windowMatcher) {
+ this.valueMatcher = valueMatcher;
+ this.timestampMatcher = timestampMatcher;
+ this.windowMatcher = windowMatcher;
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description
+ .appendText("a WindowedValue(").appendValue(valueMatcher)
+ .appendText(", ").appendValue(timestampMatcher)
+ .appendText(", ").appendValue(timestampMatcher)
+ .appendText(")");
+ }
+
+ @Override
+ protected boolean matchesSafely(StreamRecord<? extends WindowedValue<? extends T, ? extends W>> streamRecord) {
+ return valueMatcher.matches(streamRecord.getValue().value())
+ && timestampMatcher.matches(streamRecord.getTimestamp())
+ && windowMatcher.matches(streamRecord.getValue().window());
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TimeWindowTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TimeWindowTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TimeWindowTest.java
index 341171d..f4e0f1d 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TimeWindowTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TimeWindowTest.java
@@ -19,41 +19,45 @@
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
+
import org.junit.Assert;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
+/**
+ * Tests for {@link TimeWindow}.
+ */
public class TimeWindowTest {
@Test
public void testGetWindowStartWithOffset() {
- //[0,7),[7,14),[14,21)...
+ // [0, 7), [7, 14), [14, 21)...
long offset = 0;
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(1,offset,7),0);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(6,offset,7),0);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(7,offset,7),7);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(8,offset,7),7);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(1, offset, 7), 0);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(6, offset, 7), 0);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(7, offset, 7), 7);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(8, offset, 7), 7);
- //[-4,3),[3,10),[10,17)...
+ // [-4, 3), [3, 10), [10, 17)...
offset = 3;
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(1,offset,7),-4);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(2,offset,7),-4);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(3,offset,7),3);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(9,offset,7),3);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(10,offset,7),10);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(1, offset, 7), -4);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(2, offset, 7), -4);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(3, offset, 7), 3);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(9, offset, 7), 3);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(10, offset, 7), 10);
- //[-2,5),[5,12),[12,19)...
+ // [-2, 5), [5, 12), [12, 19)...
offset = -2;
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(1,offset,7),-2);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(-2,offset,7),-2);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(3,offset,7),-2);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(4,offset,7),-2);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(7,offset,7),5);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(12,offset,7),12);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(1, offset, 7), -2);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(-2, offset, 7), -2);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(3, offset, 7), -2);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(4, offset, 7), -2);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(7, offset, 7), 5);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(12, offset, 7), 12);
// for GMT+8:00
- offset = - TimeUnit.HOURS.toMillis(8);
+ offset = -TimeUnit.HOURS.toMillis(8);
long size = TimeUnit.DAYS.toMillis(1);
- Assert.assertEquals(TimeWindow.getWindowStartWithOffset(1470902048450l,offset,size),1470844800000l);
+ Assert.assertEquals(TimeWindow.getWindowStartWithOffset(1470902048450L, offset, size), 1470844800000L);
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TimeWindowTranslationTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TimeWindowTranslationTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TimeWindowTranslationTest.java
index df65ca2..dc0e21c 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TimeWindowTranslationTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TimeWindowTranslationTest.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.functions.FoldFunction;
@@ -28,8 +29,8 @@ import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.WindowedStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
-import org.apache.flink.streaming.api.functions.windowing.WindowFunction;
import org.apache.flink.streaming.api.functions.windowing.AllWindowFunction;
+import org.apache.flink.streaming.api.functions.windowing.WindowFunction;
import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
import org.apache.flink.streaming.api.transformations.OneInputTransformation;
import org.apache.flink.streaming.api.windowing.assigners.SlidingAlignedProcessingTimeWindows;
@@ -161,7 +162,7 @@ public class TimeWindowTranslationTest {
DataStream<Tuple2<String, Integer>> window1 = source
.keyBy(0)
- .timeWindow(Time.of(1000, TimeUnit.MILLISECONDS),Time.of(100, TimeUnit.MILLISECONDS))
+ .timeWindow(Time.of(1000, TimeUnit.MILLISECONDS), Time.of(100, TimeUnit.MILLISECONDS))
.reduce(new DummyReducer());
OneInputTransformation<Tuple2<String, Integer>, Tuple2<String, Integer>> transform1 = (OneInputTransformation<Tuple2<String, Integer>, Tuple2<String, Integer>>) window1.getTransformation();
@@ -185,7 +186,7 @@ public class TimeWindowTranslationTest {
DataStream<Tuple2<String, Integer>> window1 = source
.keyBy(0)
- .timeWindow(Time.of(1000, TimeUnit.MILLISECONDS),Time.of(100, TimeUnit.MILLISECONDS))
+ .timeWindow(Time.of(1000, TimeUnit.MILLISECONDS), Time.of(100, TimeUnit.MILLISECONDS))
.fold(new Tuple2<>("", 1), new DummyFolder());
OneInputTransformation<Tuple2<String, Integer>, Tuple2<String, Integer>> transform1 = (OneInputTransformation<Tuple2<String, Integer>, Tuple2<String, Integer>>) window1.getTransformation();
@@ -235,7 +236,7 @@ public class TimeWindowTranslationTest {
* These tests ensure that the fast aligned time windows operator is used if the
* conditions are right.
*
- * TODO: update once the fast aligned time windows operator is in
+ * <p>TODO: update once the fast aligned time windows operator is in
*/
@Ignore
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TriggerTestHarness.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TriggerTestHarness.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TriggerTestHarness.java
index 4267444..5aa47e8 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TriggerTestHarness.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TriggerTestHarness.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.JobID;
@@ -36,9 +37,9 @@ import org.apache.flink.runtime.state.KeyedStateBackend;
import org.apache.flink.runtime.state.heap.HeapKeyedStateBackend;
import org.apache.flink.runtime.state.internal.InternalMergingState;
import org.apache.flink.runtime.state.memory.MemoryStateBackend;
+import org.apache.flink.streaming.api.operators.InternalTimerService;
import org.apache.flink.streaming.api.operators.KeyContext;
import org.apache.flink.streaming.api.operators.TestInternalTimerService;
-import org.apache.flink.streaming.api.operators.InternalTimerService;
import org.apache.flink.streaming.api.windowing.triggers.Trigger;
import org.apache.flink.streaming.api.windowing.triggers.TriggerResult;
import org.apache.flink.streaming.api.windowing.windows.Window;
@@ -123,7 +124,7 @@ public class TriggerTestHarness<T, W extends Window> {
/**
* Injects one element into the trigger for the given window and returns the result of
- * {@link Trigger#onElement(Object, long, Window, Trigger.TriggerContext)}
+ * {@link Trigger#onElement(Object, long, Window, Trigger.TriggerContext)}.
*/
public TriggerResult processElement(StreamRecord<T> element, W window) throws Exception {
TestTriggerContext<Integer, W> triggerContext = new TestTriggerContext<>(
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingEventTimeWindowsTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingEventTimeWindowsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingEventTimeWindowsTest.java
index 2373a86..9e4669f 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingEventTimeWindowsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingEventTimeWindowsTest.java
@@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
+package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
@@ -26,17 +26,21 @@ import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import static org.apache.flink.streaming.runtime.operators.windowing.StreamRecordMatchers.timeWindow;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.instanceOf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
/**
- * Tests for {@link TumblingEventTimeWindows}
+ * Tests for {@link TumblingEventTimeWindows}.
*/
public class TumblingEventTimeWindowsTest extends TestLogger {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingProcessingTimeWindowsTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingProcessingTimeWindowsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingProcessingTimeWindowsTest.java
index 348b6fa..a611fc0 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingProcessingTimeWindowsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingProcessingTimeWindowsTest.java
@@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
+package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
@@ -26,18 +26,22 @@ import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.triggers.ProcessingTimeTrigger;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.TestLogger;
+
import org.junit.Test;
import static org.apache.flink.streaming.runtime.operators.windowing.StreamRecordMatchers.timeWindow;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.instanceOf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
- * Tests for {@link TumblingProcessingTimeWindows}
+ * Tests for {@link TumblingProcessingTimeWindows}.
*/
public class TumblingProcessingTimeWindowsTest extends TestLogger {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorContractTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorContractTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorContractTest.java
index 0d80605..8ceda45 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorContractTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorContractTest.java
@@ -15,38 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
-
-import static org.apache.flink.streaming.runtime.operators.windowing.StreamRecordMatchers.isStreamRecord;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyCollection;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.atLeastOnce;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+package org.apache.flink.streaming.runtime.operators.windowing;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.state.ValueStateDescriptor;
import org.apache.flink.api.common.typeutils.base.StringSerializer;
-import org.apache.flink.streaming.api.functions.ProcessFunction;
-import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner;
import org.apache.flink.streaming.api.windowing.assigners.WindowAssigner;
@@ -64,6 +38,7 @@ import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.util.Collector;
import org.apache.flink.util.OutputTag;
import org.apache.flink.util.TestLogger;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -73,6 +48,31 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.mockito.verification.VerificationMode;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import static org.apache.flink.streaming.runtime.operators.windowing.StreamRecordMatchers.isStreamRecord;
+import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.anyCollection;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
/**
* Base for window operator tests that verify correct interaction with the other windowing
* components: {@link org.apache.flink.streaming.api.windowing.assigners.WindowAssigner},
@@ -128,7 +128,6 @@ public abstract class WindowOperatorContractTest extends TestLogger {
return mockAssigner;
}
-
static <T> MergingWindowAssigner<T, TimeWindow> mockMergingAssigner() throws Exception {
@SuppressWarnings("unchecked")
MergingWindowAssigner<T, TimeWindow> mockAssigner = mock(MergingWindowAssigner.class);
@@ -139,7 +138,6 @@ public abstract class WindowOperatorContractTest extends TestLogger {
return mockAssigner;
}
-
static WindowAssigner.WindowAssignerContext anyAssignerContext() {
return Mockito.any();
}
@@ -177,7 +175,6 @@ public abstract class WindowOperatorContractTest extends TestLogger {
return Mockito.any();
}
-
static <T> void shouldRegisterEventTimeTimerOnElement(Trigger<T, TimeWindow> mockTrigger, final long timestamp) throws Exception {
doAnswer(new Answer<TriggerResult>() {
@Override
@@ -369,7 +366,6 @@ public abstract class WindowOperatorContractTest extends TestLogger {
}
-
@Test
public void testAssignerIsInvokedOncePerElement() throws Exception {
@@ -540,7 +536,6 @@ public abstract class WindowOperatorContractTest extends TestLogger {
testEmittingFromWindowFunction(new ProcessingTimeAdaptor());
}
-
private void testEmittingFromWindowFunction(TimeDomainAdaptor timeAdaptor) throws Exception {
WindowAssigner<Integer, TimeWindow> mockAssigner = mockTimeWindowAssigner();
@@ -1258,7 +1253,6 @@ public abstract class WindowOperatorContractTest extends TestLogger {
testTimerFiring(new ProcessingTimeAdaptor());
}
-
private void testTimerFiring(TimeDomainAdaptor timeAdaptor) throws Exception {
WindowAssigner<Integer, TimeWindow> mockAssigner = mockTimeWindowAssigner();
@@ -1382,8 +1376,6 @@ public abstract class WindowOperatorContractTest extends TestLogger {
verify(mockAssigner).mergeWindows(eq(Collections.singletonList(new TimeWindow(2, 4))), anyMergeCallback());
verify(mockAssigner, times(2)).mergeWindows(anyCollection(), anyMergeCallback());
-
-
}
@Test
@@ -2392,7 +2384,7 @@ public abstract class WindowOperatorContractTest extends TestLogger {
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
- InternalWindowFunction.InternalWindowContext context = (InternalWindowFunction.InternalWindowContext)invocationOnMock.getArguments()[2];
+ InternalWindowFunction.InternalWindowContext context = (InternalWindowFunction.InternalWindowContext) invocationOnMock.getArguments()[2];
context.windowState().getState(valueStateDescriptor).update("hello");
return null;
}
@@ -2401,7 +2393,7 @@ public abstract class WindowOperatorContractTest extends TestLogger {
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
- InternalWindowFunction.InternalWindowContext context = (InternalWindowFunction.InternalWindowContext)invocationOnMock.getArguments()[1];
+ InternalWindowFunction.InternalWindowContext context = (InternalWindowFunction.InternalWindowContext) invocationOnMock.getArguments()[1];
context.windowState().getState(valueStateDescriptor).clear();
return null;
}
@@ -2441,7 +2433,7 @@ public abstract class WindowOperatorContractTest extends TestLogger {
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
- InternalWindowFunction.InternalWindowContext context = (InternalWindowFunction.InternalWindowContext)invocationOnMock.getArguments()[2];
+ InternalWindowFunction.InternalWindowContext context = (InternalWindowFunction.InternalWindowContext) invocationOnMock.getArguments()[2];
context.windowState().getState(valueStateDescriptor).update("hello");
return null;
}
@@ -2481,7 +2473,7 @@ public abstract class WindowOperatorContractTest extends TestLogger {
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
- InternalWindowFunction.InternalWindowContext context = (InternalWindowFunction.InternalWindowContext)invocationOnMock.getArguments()[2];
+ InternalWindowFunction.InternalWindowContext context = (InternalWindowFunction.InternalWindowContext) invocationOnMock.getArguments()[2];
timeAdaptor.verifyCorrectTime(testHarness, context);
return null;
}
@@ -2490,7 +2482,7 @@ public abstract class WindowOperatorContractTest extends TestLogger {
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
- InternalWindowFunction.InternalWindowContext context = (InternalWindowFunction.InternalWindowContext)invocationOnMock.getArguments()[1];
+ InternalWindowFunction.InternalWindowContext context = (InternalWindowFunction.InternalWindowContext) invocationOnMock.getArguments()[1];
timeAdaptor.verifyCorrectTime(testHarness, context);
return null;
}
@@ -2520,7 +2512,6 @@ public abstract class WindowOperatorContractTest extends TestLogger {
long allowedLatenss,
InternalWindowFunction<Iterable<Integer>, OUT, Integer, W> windowFunction) throws Exception;
-
private interface TimeDomainAdaptor {
void setIsEventTime(WindowAssigner<?, ?> mockAssigner);
@@ -2535,9 +2526,9 @@ public abstract class WindowOperatorContractTest extends TestLogger {
int numTimersOtherDomain(AbstractStreamOperatorTestHarness testHarness);
- void shouldRegisterTimerOnElement(Trigger<?, TimeWindow> mockTrigger, final long timestamp) throws Exception;
+ void shouldRegisterTimerOnElement(Trigger<?, TimeWindow> mockTrigger, long timestamp) throws Exception;
- void shouldDeleteTimerOnElement(Trigger<?, TimeWindow> mockTrigger, final long timestamp) throws Exception;
+ void shouldDeleteTimerOnElement(Trigger<?, TimeWindow> mockTrigger, long timestamp) throws Exception;
void shouldContinueOnTime(Trigger<?, TimeWindow> mockTrigger) throws Exception;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorFrom11MigrationTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorFrom11MigrationTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorFrom11MigrationTest.java
index 9ec1923..904a8b9 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorFrom11MigrationTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorFrom11MigrationTest.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.ExecutionConfig;
@@ -50,6 +51,7 @@ import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.util.Collector;
+
import org.junit.Test;
import java.net.URL;
@@ -63,8 +65,7 @@ import static org.junit.Assert.fail;
* Tests for checking whether {@link WindowOperator} can restore from snapshots that were done
* using the Flink 1.1 {@link WindowOperator}.
*
- * <p>
- * This also checks whether {@link WindowOperator} can restore from a checkpoint of the Flink 1.1
+ * <p>This also checks whether {@link WindowOperator} can restore from a checkpoint of the Flink 1.1
* aligned processing-time windows operator.
*
* <p>For regenerating the binary snapshot file you have to run the commented out portion
@@ -85,7 +86,7 @@ public class WindowOperatorFrom11MigrationTest {
@SuppressWarnings("unchecked")
public void testRestoreSessionWindowsWithCountTriggerFromFlink11() throws Exception {
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -93,7 +94,7 @@ public class WindowOperatorFrom11MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -131,7 +132,6 @@ public class WindowOperatorFrom11MigrationTest {
testHarness.close();
*/
-
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple3<String, Long, Long>> testHarness =
new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO);
@@ -146,7 +146,6 @@ public class WindowOperatorFrom11MigrationTest {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 2), 6500));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 3), 7000));
-
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple3ResultSortComparator());
// add an element that merges the two "key1" sessions, they should now have count 6, and therfore fire
@@ -167,7 +166,7 @@ public class WindowOperatorFrom11MigrationTest {
@SuppressWarnings("unchecked")
public void testRestoreSessionWindowsWithCountTriggerInMintConditionFromFlink11() throws Exception {
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -175,7 +174,7 @@ public class WindowOperatorFrom11MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -244,7 +243,7 @@ public class WindowOperatorFrom11MigrationTest {
@Test
@SuppressWarnings("unchecked")
public void testRestoreReducingEventTimeWindowsFromFlink11() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -253,7 +252,7 @@ public class WindowOperatorFrom11MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -334,7 +333,7 @@ public class WindowOperatorFrom11MigrationTest {
@Test
@SuppressWarnings("unchecked")
public void testRestoreApplyEventTimeWindowsFromFlink11() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -342,7 +341,7 @@ public class WindowOperatorFrom11MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -423,7 +422,7 @@ public class WindowOperatorFrom11MigrationTest {
@Test
@SuppressWarnings("unchecked")
public void testRestoreReducingProcessingTimeWindowsFromFlink11() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -432,7 +431,7 @@ public class WindowOperatorFrom11MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -500,7 +499,7 @@ public class WindowOperatorFrom11MigrationTest {
@Test
@SuppressWarnings("unchecked")
public void testRestoreApplyProcessingTimeWindowsFromFlink11() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -508,7 +507,7 @@ public class WindowOperatorFrom11MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -622,7 +621,7 @@ public class WindowOperatorFrom11MigrationTest {
*/
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -631,7 +630,7 @@ public class WindowOperatorFrom11MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -725,7 +724,7 @@ public class WindowOperatorFrom11MigrationTest {
testHarness.close();
*/
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -734,7 +733,7 @@ public class WindowOperatorFrom11MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -774,7 +773,6 @@ public class WindowOperatorFrom11MigrationTest {
testHarness.close();
}
-
private static class TupleKeySelector implements KeySelector<Tuple2<String, Integer>, String> {
private static final long serialVersionUID = 1L;
@@ -832,7 +830,7 @@ public class WindowOperatorFrom11MigrationTest {
}
}
- public static class SumReducer implements ReduceFunction<Tuple2<String, Integer>> {
+ private static class SumReducer implements ReduceFunction<Tuple2<String, Integer>> {
private static final long serialVersionUID = 1L;
@Override
public Tuple2<String, Integer> reduce(Tuple2<String, Integer> value1,
@@ -841,7 +839,7 @@ public class WindowOperatorFrom11MigrationTest {
}
}
- public static class RichSumReducer<W extends Window> extends RichWindowFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, String, W> {
+ private static class RichSumReducer<W extends Window> extends RichWindowFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, String, W> {
private static final long serialVersionUID = 1L;
private boolean openCalled = false;
@@ -877,7 +875,7 @@ public class WindowOperatorFrom11MigrationTest {
}
- public static class SessionWindowFunction implements WindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
+ private static class SessionWindowFunction implements WindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
private static final long serialVersionUID = 1L;
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorFrom12MigrationTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorFrom12MigrationTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorFrom12MigrationTest.java
index 0d3a6dc..6e9db1a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorFrom12MigrationTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorFrom12MigrationTest.java
@@ -15,13 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.runtime.operators.windowing;
-import static org.junit.Assert.fail;
+package org.apache.flink.streaming.runtime.operators.windowing;
-import java.util.Comparator;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.TimeUnit;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.common.state.ListStateDescriptor;
@@ -57,9 +53,16 @@ import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.OperatorSnapshotUtil;
import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.util.Collector;
+
import org.junit.Ignore;
import org.junit.Test;
+import java.util.Comparator;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.Assert.fail;
+
/**
* Tests for checking whether {@link WindowOperator} can restore from snapshots that were done
* using the Flink 1.2 {@link WindowOperator}.
@@ -78,7 +81,7 @@ public class WindowOperatorFrom12MigrationTest {
@Ignore
@Test
public void writeSessionWindowsWithCountTriggerSnapshot() throws Exception {
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -86,7 +89,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -122,7 +125,7 @@ public class WindowOperatorFrom12MigrationTest {
@Test
public void testRestoreSessionWindowsWithCountTrigger() throws Exception {
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -130,7 +133,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -157,7 +160,6 @@ public class WindowOperatorFrom12MigrationTest {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 2), 6500));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 3), 7000));
-
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple3ResultSortComparator());
// add an element that merges the two "key1" sessions, they should now have count 6, and therfore fire
@@ -177,7 +179,7 @@ public class WindowOperatorFrom12MigrationTest {
@Test
public void writeSessionWindowsWithCountTriggerInMintConditionSnapshot() throws Exception {
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -185,7 +187,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -215,7 +217,7 @@ public class WindowOperatorFrom12MigrationTest {
@Test
public void testRestoreSessionWindowsWithCountTriggerInMintCondition() throws Exception {
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -223,7 +225,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -280,7 +282,7 @@ public class WindowOperatorFrom12MigrationTest {
@Ignore
@Test
public void writeReducingEventTimeWindowsSnapshot() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -289,7 +291,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -336,7 +338,7 @@ public class WindowOperatorFrom12MigrationTest {
@Test
public void testRestoreReducingEventTimeWindows() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -345,7 +347,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -391,7 +393,7 @@ public class WindowOperatorFrom12MigrationTest {
@Ignore
@Test
public void writeApplyEventTimeWindowsSnapshot() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -399,7 +401,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -446,7 +448,7 @@ public class WindowOperatorFrom12MigrationTest {
@Test
public void testRestoreApplyEventTimeWindows() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -454,7 +456,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -500,7 +502,7 @@ public class WindowOperatorFrom12MigrationTest {
@Ignore
@Test
public void writeReducingProcessingTimeWindowsSnapshot() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -509,7 +511,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -550,7 +552,7 @@ public class WindowOperatorFrom12MigrationTest {
@Test
public void testRestoreReducingProcessingTimeWindows() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -559,7 +561,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -600,7 +602,7 @@ public class WindowOperatorFrom12MigrationTest {
@Ignore
@Test
public void writeApplyProcessingTimeWindowsSnapshot() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -608,7 +610,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -648,7 +650,7 @@ public class WindowOperatorFrom12MigrationTest {
@Test
public void testRestoreApplyProcessingTimeWindows() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -656,7 +658,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -738,7 +740,7 @@ public class WindowOperatorFrom12MigrationTest {
@Test
public void testRestoreAggregatingAlignedProcessingTimeWindows() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -747,7 +749,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -841,7 +843,7 @@ public class WindowOperatorFrom12MigrationTest {
@Test
public void testRestoreAccumulatingAlignedProcessingTimeWindows() throws Exception {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -850,7 +852,7 @@ public class WindowOperatorFrom12MigrationTest {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -892,7 +894,6 @@ public class WindowOperatorFrom12MigrationTest {
testHarness.close();
}
-
private static class TupleKeySelector implements KeySelector<Tuple2<String, Integer>, String> {
private static final long serialVersionUID = 1L;
@@ -950,7 +951,7 @@ public class WindowOperatorFrom12MigrationTest {
}
}
- public static class SumReducer implements ReduceFunction<Tuple2<String, Integer>> {
+ private static class SumReducer implements ReduceFunction<Tuple2<String, Integer>> {
private static final long serialVersionUID = 1L;
@Override
public Tuple2<String, Integer> reduce(Tuple2<String, Integer> value1,
@@ -959,7 +960,7 @@ public class WindowOperatorFrom12MigrationTest {
}
}
- public static class RichSumReducer<W extends Window> extends RichWindowFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, String, W> {
+ private static class RichSumReducer<W extends Window> extends RichWindowFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, String, W> {
private static final long serialVersionUID = 1L;
private boolean openCalled = false;
@@ -995,7 +996,7 @@ public class WindowOperatorFrom12MigrationTest {
}
- public static class SessionWindowFunction implements WindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
+ private static class SessionWindowFunction implements WindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
private static final long serialVersionUID = 1L;
@Override
[02/10] flink git commit: [FLINK-6603] [streaming] Enable checkstyle
on test sources
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorTest.java
index 8db7a7f..42c6c6f 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorTest.java
@@ -15,10 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
-import com.google.common.base.Joiner;
-import com.google.common.collect.Iterables;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.FoldFunction;
import org.apache.flink.api.common.functions.ReduceFunction;
@@ -26,7 +25,6 @@ import org.apache.flink.api.common.state.FoldingStateDescriptor;
import org.apache.flink.api.common.state.ListStateDescriptor;
import org.apache.flink.api.common.state.ReducingStateDescriptor;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
-import org.apache.flink.util.OutputTag;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.api.java.tuple.Tuple2;
@@ -67,7 +65,11 @@ import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.TestHarnessUtil;
import org.apache.flink.util.Collector;
+import org.apache.flink.util.OutputTag;
import org.apache.flink.util.TestLogger;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
import org.junit.Assert;
import org.junit.Test;
@@ -83,6 +85,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+/**
+ * Tests for {@link WindowOperator}.
+ */
@SuppressWarnings("serial")
public class WindowOperatorTest extends TestLogger {
@@ -108,13 +113,11 @@ public class WindowOperatorTest extends TestLogger {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 1999));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 1000));
-
testHarness.processWatermark(new Watermark(999));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key1", 3), 999));
expectedOutput.add(new Watermark(999));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple2ResultSortComparator());
-
testHarness.processWatermark(new Watermark(1999));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key1", 3), 1999));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 3), 1999));
@@ -149,7 +152,6 @@ public class WindowOperatorTest extends TestLogger {
expectedOutput.add(new Watermark(5999));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple2ResultSortComparator());
-
// those don't have any effect...
testHarness.processWatermark(new Watermark(6999));
testHarness.processWatermark(new Watermark(7999));
@@ -164,8 +166,8 @@ public class WindowOperatorTest extends TestLogger {
public void testSlidingEventTimeWindowsReduce() throws Exception {
closeCalled.set(0);
- final int WINDOW_SIZE = 3;
- final int WINDOW_SLIDE = 1;
+ final int windowSize = 3;
+ final int windowSlide = 1;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -174,7 +176,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- SlidingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS), Time.of(WINDOW_SLIDE, TimeUnit.SECONDS)),
+ SlidingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS), Time.of(windowSlide, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -200,8 +202,8 @@ public class WindowOperatorTest extends TestLogger {
public void testSlidingEventTimeWindowsApply() throws Exception {
closeCalled.set(0);
- final int WINDOW_SIZE = 3;
- final int WINDOW_SLIDE = 1;
+ final int windowSize = 3;
+ final int windowSlide = 1;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -209,7 +211,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- SlidingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS), Time.of(WINDOW_SLIDE, TimeUnit.SECONDS)),
+ SlidingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS), Time.of(windowSlide, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -249,12 +251,10 @@ public class WindowOperatorTest extends TestLogger {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 1999));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 1000));
-
testHarness.processWatermark(new Watermark(999));
expectedOutput.add(new Watermark(999));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple2ResultSortComparator());
-
testHarness.processWatermark(new Watermark(1999));
expectedOutput.add(new Watermark(1999));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple2ResultSortComparator());
@@ -285,7 +285,6 @@ public class WindowOperatorTest extends TestLogger {
expectedOutput.add(new Watermark(5999));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple2ResultSortComparator());
-
// those don't have any effect...
testHarness.processWatermark(new Watermark(6999));
testHarness.processWatermark(new Watermark(7999));
@@ -300,7 +299,7 @@ public class WindowOperatorTest extends TestLogger {
public void testTumblingEventTimeWindowsReduce() throws Exception {
closeCalled.set(0);
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -309,7 +308,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -334,7 +333,7 @@ public class WindowOperatorTest extends TestLogger {
public void testTumblingEventTimeWindowsApply() throws Exception {
closeCalled.set(0);
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -342,7 +341,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -370,7 +369,7 @@ public class WindowOperatorTest extends TestLogger {
public void testSessionWindows() throws Exception {
closeCalled.set(0);
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -378,7 +377,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -443,7 +442,7 @@ public class WindowOperatorTest extends TestLogger {
public void testSessionWindowsWithProcessFunction() throws Exception {
closeCalled.set(0);
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -451,7 +450,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -516,7 +515,7 @@ public class WindowOperatorTest extends TestLogger {
public void testReduceSessionWindows() throws Exception {
closeCalled.set(0);
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -524,7 +523,7 @@ public class WindowOperatorTest extends TestLogger {
"window-contents", new SumReducer(), inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -587,7 +586,7 @@ public class WindowOperatorTest extends TestLogger {
public void testReduceSessionWindowsWithProcessFunction() throws Exception {
closeCalled.set(0);
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -595,7 +594,7 @@ public class WindowOperatorTest extends TestLogger {
"window-contents", new SumReducer(), inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -662,7 +661,7 @@ public class WindowOperatorTest extends TestLogger {
public void testSessionWindowsWithCountTrigger() throws Exception {
closeCalled.set(0);
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -670,7 +669,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -709,7 +708,6 @@ public class WindowOperatorTest extends TestLogger {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 2), 6500));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 3), 7000));
-
expectedOutput.add(new StreamRecord<>(new Tuple3<>("key2-10", 0L, 6500L), 6499));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple3ResultSortComparator());
@@ -733,7 +731,7 @@ public class WindowOperatorTest extends TestLogger {
public void testSessionWindowsWithContinuousEventTimeTrigger() throws Exception {
closeCalled.set(0);
- final int SESSION_SIZE = 3;
+ final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -741,7 +739,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(SESSION_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -864,7 +862,7 @@ public class WindowOperatorTest extends TestLogger {
public void testContinuousWatermarkTrigger() throws Exception {
closeCalled.set(0);
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -879,7 +877,7 @@ public class WindowOperatorTest extends TestLogger {
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new PassThroughWindowFunction<String, GlobalWindow, Tuple2<String, Integer>>()),
- ContinuousEventTimeTrigger.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ ContinuousEventTimeTrigger.of(Time.of(windowSize, TimeUnit.SECONDS)),
0,
null /* late data output tag */);
@@ -905,12 +903,10 @@ public class WindowOperatorTest extends TestLogger {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 1999));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 1000));
-
testHarness.processWatermark(new Watermark(1000));
expectedOutput.add(new Watermark(1000));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple2ResultSortComparator());
-
testHarness.processWatermark(new Watermark(2000));
expectedOutput.add(new Watermark(2000));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple2ResultSortComparator());
@@ -930,13 +926,12 @@ public class WindowOperatorTest extends TestLogger {
testHarness.processWatermark(new Watermark(6000));
- expectedOutput.add(new StreamRecord<>(new Tuple2<>("key1", 3), Long.MAX_VALUE));
+ expectedOutput.add(new StreamRecord<>(new Tuple2<>("key1", 3), Long.MAX_VALUE));
expectedOutput.add(new StreamRecord<>(new Tuple2<>("key2", 5), Long.MAX_VALUE));
expectedOutput.add(new Watermark(6000));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple2ResultSortComparator());
-
// those don't have any effect...
testHarness.processWatermark(new Watermark(7000));
testHarness.processWatermark(new Watermark(8000));
@@ -953,7 +948,7 @@ public class WindowOperatorTest extends TestLogger {
public void testCountTrigger() throws Exception {
closeCalled.set(0);
- final int WINDOW_SIZE = 4;
+ final int windowSize = 4;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -968,7 +963,7 @@ public class WindowOperatorTest extends TestLogger {
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new PassThroughWindowFunction<String, GlobalWindow, Tuple2<String, Integer>>()),
- PurgingTrigger.of(CountTrigger.of(WINDOW_SIZE)),
+ PurgingTrigger.of(CountTrigger.of(windowSize)),
0,
null /* late data output tag */);
@@ -1010,7 +1005,7 @@ public class WindowOperatorTest extends TestLogger {
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new PassThroughWindowFunction<String, GlobalWindow, Tuple2<String, Integer>>()),
- PurgingTrigger.of(CountTrigger.of(WINDOW_SIZE)),
+ PurgingTrigger.of(CountTrigger.of(windowSize)),
0,
null /* late data output tag */);
@@ -1042,7 +1037,7 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testProcessingTimeTumblingWindows() throws Throwable {
- final int WINDOW_SIZE = 3;
+ final int windowSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1051,7 +1046,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- TumblingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -1100,8 +1095,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testProcessingTimeSlidingWindows() throws Throwable {
- final int WINDOW_SIZE = 3;
- final int WINDOW_SLIDE = 1;
+ final int windowSize = 3;
+ final int windowSlide = 1;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1110,7 +1105,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- SlidingProcessingTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS), Time.of(WINDOW_SLIDE, TimeUnit.SECONDS)),
+ SlidingProcessingTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS), Time.of(windowSlide, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -1173,7 +1168,7 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testProcessingTimeSessionWindows() throws Throwable {
- final int WINDOW_GAP = 3;
+ final int windowGap = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1182,7 +1177,7 @@ public class WindowOperatorTest extends TestLogger {
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator = new WindowOperator<>(
- ProcessingTimeSessionWindows.withGap(Time.of(WINDOW_GAP, TimeUnit.SECONDS)),
+ ProcessingTimeSessionWindows.withGap(Time.of(windowGap, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
@@ -1201,10 +1196,10 @@ public class WindowOperatorTest extends TestLogger {
// timestamp is ignored in processing time
testHarness.setProcessingTime(3);
- testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 1));//Long.MAX_VALUE));
+ testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 1)); //Long.MAX_VALUE));
testHarness.setProcessingTime(1000);
- testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 1002));//Long.MAX_VALUE));
+ testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 1002)); //Long.MAX_VALUE));
testHarness.setProcessingTime(5000);
@@ -1237,8 +1232,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testLateness() throws Exception {
- final int WINDOW_SIZE = 2;
- final long LATENESS = 500;
+ final int windowSize = 2;
+ final long lateness = 500;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1248,14 +1243,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator =
new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new PassThroughWindowFunction<String, TimeWindow, Tuple2<String, Integer>>()),
PurgingTrigger.of(EventTimeTrigger.create()),
- LATENESS,
+ lateness,
lateOutputTag);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
@@ -1293,7 +1288,7 @@ public class WindowOperatorTest extends TestLogger {
expected.add(new Watermark(7000));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expected, testHarness.getOutput(), new Tuple2ResultSortComparator());
-
+
TestHarnessUtil.assertOutputEqualsSorted(
"SideOutput was not correct.",
lateExpected,
@@ -1305,8 +1300,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testCleanupTimeOverflow() throws Exception {
- final int WINDOW_SIZE = 1000;
- final long LATENESS = 2000;
+ final int windowSize = 1000;
+ final long lateness = 2000;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1314,7 +1309,7 @@ public class WindowOperatorTest extends TestLogger {
new SumReducer(),
inputType.createSerializer(new ExecutionConfig()));
- TumblingEventTimeWindows windowAssigner = TumblingEventTimeWindows.of(Time.milliseconds(WINDOW_SIZE));
+ TumblingEventTimeWindows windowAssigner = TumblingEventTimeWindows.of(Time.milliseconds(windowSize));
final WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator =
new WindowOperator<>(
@@ -1325,7 +1320,7 @@ public class WindowOperatorTest extends TestLogger {
stateDesc,
new InternalSingleValueWindowFunction<>(new PassThroughWindowFunction<String, TimeWindow, Tuple2<String, Integer>>()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
@@ -1347,10 +1342,10 @@ public class WindowOperatorTest extends TestLogger {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), timestamp));
// the garbage collection timer would wrap-around
- Assert.assertTrue(window.maxTimestamp() + LATENESS < window.maxTimestamp());
+ Assert.assertTrue(window.maxTimestamp() + lateness < window.maxTimestamp());
// and it would prematurely fire with watermark (Long.MAX_VALUE - 1500)
- Assert.assertTrue(window.maxTimestamp() + LATENESS < Long.MAX_VALUE - 1500);
+ Assert.assertTrue(window.maxTimestamp() + lateness < Long.MAX_VALUE - 1500);
// if we don't correctly prevent wrap-around in the garbage collection
// timers this watermark will clean our window state for the just-added
@@ -1374,8 +1369,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testSideOutputDueToLatenessTumbling() throws Exception {
- final int WINDOW_SIZE = 2;
- final long LATENESS = 0;
+ final int windowSize = 2;
+ final long lateness = 0;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1385,14 +1380,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator =
new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new PassThroughWindowFunction<String, TimeWindow, Tuple2<String, Integer>>()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
lateOutputTag);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
@@ -1438,9 +1433,9 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testSideOutputDueToLatenessSliding() throws Exception {
- final int WINDOW_SIZE = 3;
- final int WINDOW_SLIDE = 1;
- final long LATENESS = 0;
+ final int windowSize = 3;
+ final int windowSlide = 1;
+ final long lateness = 0;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1450,14 +1445,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator =
new WindowOperator<>(
- SlidingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS), Time.of(WINDOW_SLIDE, TimeUnit.SECONDS)),
+ SlidingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS), Time.of(windowSlide, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new PassThroughWindowFunction<String, TimeWindow, Tuple2<String, Integer>>()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
lateOutputTag /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
@@ -1482,7 +1477,7 @@ public class WindowOperatorTest extends TestLogger {
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 1), 3001));
- // lateness is set to 0 and window_size = 3 sec and slide 1, the following 2 elements (2400)
+ // lateness is set to 0 and window size = 3 sec and slide 1, the following 2 elements (2400)
// are assigned to windows ending at 2999, 3999, 4999.
// The 2999 is dropped because it is already late (WM = 2999) but the rest are kept.
@@ -1518,8 +1513,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testSideOutputDueToLatenessSessionZeroLatenessPurgingTrigger() throws Exception {
- final int GAP_SIZE = 3;
- final long LATENESS = 0;
+ final int gapSize = 3;
+ final long lateness = 0;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1529,14 +1524,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Long, Long>, TimeWindow> operator =
new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(GAP_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(gapSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new ReducedSessionWindowFunction()),
PurgingTrigger.of(EventTimeTrigger.create()),
- LATENESS,
+ lateness,
lateOutputTag);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple3<String, Long, Long>> testHarness =
@@ -1610,8 +1605,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testSideOutputDueToLatenessSessionZeroLateness() throws Exception {
- final int GAP_SIZE = 3;
- final long LATENESS = 0;
+ final int gapSize = 3;
+ final long lateness = 0;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1621,14 +1616,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Long, Long>, TimeWindow> operator =
new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(GAP_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(gapSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new ReducedSessionWindowFunction()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
lateOutputTag);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple3<String, Long, Long>> testHarness =
@@ -1700,8 +1695,8 @@ public class WindowOperatorTest extends TestLogger {
// this has the same output as testSideOutputDueToLatenessSessionZeroLateness() because
// the allowed lateness is too small to make a difference
- final int GAP_SIZE = 3;
- final long LATENESS = 10;
+ final int gapSize = 3;
+ final long lateness = 10;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1711,14 +1706,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Long, Long>, TimeWindow> operator =
new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(GAP_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(gapSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new ReducedSessionWindowFunction()),
PurgingTrigger.of(EventTimeTrigger.create()),
- LATENESS,
+ lateness,
lateOutputTag);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple3<String, Long, Long>> testHarness =
@@ -1787,8 +1782,8 @@ public class WindowOperatorTest extends TestLogger {
// one that does not return FIRE_AND_PURGE when firing but just FIRE. The expected
// results are therefore slightly different.
- final int GAP_SIZE = 3;
- final long LATENESS = 10;
+ final int gapSize = 3;
+ final long lateness = 10;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1798,14 +1793,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Long, Long>, TimeWindow> operator =
new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(GAP_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(gapSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new ReducedSessionWindowFunction()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple3<String, Long, Long>> testHarness =
@@ -1888,8 +1883,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testNotSideOutputDueToLatenessSessionWithHugeLatenessPurgingTrigger() throws Exception {
- final int GAP_SIZE = 3;
- final long LATENESS = 10000;
+ final int gapSize = 3;
+ final long lateness = 10000;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1899,14 +1894,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Long, Long>, TimeWindow> operator =
new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(GAP_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(gapSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new ReducedSessionWindowFunction()),
PurgingTrigger.of(EventTimeTrigger.create()),
- LATENESS,
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple3<String, Long, Long>> testHarness =
@@ -1979,8 +1974,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testNotSideOutputDueToLatenessSessionWithHugeLateness() throws Exception {
- final int GAP_SIZE = 3;
- final long LATENESS = 10000;
+ final int gapSize = 3;
+ final long lateness = 10000;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -1990,14 +1985,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Long, Long>, TimeWindow> operator =
new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(GAP_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(gapSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new ReducedSessionWindowFunction()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple3<String, Long, Long>> testHarness =
@@ -2072,8 +2067,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testCleanupTimerWithEmptyListStateForTumblingWindows2() throws Exception {
- final int WINDOW_SIZE = 2;
- final long LATENESS = 100;
+ final int windowSize = 2;
+ final long lateness = 100;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -2082,14 +2077,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, String, TimeWindow> operator =
new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
windowStateDesc,
new InternalIterableWindowFunction<>(new PassThroughFunction2()),
- new EventTimeTriggerAccumGC(LATENESS),
- LATENESS,
+ new EventTimeTriggerAccumGC(lateness),
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, String> testHarness =
@@ -2127,8 +2122,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testCleanupTimerWithEmptyListStateForTumblingWindows() throws Exception {
- final int WINDOW_SIZE = 2;
- final long LATENESS = 1;
+ final int windowSize = 2;
+ final long lateness = 1;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -2137,14 +2132,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple2<String, Integer>, TimeWindow> operator =
new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
windowStateDesc,
new InternalIterableWindowFunction<>(new PassThroughFunction()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
@@ -2173,8 +2168,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testCleanupTimerWithEmptyReduceStateForTumblingWindows() throws Exception {
- final int WINDOW_SIZE = 2;
- final long LATENESS = 1;
+ final int windowSize = 2;
+ final long lateness = 1;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -2184,14 +2179,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator =
new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new PassThroughWindowFunction<String, TimeWindow, Tuple2<String, Integer>>()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
@@ -2220,8 +2215,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testCleanupTimerWithEmptyFoldingStateForTumblingWindows() throws Exception {
- final int WINDOW_SIZE = 2;
- final long LATENESS = 1;
+ final int windowSize = 2;
+ final long lateness = 1;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -2242,14 +2237,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator =
new WindowOperator<>(
- TumblingEventTimeWindows.of(Time.of(WINDOW_SIZE, TimeUnit.SECONDS)),
+ TumblingEventTimeWindows.of(Time.of(windowSize, TimeUnit.SECONDS)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
windowStateDesc,
new InternalSingleValueWindowFunction<>(new PassThroughFunction()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
@@ -2278,8 +2273,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testCleanupTimerWithEmptyListStateForSessionWindows() throws Exception {
- final int GAP_SIZE = 3;
- final long LATENESS = 10;
+ final int gapSize = 3;
+ final long lateness = 10;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -2288,14 +2283,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple2<String, Integer>, TimeWindow> operator =
new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(GAP_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(gapSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
windowStateDesc,
new InternalIterableWindowFunction<>(new PassThroughFunction()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
@@ -2322,8 +2317,8 @@ public class WindowOperatorTest extends TestLogger {
@Test
public void testCleanupTimerWithEmptyReduceStateForSessionWindows() throws Exception {
- final int GAP_SIZE = 3;
- final long LATENESS = 10;
+ final int gapSize = 3;
+ final long lateness = 10;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -2333,14 +2328,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Long, Long>, TimeWindow> operator =
new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(GAP_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(gapSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(new ReducedSessionWindowFunction()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple3<String, Long, Long>> testHarness =
@@ -2367,8 +2362,8 @@ public class WindowOperatorTest extends TestLogger {
// TODO this test seems invalid, as it uses the unsupported combination of merging windows and folding window state
@Test
public void testCleanupTimerWithEmptyFoldingStateForSessionWindows() throws Exception {
- final int GAP_SIZE = 3;
- final long LATENESS = 10;
+ final int gapSize = 3;
+ final long lateness = 10;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
@@ -2389,14 +2384,14 @@ public class WindowOperatorTest extends TestLogger {
WindowOperator<String, Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple2<String, Integer>, TimeWindow> operator =
new WindowOperator<>(
- EventTimeSessionWindows.withGap(Time.seconds(GAP_SIZE)),
+ EventTimeSessionWindows.withGap(Time.seconds(gapSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
windowStateDesc,
new InternalSingleValueWindowFunction<>(new PassThroughFunction()),
EventTimeTrigger.create(),
- LATENESS,
+ lateness,
null /* late data output tag */);
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple2<String, Integer>> testHarness =
@@ -2435,7 +2430,7 @@ public class WindowOperatorTest extends TestLogger {
}
}
- public static class SumReducer implements ReduceFunction<Tuple2<String, Integer>> {
+ private static class SumReducer implements ReduceFunction<Tuple2<String, Integer>> {
private static final long serialVersionUID = 1L;
@Override
public Tuple2<String, Integer> reduce(Tuple2<String, Integer> value1,
@@ -2444,8 +2439,7 @@ public class WindowOperatorTest extends TestLogger {
}
}
-
- public static class RichSumReducer<W extends Window> extends RichWindowFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, String, W> {
+ private static class RichSumReducer<W extends Window> extends RichWindowFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, String, W> {
private static final long serialVersionUID = 1L;
private boolean openCalled = false;
@@ -2539,7 +2533,7 @@ public class WindowOperatorTest extends TestLogger {
}
}
- public static class SessionWindowFunction implements WindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
+ private static class SessionWindowFunction implements WindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
private static final long serialVersionUID = 1L;
@Override
@@ -2556,7 +2550,7 @@ public class WindowOperatorTest extends TestLogger {
}
}
- public static class ReducedSessionWindowFunction implements WindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
+ private static class ReducedSessionWindowFunction implements WindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
private static final long serialVersionUID = 1L;
@Override
@@ -2570,7 +2564,7 @@ public class WindowOperatorTest extends TestLogger {
}
}
- public static class SessionProcessWindowFunction extends ProcessWindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
+ private static class SessionProcessWindowFunction extends ProcessWindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
private static final long serialVersionUID = 1L;
@Override
@@ -2588,7 +2582,7 @@ public class WindowOperatorTest extends TestLogger {
}
}
- public static class ReducedProcessSessionWindowFunction extends ProcessWindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
+ private static class ReducedProcessSessionWindowFunction extends ProcessWindowFunction<Tuple2<String, Integer>, Tuple3<String, Long, Long>, String, TimeWindow> {
private static final long serialVersionUID = 1L;
@Override
@@ -2603,10 +2597,9 @@ public class WindowOperatorTest extends TestLogger {
}
}
- public static class PointSessionWindows extends EventTimeSessionWindows {
+ private static class PointSessionWindows extends EventTimeSessionWindows {
private static final long serialVersionUID = 1L;
-
private PointSessionWindows(long sessionTimeout) {
super(sessionTimeout);
}
@@ -2629,7 +2622,7 @@ public class WindowOperatorTest extends TestLogger {
* purge the state of the fired window. This is to test the state
* garbage collection mechanism.
*/
- public static class EventTimeTriggerAccumGC extends Trigger<Object, TimeWindow> {
+ private static class EventTimeTriggerAccumGC extends Trigger<Object, TimeWindow> {
private static final long serialVersionUID = 1L;
private long cleanupTime;
@@ -2672,8 +2665,7 @@ public class WindowOperatorTest extends TestLogger {
}
@Override
- public void onMerge(TimeWindow window,
- OnMergeContext ctx) {
+ public void onMerge(TimeWindow window, OnMergeContext ctx) {
ctx.registerEventTimeTimer(window.maxTimestamp());
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowTranslationTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowTranslationTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowTranslationTest.java
index 5071c37..ced27b6 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowTranslationTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowTranslationTest.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.api.common.ExecutionConfig;
@@ -124,7 +125,7 @@ public class WindowTranslationTest {
source
.keyBy(0)
.window(SlidingEventTimeWindows.of(Time.of(1, TimeUnit.SECONDS), Time.of(100, TimeUnit.MILLISECONDS)))
- .aggregate(new DummyRichAggregationFunction<Tuple2<String,Integer>>());
+ .aggregate(new DummyRichAggregationFunction<Tuple2<String, Integer>>());
fail("exception was not thrown");
}
@@ -998,14 +999,14 @@ public class WindowTranslationTest {
Iterable<Tuple3<String, String, Integer>> values,
Collector<Tuple3<String, String, Integer>> out) throws Exception {
for (Tuple3<String, String, Integer> in : values) {
- out.collect(new Tuple3<>(in.f0, in. f1, in.f2));
+ out.collect(new Tuple3<>(in.f0, in.f1, in.f2));
}
}
});
OneInputTransformation<Tuple2<String, Integer>, Tuple3<String, String, Integer>> transform =
(OneInputTransformation<Tuple2<String, Integer>, Tuple3<String, String, Integer>>) window.getTransformation();
- OneInputStreamOperator<Tuple2<String, Integer>, Tuple3<String,String, Integer>> operator = transform.getOperator();
+ OneInputStreamOperator<Tuple2<String, Integer>, Tuple3<String, String, Integer>> operator = transform.getOperator();
Assert.assertTrue(operator instanceof WindowOperator);
WindowOperator<String, Tuple2<String, Integer>, ?, ?, ?> winOperator = (WindowOperator<String, Tuple2<String, Integer>, ?, ?, ?>) operator;
Assert.assertTrue(winOperator.getTrigger() instanceof EventTimeTrigger);
@@ -1036,14 +1037,14 @@ public class WindowTranslationTest {
Iterable<Tuple3<String, String, Integer>> values,
Collector<Tuple3<String, String, Integer>> out) throws Exception {
for (Tuple3<String, String, Integer> in : values) {
- out.collect(new Tuple3<>(in.f0, in. f1, in.f2));
+ out.collect(new Tuple3<>(in.f0, in.f1, in.f2));
}
}
});
OneInputTransformation<Tuple2<String, Integer>, Tuple3<String, String, Integer>> transform =
(OneInputTransformation<Tuple2<String, Integer>, Tuple3<String, String, Integer>>) window.getTransformation();
- OneInputStreamOperator<Tuple2<String, Integer>, Tuple3<String,String, Integer>> operator = transform.getOperator();
+ OneInputStreamOperator<Tuple2<String, Integer>, Tuple3<String, String, Integer>> operator = transform.getOperator();
Assert.assertTrue(operator instanceof WindowOperator);
WindowOperator<String, Tuple2<String, Integer>, ?, ?, ?> winOperator = (WindowOperator<String, Tuple2<String, Integer>, ?, ?, ?>) operator;
Assert.assertTrue(winOperator.getTrigger() instanceof EventTimeTrigger);
@@ -1473,7 +1474,6 @@ public class WindowTranslationTest {
winOperator, winOperator.getKeySelector(), BasicTypeInfo.STRING_TYPE_INFO, new Tuple2<>("hello", 1));
}
-
@Test
@SuppressWarnings({"rawtypes", "unchecked"})
public void testFoldWithEvictor() throws Exception {
@@ -1665,7 +1665,7 @@ public class WindowTranslationTest {
// UDFs
// ------------------------------------------------------------------------
- public static class DummyReducer implements ReduceFunction<Tuple2<String, Integer>> {
+ private static class DummyReducer implements ReduceFunction<Tuple2<String, Integer>> {
@Override
public Tuple2<String, Integer> reduce(Tuple2<String, Integer> value1, Tuple2<String, Integer> value2) throws Exception {
@@ -1758,7 +1758,6 @@ public class WindowTranslationTest {
}
}
-
private static class TupleKeySelector implements KeySelector<Tuple2<String, Integer>, String> {
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowedValue.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowedValue.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowedValue.java
index 449d54b..8be5456 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowedValue.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowedValue.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.operators.windowing;
import org.apache.flink.streaming.api.windowing.windows.Window;
@@ -24,24 +25,24 @@ import org.apache.flink.streaming.api.windowing.windows.Window;
* a {@link org.apache.flink.streaming.api.functions.windowing.WindowFunction}.
*/
public class WindowedValue<T, W extends Window> {
- private final T value;
- private final W window;
+ private final T value;
+ private final W window;
- public WindowedValue(T value, W window) {
- this.value = value;
- this.window = window;
- }
+ public WindowedValue(T value, W window) {
+ this.value = value;
+ this.window = window;
+ }
- public T value() {
- return value;
- }
+ public T value() {
+ return value;
+ }
- public W window() {
- return window;
- }
+ public W window() {
+ return window;
+ }
- @Override
- public String toString() {
- return "WindowedValue(" + value + ", " + window + ")";
- }
+ @Override
+ public String toString() {
+ return "WindowedValue(" + value + ", " + window + ")";
+ }
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/BroadcastPartitionerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/BroadcastPartitionerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/BroadcastPartitionerTest.java
index ddfb9e7..3077005 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/BroadcastPartitionerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/BroadcastPartitionerTest.java
@@ -17,14 +17,18 @@
package org.apache.flink.streaming.runtime.partitioner;
-import static org.junit.Assert.assertArrayEquals;
-
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.runtime.plugable.SerializationDelegate;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertArrayEquals;
+
+/**
+ * Tests for {@link BroadcastPartitioner}.
+ */
public class BroadcastPartitionerTest {
private BroadcastPartitioner<Tuple> broadcastPartitioner1;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ForwardPartitionerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ForwardPartitionerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ForwardPartitionerTest.java
index f7bd739..2ecf17b 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ForwardPartitionerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ForwardPartitionerTest.java
@@ -17,14 +17,18 @@
package org.apache.flink.streaming.runtime.partitioner;
-import static org.junit.Assert.*;
-
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.runtime.plugable.SerializationDelegate;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link ForwardPartitioner}.
+ */
public class ForwardPartitionerTest {
private ForwardPartitioner<Tuple> forwardPartitioner;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/GlobalPartitionerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/GlobalPartitionerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/GlobalPartitionerTest.java
index 6ae3730..5d023c8 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/GlobalPartitionerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/GlobalPartitionerTest.java
@@ -17,14 +17,18 @@
package org.apache.flink.streaming.runtime.partitioner;
-import static org.junit.Assert.assertArrayEquals;
-
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.runtime.plugable.SerializationDelegate;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertArrayEquals;
+
+/**
+ * Tests for {@link GlobalPartitioner}.
+ */
public class GlobalPartitionerTest {
private GlobalPartitioner<Tuple> globalPartitioner;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/KeyGroupStreamPartitionerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/KeyGroupStreamPartitionerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/KeyGroupStreamPartitionerTest.java
index 4ca7449..a57e6f4 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/KeyGroupStreamPartitionerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/KeyGroupStreamPartitionerTest.java
@@ -17,17 +17,21 @@
package org.apache.flink.streaming.runtime.partitioner;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.runtime.plugable.SerializationDelegate;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.TestLogger;
+
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link KeyGroupStreamPartitioner}.
+ */
public class KeyGroupStreamPartitionerTest extends TestLogger {
private KeyGroupStreamPartitioner<Tuple2<String, Integer>, String> keyGroupPartitioner;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/RebalancePartitionerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/RebalancePartitionerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/RebalancePartitionerTest.java
index 06a1acd..85410f3 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/RebalancePartitionerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/RebalancePartitionerTest.java
@@ -17,14 +17,18 @@
package org.apache.flink.streaming.runtime.partitioner;
-import static org.junit.Assert.*;
-
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.runtime.plugable.SerializationDelegate;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link RebalancePartitioner}.
+ */
public class RebalancePartitionerTest {
private RebalancePartitioner<Tuple> distributePartitioner;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/RescalePartitionerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/RescalePartitionerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/RescalePartitionerTest.java
index 4019d63..309f24d 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/RescalePartitionerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/RescalePartitionerTest.java
@@ -56,8 +56,13 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+/**
+ * Tests for {@link RescalePartitioner}.
+ */
@SuppressWarnings("serial")
public class RescalePartitionerTest extends TestLogger {
@@ -161,10 +166,9 @@ public class RescalePartitionerTest extends TestLogger {
fail("Building ExecutionGraph failed: " + e.getMessage());
}
-
ExecutionJobVertex execSourceVertex = eg.getJobVertex(sourceVertex.getID());
- ExecutionJobVertex execMapVertex= eg.getJobVertex(mapVertex.getID());
- ExecutionJobVertex execSinkVertex= eg.getJobVertex(sinkVertex.getID());
+ ExecutionJobVertex execMapVertex = eg.getJobVertex(mapVertex.getID());
+ ExecutionJobVertex execSinkVertex = eg.getJobVertex(sinkVertex.getID());
assertEquals(0, execSourceVertex.getInputs().size());
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitionerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitionerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitionerTest.java
index aff177c..238ec4b 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitionerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitionerTest.java
@@ -17,15 +17,19 @@
package org.apache.flink.streaming.runtime.partitioner;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import org.apache.flink.api.java.tuple.Tuple;
import org.apache.flink.runtime.plugable.SerializationDelegate;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for {@link ShufflePartitioner}.
+ */
public class ShufflePartitionerTest {
private ShufflePartitioner<Tuple> shufflePartitioner;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializerTest.java
index 2012c94..79b2b75 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializerTest.java
@@ -32,10 +32,12 @@ import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
-
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+/**
+ * Tests for {@link StreamElementSerializer}.
+ */
public class StreamElementSerializerTest {
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamRecordTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamRecordTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamRecordTest.java
index 08d9644..a869e70 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamRecordTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamRecordTest.java
@@ -20,8 +20,15 @@ package org.apache.flink.streaming.runtime.streamrecord;
import org.junit.Test;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests for {@link StreamRecord}.
+ */
public class StreamRecordTest {
@Test
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValveTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValveTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValveTest.java
index 564901f..4c945fe 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValveTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValveTest.java
@@ -19,6 +19,7 @@
package org.apache.flink.streaming.runtime.streamstatus;
import org.apache.flink.streaming.api.watermark.Watermark;
+
import org.junit.Test;
import java.util.concurrent.BlockingQueue;
@@ -34,8 +35,7 @@ import static org.junit.Assert.assertTrue;
* the watermarks and stream statuses to forward are generated from the valve at the exact correct times and in a
* deterministic behaviour. The unit tests here also test more complex stream status / watermark input cases.
*
- * <p>
- * The tests are performed by a series of watermark and stream status inputs to the valve. On every input method call,
+ * <p>The tests are performed by a series of watermark and stream status inputs to the valve. On every input method call,
* the output is checked to contain only the expected watermark or stream status, and nothing else. This ensures that
* no redundant outputs are generated by the output logic of {@link StatusWatermarkValve}. The behaviours that a series of
* input calls to the valve is trying to test is explained as inline comments within the tests.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusTest.java
index 247dc8b..152fc6f 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamstatus/StreamStatusTest.java
@@ -21,10 +21,13 @@ package org.apache.flink.streaming.runtime.streamstatus;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+/**
+ * Tests for {@link StreamStatus}.
+ */
public class StreamStatusTest {
@Test (expected = IllegalArgumentException.class)
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/BlockingCheckpointsTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/BlockingCheckpointsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/BlockingCheckpointsTest.java
index bf5be79..51328ab 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/BlockingCheckpointsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/BlockingCheckpointsTest.java
@@ -67,6 +67,7 @@ import org.apache.flink.runtime.util.TestingTaskManagerRuntimeInfo;
import org.apache.flink.streaming.api.graph.StreamConfig;
import org.apache.flink.streaming.api.operators.StreamFilter;
import org.apache.flink.util.SerializedValue;
+
import org.junit.Test;
import java.io.IOException;
@@ -80,8 +81,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
- * This test checks that task checkpoints that block and do not react to thread interrupts
- * are
+ * This test checks that task checkpoints that block and do not react to thread interrupts.
*/
public class BlockingCheckpointsTest {
@@ -281,10 +281,9 @@ public class BlockingCheckpointsTest {
}
}
- // ------------------------------------------------------------------------
- // stream task that simply triggers a checkpoint
- // ------------------------------------------------------------------------
-
+ /**
+ * Stream task that simply triggers a checkpoint.
+ */
public static final class TestStreamTask extends OneInputStreamTask<Object, Object> {
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/InterruptSensitiveRestoreTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/InterruptSensitiveRestoreTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/InterruptSensitiveRestoreTest.java
index 4435247..542e88a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/InterruptSensitiveRestoreTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/InterruptSensitiveRestoreTest.java
@@ -68,6 +68,7 @@ import org.apache.flink.streaming.api.functions.source.SourceFunction;
import org.apache.flink.streaming.api.graph.StreamConfig;
import org.apache.flink.streaming.api.operators.StreamSource;
import org.apache.flink.util.SerializedValue;
+
import org.junit.Test;
import java.io.EOFException;
@@ -92,7 +93,7 @@ import static org.mockito.Mockito.when;
* This test checks that task restores that get stuck in the presence of interrupts
* are handled properly.
*
- * In practice, reading from HDFS is interrupt sensitive: The HDFS code frequently deadlocks
+ * <p>In practice, reading from HDFS is interrupt sensitive: The HDFS code frequently deadlocks
* or livelocks if it is interrupted.
*/
public class InterruptSensitiveRestoreTest {
@@ -185,7 +186,6 @@ public class InterruptSensitiveRestoreTest {
when(networkEnvironment.createKvStateTaskRegistry(any(JobID.class), any(JobVertexID.class)))
.thenReturn(mock(TaskKvStateRegistry.class));
-
ChainedStateHandle<StreamStateHandle> operatorState = null;
List<KeyedStateHandle> keyedStateFromBackend = Collections.emptyList();
List<KeyedStateHandle> keyedStateFromStream = Collections.emptyList();
@@ -197,7 +197,7 @@ public class InterruptSensitiveRestoreTest {
new OperatorStateHandle.StateMetaInfo(new long[]{0}, OperatorStateHandle.Mode.SPLIT_DISTRIBUTE);
operatorStateMetadata.put(DefaultOperatorStateBackend.DEFAULT_OPERATOR_STATE_NAME, metaInfo);
- KeyGroupRangeOffsets keyGroupRangeOffsets = new KeyGroupRangeOffsets(new KeyGroupRange(0,0));
+ KeyGroupRangeOffsets keyGroupRangeOffsets = new KeyGroupRangeOffsets(new KeyGroupRange(0, 0));
Collection<OperatorStateHandle> operatorStateHandles =
Collections.singletonList(new OperatorStateHandle(operatorStateMetadata, state));
@@ -381,7 +381,6 @@ public class InterruptSensitiveRestoreTest {
@Override
public void cancel() {}
-
@Override
public void snapshotState(FunctionSnapshotContext context) throws Exception {
fail("should never be called");
@@ -389,7 +388,7 @@ public class InterruptSensitiveRestoreTest {
@Override
public void initializeState(FunctionInitializationContext context) throws Exception {
- ((StateInitializationContext)context).getRawOperatorStateInputs().iterator().next().getStream().read();
+ ((StateInitializationContext) context).getRawOperatorStateInputs().iterator().next().getStream().read();
}
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTest.java
index 90f5619..d343eaf 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTest.java
@@ -47,8 +47,8 @@ import org.apache.flink.streaming.api.graph.StreamEdge;
import org.apache.flink.streaming.api.graph.StreamNode;
import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
-import org.apache.flink.streaming.api.operators.StreamMap;
import org.apache.flink.streaming.api.operators.StreamCheckpointedOperator;
+import org.apache.flink.streaming.api.operators.StreamMap;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.partitioner.BroadcastPartitioner;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
@@ -60,12 +60,19 @@ import org.apache.flink.util.TestLogger;
import org.junit.Assert;
import org.junit.Test;
-
import scala.concurrent.duration.Deadline;
import scala.concurrent.duration.FiniteDuration;
import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.TimeUnit;
@@ -77,8 +84,7 @@ import static org.junit.Assert.fail;
/**
* Tests for {@link OneInputStreamTask}.
*
- * <p>
- * Note:<br>
+ * <p>Note:<br>
* We only use a {@link StreamMap} operator here. We also test the individual operators but Map is
* used as a representative to test OneInputStreamTask, since OneInputStreamTask is used for all
* OneInputStreamOperators.
@@ -238,7 +244,7 @@ public class OneInputStreamTaskTest extends TestLogger {
* It also verifies that when task is idle, watermarks generated in the middle of chains are also blocked and
* never forwarded.
*
- * The tested chain will be: (HEAD: normal operator) --> (watermark generating operator) --> (normal operator).
+ * <p>The tested chain will be: (HEAD: normal operator) --> (watermark generating operator) --> (normal operator).
* The operators will throw an exception and fail the test if either of them were forwarded watermarks when
* the task is idle.
*/
@@ -506,7 +512,6 @@ public class OneInputStreamTaskTest extends TestLogger {
TestHarnessUtil.assertOutputEquals("Output was not correct.", expectedOutput, testHarness.getOutput());
-
// Then give the earlier barrier, these should be ignored
testHarness.processEvent(new CheckpointBarrier(0, 0, CheckpointOptions.forFullCheckpoint()), 0, 1);
testHarness.processEvent(new CheckpointBarrier(0, 0, CheckpointOptions.forFullCheckpoint()), 1, 0);
@@ -523,7 +528,7 @@ public class OneInputStreamTaskTest extends TestLogger {
/**
* Tests that the stream operator can snapshot and restore the operator state of chained
- * operators
+ * operators.
*/
@Test
public void testSnapshottingAndRestoring() throws Exception {
@@ -561,7 +566,7 @@ public class OneInputStreamTaskTest extends TestLogger {
CheckpointMetaData checkpointMetaData = new CheckpointMetaData(checkpointId, checkpointTimestamp);
- while(!streamTask.triggerCheckpoint(checkpointMetaData, CheckpointOptions.forFullCheckpoint()));
+ while (!streamTask.triggerCheckpoint(checkpointMetaData, CheckpointOptions.forFullCheckpoint())) {}
// since no state was set, there shouldn't be restore calls
assertEquals(0, TestingStreamOperator.numberRestoreCalls);
@@ -682,7 +687,6 @@ public class OneInputStreamTaskTest extends TestLogger {
super(jobConfig, taskConfig, executionConfig, memorySize, inputSplitProvider, bufferSize);
}
-
@Override
public void acknowledgeCheckpoint(
long checkpointId,
@@ -793,8 +797,8 @@ public class OneInputStreamTaskTest extends TestLogger {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Serializable functionState= InstantiationUtil.deserializeObject(in, cl);
- Integer operatorState= InstantiationUtil.deserializeObject(in, cl);
+ Serializable functionState = InstantiationUtil.deserializeObject(in, cl);
+ Integer operatorState = InstantiationUtil.deserializeObject(in, cl);
assertEquals(random.nextInt(), functionState);
assertEquals(random.nextInt(), (int) operatorState);
@@ -885,7 +889,7 @@ public class OneInputStreamTaskTest extends TestLogger {
* An operator that can be triggered whether or not to expect watermarks forwarded to it, toggled
* by letting it process special trigger marker records.
*
- * If it receives a watermark when it's not expecting one, it'll throw an exception and fail.
+ * <p>If it receives a watermark when it's not expecting one, it'll throw an exception and fail.
*/
private static class TriggerableFailOnWatermarkTestOperator
extends AbstractStreamOperator<String>
@@ -893,8 +897,8 @@ public class OneInputStreamTaskTest extends TestLogger {
private static final long serialVersionUID = 2048954179291813243L;
- public final static String EXPECT_FORWARDED_WATERMARKS_MARKER = "EXPECT_WATERMARKS";
- public final static String NO_FORWARDED_WATERMARKS_MARKER = "NO_WATERMARKS";
+ public static final String EXPECT_FORWARDED_WATERMARKS_MARKER = "EXPECT_WATERMARKS";
+ public static final String NO_FORWARDED_WATERMARKS_MARKER = "NO_WATERMARKS";
protected boolean expectForwardedWatermarks;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTestHarness.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTestHarness.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTestHarness.java
index 19e27f2..4d11c97 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTestHarness.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/OneInputStreamTaskTestHarness.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.runtime.tasks;
import org.apache.flink.api.common.typeinfo.TypeInformation;
@@ -30,21 +31,18 @@ import java.io.IOException;
/**
* Test harness for testing a {@link org.apache.flink.streaming.runtime.tasks.OneInputStreamTask}.
*
- * <p>
- * This mock Invokable provides the task with a basic runtime context and allows pushing elements
+ * <p>This mock Invokable provides the task with a basic runtime context and allows pushing elements
* and watermarks into the task. {@link #getOutput()} can be used to get the emitted elements
* and events. You are free to modify the retrieved list.
*
- * <p>
- * After setting up everything the Task can be invoked using {@link #invoke()}. This will start
+ * <p>After setting up everything the Task can be invoked using {@link #invoke()}. This will start
* a new Thread to execute the Task. Use {@link #waitForTaskCompletion()} to wait for the Task
* thread to finish. Use {@link #processElement} to send elements to the task. Use
* {@link #processEvent(AbstractEvent)} to send events to the task.
* Before waiting for the task to finish you must call {@link #endInput()} to signal to the task
* that data entry is finished.
*
- * <p>
- * When Elements or Events are offered to the Task they are put into a queue. The input gates
+ * <p>When Elements or Events are offered to the Task they are put into a queue. The input gates
* of the Task notifyNonEmpty from this queue. Use {@link #waitForInputProcessing()} to wait until all
* queues are empty. This must be used after entering some elements before checking the
* desired output.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceExternalCheckpointTriggerTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceExternalCheckpointTriggerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceExternalCheckpointTriggerTest.java
index e5caff3..47a5350 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceExternalCheckpointTriggerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceExternalCheckpointTriggerTest.java
@@ -45,8 +45,8 @@ import static org.junit.Assert.assertTrue;
@SuppressWarnings("serial")
public class SourceExternalCheckpointTriggerTest {
- static final OneShotLatch ready = new OneShotLatch();
- static final MultiShotLatch sync = new MultiShotLatch();
+ private static final OneShotLatch ready = new OneShotLatch();
+ private static final MultiShotLatch sync = new MultiShotLatch();
@Test
public void testCheckpointsTriggeredBySource() throws Exception {
@@ -129,7 +129,7 @@ public class SourceExternalCheckpointTriggerTest {
private final long numEvents;
private final long checkpointFrequency;
-
+
private CheckpointTrigger trigger;
ExternalCheckpointsSource(long numEvents, long checkpointFrequency) {
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTaskTest.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTaskTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTaskTest.java
index 9e26f9e..27818bc 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTaskTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTaskTest.java
@@ -78,22 +78,22 @@ public class SourceStreamTaskTest {
* and element emission. This also verifies that there are no concurrent invocations
* of the checkpoint method on the source operator.
*
- * The source emits elements and performs checkpoints. We have several checkpointer threads
+ * <p>The source emits elements and performs checkpoints. We have several checkpointer threads
* that fire checkpoint requests at the source task.
*
- * If element emission and checkpointing are not in series the count of elements at the
+ * <p>If element emission and checkpointing are not in series the count of elements at the
* beginning of a checkpoint and at the end of a checkpoint are not the same because the
* source kept emitting elements while the checkpoint was ongoing.
*/
@Test
@SuppressWarnings("unchecked")
public void testCheckpointing() throws Exception {
- final int NUM_ELEMENTS = 100;
- final int NUM_CHECKPOINTS = 100;
- final int NUM_CHECKPOINTERS = 1;
- final int CHECKPOINT_INTERVAL = 5; // in ms
- final int SOURCE_CHECKPOINT_DELAY = 1000; // how many random values we sum up in storeCheckpoint
- final int SOURCE_READ_DELAY = 1; // in ms
+ final int numElements = 100;
+ final int numCheckpoints = 100;
+ final int numCheckpointers = 1;
+ final int checkpointInterval = 5; // in ms
+ final int sourceCheckpointDelay = 1000; // how many random values we sum up in storeCheckpoint
+ final int sourceReadDelay = 1; // in ms
ExecutorService executor = Executors.newFixedThreadPool(10);
try {
@@ -104,25 +104,25 @@ public class SourceStreamTaskTest {
testHarness.setupOutputForSingletonOperatorChain();
StreamConfig streamConfig = testHarness.getStreamConfig();
- StreamSource<Tuple2<Long, Integer>, ?> sourceOperator = new StreamSource<>(new MockSource(NUM_ELEMENTS, SOURCE_CHECKPOINT_DELAY, SOURCE_READ_DELAY));
+ StreamSource<Tuple2<Long, Integer>, ?> sourceOperator = new StreamSource<>(new MockSource(numElements, sourceCheckpointDelay, sourceReadDelay));
streamConfig.setStreamOperator(sourceOperator);
// prepare the
- Future<Boolean>[] checkpointerResults = new Future[NUM_CHECKPOINTERS];
+ Future<Boolean>[] checkpointerResults = new Future[numCheckpointers];
// invoke this first, so the tasks are actually running when the checkpoints are scheduled
testHarness.invoke();
- for (int i = 0; i < NUM_CHECKPOINTERS; i++) {
- checkpointerResults[i] = executor.submit(new Checkpointer(NUM_CHECKPOINTS, CHECKPOINT_INTERVAL, sourceTask));
+ for (int i = 0; i < numCheckpointers; i++) {
+ checkpointerResults[i] = executor.submit(new Checkpointer(numCheckpoints, checkpointInterval, sourceTask));
}
testHarness.waitForTaskCompletion();
// Get the result from the checkpointers, if these threw an exception it
// will be rethrown here
- for (int i = 0; i < NUM_CHECKPOINTERS; i++) {
+ for (int i = 0; i < numCheckpointers; i++) {
if (!checkpointerResults[i].isDone()) {
checkpointerResults[i].cancel(true);
}
@@ -132,7 +132,7 @@ public class SourceStreamTaskTest {
}
List<Tuple2<Long, Integer>> resultElements = TestHarnessUtil.getRawElementsFromOutput(testHarness.getOutput());
- Assert.assertEquals(NUM_ELEMENTS, resultElements.size());
+ Assert.assertEquals(numElements, resultElements.size());
}
finally {
executor.shutdown();
@@ -241,7 +241,7 @@ public class SourceStreamTaskTest {
}
}
- public static class OpenCloseTestSource extends RichSourceFunction<String> {
+ private static class OpenCloseTestSource extends RichSourceFunction<String> {
private static final long serialVersionUID = 1L;
public static boolean openCalled = false;
[09/10] flink git commit: [FLINK-6603] [streaming] Enable checkstyle
on test sources
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileMonitoringFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileMonitoringFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileMonitoringFunction.java
index 332d362..3c4cfbd 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileMonitoringFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileMonitoringFunction.java
@@ -14,16 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.source;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.api.common.io.FileInputFormat;
@@ -41,9 +34,19 @@ import org.apache.flink.runtime.state.FunctionSnapshotContext;
import org.apache.flink.streaming.api.checkpoint.CheckpointedFunction;
import org.apache.flink.streaming.api.checkpoint.CheckpointedRestoring;
import org.apache.flink.util.Preconditions;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
/**
* This is the single (non-parallel) monitoring task which takes a {@link FileInputFormat}
* and, depending on the {@link FileProcessingMode} and the {@link FilePathFilter}, it is responsible for:
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperator.java
index 54b6a03..3a9e8e1 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperator.java
@@ -14,19 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.api.functions.source;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-import static org.apache.flink.util.Preconditions.checkState;
+package org.apache.flink.streaming.api.functions.source;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.PriorityQueue;
-import java.util.Queue;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.io.CheckpointableInputFormat;
@@ -50,9 +40,22 @@ import org.apache.flink.streaming.api.operators.StreamSourceContexts;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.Preconditions;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.PriorityQueue;
+import java.util.Queue;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
+import static org.apache.flink.util.Preconditions.checkState;
+
/**
* The operator that reads the {@link TimestampedFileInputSplit splits} received from the preceding
* {@link ContinuousFileMonitoringFunction}. Contrary to the {@link ContinuousFileMonitoringFunction}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunction.java
index 2f91227..479cdf0 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunction.java
@@ -17,20 +17,22 @@
package org.apache.flink.streaming.api.functions.source;
-import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.core.fs.FileStatus;
import org.apache.flink.core.fs.FileSystem;
import org.apache.flink.core.fs.Path;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* A {@link SourceFunction} that monitors a directory and sends events downstream when it detects
* new files. Used together with {@link FileReadFunction}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileProcessingMode.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileProcessingMode.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileProcessingMode.java
index f8c4fba..8659a4f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileProcessingMode.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileProcessingMode.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.source;
import org.apache.flink.annotation.PublicEvolving;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileReadFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileReadFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileReadFunction.java
index 172f7a3..600b32c 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileReadFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FileReadFunction.java
@@ -17,10 +17,6 @@
package org.apache.flink.streaming.api.functions.source;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URI;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.java.tuple.Tuple3;
@@ -29,6 +25,10 @@ import org.apache.flink.core.fs.FileSystem;
import org.apache.flink.core.fs.Path;
import org.apache.flink.util.Collector;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URI;
+
/**
* This is used together with {@link FileMonitoringFunction} to read from files that the
* monitoring functions discovers.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromElementsFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromElementsFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromElementsFunction.java
index 745a26b..691d3d6 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromElementsFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromElementsFunction.java
@@ -17,13 +17,6 @@
package org.apache.flink.streaming.api.functions.source;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.state.ListState;
import org.apache.flink.api.common.state.ListStateDescriptor;
@@ -37,6 +30,14 @@ import org.apache.flink.runtime.state.FunctionSnapshotContext;
import org.apache.flink.streaming.api.checkpoint.CheckpointedFunction;
import org.apache.flink.util.Preconditions;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
/**
* A stream source function that returns a sequence of elements.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromIteratorFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromIteratorFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromIteratorFunction.java
index b844a0a..a8b527f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromIteratorFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromIteratorFunction.java
@@ -17,9 +17,10 @@
package org.apache.flink.streaming.api.functions.source;
-import java.util.Iterator;
import org.apache.flink.annotation.PublicEvolving;
+import java.util.Iterator;
+
/**
* A {@link SourceFunction} that reads elements from an {@link Iterator} and emits them.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromSplittableIteratorFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromSplittableIteratorFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromSplittableIteratorFunction.java
index 68e18bb..db6c8a2 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromSplittableIteratorFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromSplittableIteratorFunction.java
@@ -17,11 +17,12 @@
package org.apache.flink.streaming.api.functions.source;
-import java.util.Iterator;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.util.SplittableIterator;
+import java.util.Iterator;
+
/**
* A {@link SourceFunction} that reads elements from an {@link SplittableIterator} and emits them.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunction.java
index e6e6ea3..3fdedf1 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunction.java
@@ -17,8 +17,6 @@
package org.apache.flink.streaming.api.functions.source;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.io.InputFormat;
import org.apache.flink.api.common.io.RichInputFormat;
@@ -31,6 +29,9 @@ import org.apache.flink.runtime.jobgraph.tasks.InputSplitProvider;
import org.apache.flink.runtime.jobgraph.tasks.InputSplitProviderException;
import org.apache.flink.streaming.api.operators.StreamingRuntimeContext;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
/**
* A {@link SourceFunction} that reads data using an {@link InputFormat}.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MessageAcknowledgingSourceBase.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MessageAcknowledgingSourceBase.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MessageAcknowledgingSourceBase.java
index 3da1ec3..ab21586 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MessageAcknowledgingSourceBase.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MessageAcknowledgingSourceBase.java
@@ -18,13 +18,6 @@
package org.apache.flink.streaming.api.functions.source;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.state.ListState;
@@ -38,9 +31,17 @@ import org.apache.flink.runtime.state.FunctionSnapshotContext;
import org.apache.flink.runtime.state.SerializedCheckpointData;
import org.apache.flink.streaming.api.checkpoint.CheckpointedFunction;
import org.apache.flink.util.Preconditions;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
/**
* Abstract base class for data sources that receive elements from a message queue and
* acknowledge them back by IDs.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MultipleIdsMessageAcknowledgingSourceBase.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MultipleIdsMessageAcknowledgingSourceBase.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MultipleIdsMessageAcknowledgingSourceBase.java
index ceef4e0..e7cdb99 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MultipleIdsMessageAcknowledgingSourceBase.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MultipleIdsMessageAcknowledgingSourceBase.java
@@ -18,19 +18,21 @@
package org.apache.flink.streaming.api.functions.source;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.Deque;
-import java.util.Iterator;
-import java.util.List;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.runtime.state.FunctionSnapshotContext;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.Iterator;
+import java.util.List;
+
/**
* Abstract base class for data sources that receive elements from a message queue and
* acknowledge them back by IDs. In contrast to {@link MessageAcknowledgingSourceBase}, this source
@@ -132,7 +134,6 @@ public abstract class MultipleIdsMessageAcknowledgingSourceBase<Type, UId, Sessi
// Checkpointing the data
// ------------------------------------------------------------------------
-
@Override
public void snapshotState(FunctionSnapshotContext context) throws Exception {
sessionIdsPerSnapshot.add(new Tuple2<>(context.getCheckpointId(), sessionIds));
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunction.java
index e7d1673..1552ee2 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunction.java
@@ -17,17 +17,19 @@
package org.apache.flink.streaming.api.functions.source;
-import static org.apache.flink.util.Preconditions.checkArgument;
-import static org.apache.flink.util.Preconditions.checkNotNull;
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.util.IOUtils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.Socket;
-import org.apache.flink.annotation.PublicEvolving;
-import org.apache.flink.util.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
/**
* A source function that reads strings from a socket. The source will read bytes from the socket
@@ -64,7 +66,6 @@ public class SocketTextStreamFunction implements SourceFunction<String> {
private volatile boolean isRunning = true;
-
public SocketTextStreamFunction(String hostname, int port, String delimiter, long maxNumRetries) {
this(hostname, port, delimiter, maxNumRetries, DEFAULT_CONNECTION_RETRY_SLEEP);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SourceFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SourceFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SourceFunction.java
index 0db8984..4665cc6 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SourceFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SourceFunction.java
@@ -18,7 +18,6 @@
package org.apache.flink.streaming.api.functions.source;
-import java.io.Serializable;
import org.apache.flink.annotation.Public;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.functions.Function;
@@ -26,6 +25,8 @@ import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.functions.TimestampAssigner;
import org.apache.flink.streaming.api.watermark.Watermark;
+import java.io.Serializable;
+
/**
* Base interface for all stream data sources in Flink. The contract of a stream source
* is the following: When the source should start emitting elements, the {@link #run} method
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/StatefulSequenceSource.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/StatefulSequenceSource.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/StatefulSequenceSource.java
index 598ccb3..6213ce0 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/StatefulSequenceSource.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/StatefulSequenceSource.java
@@ -15,10 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.source;
-import java.util.ArrayDeque;
-import java.util.Deque;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.state.ListState;
import org.apache.flink.api.common.state.ListStateDescriptor;
@@ -28,6 +27,9 @@ import org.apache.flink.runtime.state.FunctionSnapshotContext;
import org.apache.flink.streaming.api.checkpoint.CheckpointedFunction;
import org.apache.flink.util.Preconditions;
+import java.util.ArrayDeque;
+import java.util.Deque;
+
/**
* A stateful streaming source that emits each number from a given interval exactly once,
* possibly in parallel.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/TimestampedFileInputSplit.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/TimestampedFileInputSplit.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/TimestampedFileInputSplit.java
index ddc3559..4111d91 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/TimestampedFileInputSplit.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/TimestampedFileInputSplit.java
@@ -17,11 +17,12 @@
package org.apache.flink.streaming.api.functions.source;
-import java.io.Serializable;
import org.apache.flink.core.fs.FileInputSplit;
import org.apache.flink.core.fs.Path;
import org.apache.flink.util.Preconditions;
+import java.io.Serializable;
+
/**
* An extended {@link FileInputSplit} that also includes information about:
* <ul>
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/timestamps/AscendingTimestampExtractor.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/timestamps/AscendingTimestampExtractor.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/timestamps/AscendingTimestampExtractor.java
index 500348a..8a675d0 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/timestamps/AscendingTimestampExtractor.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/timestamps/AscendingTimestampExtractor.java
@@ -18,14 +18,15 @@
package org.apache.flink.streaming.api.functions.timestamps;
-import static java.util.Objects.requireNonNull;
-
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.streaming.api.functions.AssignerWithPeriodicWatermarks;
import org.apache.flink.streaming.api.watermark.Watermark;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static java.util.Objects.requireNonNull;
+
/**
* A timestamp assigner and watermark generator for streams where timestamps are monotonously
* ascending. In this case, the local watermarks for the streams are easy to generate, because
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/timestamps/BoundedOutOfOrdernessTimestampExtractor.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/timestamps/BoundedOutOfOrdernessTimestampExtractor.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/timestamps/BoundedOutOfOrdernessTimestampExtractor.java
index 982c283..9936b8e 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/timestamps/BoundedOutOfOrdernessTimestampExtractor.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/timestamps/BoundedOutOfOrdernessTimestampExtractor.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.timestamps;
import org.apache.flink.streaming.api.functions.AssignerWithPeriodicWatermarks;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AggregateApplyAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AggregateApplyAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AggregateApplyAllWindowFunction.java
index 3d6c1e1..e20b878 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AggregateApplyAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AggregateApplyAllWindowFunction.java
@@ -18,13 +18,14 @@
package org.apache.flink.streaming.api.functions.windowing;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.functions.AggregateFunction;
import org.apache.flink.api.java.operators.translation.WrappingFunction;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* A {@link AllWindowFunction} that composes an {@link AggregateFunction} and {@link AllWindowFunction}.
* Upon invocation, this first applies {@code AggregateFunction} to the input, and then
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AggregateApplyWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AggregateApplyWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AggregateApplyWindowFunction.java
index ce5363f..6d2d7f4 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AggregateApplyWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AggregateApplyWindowFunction.java
@@ -15,15 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.functions.AggregateFunction;
import org.apache.flink.api.java.operators.translation.WrappingFunction;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* A {@link WindowFunction} that composes an {@link AggregateFunction} and {@link WindowFunction}.
* Upon invocation, this first applies {@code AggregateFunction} to the input, and then
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AllWindowFunction.java
index 04817b4..c497b4a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AllWindowFunction.java
@@ -18,12 +18,13 @@
package org.apache.flink.streaming.api.functions.windowing;
-import java.io.Serializable;
import org.apache.flink.annotation.Public;
import org.apache.flink.api.common.functions.Function;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.io.Serializable;
+
/**
* Base interface for functions that are evaluated over non-keyed windows.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyAllWindowFunction.java
index 2069f7a..5b2abeb 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyAllWindowFunction.java
@@ -15,12 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.FoldFunction;
@@ -34,6 +31,11 @@ import org.apache.flink.streaming.api.operators.OutputTypeConfigurable;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Collections;
+
/**
* Internal {@link AllWindowFunction} that is used for implementing a fold on a window configuration
* that only allows {@link AllWindowFunction} and cannot directly execute a {@link FoldFunction}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java
index 1d39252..362956d 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java
@@ -15,12 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.FoldFunction;
@@ -35,6 +32,11 @@ import org.apache.flink.streaming.api.operators.OutputTypeConfigurable;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Collections;
+
/**
* Internal {@link ProcessAllWindowFunction} that is used for implementing a fold on a window
* configuration that only allows {@link ProcessAllWindowFunction} and cannot directly execute a
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java
index fa4fe86..183a676 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java
@@ -15,12 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.FoldFunction;
@@ -35,6 +32,11 @@ import org.apache.flink.streaming.api.operators.OutputTypeConfigurable;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Collections;
+
/**
* Internal {@link ProcessWindowFunction} that is used for implementing a fold on a window
* configuration that only allows {@link ProcessWindowFunction} and cannot directly execute a
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyWindowFunction.java
index 865dbc9..2ac4b62 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyWindowFunction.java
@@ -15,12 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.FoldFunction;
@@ -34,6 +31,11 @@ import org.apache.flink.streaming.api.operators.OutputTypeConfigurable;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Collections;
+
/**
* Internal {@link WindowFunction} that is used for implementing a fold on a window configuration
* that only allows {@link WindowFunction} and cannot directly execute a {@link FoldFunction}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/InternalProcessApplyAllWindowContext.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/InternalProcessApplyAllWindowContext.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/InternalProcessApplyAllWindowContext.java
index e1a0a98..a27d71b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/InternalProcessApplyAllWindowContext.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/InternalProcessApplyAllWindowContext.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/InternalProcessApplyWindowContext.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/InternalProcessApplyWindowContext.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/InternalProcessApplyWindowContext.java
index fc31b07..47a2e3a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/InternalProcessApplyWindowContext.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/InternalProcessApplyWindowContext.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/PassThroughAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/PassThroughAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/PassThroughAllWindowFunction.java
index fb1ff81..a1a338b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/PassThroughAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/PassThroughAllWindowFunction.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/PassThroughWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/PassThroughWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/PassThroughWindowFunction.java
index edc495c..ab64859 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/PassThroughWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/PassThroughWindowFunction.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyAllWindowFunction.java
index a8469f5..7c636ea 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyAllWindowFunction.java
@@ -15,15 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.java.operators.translation.WrappingFunction;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* Internal {@link AllWindowFunction} that is used for implementing a fold on a window configuration
* that only allows {@link AllWindowFunction} and cannot directly execute a {@link ReduceFunction}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessAllWindowFunction.java
index e7e6609..108ba9e 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessAllWindowFunction.java
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.common.functions.RuntimeContext;
@@ -26,6 +26,8 @@ import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* Internal {@link ProcessAllWindowFunction} that is used for implementing a fold on a window
* configuration that only allows {@link AllWindowFunction} and cannot directly execute a
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessWindowFunction.java
index 18037b7..1e3f5a2 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessWindowFunction.java
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.common.functions.RuntimeContext;
@@ -26,6 +26,8 @@ import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* Internal {@link ProcessWindowFunction} that is used for implementing a fold on a window
* configuration that only allows {@link AllWindowFunction} and cannot directly execute a
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyWindowFunction.java
index 5890ec7..ff9d03e 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyWindowFunction.java
@@ -15,15 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
-import java.util.Collections;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.java.operators.translation.WrappingFunction;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.util.Collections;
+
/**
* Internal {@link WindowFunction} that is used for implementing a fold on a window configuration
* that only allows {@link WindowFunction} and cannot directly execute a {@link ReduceFunction}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichAllWindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichAllWindowFunction.java
index b0df6d8..b28a6c2 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichAllWindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichAllWindowFunction.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.functions.windowing;
import org.apache.flink.annotation.Public;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/WindowFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/WindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/WindowFunction.java
index 96e665a..030e973 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/WindowFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/WindowFunction.java
@@ -18,12 +18,13 @@
package org.apache.flink.streaming.api.functions.windowing;
-import java.io.Serializable;
import org.apache.flink.annotation.Public;
import org.apache.flink.api.common.functions.Function;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;
+import java.io.Serializable;
+
/**
* Base interface for functions that are evaluated over keyed (grouped) windows.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/DeltaFunction.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/DeltaFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/DeltaFunction.java
index 7420a5a..ed1f830 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/DeltaFunction.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/DeltaFunction.java
@@ -17,9 +17,10 @@
package org.apache.flink.streaming.api.functions.windowing.delta;
-import java.io.Serializable;
import org.apache.flink.annotation.PublicEvolving;
+import java.io.Serializable;
+
/**
* This interface allows the implementation of a function which calculates the
* delta between two data points. Delta functions might be used in delta
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/Extractor.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/Extractor.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/Extractor.java
index 7914792..4263285 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/Extractor.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/Extractor.java
@@ -17,9 +17,10 @@
package org.apache.flink.streaming.api.functions.windowing.delta.extractor;
-import java.io.Serializable;
import org.apache.flink.annotation.Internal;
+import java.io.Serializable;
+
/**
* Extractors allow to extract/convert one type to another. They are mostly used
* to extract some fields out of a more complex structure (Tuple/Array) to run
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArray.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArray.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArray.java
index f8d1be3..9fc6354 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArray.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArray.java
@@ -17,9 +17,10 @@
package org.apache.flink.streaming.api.functions.windowing.delta.extractor;
-import java.lang.reflect.Array;
import org.apache.flink.annotation.Internal;
+import java.lang.reflect.Array;
+
/**
* Extracts a single field out of an array.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArray.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArray.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArray.java
index 0d4e0f9..1fa9eb8 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArray.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArray.java
@@ -17,9 +17,10 @@
package org.apache.flink.streaming.api.functions.windowing.delta.extractor;
-import java.lang.reflect.Array;
import org.apache.flink.annotation.Internal;
+import java.lang.reflect.Array;
+
/**
* Extracts multiple fields from an array and puts them into a new array of the
* specified type.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/FunctionMasterCheckpointHookFactory.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/FunctionMasterCheckpointHookFactory.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/FunctionMasterCheckpointHookFactory.java
index c256698..79d1dda 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/FunctionMasterCheckpointHookFactory.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/FunctionMasterCheckpointHookFactory.java
@@ -18,11 +18,11 @@
package org.apache.flink.streaming.api.graph;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
import org.apache.flink.runtime.checkpoint.MasterTriggerRestoreHook;
import org.apache.flink.streaming.api.checkpoint.WithMasterCheckpointHook;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* Utility class that turns a {@link WithMasterCheckpointHook} into a
* {@link org.apache.flink.runtime.checkpoint.MasterTriggerRestoreHook.Factory}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/JSONGenerator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/JSONGenerator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/JSONGenerator.java
index d4e4873..a9bb0b6 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/JSONGenerator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/JSONGenerator.java
@@ -17,6 +17,13 @@
package org.apache.flink.streaming.api.graph;
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.streaming.api.operators.StreamOperator;
+
+import org.apache.sling.commons.json.JSONArray;
+import org.apache.sling.commons.json.JSONException;
+import org.apache.sling.commons.json.JSONObject;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -24,12 +31,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.flink.annotation.Internal;
-import org.apache.flink.streaming.api.operators.StreamOperator;
-import org.apache.sling.commons.json.JSONArray;
-import org.apache.sling.commons.json.JSONException;
-import org.apache.sling.commons.json.JSONObject;
-
/**
* Helper class for generating a JSON representation from a {@link StreamGraph}.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamConfig.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamConfig.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamConfig.java
index d5ee13a..77caa34 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamConfig.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamConfig.java
@@ -17,13 +17,6 @@
package org.apache.flink.streaming.api.graph;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.java.functions.KeySelector;
@@ -40,6 +33,14 @@ import org.apache.flink.util.InstantiationUtil;
import org.apache.flink.util.OutputTag;
import org.apache.flink.util.Preconditions;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* Internal configuration for a {@link StreamOperator}. This is created and populated by the
* {@link StreamingJobGraphGenerator}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamEdge.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamEdge.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamEdge.java
index 95c80a8..2e89932 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamEdge.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamEdge.java
@@ -17,12 +17,13 @@
package org.apache.flink.streaming.api.graph;
-import java.io.Serializable;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.runtime.partitioner.StreamPartitioner;
import org.apache.flink.util.OutputTag;
+import java.io.Serializable;
+import java.util.List;
+
/**
* An edge in the streaming topology. One edge like this does not necessarily
* gets converted to a connection between two job vertices (due to
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java
index 4026817..20a361e 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java
@@ -17,17 +17,6 @@
package org.apache.flink.streaming.api.graph;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.io.InputFormat;
@@ -60,9 +49,22 @@ import org.apache.flink.streaming.runtime.tasks.StreamIterationHead;
import org.apache.flink.streaming.runtime.tasks.StreamIterationTail;
import org.apache.flink.streaming.runtime.tasks.TwoInputStreamTask;
import org.apache.flink.util.OutputTag;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* Class representing the streaming topology. It contains all the information
* necessary to build the jobgraph for the execution.
@@ -93,7 +95,6 @@ public class StreamGraph extends StreamingPlan {
private AbstractStateBackend stateBackend;
private Set<Tuple2<StreamNode, StreamNode>> iterationSourceSinkPairs;
-
public StreamGraph(StreamExecutionEnvironment environment) {
this.environment = environment;
this.executionConfig = environment.getConfig();
@@ -118,7 +119,6 @@ public class StreamGraph extends StreamingPlan {
sinks = new HashSet<>();
}
-
public StreamExecutionEnvironment getEnvironment() {
return environment;
}
@@ -157,7 +157,6 @@ public class StreamGraph extends StreamingPlan {
return chaining;
}
-
public boolean isIterative() {
return !vertexIDtoLoopTimeout.isEmpty();
}
@@ -558,7 +557,6 @@ public class StreamGraph extends StreamingPlan {
return sources;
}
-
public Collection<Integer> getSinkIDs() {
return sinks;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java
index b20f6d6..70b9fd4 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java
@@ -15,14 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.graph;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.java.tuple.Tuple2;
@@ -41,9 +36,17 @@ import org.apache.flink.streaming.api.transformations.SplitTransformation;
import org.apache.flink.streaming.api.transformations.StreamTransformation;
import org.apache.flink.streaming.api.transformations.TwoInputTransformation;
import org.apache.flink.streaming.api.transformations.UnionTransformation;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* A generator that generates a {@link StreamGraph} from a graph of
* {@link StreamTransformation StreamTransformations}.
@@ -264,7 +267,6 @@ public class StreamGraphGenerator {
streamGraph.addOutputSelector(inputId, split.getOutputSelector());
}
-
return resultIds;
}
@@ -279,7 +281,6 @@ public class StreamGraphGenerator {
StreamTransformation<T> input = select.getInput();
Collection<Integer> resultIds = transform(input);
-
// the recursive transform might have already transformed this
if (alreadyTransformed.containsKey(select)) {
return alreadyTransformed.get(select);
@@ -307,7 +308,6 @@ public class StreamGraphGenerator {
StreamTransformation<?> input = sideOutput.getInput();
Collection<Integer> resultIds = transform(input);
-
// the recursive transform might have already transformed this
if (alreadyTransformed.containsKey(sideOutput)) {
return alreadyTransformed.get(sideOutput);
@@ -508,7 +508,6 @@ public class StreamGraphGenerator {
);
}
-
if (sink.getStateKeySelector() != null) {
TypeSerializer<?> keySerializer = sink.getStateKeyType().createSerializer(env.getConfig());
streamGraph.setOneInputStateKey(sink.getId(), sink.getStateKeySelector(), keySerializer);
@@ -592,7 +591,6 @@ public class StreamGraphGenerator {
streamGraph.setTwoInputStateKey(transform.getId(), transform.getStateKeySelector1(), transform.getStateKeySelector2(), keySerializer);
}
-
streamGraph.setParallelism(transform.getId(), transform.getParallelism());
streamGraph.setMaxParallelism(transform.getId(), transform.getMaxParallelism());
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasher.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasher.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasher.java
index dd14d50..866fd1f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasher.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasher.java
@@ -18,9 +18,10 @@
package org.apache.flink.streaming.api.graph;
-import java.util.Map;
import org.apache.flink.runtime.jobgraph.JobVertexID;
+import java.util.Map;
+
/**
* Interface for different implementations of generating hashes over a stream graph.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasherV2.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasherV2.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasherV2.java
index 7c2416e..bb9e47b 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasherV2.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasherV2.java
@@ -18,11 +18,19 @@
package org.apache.flink.streaming.api.graph;
-import static org.apache.flink.util.StringUtils.byteToHexString;
+import org.apache.flink.runtime.jobgraph.JobVertexID;
+import org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator;
+import org.apache.flink.streaming.api.operators.ChainingStrategy;
+import org.apache.flink.streaming.api.operators.StreamOperator;
+import org.apache.flink.streaming.api.transformations.StreamTransformation;
+import org.apache.flink.streaming.runtime.partitioner.ForwardPartitioner;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.nio.charset.Charset;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -34,14 +42,8 @@ import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
-import org.apache.flink.runtime.jobgraph.JobVertexID;
-import org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator;
-import org.apache.flink.streaming.api.operators.ChainingStrategy;
-import org.apache.flink.streaming.api.operators.StreamOperator;
-import org.apache.flink.streaming.api.transformations.StreamTransformation;
-import org.apache.flink.streaming.runtime.partitioner.ForwardPartitioner;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import static org.apache.flink.util.StringUtils.byteToHexString;
/**
* StreamGraphHasher from Flink 1.2. This contains duplicated code to ensure that the algorithm does not change with
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphUserHashHasher.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphUserHashHasher.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphUserHashHasher.java
index 8a8c8b0..f17793e 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphUserHashHasher.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphUserHashHasher.java
@@ -18,9 +18,10 @@
package org.apache.flink.streaming.api.graph;
+import org.apache.flink.util.StringUtils;
+
import java.util.HashMap;
import java.util.Map;
-import org.apache.flink.util.StringUtils;
/**
* StreamGraphHasher that works with user provided hashes. This is useful in case we want to set (alternative) hashes
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamNode.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamNode.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamNode.java
index 5c421aa..78ab877 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamNode.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamNode.java
@@ -17,9 +17,6 @@
package org.apache.flink.streaming.api.graph;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.io.InputFormat;
@@ -31,6 +28,10 @@ import org.apache.flink.streaming.api.collector.selector.OutputSelector;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.operators.StreamOperator;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Class representing the operators in the streaming programs, with all their properties.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java
index 6d1af72..3008a43 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java
@@ -17,17 +17,6 @@
package org.apache.flink.streaming.api.graph;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import org.apache.commons.lang3.StringUtils;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.cache.DistributedCache;
import org.apache.flink.api.common.functions.Function;
@@ -65,12 +54,23 @@ import org.apache.flink.streaming.runtime.partitioner.RescalePartitioner;
import org.apache.flink.streaming.runtime.partitioner.StreamPartitioner;
import org.apache.flink.streaming.runtime.tasks.StreamIterationHead;
import org.apache.flink.streaming.runtime.tasks.StreamIterationTail;
-
import org.apache.flink.util.FlinkRuntimeException;
import org.apache.flink.util.SerializedValue;
+
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
/**
* The StreamingJobGraphGenerator converts a {@link StreamGraph} into a {@link JobGraph}.
*/
@@ -434,7 +434,6 @@ public class StreamingJobGraphGenerator {
}
}
-
config.setStreamOperator(vertex.getOperator());
config.setOutputSelectors(vertex.getOutputSelectors());
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java
index 057df2b..d711518 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java
@@ -18,15 +18,6 @@
package org.apache.flink.streaming.api.operators;
-import static org.apache.flink.util.Preconditions.checkArgument;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.ConcurrentModificationException;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.api.common.ExecutionConfig;
@@ -73,9 +64,20 @@ import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.streaming.runtime.tasks.StreamTask;
import org.apache.flink.util.OutputTag;
+
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+
/**
* Base class for all stream operators. Operators that contain a user function should extend the class
* {@link AbstractUdfStreamOperator} instead (which is a specialized subclass of this class).
@@ -609,7 +611,6 @@ public abstract class AbstractStreamOperator<OUT>
return getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, stateDescriptor);
}
-
protected <N, S extends State, T> S getOrCreateKeyedState(
TypeSerializer<N> namespaceSerializer,
StateDescriptor<S, T> stateDescriptor) throws Exception {
@@ -635,7 +636,6 @@ public abstract class AbstractStreamOperator<OUT>
TypeSerializer<N> namespaceSerializer,
StateDescriptor<S, ?> stateDescriptor) throws Exception {
-
/*
TODO: NOTE: This method does a lot of work caching / retrieving states just to update the namespace.
This method should be removed for the sake of namespaces being lazily fetched from the keyed
@@ -731,7 +731,6 @@ public abstract class AbstractStreamOperator<OUT>
reportOrForwardLatencyMarker(latencyMarker);
}
-
protected void reportOrForwardLatencyMarker(LatencyMarker marker) {
// all operators are tracking latencies
this.latencyGauge.reportLatency(marker, false);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperator.java
index 14857de..efbebf4 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperator.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.api.operators;
-import static java.util.Objects.requireNonNull;
-
-import java.io.Serializable;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.Function;
@@ -43,6 +40,10 @@ import org.apache.flink.streaming.util.functions.StreamingFunctionUtils;
import org.apache.flink.util.InstantiationUtil;
import org.apache.flink.util.Migration;
+import java.io.Serializable;
+
+import static java.util.Objects.requireNonNull;
+
/**
* This is used as the base class for operators that have a user-defined
* function. This class handles the opening and closing of the user-defined functions,
@@ -85,7 +86,6 @@ public abstract class AbstractUdfStreamOperator<OUT, F extends Function>
// operator life cycle
// ------------------------------------------------------------------------
-
@Override
public void setup(StreamTask<?, ?> containingTask, StreamConfig config, Output<StreamRecord<OUT>> output) {
super.setup(containingTask, config, output);
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/HeapInternalTimerService.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/HeapInternalTimerService.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/HeapInternalTimerService.java
index de3a7d2..1b531aa 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/HeapInternalTimerService.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/HeapInternalTimerService.java
@@ -15,16 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.flink.streaming.api.operators;
-import static org.apache.flink.util.Preconditions.checkArgument;
-import static org.apache.flink.util.Preconditions.checkNotNull;
+package org.apache.flink.streaming.api.operators;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.PriorityQueue;
-import java.util.Set;
-import java.util.concurrent.ScheduledFuture;
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.core.memory.DataInputViewStreamWrapper;
@@ -36,6 +29,15 @@ import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.util.InstantiationUtil;
import org.apache.flink.util.Preconditions;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.PriorityQueue;
+import java.util.Set;
+import java.util.concurrent.ScheduledFuture;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
/**
* {@link InternalTimerService} that stores timers on the Java heap.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimeServiceManager.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimeServiceManager.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimeServiceManager.java
index ff5164d..17af3aa 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimeServiceManager.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimeServiceManager.java
@@ -18,9 +18,6 @@
package org.apache.flink.streaming.api.operators;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -32,6 +29,10 @@ import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.util.Preconditions;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* An entity keeping all the time-related services available to all operators extending the
* {@link AbstractStreamOperator}. Right now, this is only a
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimer.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimer.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimer.java
index 1455712..4b86574 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimer.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimer.java
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.operators;
-import java.io.IOException;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.typeutils.CompatibilityResult;
import org.apache.flink.api.common.typeutils.TypeSerializer;
@@ -26,6 +26,8 @@ import org.apache.flink.api.common.typeutils.base.LongSerializer;
import org.apache.flink.core.memory.DataInputView;
import org.apache.flink.core.memory.DataOutputView;
+import java.io.IOException;
+
/**
* Internal class for keeping track of in-flight timers.
*
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimerService.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimerService.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimerService.java
index 805f9d4..f55cb03 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimerService.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimerService.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.operators;
import org.apache.flink.annotation.Internal;
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyContext.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyContext.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyContext.java
index e0fd493..2160f1e 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyContext.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyContext.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.flink.streaming.api.operators;
/**
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyedProcessOperator.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyedProcessOperator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyedProcessOperator.java
index db4b183..a46897c 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyedProcessOperator.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyedProcessOperator.java
@@ -17,9 +17,6 @@
package org.apache.flink.streaming.api.operators;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-import static org.apache.flink.util.Preconditions.checkState;
-
import org.apache.flink.annotation.Internal;
import org.apache.flink.runtime.state.VoidNamespace;
import org.apache.flink.runtime.state.VoidNamespaceSerializer;
@@ -30,6 +27,9 @@ import org.apache.flink.streaming.api.functions.ProcessFunction;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.util.OutputTag;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+import static org.apache.flink.util.Preconditions.checkState;
+
/**
* A {@link org.apache.flink.streaming.api.operators.StreamOperator} for executing keyed
* {@link ProcessFunction ProcessFunctions}.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/OnWatermarkCallback.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/OnWatermarkCallback.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/OnWatermarkCallback.java
index e78288d..bc317a9 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/OnWatermarkCallback.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/OnWatermarkCallback.java
@@ -18,10 +18,11 @@
package org.apache.flink.streaming.api.operators;
-import java.io.IOException;
import org.apache.flink.annotation.Internal;
import org.apache.flink.streaming.api.watermark.Watermark;
+import java.io.IOException;
+
/**
* A callback registered with the {@link InternalWatermarkCallbackService} service. This callback will
* be invoked for all keys registered with the service, upon reception of a watermark.
http://git-wip-us.apache.org/repos/asf/flink/blob/12b4185c/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/OperatorSnapshotResult.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/OperatorSnapshotResult.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/OperatorSnapshotResult.java
index eb743dd..8aa76a5 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/OperatorSnapshotResult.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/OperatorSnapshotResult.java
@@ -18,12 +18,13 @@
package org.apache.flink.streaming.api.operators;
-import java.util.concurrent.RunnableFuture;
import org.apache.flink.runtime.state.KeyedStateHandle;
import org.apache.flink.runtime.state.OperatorStateHandle;
import org.apache.flink.runtime.state.StateUtil;
import org.apache.flink.util.ExceptionUtils;
+import java.util.concurrent.RunnableFuture;
+
/**
* Result of {@link StreamOperator#snapshotState}.
*/