You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2017/05/26 19:16:12 UTC
[03/15] flink git commit: [FLINK-6709] [gelly] Activate strict
checkstyle for flink-gellies
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/TestGraphUtils.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/TestGraphUtils.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/TestGraphUtils.java
index 7766723..c160389 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/TestGraphUtils.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/TestGraphUtils.java
@@ -30,6 +30,9 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+/**
+ * Utility methods and data for testing graph algorithms.
+ */
public class TestGraphUtils {
public static DataSet<Vertex<Long, Long>> getLongLongVertexData(
@@ -37,7 +40,7 @@ public class TestGraphUtils {
return env.fromCollection(getLongLongVertices());
}
-
+
public static DataSet<Edge<Long, Long>> getLongLongEdgeData(
ExecutionEnvironment env) {
@@ -187,7 +190,7 @@ public class TestGraphUtils {
}
/**
- * A graph with invalid vertex ids
+ * A graph with invalid vertex ids.
*/
public static DataSet<Vertex<Long, Long>> getLongLongInvalidVertexData(
ExecutionEnvironment env) {
@@ -200,7 +203,7 @@ public class TestGraphUtils {
}
/**
- * A graph that has at least one vertex with no ingoing/outgoing edges
+ * A graph that has at least one vertex with no ingoing/outgoing edges.
*/
public static DataSet<Edge<Long, Long>> getLongLongEdgeDataWithZeroDegree(
ExecutionEnvironment env) {
@@ -216,7 +219,7 @@ public class TestGraphUtils {
}
/**
- * Function that produces an ArrayList of vertices
+ * Function that produces an ArrayList of vertices.
*/
public static List<Vertex<Long, Long>> getLongLongVertices() {
List<Vertex<Long, Long>> vertices = new ArrayList<>();
@@ -246,12 +249,12 @@ public class TestGraphUtils {
edges.add(new Edge<>(1L, 3L, 13L));
edges.add(new Edge<>(2L, 3L, 23L));
edges.add(new Edge<>(4L, 5L, 45L));
-
+
return env.fromCollection(edges);
}
-
+
/**
- * Function that produces an ArrayList of edges
+ * Function that produces an ArrayList of edges.
*/
public static List<Edge<Long, Long>> getLongLongEdges() {
List<Edge<Long, Long>> edges = new ArrayList<>();
@@ -262,21 +265,24 @@ public class TestGraphUtils {
edges.add(new Edge<>(3L, 5L, 35L));
edges.add(new Edge<>(4L, 5L, 45L));
edges.add(new Edge<>(5L, 1L, 51L));
-
+
return edges;
}
+ /**
+ * Test POJO.
+ */
public static class DummyCustomType implements Serializable {
private static final long serialVersionUID = 1L;
-
+
private int intField;
private boolean booleanField;
-
+
public DummyCustomType(int intF, boolean boolF) {
this.intField = intF;
this.booleanField = boolF;
}
-
+
public DummyCustomType() {
this.intField = 0;
this.booleanField = true;
@@ -285,32 +291,37 @@ public class TestGraphUtils {
public int getIntField() {
return intField;
}
-
+
public void setIntField(int intF) {
this.intField = intF;
}
-
+
public boolean getBooleanField() {
return booleanField;
}
-
+
@Override
public String toString() {
return booleanField ? "(T," + intField + ")" : "(F," + intField + ")";
}
}
-
+
+ /**
+ * Generic test POJO.
+ *
+ * @param <T> field type
+ */
public static class DummyCustomParameterizedType<T> implements Serializable {
private static final long serialVersionUID = 1L;
-
+
private int intField;
private T tField;
-
+
public DummyCustomParameterizedType(int intF, T tF) {
this.intField = intF;
this.tField = tF;
}
-
+
public DummyCustomParameterizedType() {
this.intField = 0;
this.tField = null;
@@ -319,19 +330,19 @@ public class TestGraphUtils {
public int getIntField() {
return intField;
}
-
+
public void setIntField(int intF) {
this.intField = intF;
}
-
+
public void setTField(T tF) {
this.tField = tF;
}
-
+
public T getTField() {
return tField;
}
-
+
@Override
public String toString() {
return "(" + tField.toString() + "," + intField + ")";
@@ -339,7 +350,7 @@ public class TestGraphUtils {
}
/**
- * Method useful for suppressing sysout printing
+ * Method useful for suppressing sysout printing.
*/
public static void pipeSystemOutToNull() {
System.setOut(new PrintStream(new BlackholeOutputSteam()));
@@ -351,7 +362,8 @@ public class TestGraphUtils {
}
/**
- * utils for getting the second graph for the test of method difference();
+ * utils for getting the second graph for the test of method difference().
+ *
* @param env - ExecutionEnvironment
*/
public static DataSet<Edge<Long, Long>> getLongLongEdgeDataDifference(ExecutionEnvironment env) {
@@ -389,4 +401,4 @@ public class TestGraphUtils {
edges.add(new Edge<>(6L, 6L, 66L));
return edges;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesITCase.java
index 3e375b5..d9e15dd 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesITCase.java
@@ -26,12 +26,17 @@ import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.test.util.MultipleProgramsTestBase;
import org.apache.flink.types.LongValue;
import org.apache.flink.types.NullValue;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.List;
+/**
+ * Tests for {@link Graph#inDegrees()}, {@link Graph#outDegrees()},
+ * and {@link Graph#getDegrees()}.
+ */
@RunWith(Parameterized.class)
public class DegreesITCase extends MultipleProgramsTestBase {
@@ -171,4 +176,4 @@ public class DegreesITCase extends MultipleProgramsTestBase {
compareResultAsTuples(result, expectedResult);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesWithExceptionITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesWithExceptionITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesWithExceptionITCase.java
index 111d421..8b726f4 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesWithExceptionITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesWithExceptionITCase.java
@@ -21,28 +21,30 @@ package org.apache.flink.graph.test.operations;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.io.DiscardingOutputFormat;
import org.apache.flink.api.java.tuple.Tuple2;
-
import org.apache.flink.configuration.ConfigConstants;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.graph.Graph;
import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster;
-
import org.apache.flink.test.util.TestEnvironment;
import org.apache.flink.types.LongValue;
import org.apache.flink.util.TestLogger;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.fail;
+/**
+ * Test expected errors for {@link Graph#inDegrees()},
+ * {@link Graph#outDegrees()}, and {@link Graph#getDegrees()}.
+ */
public class DegreesWithExceptionITCase extends TestLogger {
private static final int PARALLELISM = 4;
private static LocalFlinkMiniCluster cluster;
-
@BeforeClass
public static void setupCluster() {
@@ -62,7 +64,7 @@ public class DegreesWithExceptionITCase extends TestLogger {
}
/**
- * Test outDegrees() with an edge having a srcId that does not exist in the vertex DataSet
+ * Test outDegrees() with an edge having a srcId that does not exist in the vertex DataSet.
*/
@Test
public void testOutDegreesInvalidEdgeSrcId() throws Exception {
@@ -70,7 +72,7 @@ public class DegreesWithExceptionITCase extends TestLogger {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(PARALLELISM);
env.getConfig().disableSysoutLogging();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
TestGraphUtils.getLongLongEdgeInvalidSrcData(env), env);
@@ -85,7 +87,7 @@ public class DegreesWithExceptionITCase extends TestLogger {
}
/**
- * Test inDegrees() with an edge having a trgId that does not exist in the vertex DataSet
+ * Test inDegrees() with an edge having a trgId that does not exist in the vertex DataSet.
*/
@Test
public void testInDegreesInvalidEdgeTrgId() throws Exception {
@@ -108,7 +110,7 @@ public class DegreesWithExceptionITCase extends TestLogger {
}
/**
- * Test getDegrees() with an edge having a trgId that does not exist in the vertex DataSet
+ * Test getDegrees() with an edge having a trgId that does not exist in the vertex DataSet.
*/
@Test
public void testGetDegreesInvalidEdgeTrgId() throws Exception {
@@ -131,7 +133,7 @@ public class DegreesWithExceptionITCase extends TestLogger {
}
/**
- * Test getDegrees() with an edge having a srcId that does not exist in the vertex DataSet
+ * Test getDegrees() with an edge having a srcId that does not exist in the vertex DataSet.
*/
@Test
public void testGetDegreesInvalidEdgeSrcId() throws Exception {
@@ -154,7 +156,7 @@ public class DegreesWithExceptionITCase extends TestLogger {
}
/**
- * Test getDegrees() with an edge having a srcId and a trgId that does not exist in the vertex DataSet
+ * Test getDegrees() with an edge having a srcId and a trgId that does not exist in the vertex DataSet.
*/
@Test
public void testGetDegreesInvalidEdgeSrcTrgId() throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
index ab2ffe0..7995bae 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
@@ -27,12 +27,16 @@ import org.apache.flink.graph.Vertex;
import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.test.util.MultipleProgramsTestBase;
import org.apache.flink.types.NullValue;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.List;
+/**
+ * Test creating graphs from collections.
+ */
@RunWith(Parameterized.class)
public class FromCollectionITCase extends MultipleProgramsTestBase {
@@ -74,7 +78,6 @@ public class FromCollectionITCase extends MultipleProgramsTestBase {
Graph<Long, NullValue, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongEdges(),
env);
-
DataSet<Vertex<Long, NullValue>> data = graph.getVertices();
List<Vertex<Long, NullValue>> result = data.collect();
@@ -115,4 +118,4 @@ public class FromCollectionITCase extends MultipleProgramsTestBase {
return vertexId * 2;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
index 77dd4d1..991a420 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
@@ -30,6 +30,7 @@ import org.apache.flink.graph.test.TestGraphUtils.DummyCustomParameterizedType;
import org.apache.flink.graph.validation.InvalidVertexIdsValidator;
import org.apache.flink.test.util.MultipleProgramsTestBase;
import org.apache.flink.types.NullValue;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -37,6 +38,9 @@ import org.junit.runners.Parameterized;
import java.util.LinkedList;
import java.util.List;
+/**
+ * Test graph creation and validation from datasets and tuples.
+ */
@RunWith(Parameterized.class)
public class GraphCreationITCase extends MultipleProgramsTestBase {
@@ -122,7 +126,7 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
//env.fromElements(result).writeAsText(resultPath);
- String res = valid.toString();//env.fromElements(valid);
+ String res = valid.toString(); //env.fromElements(valid);
List<String> result = new LinkedList<>();
result.add(res);
expectedResult = "true";
@@ -142,7 +146,7 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromDataSet(vertices, edges, env);
Boolean valid = graph.validate(new InvalidVertexIdsValidator<Long, Long, Long>());
- String res = valid.toString();//env.fromElements(valid);
+ String res = valid.toString(); //env.fromElements(valid);
List<String> result = new LinkedList<>();
result.add(res);
@@ -230,4 +234,4 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
return "boo";
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithCsvITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithCsvITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithCsvITCase.java
index 812f418..e92e644 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithCsvITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithCsvITCase.java
@@ -26,6 +26,7 @@ import org.apache.flink.graph.Graph;
import org.apache.flink.graph.Triplet;
import org.apache.flink.test.util.MultipleProgramsTestBase;
import org.apache.flink.types.NullValue;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -37,6 +38,9 @@ import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.util.List;
+/**
+ * Test graph creation from CSV.
+ */
@RunWith(Parameterized.class)
public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
@@ -52,12 +56,12 @@ public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
* Test with two Csv files one with Vertex Data and one with Edges data
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- final String fileContent = "1,1\n"+
- "2,2\n"+
+ final String fileContent = "1,1\n" +
+ "2,2\n" +
"3,3\n";
final FileInputSplit split = createTempFile(fileContent);
- final String fileContent2 = "1,2,ot\n"+
- "3,2,tt\n"+
+ final String fileContent2 = "1,2,ot\n" +
+ "3,2,tt\n" +
"3,1,to\n";
final FileInputSplit split2 = createTempFile(fileContent2);
@@ -79,11 +83,11 @@ public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
Test fromCsvReader with edge and vertex path and nullvalue for edge
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- final String vertexFileContent = "1,one\n"+
- "2,two\n"+
+ final String vertexFileContent = "1,one\n" +
+ "2,two\n" +
"3,three\n";
- final String edgeFileContent = "1,2\n"+
- "3,2\n"+
+ final String edgeFileContent = "1,2\n" +
+ "3,2\n" +
"3,1\n";
final FileInputSplit split = createTempFile(vertexFileContent);
final FileInputSplit edgeSplit = createTempFile(edgeFileContent);
@@ -93,8 +97,8 @@ public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
List<Triplet<Long, String, NullValue>> result = graph.getTriplets().collect();
- expectedResult = "1,2,one,two,(null)\n"+
- "3,2,three,two,(null)\n"+
+ expectedResult = "1,2,one,two,(null)\n" +
+ "3,2,three,two,(null)\n" +
"3,1,three,one,(null)\n";
compareResultAsTuples(result, expectedResult);
@@ -106,8 +110,8 @@ public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
*Test fromCsvReader with edge path and a mapper that assigns a Double constant as value
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- final String fileContent = "1,2,ot\n"+
- "3,2,tt\n"+
+ final String fileContent = "1,2,ot\n" +
+ "3,2,tt\n" +
"3,1,to\n";
final FileInputSplit split = createTempFile(fileContent);
@@ -126,12 +130,12 @@ public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
* Test with one Csv file one with Edges data. Also tests the configuration method ignoreFistLineEdges()
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- final String fileContent2 = "header\n1,2,ot\n"+
- "3,2,tt\n"+
+ final String fileContent2 = "header\n1,2,ot\n" +
+ "3,2,tt\n" +
"3,1,to\n";
final FileInputSplit split2 = createTempFile(fileContent2);
- Graph<Long, NullValue, String> graph= Graph.fromCsvReader(split2.getPath().toString(), env)
+ Graph<Long, NullValue, String> graph = Graph.fromCsvReader(split2.getPath().toString(), env)
.ignoreFirstLineEdges()
.ignoreCommentsVertices("hi")
.edgeTypes(Long.class, String.class);
@@ -153,19 +157,19 @@ public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- final String fileContent = "header\n1;1\n"+
- "2;2\n"+
+ final String fileContent = "header\n1;1\n" +
+ "2;2\n" +
"3;3\n";
final FileInputSplit split = createTempFile(fileContent);
- final String fileContent2 = "header|1:2:ot|"+
- "3:2:tt|"+
+ final String fileContent2 = "header|1:2:ot|" +
+ "3:2:tt|" +
"3:1:to|";
final FileInputSplit split2 = createTempFile(fileContent2);
- Graph<Long, Long, String> graph= Graph.fromCsvReader(split.getPath().toString(), split2.getPath().toString(), env).
+ Graph<Long, Long, String> graph = Graph.fromCsvReader(split.getPath().toString(), split2.getPath().toString(), env).
ignoreFirstLineEdges().ignoreFirstLineVertices().
fieldDelimiterEdges(":").fieldDelimiterVertices(";").
lineDelimiterEdges("|").
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
index 148952c..b67557b 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
@@ -27,12 +27,16 @@ import org.apache.flink.graph.Vertex;
import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.graph.test.TestGraphUtils.DummyCustomType;
import org.apache.flink.test.util.MultipleProgramsTestBase;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.List;
+/**
+ * Test graph creation with a mapper.
+ */
@RunWith(Parameterized.class)
public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java
index c72750e..75f8d9c 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java
@@ -25,6 +25,7 @@ import org.apache.flink.graph.Graph;
import org.apache.flink.graph.Vertex;
import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.test.util.MultipleProgramsTestBase;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -32,6 +33,9 @@ import org.junit.runners.Parameterized;
import java.util.ArrayList;
import java.util.List;
+/**
+ * Tests for adding and removing {@link Graph} vertices and edges.
+ */
@RunWith(Parameterized.class)
public class GraphMutationsITCase extends MultipleProgramsTestBase {
@@ -45,7 +49,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
public void testAddVertex() throws Exception {
/*
* Test addVertex() -- simple case
- */
+ */
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
@@ -88,7 +92,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addVertices(vertices);
DataSet<Vertex<Long, Long>> data = graph.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
+ List<Vertex<Long, Long>> result = data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -114,7 +118,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addVertex(new Vertex<>(1L, 1L));
DataSet<Vertex<Long, Long>> data = graph.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
+ List<Vertex<Long, Long>> result = data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -143,7 +147,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addVertices(vertices);
DataSet<Vertex<Long, Long>> data = graph.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
+ List<Vertex<Long, Long>> result = data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -172,7 +176,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addVertices(vertices);
DataSet<Vertex<Long, Long>> data = graph.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
+ List<Vertex<Long, Long>> result = data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -197,7 +201,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeVertex(new Vertex<>(5L, 5L));
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,3,13\n" +
@@ -225,7 +229,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeVertices(verticesToBeRemoved);
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "3,4,34\n" +
"3,5,35\n" +
@@ -247,7 +251,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeVertex(new Vertex<>(6L, 6L));
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,3,13\n" +
@@ -277,7 +281,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeVertices(verticesToBeRemoved);
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "2,3,23\n" +
"3,4,34\n" +
@@ -304,7 +308,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeVertices(verticesToBeRemoved);
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,3,13\n" +
@@ -334,7 +338,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeVertices(verticesToBeRemoved);
DataSet<Vertex<Long, Long>> data = graph.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
+ List<Vertex<Long, Long>> result = data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -358,7 +362,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addEdge(new Vertex<>(6L, 6L), new Vertex<>(1L, 1L), 61L);
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,3,13\n" +
@@ -390,7 +394,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addEdges(edgesToBeAdded);
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,3,13\n" +
@@ -423,7 +427,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addEdges(edgesToBeAdded);
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,3,13\n" +
@@ -450,7 +454,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
12L);
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,2,12\n" +
@@ -481,7 +485,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeEdge(new Edge<>(5L, 1L, 51L));
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,2,12\n" +
@@ -514,7 +518,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeEdges(edgesToBeRemoved);
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,2,12\n" +
@@ -543,7 +547,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeEdges(edgesToBeRemoved);
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,3,13\n" +
@@ -568,7 +572,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeEdge(new Edge<>(6L, 1L, 61L));
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,3,13\n" +
@@ -598,7 +602,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeEdges(edgesToBeRemoved);
DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
"1,3,13\n" +
@@ -607,7 +611,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
"3,5,35\n" +
"4,5,45\n" +
"5,1,51\n";
-
+
compareResultAsTuples(result, expectedResult);
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
index e03e8cf..cbb4194 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
@@ -30,6 +30,7 @@ import org.apache.flink.graph.Vertex;
import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.test.util.MultipleProgramsTestBase;
import org.apache.flink.types.NullValue;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -37,6 +38,9 @@ import org.junit.runners.Parameterized;
import java.util.ArrayList;
import java.util.List;
+/**
+ * Tests for {@link Graph} operations.
+ */
@RunWith(Parameterized.class)
public class GraphOperationsITCase extends MultipleProgramsTestBase {
@@ -457,4 +461,4 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
compareResultAsTuples(result, expectedResult);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
index 6988218..43ff124 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
@@ -30,12 +30,17 @@ import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.graph.test.TestGraphUtils.DummyCustomParameterizedType;
import org.apache.flink.graph.utils.EdgeToTuple3Map;
import org.apache.flink.test.util.MultipleProgramsTestBase;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.List;
+/**
+ * Tests for {@link Graph#joinWithEdges}, {@link Graph#joinWithEdgesOnSource},
+ * and {@link Graph#joinWithEdgesOnTarget}.
+ */
@RunWith(Parameterized.class)
public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
@@ -532,4 +537,4 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
return new Tuple2<>(edge.getTarget(), true);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
index 7676e8c..181c1a7 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
@@ -29,12 +29,16 @@ import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.graph.test.TestGraphUtils.DummyCustomParameterizedType;
import org.apache.flink.graph.utils.VertexToTuple2Map;
import org.apache.flink.test.util.MultipleProgramsTestBase;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.List;
+/**
+ * Tests for {@link Graph#joinWithVertices}.
+ */
@RunWith(Parameterized.class)
public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapEdgesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapEdgesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapEdgesITCase.java
index 34a2518..f70b4fb 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapEdgesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapEdgesITCase.java
@@ -28,12 +28,16 @@ import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.graph.test.TestGraphUtils.DummyCustomParameterizedType;
import org.apache.flink.graph.test.TestGraphUtils.DummyCustomType;
import org.apache.flink.test.util.MultipleProgramsTestBase;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.List;
+/**
+ * Tests for {@link Graph#mapEdges}.
+ */
@RunWith(Parameterized.class)
public class MapEdgesITCase extends MultipleProgramsTestBase {
@@ -207,4 +211,4 @@ public class MapEdgesITCase extends MultipleProgramsTestBase {
return dummyValue;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapVerticesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapVerticesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapVerticesITCase.java
index 24aae7b..9d1609f 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapVerticesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapVerticesITCase.java
@@ -28,12 +28,16 @@ import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.graph.test.TestGraphUtils.DummyCustomParameterizedType;
import org.apache.flink.graph.test.TestGraphUtils.DummyCustomType;
import org.apache.flink.test.util.MultipleProgramsTestBase;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.List;
+/**
+ * Tests for {@link Graph#mapVertices}.
+ */
@RunWith(Parameterized.class)
public class MapVerticesITCase extends MultipleProgramsTestBase {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
index b26bb43..dbd9f64 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
@@ -31,6 +31,7 @@ import org.apache.flink.graph.Vertex;
import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.test.util.MultipleProgramsTestBase;
import org.apache.flink.util.Collector;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -38,6 +39,9 @@ import org.junit.runners.Parameterized;
import java.util.List;
import java.util.Objects;
+/**
+ * Tests for {@link Graph#groupReduceOnEdges} and {@link Graph#reduceOnEdges}.
+ */
@RunWith(Parameterized.class)
public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@@ -403,7 +407,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Vertex<Long, Long> v,
- Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
long weight = Long.MAX_VALUE;
long minNeighborId = 0;
@@ -423,7 +427,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Vertex<Long, Long> v,
- Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
long weight = Long.MIN_VALUE;
@@ -459,7 +463,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Vertex<Long, Long> v,
- Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
long weight = Long.MAX_VALUE;
long minNeighborId = 0;
@@ -479,7 +483,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
out.collect(new Tuple2<>(edge.f0, edge.f1.getTarget()));
@@ -492,7 +496,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
if (edge.f0 != 5) {
@@ -508,7 +512,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Vertex<Long, Long> v, Iterable<Edge<Long, Long>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
for (Edge<Long, Long> edge : edges) {
if (v.getValue() > 2) {
@@ -523,7 +527,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
out.collect(new Tuple2<>(edge.f0, edge.f1.getSource()));
@@ -536,7 +540,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
if (edge.f0 != 5) {
@@ -552,7 +556,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Vertex<Long, Long> v, Iterable<Edge<Long, Long>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
for (Edge<Long, Long> edge : edges) {
if (v.getValue() > 2) {
@@ -567,7 +571,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
if (Objects.equals(edge.f0, edge.f1.getTarget())) {
out.collect(new Tuple2<>(edge.f0, edge.f1.getSource()));
@@ -583,7 +587,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
if (edge.f0 != 5 && edge.f0 != 2) {
@@ -603,7 +607,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Vertex<Long, Long> v, Iterable<Edge<Long, Long>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
for (Edge<Long, Long> edge : edges) {
if (v.getValue() > 4) {
@@ -616,4 +620,4 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesWithExceptionITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesWithExceptionITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesWithExceptionITCase.java
index 7a0a30c..19e701d 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesWithExceptionITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesWithExceptionITCase.java
@@ -34,19 +34,22 @@ import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster;
import org.apache.flink.test.util.TestEnvironment;
import org.apache.flink.util.Collector;
import org.apache.flink.util.TestLogger;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.fail;
+/**
+ * Test expected exceptions for {@link Graph#groupReduceOnEdges}.
+ */
public class ReduceOnEdgesWithExceptionITCase extends TestLogger {
private static final int PARALLELISM = 4;
private static LocalFlinkMiniCluster cluster;
-
@BeforeClass
public static void setupCluster() {
Configuration config = new Configuration();
@@ -65,7 +68,7 @@ public class ReduceOnEdgesWithExceptionITCase extends TestLogger {
}
/**
- * Test groupReduceOnEdges() with an edge having a srcId that does not exist in the vertex DataSet
+ * Test groupReduceOnEdges() with an edge having a srcId that does not exist in the vertex DataSet.
*/
@Test
public void testGroupReduceOnEdgesInvalidEdgeSrcId() throws Exception {
@@ -91,7 +94,7 @@ public class ReduceOnEdgesWithExceptionITCase extends TestLogger {
}
/**
- * Test groupReduceOnEdges() with an edge having a trgId that does not exist in the vertex DataSet
+ * Test groupReduceOnEdges() with an edge having a trgId that does not exist in the vertex DataSet.
*/
@Test
public void testGroupReduceOnEdgesInvalidEdgeTrgId() throws Exception {
@@ -116,17 +119,16 @@ public class ReduceOnEdgesWithExceptionITCase extends TestLogger {
}
}
-
@SuppressWarnings("serial")
private static final class SelectNeighborsValueGreaterThanFour implements
EdgesFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateEdges(Vertex<Long, Long> v, Iterable<Edge<Long, Long>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
- for(Edge<Long, Long> edge : edges) {
- if(v.getValue() > 4) {
- if(v.getId().equals(edge.getTarget())) {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
+ for (Edge<Long, Long> edge : edges) {
+ if (v.getValue() > 4) {
+ if (v.getId().equals(edge.getTarget())) {
out.collect(new Tuple2<>(v.getId(), edge.getSource()));
} else {
out.collect(new Tuple2<>(v.getId(), edge.getTarget()));
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
index 7fad2e8..ee48b84 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
@@ -32,12 +32,16 @@ import org.apache.flink.graph.Vertex;
import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.test.util.MultipleProgramsTestBase;
import org.apache.flink.util.Collector;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.List;
+/**
+ * Tests for {@link Graph#groupReduceOnNeighbors} and {@link Graph#reduceOnNeighbors}.
+ */
@RunWith(Parameterized.class)
public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@@ -410,8 +414,8 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -427,8 +431,8 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -444,8 +448,8 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -461,8 +465,8 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -480,8 +484,8 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -499,8 +503,8 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -526,7 +530,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Iterable<Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>> next = null;
@@ -544,7 +548,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Iterable<Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>> next = null;
@@ -565,7 +569,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Iterable<Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>> next = null;
@@ -586,7 +590,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Iterable<Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>> next = null;
@@ -607,8 +611,8 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -625,8 +629,8 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -643,8 +647,8 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -654,4 +658,4 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
out.collect(new Tuple2<>(vertex.getId(), sum + vertex.getValue() + 5));
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborsWithExceptionITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborsWithExceptionITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborsWithExceptionITCase.java
index b337bca..d3b97a1 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborsWithExceptionITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborsWithExceptionITCase.java
@@ -35,19 +35,22 @@ import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster;
import org.apache.flink.test.util.TestEnvironment;
import org.apache.flink.util.Collector;
import org.apache.flink.util.TestLogger;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.fail;
+/**
+ * Test expected exceptions for {@link Graph#groupReduceOnNeighbors} and {@link Graph#reduceOnNeighbors}.
+ */
public class ReduceOnNeighborsWithExceptionITCase extends TestLogger {
private static final int PARALLELISM = 4;
private static LocalFlinkMiniCluster cluster;
-
@BeforeClass
public static void setupCluster() {
Configuration config = new Configuration();
@@ -67,7 +70,7 @@ public class ReduceOnNeighborsWithExceptionITCase extends TestLogger {
/**
* Test groupReduceOnNeighbors() -NeighborsFunctionWithVertexValue-
- * with an edge having a srcId that does not exist in the vertex DataSet
+ * with an edge having a srcId that does not exist in the vertex DataSet.
*/
@Test
public void testGroupReduceOnNeighborsWithVVInvalidEdgeSrcId() throws Exception {
@@ -94,7 +97,7 @@ public class ReduceOnNeighborsWithExceptionITCase extends TestLogger {
/**
* Test groupReduceOnNeighbors() -NeighborsFunctionWithVertexValue-
- * with an edge having a trgId that does not exist in the vertex DataSet
+ * with an edge having a trgId that does not exist in the vertex DataSet.
*/
@Test
public void testGroupReduceOnNeighborsWithVVInvalidEdgeTrgId() throws Exception {
@@ -121,7 +124,7 @@ public class ReduceOnNeighborsWithExceptionITCase extends TestLogger {
/**
* Test groupReduceOnNeighbors() -NeighborsFunction-
- * with an edge having a srcId that does not exist in the vertex DataSet
+ * with an edge having a srcId that does not exist in the vertex DataSet.
*/
@Test
public void testGroupReduceOnNeighborsInvalidEdgeSrcId() throws Exception {
@@ -146,7 +149,7 @@ public class ReduceOnNeighborsWithExceptionITCase extends TestLogger {
/**
* Test groupReduceOnNeighbors() -NeighborsFunction-
- * with an edge having a trgId that does not exist in the vertex DataSet
+ * with an edge having a trgId that does not exist in the vertex DataSet.
*/
@Test
public void testGroupReduceOnNeighborsInvalidEdgeTrgId() throws Exception {
@@ -175,8 +178,8 @@ public class ReduceOnNeighborsWithExceptionITCase extends TestLogger {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java
index 484ef3d..4d9040c 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java
@@ -24,13 +24,21 @@ import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.typeutils.TupleTypeInfo;
-import org.apache.flink.graph.*;
+import org.apache.flink.graph.Edge;
+import org.apache.flink.graph.EdgeDirection;
+import org.apache.flink.graph.EdgesFunction;
+import org.apache.flink.graph.Graph;
+import org.apache.flink.graph.Vertex;
import org.apache.flink.graph.test.TestGraphUtils;
import org.apache.flink.util.Collector;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+/**
+ * Test output types from {@link Graph} methods.
+ */
public class TypeExtractorTest {
private Graph<Long, Long, Long> inputGraph;
@@ -81,7 +89,7 @@ public class TypeExtractorTest {
Assert.assertTrue((new TupleTypeInfo<Tuple2<Long, Long>>(BasicTypeInfo.LONG_TYPE_INFO, BasicTypeInfo.LONG_TYPE_INFO)).equals(output.getType()));
}
- public static final class VertexMapper<K> implements MapFunction<Vertex<K, Long>, Tuple2<K, Integer>> {
+ private static final class VertexMapper<K> implements MapFunction<Vertex<K, Long>, Tuple2<K, Integer>> {
private final Tuple2<K, Integer> outTuple = new Tuple2<>();
@@ -91,7 +99,7 @@ public class TypeExtractorTest {
}
}
- public static final class EdgeMapper<K> implements MapFunction<Edge<K, Long>, Tuple2<K, Integer>> {
+ private static final class EdgeMapper<K> implements MapFunction<Edge<K, Long>, Tuple2<K, Integer>> {
private final Tuple2<K, Integer> outTuple = new Tuple2<>();
@@ -101,7 +109,7 @@ public class TypeExtractorTest {
}
}
- public static final class EdgesGroupFunction<K, EV> implements EdgesFunction<K, EV, Tuple2<K, EV>> {
+ private static final class EdgesGroupFunction<K, EV> implements EdgesFunction<K, EV, Tuple2<K, EV>> {
@Override
public void iterateEdges(Iterable<Tuple2<K, Edge<K, EV>>> edges, Collector<Tuple2<K, EV>> out) throws Exception {
@@ -109,7 +117,7 @@ public class TypeExtractorTest {
}
}
- public static final class VertexInitializer<K> implements MapFunction<K, Tuple2<K, Integer>> {
+ private static final class VertexInitializer<K> implements MapFunction<K, Tuple2<K, Integer>> {
@Override
public Tuple2<K, Integer> map(K value) throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArrayComparatorTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArrayComparatorTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArrayComparatorTest.java
index bbc6846..89cb3f9 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArrayComparatorTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArrayComparatorTest.java
@@ -23,6 +23,9 @@ import org.apache.flink.api.common.typeutils.TypeComparator;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.types.IntValue;
+/**
+ * Tests for {@link IntValueArrayComparator}.
+ */
public class IntValueArrayComparatorTest extends ComparatorTestBase<IntValueArray> {
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArraySerializerTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArraySerializerTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArraySerializerTest.java
index 1ee24c9..88a367c 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArraySerializerTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArraySerializerTest.java
@@ -83,7 +83,7 @@ public class IntValueArraySerializerTest extends SerializerTestBase<IntValueArra
IntValueArray iva8 = new IntValueArray();
iva8.addAll(iva7);
- for (int i = 0 ; i < 1.5 * defaultElements ; i++) {
+ for (int i = 0; i < 1.5 * defaultElements; i++) {
iva8.add(new IntValue(i));
}
iva8.addAll(iva8);
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArrayTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArrayTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArrayTest.java
index 2e1282a..77d98a9 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArrayTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/IntValueArrayTest.java
@@ -19,12 +19,16 @@
package org.apache.flink.graph.types.valuearray;
import org.apache.flink.types.IntValue;
+
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+/**
+ * Tests for {@link IntValueArray}.
+ */
public class IntValueArrayTest {
@Test
@@ -34,7 +38,7 @@ public class IntValueArrayTest {
ValueArray<IntValue> iva = new IntValueArray(IntValueArray.DEFAULT_CAPACITY_IN_BYTES);
// fill the array
- for (int i = 0 ; i < count ; i++) {
+ for (int i = 0; i < count; i++) {
assertFalse(iva.isFull());
assertEquals(i, iva.size());
@@ -61,9 +65,9 @@ public class IntValueArrayTest {
assertEquals(iva, iva.copy());
// test copyTo
- IntValueArray iva_to = new IntValueArray();
- iva.copyTo(iva_to);
- assertEquals(iva, iva_to);
+ IntValueArray ivaTo = new IntValueArray();
+ iva.copyTo(ivaTo);
+ assertEquals(iva, ivaTo);
// test clear
iva.clear();
@@ -77,7 +81,7 @@ public class IntValueArrayTest {
ValueArray<IntValue> iva = new IntValueArray();
// add several elements
- for (int i = 0 ; i < count ; i++) {
+ for (int i = 0; i < count; i++) {
assertFalse(iva.isFull());
assertEquals(i, iva.size());
@@ -104,9 +108,9 @@ public class IntValueArrayTest {
assertEquals(iva, iva.copy());
// test copyTo
- IntValueArray iva_to = new IntValueArray();
- iva.copyTo(iva_to);
- assertEquals(iva, iva_to);
+ IntValueArray ivaTo = new IntValueArray();
+ iva.copyTo(ivaTo);
+ assertEquals(iva, ivaTo);
// test mark/reset
int size = iva.size();
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArrayComparatorTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArrayComparatorTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArrayComparatorTest.java
index af9dbdb..e76b840 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArrayComparatorTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArrayComparatorTest.java
@@ -23,6 +23,9 @@ import org.apache.flink.api.common.typeutils.TypeComparator;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.types.LongValue;
+/**
+ * Tests for {@link LongValueArrayComparator}.
+ */
public class LongValueArrayComparatorTest extends ComparatorTestBase<LongValueArray> {
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArraySerializerTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArraySerializerTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArraySerializerTest.java
index 1cd0a6c..50201da 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArraySerializerTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArraySerializerTest.java
@@ -83,7 +83,7 @@ public class LongValueArraySerializerTest extends SerializerTestBase<LongValueAr
LongValueArray lva8 = new LongValueArray();
lva8.addAll(lva7);
- for (int i = 0 ; i < 1.5 * defaultElements ; i++) {
+ for (int i = 0; i < 1.5 * defaultElements; i++) {
lva8.add(new LongValue(i));
}
lva8.addAll(lva8);
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArrayTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArrayTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArrayTest.java
index cfc345e..7acdc4c 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArrayTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/LongValueArrayTest.java
@@ -19,12 +19,16 @@
package org.apache.flink.graph.types.valuearray;
import org.apache.flink.types.LongValue;
+
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+/**
+ * Tests for {@link LongValueArray}.
+ */
public class LongValueArrayTest {
@Test
@@ -34,7 +38,7 @@ public class LongValueArrayTest {
ValueArray<LongValue> lva = new LongValueArray(LongValueArray.DEFAULT_CAPACITY_IN_BYTES);
// fill the array
- for (int i = 0 ; i < count ; i++) {
+ for (int i = 0; i < count; i++) {
assertFalse(lva.isFull());
assertEquals(i, lva.size());
@@ -61,9 +65,9 @@ public class LongValueArrayTest {
assertEquals(lva, lva.copy());
// test copyTo
- LongValueArray lva_to = new LongValueArray();
- lva.copyTo(lva_to);
- assertEquals(lva, lva_to);
+ LongValueArray lvaTo = new LongValueArray();
+ lva.copyTo(lvaTo);
+ assertEquals(lva, lvaTo);
// test clear
lva.clear();
@@ -77,7 +81,7 @@ public class LongValueArrayTest {
ValueArray<LongValue> lva = new LongValueArray();
// add several elements
- for (int i = 0 ; i < count ; i++) {
+ for (int i = 0; i < count; i++) {
assertFalse(lva.isFull());
assertEquals(i, lva.size());
@@ -104,9 +108,9 @@ public class LongValueArrayTest {
assertEquals(lva, lva.copy());
// test copyTo
- LongValueArray lva_to = new LongValueArray();
- lva.copyTo(lva_to);
- assertEquals(lva, lva_to);
+ LongValueArray lvaTo = new LongValueArray();
+ lva.copyTo(lvaTo);
+ assertEquals(lva, lvaTo);
// test mark/reset
int size = lva.size();
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArrayComparatorTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArrayComparatorTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArrayComparatorTest.java
index 10fa2e2..18f963f 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArrayComparatorTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArrayComparatorTest.java
@@ -23,6 +23,9 @@ import org.apache.flink.api.common.typeutils.TypeComparator;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.types.NullValue;
+/**
+ * Tests for {@link NullValueArrayComparator}.
+ */
public class NullValueArrayComparatorTest extends ComparatorTestBase<NullValueArray> {
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArraySerializerTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArraySerializerTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArraySerializerTest.java
index 2253a42..8cf1efa 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArraySerializerTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArraySerializerTest.java
@@ -58,7 +58,7 @@ public class NullValueArraySerializerTest extends SerializerTestBase<NullValueAr
NullValueArray nva3 = new NullValueArray();
nva3.addAll(nva2);
- for (int i = 0 ; i < 100 ; i++) {
+ for (int i = 0; i < 100; i++) {
nva3.add(nv);
}
nva3.addAll(nva3);
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArrayTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArrayTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArrayTest.java
index 6d013a1..988812e 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArrayTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/NullValueArrayTest.java
@@ -19,12 +19,16 @@
package org.apache.flink.graph.types.valuearray;
import org.apache.flink.types.NullValue;
+
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+/**
+ * Tests for {@link NullValueArray}.
+ */
public class NullValueArrayTest {
@Test
@@ -34,7 +38,7 @@ public class NullValueArrayTest {
ValueArray<NullValue> nva = new NullValueArray();
// add several elements
- for (int i = 0 ; i < count ; i++) {
+ for (int i = 0; i < count; i++) {
assertFalse(nva.isFull());
assertEquals(i, nva.size());
@@ -61,9 +65,9 @@ public class NullValueArrayTest {
assertEquals(nva, nva.copy());
// test copyTo
- NullValueArray nva_to = new NullValueArray();
- nva.copyTo(nva_to);
- assertEquals(nva, nva_to);
+ NullValueArray nvaTo = new NullValueArray();
+ nva.copyTo(nvaTo);
+ assertEquals(nva, nvaTo);
// test mark/reset
int size = nva.size();
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArrayComparatorTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArrayComparatorTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArrayComparatorTest.java
index e7cc102..618aa8b 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArrayComparatorTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArrayComparatorTest.java
@@ -23,6 +23,9 @@ import org.apache.flink.api.common.typeutils.TypeComparator;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.types.StringValue;
+/**
+ * Tests for {@link StringValueArrayComparator}.
+ */
public class StringValueArrayComparatorTest extends ComparatorTestBase<StringValueArray> {
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArraySerializerTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArraySerializerTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArraySerializerTest.java
index f5909da..52892ca 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArraySerializerTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArraySerializerTest.java
@@ -83,7 +83,7 @@ public class StringValueArraySerializerTest extends SerializerTestBase<StringVal
StringValueArray sva8 = new StringValueArray();
sva8.addAll(sva7);
- for (int i = 0 ; i < 1.5 * defaultElements ; i++) {
+ for (int i = 0; i < 1.5 * defaultElements; i++) {
sva8.add(new StringValue(String.valueOf(i)));
}
sva8.addAll(sva8);
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArrayTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArrayTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArrayTest.java
index a425e8e..d10e984 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArrayTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/StringValueArrayTest.java
@@ -19,12 +19,16 @@
package org.apache.flink.graph.types.valuearray;
import org.apache.flink.types.StringValue;
+
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+/**
+ * Tests for {@link StringValueArray}.
+ */
public class StringValueArrayTest {
@Test
@@ -35,11 +39,11 @@ public class StringValueArrayTest {
ValueArray<StringValue> sva = new StringValueArray(StringValueArray.DEFAULT_CAPACITY_IN_BYTES);
// fill the array
- for (int i = 0 ; i < count ; i++) {
+ for (int i = 0; i < count; i++) {
assertFalse(sva.isFull());
assertEquals(i, sva.size());
- assertTrue(sva.add(new StringValue(Character.toString((char)(i & 0x7F)))));
+ assertTrue(sva.add(new StringValue(Character.toString((char) (i & 0x7F)))));
assertEquals(i + 1, sva.size());
}
@@ -55,16 +59,16 @@ public class StringValueArrayTest {
}
// add element past end of array
- assertFalse(sva.add(new StringValue(String.valueOf((char)count))));
+ assertFalse(sva.add(new StringValue(String.valueOf((char) count))));
assertFalse(sva.addAll(sva));
// test copy
assertEquals(sva, sva.copy());
// test copyTo
- StringValueArray sva_to = new StringValueArray();
- sva.copyTo(sva_to);
- assertEquals(sva, sva_to);
+ StringValueArray svaTo = new StringValueArray();
+ sva.copyTo(svaTo);
+ assertEquals(sva, svaTo);
// test clear
sva.clear();
@@ -79,11 +83,11 @@ public class StringValueArrayTest {
ValueArray<StringValue> sva = new StringValueArray(3200);
// fill the array
- for (int i = 0 ; i < count ; i++) {
+ for (int i = 0; i < count; i++) {
assertFalse(sva.isFull());
assertEquals(i, sva.size());
- assertTrue(sva.add(new StringValue(Character.toString((char)(i & 0xFF)))));
+ assertTrue(sva.add(new StringValue(Character.toString((char) (i & 0xFF)))));
assertEquals(i + 1, sva.size());
}
@@ -99,16 +103,16 @@ public class StringValueArrayTest {
}
// add element past end of array
- assertFalse(sva.add(new StringValue(String.valueOf((char)count))));
+ assertFalse(sva.add(new StringValue(String.valueOf((char) count))));
assertFalse(sva.addAll(sva));
// test copy
assertEquals(sva, sva.copy());
// test copyTo
- StringValueArray sva_to = new StringValueArray();
- sva.copyTo(sva_to);
- assertEquals(sva, sva_to);
+ StringValueArray svaTo = new StringValueArray();
+ sva.copyTo(svaTo);
+ assertEquals(sva, svaTo);
// test clear
sva.clear();
@@ -122,11 +126,11 @@ public class StringValueArrayTest {
ValueArray<StringValue> sva = new StringValueArray();
// add several elements
- for (int i = 0 ; i < count ; i++) {
+ for (int i = 0; i < count; i++) {
assertFalse(sva.isFull());
assertEquals(i, sva.size());
- assertTrue(sva.add(new StringValue(String.valueOf((char)i))));
+ assertTrue(sva.add(new StringValue(String.valueOf((char) i))));
assertEquals(i + 1, sva.size());
}
@@ -142,16 +146,16 @@ public class StringValueArrayTest {
}
// add element past end of array
- assertTrue(sva.add(new StringValue(String.valueOf((char)count))));
+ assertTrue(sva.add(new StringValue(String.valueOf((char) count))));
assertTrue(sva.addAll(sva));
// test copy
assertEquals(sva, sva.copy());
// test copyTo
- StringValueArray sva_to = new StringValueArray();
- sva.copyTo(sva_to);
- assertEquals(sva, sva_to);
+ StringValueArray svaTo = new StringValueArray();
+ sva.copyTo(svaTo);
+ assertEquals(sva, svaTo);
// test mark/reset
int size = sva.size();
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/ValueArrayTypeInfoTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/ValueArrayTypeInfoTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/ValueArrayTypeInfoTest.java
index 73cecc0..54e9349 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/ValueArrayTypeInfoTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/types/valuearray/ValueArrayTypeInfoTest.java
@@ -21,7 +21,7 @@
package org.apache.flink.graph.types.valuearray;
import org.apache.flink.api.common.ExecutionConfig;
-import org.apache.flink.api.java.typeutils.runtime.CopyableValueComparator;
+
import org.junit.Test;
import static org.apache.flink.graph.types.valuearray.ValueArrayTypeInfo.INT_VALUE_ARRAY_TYPE_INFO;
@@ -30,6 +30,9 @@ import static org.apache.flink.graph.types.valuearray.ValueArrayTypeInfo.NULL_VA
import static org.apache.flink.graph.types.valuearray.ValueArrayTypeInfo.STRING_VALUE_ARRAY_TYPE_INFO;
import static org.junit.Assert.assertEquals;
+/**
+ * Tests for {@link ValueArrayTypeInfo}.
+ */
public class ValueArrayTypeInfoTest {
private ExecutionConfig config = new ExecutionConfig();
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/utils/proxy/OptionalBooleanTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/utils/proxy/OptionalBooleanTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/utils/proxy/OptionalBooleanTest.java
index a771f1f..3d6bb7a 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/utils/proxy/OptionalBooleanTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/utils/proxy/OptionalBooleanTest.java
@@ -19,12 +19,17 @@
package org.apache.flink.graph.utils.proxy;
import org.apache.flink.graph.utils.proxy.OptionalBoolean.State;
+
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for {@link OptionalBoolean}.
+ */
public class OptionalBooleanTest {
private OptionalBoolean u;
@@ -61,7 +66,6 @@ public class OptionalBooleanTest {
// unset, conflicting
assertTrue(u.conflictsWith(c));
-
// false, unset
assertFalse(f.conflictsWith(u));
@@ -74,7 +78,6 @@ public class OptionalBooleanTest {
// false, conflicting
assertTrue(f.conflictsWith(c));
-
// true, unset
assertFalse(t.conflictsWith(u));
@@ -87,7 +90,6 @@ public class OptionalBooleanTest {
// true, conflicting
assertTrue(t.conflictsWith(c));
-
// conflicting, unset
assertTrue(c.conflictsWith(u));
@@ -123,7 +125,6 @@ public class OptionalBooleanTest {
assertEquals(State.CONFLICTING, u.getState());
u.unset();
-
// false, unset => false
f.mergeWith(u);
assertEquals(State.FALSE, f.getState());
@@ -142,7 +143,6 @@ public class OptionalBooleanTest {
assertEquals(State.CONFLICTING, f.getState());
f.set(false);
-
// true, unset => true
t.mergeWith(u);
assertEquals(State.TRUE, t.getState());
@@ -161,7 +161,6 @@ public class OptionalBooleanTest {
assertEquals(State.CONFLICTING, t.getState());
t.set(true);
-
// conflicting, unset => conflicting
c.mergeWith(u);
assertEquals(State.CONFLICTING, c.getState());