Skip to content

Commit

Permalink
HV-1278 Separating BV 2.0 tests from 1.1 ones
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-bekhta authored and gsmet committed Mar 29, 2017
1 parent 368f1df commit 9f71d10
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 8 deletions.
32 changes: 32 additions & 0 deletions performance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@
</dependencies>

<build>
<pluginManagement>
<plugins>
<!-- adding sources for BV 2.0 tests -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/src/main/java-bv2</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -154,6 +177,15 @@
<artifactId>log4j</artifactId>
</dependency>
</dependencies>
<!-- adding sources for BV 2.0 tests -->
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>hv-5.4</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License: Apache License, Version 2.0
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
*/
package org.hibernate.validator.performance.simple;
package org.hibernate.validator.performance.multilevel;

import java.util.ArrayList;
import java.util.LinkedHashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
*/
package org.hibernate.validator.performance;

import java.util.Objects;
import java.util.stream.Stream;

import org.hibernate.validator.performance.cascaded.CascadedValidation;
import org.hibernate.validator.performance.simple.MultiLevelContainerValidation;
import org.hibernate.validator.performance.simple.SimpleValidation;
import org.hibernate.validator.performance.statistical.StatisticalValidation;

import org.openjdk.jmh.results.format.ResultFormatType;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
Expand All @@ -29,12 +30,14 @@
*/
public final class BenchmarkRunner {

private static final Stream<Class<?>> DEFAULT_TEST_CLASSES = Stream.of(
SimpleValidation.class,
CascadedValidation.class,
StatisticalValidation.class,
MultiLevelContainerValidation.class
);
private static final Stream<? extends Class<?>> DEFAULT_TEST_CLASSES = Stream.of(
SimpleValidation.class.getName(),
CascadedValidation.class.getName(),
StatisticalValidation.class.getName(),
// Benchmarks specific to Bean Validation 2.0
// Tests are located in a separate source folder only added for implementations compatible with BV 2.0
"org.hibernate.validator.performance.multilevel.MultiLevelContainerValidation"
).map( BenchmarkRunner::classForName ).filter( Objects::nonNull );

private BenchmarkRunner() {
}
Expand All @@ -57,4 +60,14 @@ public static void main(String[] args) throws RunnerException, CommandLineOption
new Runner( opt ).run();
}

private static Class<?> classForName(String qualifiedName) {
try {
return Class.forName( qualifiedName );
}
catch (ClassNotFoundException e) {
// silently ignore the error
}
return null;
}

}

0 comments on commit 9f71d10

Please sign in to comment.