Repository: incubator-pirk
Updated Branches:
  refs/heads/master 712e25359 -> 40f14dce4


Add maven plugin for displaying code coverage stats, formatted source - closes 
apache/incubator-pirk#58


Project: http://git-wip-us.apache.org/repos/asf/incubator-pirk/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-pirk/commit/40f14dce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-pirk/tree/40f14dce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-pirk/diff/40f14dce

Branch: refs/heads/master
Commit: 40f14dce44e7d80fa8a2bfdb7332c25fa3ef2a63
Parents: 712e253
Author: smarthi <smar...@apache.org>
Authored: Fri Aug 12 13:20:27 2016 -0400
Committer: eawilliams <eawilli...@apache.org>
Committed: Fri Aug 12 13:20:27 2016 -0400

----------------------------------------------------------------------
 README.md                                       |  6 ++-
 pom.xml                                         | 33 ++++++++++++++
 .../partitioner/PrimitiveTypePartitioner.java   | 48 +++++---------------
 .../apache/pirk/general/PartitionUtilsTest.java | 14 +++---
 4 files changed, 55 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/40f14dce/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 7109a01..a464fc4 100644
--- a/README.md
+++ b/README.md
@@ -18,9 +18,11 @@ limitations under the License.
 <img alt="Apache Pirk" class="img-responsive" src="contrib/pirkImage.png" 
width="350"/>
 --
 
+--
+
 [![Build 
Status](https://api.travis-ci.org/apache/incubator-pirk.svg?branch=master)](https://travis-ci.org/apache/incubator-pirk?branch=master)
 [![Coverage 
Status](https://coveralls.io/repos/github/apache/incubator-pirk/badge.svg?branch=master)](https://coveralls.io/github/apache/incubator-pirk?branch=master)
---
+
 
 [Apache Pirk (incubating)](http://pirk.incubator.apache.org/) is a framework 
for scalable Private Information Retrieval (PIR). The goal of Pirk is to 
provide a landing place for robust, scalable, and practical implementations of 
PIR algorithms.
 
@@ -39,7 +41,7 @@ For convenience, the following POM files are included:
 
 Pirk may be built with a specific pom file via ‘mvn package -f ’
 
-Dependencies can be found in the pom.xml file and include [Apache 
Hadoop](http://hadoop.apache.org/), [Apache Spark](http://spark.apache.org/),  
and [Elasticsearch](https://github.com/elastic/elasticsearch). Currently, Pirk 
may be utilized in a distributed Hadoop/MapReduce or Spark framework as well as 
in standalone mode.
+Dependencies can be found in the pom.xml file and include [Apache 
Hadoop](http://hadoop.apache.org/), [Apache Spark](http://spark.apache.org/), 
and [Elasticsearch](https://github.com/elastic/elasticsearch). Currently, Pirk 
may be utilized in a distributed Hadoop/MapReduce or Spark framework as well as 
in standalone mode.
 
 If you are a User, please check out the [For 
Users](http://pirk.incubator.apache.org/for_users) section of the Pirk website.
 

http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/40f14dce/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 91c67f3..66b005f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -335,6 +335,39 @@
                                        </executions>
                                </plugin>
 
+                               <!-- Coverage analysis for tests -->
+                               <plugin>
+                                       <groupId>org.jacoco</groupId>
+                                       
<artifactId>jacoco-maven-plugin</artifactId>
+                                       <version>0.7.5.201505241946</version>
+                                       <executions>
+                                               <execution>
+                                                       <goals>
+                                                               
<goal>prepare-agent</goal>
+                                                       </goals>
+                                                       <configuration>
+                                                               
<output>file</output>
+                                                               
<dumpOnExit>true</dumpOnExit>
+                                                       </configuration>
+                                               </execution>
+                                               <execution>
+                                                       <id>report</id>
+                                                       
<phase>prepare-package</phase>
+                                                       <goals>
+                                                               
<goal>report</goal>
+                                                       </goals>
+                                               </execution>
+                                       </executions>
+                               </plugin>
+
+                               <!-- Report jacoco coverage to coveralls.io -->
+                               <plugin>
+                                       <groupId>org.eluder.coveralls</groupId>
+                                       
<artifactId>coveralls-maven-plugin</artifactId>
+                                       <version>4.1.0</version>
+                               </plugin>
+
+
                                <plugin>
                                        
<groupId>org.apache.maven.plugins</groupId>
                                        
<artifactId>maven-surefire-plugin</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/40f14dce/src/main/java/org/apache/pirk/schema/data/partitioner/PrimitiveTypePartitioner.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/pirk/schema/data/partitioner/PrimitiveTypePartitioner.java
 
b/src/main/java/org/apache/pirk/schema/data/partitioner/PrimitiveTypePartitioner.java
index 10ebefe..f767a5a 100644
--- 
a/src/main/java/org/apache/pirk/schema/data/partitioner/PrimitiveTypePartitioner.java
+++ 
b/src/main/java/org/apache/pirk/schema/data/partitioner/PrimitiveTypePartitioner.java
@@ -350,59 +350,33 @@ public class PrimitiveTypePartitioner implements 
DataPartitioner
 
   private byte[] shortToBytes(short value)
   {
-    return new byte[] {
-        (byte) (value >> 8),
-        (byte) value};
+    return new byte[] {(byte) (value >> 8), (byte) value};
   }
 
   private short bytesToShort(byte[] bytes)
   {
-    return (short)(
-        bytes[0] << 8 |
-        bytes[1] & 0xff);
+    return (short) (bytes[0] << 8 | bytes[1] & 0xff);
   }
 
   private byte[] intToBytes(int value)
   {
-    return new byte[] {
-        (byte) (value >> 24), 
-        (byte) (value >> 16), 
-        (byte) (value >> 8), 
-        (byte) value};
+    return new byte[] {(byte) (value >> 24), (byte) (value >> 16), (byte) 
(value >> 8), (byte) value};
   }
-  
+
   private int bytesToInt(byte[] bytes)
   {
-    return
-        (bytes[0] << 24) |
-        (bytes[1] & 0xff) << 16 |
-        (bytes[2] & 0xff) << 8 |
-        (bytes[3] & 0xff);
+    return (bytes[0] << 24) | (bytes[1] & 0xff) << 16 | (bytes[2] & 0xff) << 8 
| (bytes[3] & 0xff);
   }
-  
+
   private byte[] longToBytes(long value)
   {
-    return new byte[] {
-        (byte) (value >> 56),
-        (byte) (value >> 48),
-        (byte) (value >> 40),
-        (byte) (value >> 32),
-        (byte) (value >> 24),
-        (byte) (value >> 16),
-        (byte) (value >> 8),
-        (byte) value};
+    return new byte[] {(byte) (value >> 56), (byte) (value >> 48), (byte) 
(value >> 40), (byte) (value >> 32), (byte) (value >> 24), (byte) (value >> 16),
+        (byte) (value >> 8), (byte) value};
   }
-  
+
   private long bytesToLong(byte[] bytes)
   {
-    return
-         (long)bytes[0] << 56 |
-        ((long)bytes[1] & 0xff) << 48 |
-        ((long)bytes[2] & 0xff) << 40 |
-        ((long)bytes[3] & 0xff) << 32 |
-        ((long)bytes[4] & 0xff) << 24 |
-        ((long)bytes[5] & 0xff) << 16 |
-        ((long)bytes[6] & 0xff) << 8 |
-         (long)bytes[7] & 0xff;
+    return (long) bytes[0] << 56 | ((long) bytes[1] & 0xff) << 48 | ((long) 
bytes[2] & 0xff) << 40 | ((long) bytes[3] & 0xff) << 32
+        | ((long) bytes[4] & 0xff) << 24 | ((long) bytes[5] & 0xff) << 16 | 
((long) bytes[6] & 0xff) << 8 | (long) bytes[7] & 0xff;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/40f14dce/src/test/java/org/apache/pirk/general/PartitionUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pirk/general/PartitionUtilsTest.java 
b/src/test/java/org/apache/pirk/general/PartitionUtilsTest.java
index 45f20bf..ccca2d7 100644
--- a/src/test/java/org/apache/pirk/general/PartitionUtilsTest.java
+++ b/src/test/java/org/apache/pirk/general/PartitionUtilsTest.java
@@ -144,8 +144,8 @@ public class PartitionUtilsTest
 
     partsByte = primitivePartitioner.toPartitions("12", 
PrimitiveTypePartitioner.BYTE);
     assertEquals(1, partsByte.size());
-    assertEquals((byte)12, primitivePartitioner.fromPartitions(partsByte, 0, 
PrimitiveTypePartitioner.BYTE));
-    
+    assertEquals((byte) 12, primitivePartitioner.fromPartitions(partsByte, 0, 
PrimitiveTypePartitioner.BYTE));
+
     ArrayList<BigInteger> partsByteMax = 
primitivePartitioner.toPartitions(Byte.MAX_VALUE, 
PrimitiveTypePartitioner.BYTE);
     assertEquals(1, partsByteMax.size());
     assertEquals(Byte.MAX_VALUE, 
primitivePartitioner.fromPartitions(partsByteMax, 0, 
PrimitiveTypePartitioner.BYTE));
@@ -165,12 +165,12 @@ public class PartitionUtilsTest
 
     partsShort = primitivePartitioner.toPartitions("32767", 
PrimitiveTypePartitioner.SHORT);
     assertEquals(2, partsShort.size());
-    assertEquals((short)32767, primitivePartitioner.fromPartitions(partsShort, 
0, PrimitiveTypePartitioner.SHORT));
-    
+    assertEquals((short) 32767, 
primitivePartitioner.fromPartitions(partsShort, 0, 
PrimitiveTypePartitioner.SHORT));
+
     partsShort = primitivePartitioner.toPartitions((short) -42, 
PrimitiveTypePartitioner.SHORT);
     assertEquals(2, partsShort.size());
     assertEquals((short) -42, primitivePartitioner.fromPartitions(partsShort, 
0, PrimitiveTypePartitioner.SHORT));
-    
+
     ArrayList<BigInteger> partsShortMax = 
primitivePartitioner.toPartitions(Short.MAX_VALUE, 
PrimitiveTypePartitioner.SHORT);
     assertEquals(2, partsShortMax.size());
     assertEquals(Short.MAX_VALUE, 
primitivePartitioner.fromPartitions(partsShortMax, 0, 
PrimitiveTypePartitioner.SHORT));
@@ -238,12 +238,12 @@ public class PartitionUtilsTest
     partsChar = primitivePartitioner.toPartitions(charTest, 
PrimitiveTypePartitioner.CHAR);
     assertEquals(2, partsChar.size());
     assertEquals(charTest, primitivePartitioner.fromPartitions(partsChar, 0, 
PrimitiveTypePartitioner.CHAR));
-    
+
     charTest = '\uFEFF';
     partsChar = primitivePartitioner.toPartitions(charTest, 
PrimitiveTypePartitioner.CHAR);
     assertEquals(2, partsChar.size());
     assertEquals(charTest, primitivePartitioner.fromPartitions(partsChar, 0, 
PrimitiveTypePartitioner.CHAR));
-    
+
     ArrayList<BigInteger> partsCharMax = 
primitivePartitioner.toPartitions(Character.MAX_VALUE, 
PrimitiveTypePartitioner.CHAR);
     assertEquals(2, partsCharMax.size());
     assertEquals(Character.MAX_VALUE, 
primitivePartitioner.fromPartitions(partsCharMax, 0, 
PrimitiveTypePartitioner.CHAR));

Reply via email to