flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ches...@apache.org
Subject [01/12] flink git commit: [FLINK-7192] [java] Activate checkstyle flink-java/test/operator
Date Mon, 31 Jul 2017 11:59:08 GMT
Repository: flink
Updated Branches:
  refs/heads/master 80468b15c -> c5b61063e


http://git-wip-us.apache.org/repos/asf/flink/blob/ca5d8afe/flink-java/src/test/java/org/apache/flink/api/java/operator/ReduceOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-java/src/test/java/org/apache/flink/api/java/operator/ReduceOperatorTest.java
b/flink-java/src/test/java/org/apache/flink/api/java/operator/ReduceOperatorTest.java
index b7f7555..4fc14b5 100644
--- a/flink-java/src/test/java/org/apache/flink/api/java/operator/ReduceOperatorTest.java
+++ b/flink-java/src/test/java/org/apache/flink/api/java/operator/ReduceOperatorTest.java
@@ -29,6 +29,7 @@ import org.apache.flink.api.java.operators.ReduceOperator;
 import org.apache.flink.api.java.tuple.Tuple2;
 import org.apache.flink.api.java.tuple.Tuple5;
 import org.apache.flink.api.java.typeutils.TupleTypeInfo;
+
 import org.junit.Test;
 
 import java.util.ArrayList;
@@ -36,13 +37,16 @@ import java.util.List;
 
 import static org.junit.Assert.assertTrue;
 
+/**
+ * Tests for {@link DataSet#reduce(ReduceFunction)}.
+ */
 @SuppressWarnings("serial")
 public class ReduceOperatorTest {
 
 	private final List<Tuple5<Integer, Long, String, Long, Integer>> emptyTupleData
=
 			new ArrayList<Tuple5<Integer, Long, String, Long, Integer>>();
-	
-	private final TupleTypeInfo<Tuple5<Integer, Long, String, Long, Integer>> tupleTypeInfo
= new 
+
+	private final TupleTypeInfo<Tuple5<Integer, Long, String, Long, Integer>> tupleTypeInfo
= new
 			TupleTypeInfo<Tuple5<Integer, Long, String, Long, Integer>>(
 					BasicTypeInfo.INT_TYPE_INFO,
 					BasicTypeInfo.LONG_TYPE_INFO,
@@ -50,10 +54,10 @@ public class ReduceOperatorTest {
 					BasicTypeInfo.LONG_TYPE_INFO,
 					BasicTypeInfo.INT_TYPE_INFO
 			);
-	
+
 	@Test
 	public void testSemanticPropsWithKeySelector1() {
-		
+
 		final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
 		DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData,
tupleTypeInfo);
 
@@ -190,7 +194,7 @@ public class ReduceOperatorTest {
 		assertTrue(semProps.getReadFields(0) == null);
 	}
 
-	public static class DummyTestKeySelector implements KeySelector<Tuple5<Integer, Long,
String, Long, Integer>, Tuple2<Long, Integer>> {
+	private static class DummyTestKeySelector implements KeySelector<Tuple5<Integer, Long,
String, Long, Integer>, Tuple2<Long, Integer>> {
 		@Override
 		public Tuple2<Long, Integer> getKey(Tuple5<Integer, Long, String, Long, Integer>
value) throws Exception {
 			return new Tuple2<Long, Integer>();
@@ -199,7 +203,7 @@ public class ReduceOperatorTest {
 
 	@FunctionAnnotation.ForwardedFields("0->4;1;1->3;2")
 	@FunctionAnnotation.ReadFields("0;3;4")
-	public static class DummyReduceFunction1 implements ReduceFunction<Tuple5<Integer,
Long, String, Long, Integer>> {
+	private static class DummyReduceFunction1 implements ReduceFunction<Tuple5<Integer,
Long, String, Long, Integer>> {
 		@Override
 		public Tuple5<Integer, Long, String, Long, Integer> reduce(Tuple5<Integer, Long,
String, Long, Integer> v1,
 																	Tuple5<Integer, Long, String, Long, Integer> v2) throws Exception
{
@@ -208,27 +212,27 @@ public class ReduceOperatorTest {
 	}
 
 	@FunctionAnnotation.ReadFields("0;3;4")
-	public static class DummyReduceFunction2 implements ReduceFunction<Tuple5<Integer,
Long, String, Long, Integer>> {
+	private static class DummyReduceFunction2 implements ReduceFunction<Tuple5<Integer,
Long, String, Long, Integer>> {
 		@Override
 		public Tuple5<Integer, Long, String, Long, Integer> reduce(Tuple5<Integer, Long,
String, Long, Integer> v1,
-																   Tuple5<Integer, Long, String, Long, Integer> v2) throws Exception
{
+																	Tuple5<Integer, Long, String, Long, Integer> v2) throws Exception
{
 			return new Tuple5<Integer, Long, String, Long, Integer>();
 		}
 	}
 
-	public static class DummyReduceFunction3 implements ReduceFunction<Tuple5<Integer,
Long, String, Long, Integer>> {
+	private static class DummyReduceFunction3 implements ReduceFunction<Tuple5<Integer,
Long, String, Long, Integer>> {
 		@Override
 		public Tuple5<Integer, Long, String, Long, Integer> reduce(Tuple5<Integer, Long,
String, Long, Integer> v1,
-																   Tuple5<Integer, Long, String, Long, Integer> v2) throws Exception
{
+																	Tuple5<Integer, Long, String, Long, Integer> v2) throws Exception
{
 			return new Tuple5<Integer, Long, String, Long, Integer>();
 		}
 	}
 
 	@FunctionAnnotation.NonForwardedFields("2;4")
-	public static class DummyReduceFunction4 implements ReduceFunction<Tuple5<Integer,
Long, String, Long, Integer>> {
+	private static class DummyReduceFunction4 implements ReduceFunction<Tuple5<Integer,
Long, String, Long, Integer>> {
 		@Override
 		public Tuple5<Integer, Long, String, Long, Integer> reduce(Tuple5<Integer, Long,
String, Long, Integer> v1,
-																   Tuple5<Integer, Long, String, Long, Integer> v2) throws Exception
{
+																	Tuple5<Integer, Long, String, Long, Integer> v2) throws Exception
{
 			return new Tuple5<Integer, Long, String, Long, Integer>();
 		}
 	}

http://git-wip-us.apache.org/repos/asf/flink/blob/ca5d8afe/flink-java/src/test/java/org/apache/flink/api/java/operator/RightOuterJoinOperatorTest.java
----------------------------------------------------------------------
diff --git a/flink-java/src/test/java/org/apache/flink/api/java/operator/RightOuterJoinOperatorTest.java
b/flink-java/src/test/java/org/apache/flink/api/java/operator/RightOuterJoinOperatorTest.java
index 709d830..389eb90 100644
--- a/flink-java/src/test/java/org/apache/flink/api/java/operator/RightOuterJoinOperatorTest.java
+++ b/flink-java/src/test/java/org/apache/flink/api/java/operator/RightOuterJoinOperatorTest.java
@@ -28,11 +28,15 @@ import org.apache.flink.api.java.ExecutionEnvironment;
 import org.apache.flink.api.java.functions.KeySelector;
 import org.apache.flink.api.java.tuple.Tuple5;
 import org.apache.flink.api.java.typeutils.TupleTypeInfo;
+
 import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.List;
 
+/**
+ * Tests for {@link DataSet#rightOuterJoin(DataSet)}.
+ */
 public class RightOuterJoinOperatorTest {
 
 	// TUPLE DATA
@@ -201,7 +205,6 @@ public class RightOuterJoinOperatorTest {
 		this.testRightOuterStrategies(JoinHint.BROADCAST_HASH_FIRST);
 	}
 
-
 	private void testRightOuterStrategies(JoinHint hint) {
 
 		final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
@@ -214,13 +217,12 @@ public class RightOuterJoinOperatorTest {
 				.with(new DummyJoin());
 	}
 
-	
 	/*
 	 * ####################################################################
 	 */
 
 	@SuppressWarnings("serial")
-	public static class DummyJoin implements
+	private static class DummyJoin implements
 			JoinFunction<Tuple5<Integer, Long, String, Long, Integer>, Tuple5<Integer,
Long, String, Long, Integer>, Long> {
 
 		@Override
@@ -230,7 +232,7 @@ public class RightOuterJoinOperatorTest {
 	}
 
 	@SuppressWarnings("serial")
-	public static class IntKeySelector implements KeySelector<Tuple5<Integer, Long, String,
Long, Integer>, Integer> {
+	private static class IntKeySelector implements KeySelector<Tuple5<Integer, Long, String,
Long, Integer>, Integer> {
 
 		@Override
 		public Integer getKey(Tuple5<Integer, Long, String, Long, Integer> v) throws Exception
{
@@ -239,7 +241,7 @@ public class RightOuterJoinOperatorTest {
 	}
 
 	@SuppressWarnings("serial")
-	public static class LongKeySelector implements KeySelector<Tuple5<Integer, Long, String,
Long, Integer>, Long> {
+	private static class LongKeySelector implements KeySelector<Tuple5<Integer, Long,
String, Long, Integer>, Long> {
 
 		@Override
 		public Long getKey(Tuple5<Integer, Long, String, Long, Integer> v) throws Exception
{

http://git-wip-us.apache.org/repos/asf/flink/blob/ca5d8afe/flink-java/src/test/java/org/apache/flink/api/java/operator/SortPartitionTest.java
----------------------------------------------------------------------
diff --git a/flink-java/src/test/java/org/apache/flink/api/java/operator/SortPartitionTest.java
b/flink-java/src/test/java/org/apache/flink/api/java/operator/SortPartitionTest.java
index c3307ec..4c4ca8d 100644
--- a/flink-java/src/test/java/org/apache/flink/api/java/operator/SortPartitionTest.java
+++ b/flink-java/src/test/java/org/apache/flink/api/java/operator/SortPartitionTest.java
@@ -30,6 +30,7 @@ import org.apache.flink.api.java.tuple.Tuple4;
 import org.apache.flink.api.java.tuple.Tuple5;
 import org.apache.flink.api.java.typeutils.TupleTypeInfo;
 import org.apache.flink.api.java.typeutils.TypeExtractor;
+
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -37,6 +38,9 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
+/**
+ * Tests for {@link DataSet#sortPartition(int, Order)}.
+ */
 public class SortPartitionTest {
 
 	// TUPLE DATA
@@ -68,7 +72,6 @@ public class SortPartitionTest {
 	private final List<Tuple4<Integer, Long, CustomType, Long[]>> tupleWithCustomData
=
 			new ArrayList<Tuple4<Integer, Long, CustomType, Long[]>>();
 
-
 	@Test
 	public void testSortPartitionPositionKeys1() {
 
@@ -78,7 +81,7 @@ public class SortPartitionTest {
 		// should work
 		try {
 			tupleDs.sortPartition(0, Order.ASCENDING);
-		} catch(Exception e) {
+		} catch (Exception e) {
 			Assert.fail();
 		}
 	}
@@ -94,7 +97,7 @@ public class SortPartitionTest {
 			tupleDs
 					.sortPartition(0, Order.ASCENDING)
 					.sortPartition(3, Order.DESCENDING);
-		} catch(Exception e) {
+		} catch (Exception e) {
 			Assert.fail();
 		}
 	}
@@ -128,7 +131,7 @@ public class SortPartitionTest {
 		// should work
 		try {
 			tupleDs.sortPartition("f1", Order.ASCENDING);
-		} catch(Exception e) {
+		} catch (Exception e) {
 			Assert.fail();
 		}
 	}
@@ -144,7 +147,7 @@ public class SortPartitionTest {
 			tupleDs
 					.sortPartition("f0", Order.ASCENDING)
 					.sortPartition("f2.nested.myInt", Order.DESCENDING);
-		} catch(Exception e) {
+		} catch (Exception e) {
 			Assert.fail();
 		}
 	}
@@ -224,7 +227,7 @@ public class SortPartitionTest {
 
 		// should work
 		try {
-			tupleDs.sortPartition(new KeySelector<Tuple4<Integer,Long,CustomType,Long[]>,
Tuple2<Integer, Long>>() {
+			tupleDs.sortPartition(new KeySelector<Tuple4<Integer, Long, CustomType, Long[]>,
Tuple2<Integer, Long>>() {
 				@Override
 				public Tuple2<Integer, Long> getKey(Tuple4<Integer, Long, CustomType, Long[]>
value) throws Exception {
 					return new Tuple2<>(value.f0, value.f1);
@@ -251,18 +254,25 @@ public class SortPartitionTest {
 			.sortPartition("f1", Order.ASCENDING);
 	}
 
+	/**
+	 * Custom data type, for testing purposes.
+	 */
 	public static class CustomType implements Serializable {
-		
+
+		/**
+		 * Custom nested data type, for testing purposes.
+		 */
 		public static class Nest {
 			public int myInt;
 		}
+
 		private static final long serialVersionUID = 1L;
-		
+
 		public int myInt;
 		public long myLong;
 		public String myString;
 		public Nest nested;
-		
+
 		public CustomType() {}
 
 		public CustomType(int i, long l, String s) {
@@ -270,17 +280,11 @@ public class SortPartitionTest {
 			myLong = l;
 			myString = s;
 		}
-		
+
 		@Override
 		public String toString() {
-			return myInt+","+myLong+","+myString;
+			return myInt + "," + myLong + "," + myString;
 		}
 	}
 
-	public static class CustomType2 implements Serializable {
-
-		public int myInt;
-		public int[] myIntArray;
-
-	}
 }


Mime
View raw message