Switched from jacoco to open-clover. Updated GzipCompressionCodec to improve coverage report.

This commit is contained in:
Micah Silverman 2017-09-02 20:29:36 -04:00
parent 8797f1d04f
commit 9aec59c4d9
3 changed files with 45 additions and 21 deletions

View File

@ -15,5 +15,5 @@ install: echo "No need to run mvn install -DskipTests then mvn install. Running
script: mvn install script: mvn install
after_success: after_success:
- test -z "$BUILD_COVERAGE" || mvn clean test jacoco:report coveralls:report - test -z "$BUILD_COVERAGE" || mvn clean test -Pclover.report coveralls:report

59
pom.xml
View File

@ -73,6 +73,7 @@
<junit.version>4.12</junit.version> <junit.version>4.12</junit.version>
<powermock.version>1.6.6</powermock.version> <powermock.version>1.6.6</powermock.version>
<failsafe.plugin.version>2.19.1</failsafe.plugin.version> <failsafe.plugin.version>2.19.1</failsafe.plugin.version>
<clover.version>4.2.0</clover.version>
</properties> </properties>
@ -269,24 +270,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<configuration>
<excludes>
<exclude>**/io/jsonwebtoken/lang/*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
@ -403,5 +386,45 @@
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile>
<id>clover.report</id>
<build>
<plugins>
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>${clover.version}</version>
<configuration>
<excludes>
<exclude>**/*Test*</exclude>
<exclude>**/*IT*</exclude>
<!-- leaving out lang as it mostly comes from other sources -->
<exclude>io/jsonwebtoken/lang/*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>clover</id>
<phase>verify</phase>
<goals>
<goal>instrument</goal>
<goal>check</goal>
<goal>clover</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>${clover.version}</version>
</plugin>
</plugins>
</reporting>
</profile>
</profiles> </profiles>
</project> </project>

View File

@ -50,9 +50,10 @@ public class GzipCompressionCodec extends AbstractCompressionCodec implements Co
inputStream = new ByteArrayInputStream(compressed); inputStream = new ByteArrayInputStream(compressed);
gzipInputStream = new GZIPInputStream(inputStream); gzipInputStream = new GZIPInputStream(inputStream);
outputStream = new ByteArrayOutputStream(); outputStream = new ByteArrayOutputStream();
int read; int read = gzipInputStream.read(buffer);
while ((read = gzipInputStream.read(buffer)) != -1) { while (read != -1) {
outputStream.write(buffer, 0, read); outputStream.write(buffer, 0, read);
read = gzipInputStream.read(buffer);
} }
return outputStream.toByteArray(); return outputStream.toByteArray();
} finally { } finally {