Permalink
Browse files

chore: make sure ubenchmark is tested with checkstyle

closes #564
  • Loading branch information...
vlsi committed May 14, 2016
1 parent db1a6e4 commit f6ed8e6768914f06a3108cbc9a969bb9d46b8f7b
Showing with 34 additions and 8 deletions.
  1. +1 −1 .travis.yml
  2. +25 −0 ubenchmark/pom.xml
  3. +8 −7 ubenchmark/src/main/java/org/postgresql/benchmark/statement/InsertBatch.java
@@ -64,7 +64,7 @@ matrix:
- COVERAGE=Y
- jdk: oraclejdk8
env: RUN_CHECKSTYLE=true
script: cd pgjdbc && mvn checkstyle:check
script: mvn checkstyle:check
- jdk: oraclejdk8
addons:
postgresql: "9.4"
@@ -73,6 +73,31 @@ POSSIBILITY OF SUCH DAMAGE.
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.13</version>
</dependency>
</dependencies>
<configuration>
<configLocation>../pgjdbc/src/main/checkstyle/checks.xml</configLocation>
<violationSeverity>error</violationSeverity>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
<consoleOutput>true</consoleOutput>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>com.igormaznitsa</groupId>
@@ -28,13 +28,11 @@
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.profile.GCProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

import java.io.CharArrayReader;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.sql.Connection;
@@ -118,9 +116,12 @@ public void tearDown() throws SQLException {
// Multi values(),(),() case
for (int i = 0; i < p1nrows; ) {
for (int k = 0, pos = 1; k < p2multi; k++, i++) {
ps.setInt(pos, i); pos++;
ps.setString(pos, strings[i]); pos++;
ps.setInt(pos, i); pos++;
ps.setInt(pos, i);
pos++;
ps.setString(pos, strings[i]);
pos++;
ps.setInt(pos, i);
pos++;
}
ps.addBatch();
}
@@ -220,8 +221,8 @@ public static void main(String[] args) throws RunnerException {
//Driver.setLogLevel(2);
Options opt = new OptionsBuilder()
.include(InsertBatch.class.getSimpleName())
// .addProfiler(GCProfiler.class)
// .addProfiler(FlightRecorderProfiler.class)
//.addProfiler(org.openjdk.jmh.profile.GCProfiler.class)
//.addProfiler(org.postgresql.benchmark.profilers.FlightRecorderProfiler.class)
.detectJvmArgs()
.build();

0 comments on commit f6ed8e6

Please sign in to comment.