Permalink
Browse files

[#643] Re-enabling build fail on checkstyle violation

* Checkstyle 2.16 needs explicit configuration to fail on violations
* let travis check for checkstyle violations
* fixes #643
  • Loading branch information...
smee authored and s1ck committed Jul 5, 2017
1 parent 5034e54 commit 9096fa96842cb4b4908e08ade2743be983d67ceb
View
@@ -1,2 +1,3 @@
language: java
jdk: oraclejdk8
jdk: oraclejdk8
script: "mvn verify"
@@ -234,4 +234,4 @@
<property name="option" value="eol"/>
</module>
</module>
</module>
</module>
@@ -16,11 +16,8 @@
package org.gradoop.common.config;
import org.gradoop.common.model.api.entities.EPGMEdge;
import org.gradoop.common.model.api.entities.EPGMEdgeFactory;
import org.gradoop.common.model.api.entities.EPGMGraphHead;
import org.gradoop.common.model.api.entities.EPGMGraphHeadFactory;
import org.gradoop.common.model.api.entities.EPGMVertex;
import org.gradoop.common.model.api.entities.EPGMVertexFactory;
import org.gradoop.common.model.impl.pojo.Edge;
import org.gradoop.common.model.impl.pojo.EdgeFactory;
import org.gradoop.common.model.impl.pojo.GraphHead;
@@ -38,24 +35,29 @@
public class GradoopConfig
<G extends EPGMGraphHead, V extends EPGMVertex, E extends EPGMEdge> {
/**
* Knows how to create {@link GraphHead}
*/
private final GraphHeadFactory graphHeadFactory;
/**
* Knows how to create {@link Vertex}
*/
private final VertexFactory vertexFactory;
/**
* Knows how to create {@link Edge}
*/
private final EdgeFactory edgeFactory;
/**
* Creates a new Configuration.
*
* @param graphHeadHandler graph head handler
* @param vertexHandler vertex handler
* @param edgeHandler edge handler
*/
@SuppressWarnings("unchecked")
protected GradoopConfig() {
this.graphHeadFactory = new GraphHeadFactory();
this.vertexFactory = new VertexFactory();
this.edgeFactory = new EdgeFactory();
this.graphHeadFactory = new GraphHeadFactory();
this.vertexFactory = new VertexFactory();
this.edgeFactory = new EdgeFactory();
}
/**
@@ -65,8 +65,8 @@
* Required for {@link GradoopId#toString()}
*/
private static final char[] HEX_CHARS = new char[] {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
/**
* Internal byte representation
@@ -346,7 +346,7 @@ static boolean equals(byte[] first, byte[] second, int firstPos, int secondPos)
return false;
}
// compare timestamp (byte 0 to 3)
if (!equalsInRange(first, second, firstPos, secondPos,3)) {
if (!equalsInRange(first, second, firstPos, secondPos, 3)) {
return false;
}
@@ -425,6 +425,6 @@ private static boolean equalsInRange(byte[] first, byte[] second, int firstPos,
* @return int value
*/
private static int makeInt(final byte b3, final byte b2, final byte b1, final byte b0) {
return (((b3) << 24) | ((b2 & 0xff) << 16) | ((b1 & 0xff) << 8) | ((b0 & 0xff)));
return (b3 << 24) | ((b2 & 0xff) << 16) | ((b1 & 0xff) << 8) | ((b0 & 0xff));
}
}
@@ -43,7 +43,7 @@
/**
* Required default constructor for instantiation by serialization logic.
*/
public GradoopIdList() {}
public GradoopIdList() { }
/**
* Initializes the list with the given byte array.
@@ -128,13 +128,13 @@ public void addAll(GradoopIdList ids) {
* @param ids the ids to add
*/
public void addAll(Collection<GradoopId> ids) {
byte[] bytes = new byte[ids.size() * GradoopId.ID_SIZE];
byte[] bytesArray = new byte[ids.size() * GradoopId.ID_SIZE];
int i = 0;
for (GradoopId id : ids) {
System.arraycopy(id.toByteArray(), 0, bytes, i * GradoopId.ID_SIZE, GradoopId.ID_SIZE);
System.arraycopy(id.toByteArray(), 0, bytesArray, i * GradoopId.ID_SIZE, GradoopId.ID_SIZE);
i++;
}
addAll(new GradoopIdList(bytes));
addAll(new GradoopIdList(bytesArray));
}
/**
@@ -53,7 +53,7 @@
int year = date.getYear();
int month = date.getMonth().getValue();
int day = date.getDayOfMonth();
return serialize(new int[] {year, month, day});
}
@@ -121,7 +121,7 @@ public static LocalDate deserializeDate(byte[] bytes) {
int year = Bytes.toInt(bytes, 0, SIZEOF_INT);
int month = Bytes.toInt(bytes, SIZEOF_INT, SIZEOF_INT);
int day = Bytes.toInt(bytes, 2 * SIZEOF_INT, SIZEOF_INT);
return LocalDate.of(year, month, day);
}
@@ -137,7 +137,7 @@ public static LocalTime deserializeTime(byte[] bytes) {
int minute = Bytes.toInt(bytes, SIZEOF_INT, SIZEOF_INT);
int second = Bytes.toInt(bytes, 2 * SIZEOF_INT, SIZEOF_INT);
int nano = Bytes.toInt(bytes, 3 * SIZEOF_INT, SIZEOF_INT);
return LocalTime.of(hour, minute, second, nano);
}
@@ -156,7 +156,7 @@ public static LocalDateTime deserializeDateTime(byte[] bytes) {
int minute = Bytes.toInt(bytes, 4 * SIZEOF_INT, SIZEOF_INT);
int second = Bytes.toInt(bytes, 5 * SIZEOF_INT, SIZEOF_INT);
int nano = Bytes.toInt(bytes, 6 * SIZEOF_INT, SIZEOF_INT);
return LocalDateTime.of(year, month, day, hour, minute, second, nano);
}
}
@@ -54,11 +54,6 @@
*/
public static final PropertyValue NULL_VALUE = PropertyValue.create(null);
/**
* Class version for serialization.
*/
private static final long serialVersionUID = 1L;
/**
* {@code <property-type>} for empty property value (i.e. {@code null})
*/
@@ -116,12 +111,16 @@
*/
public static final transient byte TYPE_DATETIME = 0x0d;
/**
* Value offset in byte
*/
public static final transient byte OFFSET = 0x01;
/**
* Class version for serialization.
*/
private static final long serialVersionUID = 1L;
/**
* Stores the type and the value
*/
@@ -738,6 +737,11 @@ public void setBytes(byte[] bytes) {
this.rawBytes = bytes;
}
/**
* Create a {@link PropertyValue} that wraps a byte array
* @param rawBytes array to wrap
* @return new instance of {@link PropertyValue}
*/
public static PropertyValue fromRawBytes(byte[] rawBytes) {
return new PropertyValue(rawBytes);
}
@@ -25,7 +25,6 @@
import org.gradoop.common.model.impl.pojo.Vertex;
import org.gradoop.common.storage.api.GraphHeadHandler;
import org.gradoop.common.util.HBaseConstants;
import org.gradoop.common.config.GradoopStoreConfig;
import org.gradoop.common.model.impl.pojo.EdgeFactory;
import org.gradoop.common.model.impl.pojo.GraphHeadFactory;
import org.gradoop.common.model.impl.pojo.VertexFactory;
@@ -50,7 +49,7 @@
*/
public class GradoopHBaseConfig
<G extends EPGMGraphHead, V extends EPGMVertex, E extends EPGMEdge>
extends GradoopStoreConfig<G, V, E>{
extends GradoopStoreConfig<G, V, E> {
/**
* Graph table name.
@@ -78,13 +77,14 @@
* EPGMEdge handler.
*/
private final EdgeHandler<E, V> edgeHandler;
/**
* Creates a new Configuration.
*
* @param graphHeadHandler graph head handler
* @param vertexHandler vertex handler
* @param edgeHandler edge handler
* @param env flink execution environment
* @param graphTableName graph table name
* @param vertexTableName vertex table name
* @param edgeTableName edge table name
@@ -97,7 +97,7 @@ private GradoopHBaseConfig(
String graphTableName,
String vertexTableName,
String edgeTableName) {
super( new HBaseGraphHeadFactory<G>(),
super(new HBaseGraphHeadFactory<G>(),
new HBaseVertexFactory<V, E>(),
new HBaseEdgeFactory<E, V>(),
env);
@@ -111,13 +111,13 @@ private GradoopHBaseConfig(
this.graphTableName = graphTableName;
this.vertexTableName = vertexTableName;
this.edgeTableName = edgeTableName;
this.graphHeadHandler =
checkNotNull(graphHeadHandler, "GraphHeadHandler was null");
checkNotNull(graphHeadHandler, "GraphHeadHandler was null");
this.vertexHandler =
checkNotNull(vertexHandler, "VertexHandler was null");
checkNotNull(vertexHandler, "VertexHandler was null");
this.edgeHandler =
checkNotNull(edgeHandler, "EdgeHandler was null");
checkNotNull(edgeHandler, "EdgeHandler was null");
}
/**
@@ -145,9 +145,11 @@ private GradoopHBaseConfig(GradoopHBaseConfig<G, V, E> config,
* Creates a default Configuration using POJO handlers for vertices, edges
* and graph heads and default table names.
*
*@param env apache flink execution environment
* @return Default Gradoop HBase configuration.
*/
public static GradoopHBaseConfig<GraphHead, Vertex, Edge> getDefaultConfig(ExecutionEnvironment env) {
public static GradoopHBaseConfig<GraphHead, Vertex, Edge>
getDefaultConfig(ExecutionEnvironment env) {
GraphHeadHandler<GraphHead> graphHeadHandler =
new HBaseGraphHeadHandler<>(new GraphHeadFactory());
VertexHandler<Vertex, Edge> vertexHandler =
@@ -197,16 +199,16 @@ public String getEdgeTableName() {
public String getGraphTableName() {
return graphTableName;
}
public GraphHeadHandler<G> getGraphHeadHandler() {
return graphHeadHandler;
return graphHeadHandler;
}
public VertexHandler<V, E> getVertexHandler() {
return vertexHandler;
return vertexHandler;
}
public EdgeHandler<E, V> getEdgeHandler() {
return edgeHandler;
return edgeHandler;
}
}
@@ -21,9 +21,6 @@
import org.gradoop.common.model.api.entities.EPGMEdge;
import org.gradoop.common.model.api.entities.EPGMGraphHead;
import org.gradoop.common.model.api.entities.EPGMVertex;
import org.gradoop.common.model.impl.pojo.Edge;
import org.gradoop.common.model.impl.pojo.GraphHead;
import org.gradoop.common.model.impl.pojo.Vertex;
import org.gradoop.common.storage.api.PersistentEdgeFactory;
import org.gradoop.common.storage.api.PersistentGraphHeadFactory;
import org.gradoop.common.storage.api.PersistentVertexFactory;
@@ -35,7 +32,7 @@
* @param <G> EPGM graph head type
* @param <V> EPGM vertex type
* @param <E> EPGM edge type
*/
*/
public abstract class GradoopStoreConfig<G extends EPGMGraphHead, V extends EPGMVertex, E extends EPGMEdge>
extends GradoopFlinkConfig {
@@ -22,7 +22,6 @@
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Writables;
import org.gradoop.common.model.api.entities.EPGMEdge;
import org.gradoop.common.model.api.entities.EPGMVertex;
import org.gradoop.common.model.api.entities.EPGMVertexFactory;
@@ -218,9 +217,9 @@ private Put writeEdge(final Put put, final byte[] columnFamily, final E edge, bo
byte[] edgeIdentifier = edge.getId().toByteArray();
// extend by source or vertex id
byte[] otherVertexIdBytes = isOutgoing
? edge.getTargetId().toByteArray()
: edge.getSourceId().toByteArray();
byte[] otherVertexIdBytes = isOutgoing ?
edge.getTargetId().toByteArray() :
edge.getSourceId().toByteArray();
ArrayUtils.addAll(edgeIdentifier, otherVertexIdBytes);
@@ -68,7 +68,7 @@
* @param config Gradoop Flink configuration
*/
public HBaseDataSink(HBaseEPGMStore<GraphHead, Vertex, Edge> epgmStore,
GradoopFlinkConfig config) {
GradoopFlinkConfig config) {
super(epgmStore, config);
}
@@ -90,7 +90,6 @@ public void write(GraphTransactions graphTransactions) throws IOException {
@Override
public void write(LogicalGraph logicalGraph, boolean overWrite) throws IOException {
write(GraphCollection.fromGraph(logicalGraph), overWrite);
}
@Override
@@ -111,7 +110,6 @@ public void write(GraphCollection graphCollection, boolean overWrite) throws IOE
@Override
public void write(GraphTransactions graphTransactions, boolean overWrite) throws IOException {
write(GraphCollection.fromTransactions(graphTransactions), overWrite);
}
/**
@@ -155,7 +153,8 @@ private void writeGraphHeads(final GraphCollection collection)
persistentGraphDataSet
// FIXME remove forced cast...
.map(new BuildGraphHeadMutation((GraphHeadHandler<PersistentGraphHead>) ((Object)getHBaseConfig().getGraphHeadHandler())))
.map(new BuildGraphHeadMutation((GraphHeadHandler<PersistentGraphHead>)
((Object) getHBaseConfig().getGraphHeadHandler())))
.output(new HadoopOutputFormat<>(new TableOutputFormat<>(), job));
}
@@ -48,8 +48,8 @@
* @param epgmStore HBase store
* @param config Gradoop Flink configuration
*/
public HBaseDataSource(HBaseEPGMStore<GraphHead, Vertex, Edge> epgmStore,
GradoopFlinkConfig config) {
public HBaseDataSource(HBaseEPGMStore<GraphHead, Vertex, Edge> epgmStore,
GradoopFlinkConfig config) {
super(epgmStore, config);
}
@@ -60,7 +60,7 @@ public LogicalGraph getLogicalGraph() {
@Override
public GraphCollection getGraphCollection() {
GradoopHBaseConfig config = getHBaseConfig();
GradoopHBaseConfig config = getHBaseConfig();
HBaseEPGMStore store = getStore();
// used for type hinting when loading graph data
View
@@ -180,6 +180,8 @@
<includeTestResources>false</includeTestResources>
<suppressionsLocation>gradoop/checkstyle-suppressions.xml</suppressionsLocation>
<suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
<failsOnError>true</failsOnError>
<consoleOutput>true</consoleOutput>
</configuration>
<executions>
<execution>

0 comments on commit 9096fa9

Please sign in to comment.