Add camel-jmh tests
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/50d134f7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/50d134f7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/50d134f7 Branch: refs/heads/master Commit: 50d134f72d2ba98bb12980133feb55f55bc65d10 Parents: 429a2e4 Author: Claus Ibsen <davscl...@apache.org> Authored: Sat Jun 10 10:09:44 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat Jun 10 10:09:44 2017 +0200 ---------------------------------------------------------------------- tests/camel-jmh/pom.xml | 33 ++++++++++++++------ .../camel/itest/jmh/CaseInsensitiveMapTest.java | 10 +----- .../itest/jmh/DefaultUuidGeneratorTest.java | 6 +--- .../apache/camel/itest/jmh/SimpleMockTest.java | 6 +--- .../camel/itest/jmh/TypeConverterTest.java | 6 +--- 5 files changed, 28 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/50d134f7/tests/camel-jmh/pom.xml ---------------------------------------------------------------------- diff --git a/tests/camel-jmh/pom.xml b/tests/camel-jmh/pom.xml index de625ea..d35cc6d 100644 --- a/tests/camel-jmh/pom.xml +++ b/tests/camel-jmh/pom.xml @@ -17,7 +17,8 @@ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -87,21 +88,35 @@ </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${maven-surefire-plugin-version}</version> + <configuration> + <includes> + <include>**/*XXX.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + + <!-- to run tests: mvn test -P jmh --> <profiles> <profile> - <id>jdk9-build</id> - <activation> - <jdk>9</jdk> - </activation> + <id>jmh</id> <build> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>${maven-surefire-plugin-version}</version> <configuration> - <excludes> - <!-- TODO: until https://issues.apache.org/jira/browse/SUREFIRE-1265 is released. --> - <exclude>**/**.java</exclude> - </excludes> + <includes> + <include>**/*Test.java</include> + </includes> </configuration> </plugin> </plugins> http://git-wip-us.apache.org/repos/asf/camel/blob/50d134f7/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/CaseInsensitiveMapTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/CaseInsensitiveMapTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/CaseInsensitiveMapTest.java index f1a0a21..e705226 100644 --- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/CaseInsensitiveMapTest.java +++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/CaseInsensitiveMapTest.java @@ -23,11 +23,9 @@ import java.util.concurrent.TimeUnit; import org.apache.camel.util.CaseInsensitiveMap; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; -import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; @@ -49,7 +47,7 @@ public class CaseInsensitiveMapTest { // You can be more specific if you'd like to run only one benchmark per test. .include(this.getClass().getName() + ".*") // Set the following options as needed - .mode(Mode.AverageTime) + .mode(Mode.All) .timeUnit(TimeUnit.MICROSECONDS) .warmupTime(TimeValue.seconds(1)) .warmupIterations(2) @@ -82,8 +80,6 @@ public class CaseInsensitiveMapTest { } @Benchmark - @BenchmarkMode(Mode.AverageTime) - @OutputTimeUnit(TimeUnit.MILLISECONDS) @Measurement(batchSize = 1000000) public void camelMap(BenchmarkState state, Blackhole bh) { Map map = state.camelMap; @@ -102,8 +98,6 @@ public class CaseInsensitiveMapTest { } @Benchmark - @BenchmarkMode(Mode.AverageTime) - @OutputTimeUnit(TimeUnit.MILLISECONDS) @Measurement(batchSize = 1000000) public void cedarsoftMap(BenchmarkState state, Blackhole bh) { Map map = state.cedarsoftMap; @@ -122,8 +116,6 @@ public class CaseInsensitiveMapTest { } @Benchmark - @BenchmarkMode(Mode.AverageTime) - @OutputTimeUnit(TimeUnit.MILLISECONDS) @Measurement(batchSize = 1000000) public void hashMap(BenchmarkState state, Blackhole bh) { Map map = state.hashMap; http://git-wip-us.apache.org/repos/asf/camel/blob/50d134f7/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DefaultUuidGeneratorTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DefaultUuidGeneratorTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DefaultUuidGeneratorTest.java index eebbc07..881436a 100644 --- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DefaultUuidGeneratorTest.java +++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DefaultUuidGeneratorTest.java @@ -21,11 +21,9 @@ import java.util.concurrent.TimeUnit; import org.apache.camel.impl.DefaultUuidGenerator; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; -import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; @@ -49,7 +47,7 @@ public class DefaultUuidGeneratorTest { // You can be more specific if you'd like to run only one benchmark per test. .include(this.getClass().getName() + ".*") // Set the following options as needed - .mode(Mode.AverageTime) + .mode(Mode.All) .timeUnit(TimeUnit.MICROSECONDS) .warmupTime(TimeValue.seconds(1)) .warmupIterations(2) @@ -77,8 +75,6 @@ public class DefaultUuidGeneratorTest { } @Benchmark - @BenchmarkMode(Mode.AverageTime) - @OutputTimeUnit(TimeUnit.MILLISECONDS) @Measurement(batchSize = 1000000) public void benchmark(BenchmarkState state, Blackhole bh) { String id = state.uuid.generateUuid(); http://git-wip-us.apache.org/repos/asf/camel/blob/50d134f7/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleMockTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleMockTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleMockTest.java index 6fa8958..be45b6a 100644 --- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleMockTest.java +++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/SimpleMockTest.java @@ -24,11 +24,9 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; -import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; @@ -51,7 +49,7 @@ public class SimpleMockTest { // You can be more specific if you'd like to run only one benchmark per test. .include(this.getClass().getName() + ".*") // Set the following options as needed - .mode(Mode.AverageTime) + .mode(Mode.All) .timeUnit(TimeUnit.MICROSECONDS) .warmupTime(TimeValue.seconds(1)) .warmupIterations(2) @@ -103,8 +101,6 @@ public class SimpleMockTest { } @Benchmark - @BenchmarkMode(Mode.AverageTime) - @OutputTimeUnit(TimeUnit.MILLISECONDS) @Measurement(batchSize = 1000) public void simpleMockTest(BenchmarkState state, Blackhole bh) { ProducerTemplate template = state.producer; http://git-wip-us.apache.org/repos/asf/camel/blob/50d134f7/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/TypeConverterTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/TypeConverterTest.java b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/TypeConverterTest.java index 48a28aa..c51c8f8 100644 --- a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/TypeConverterTest.java +++ b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/TypeConverterTest.java @@ -22,11 +22,9 @@ import org.apache.camel.CamelContext; import org.apache.camel.impl.DefaultCamelContext; import org.junit.Test; import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; -import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; @@ -49,7 +47,7 @@ public class TypeConverterTest { // You can be more specific if you'd like to run only one benchmark per test. .include(this.getClass().getName() + ".*") // Set the following options as needed - .mode(Mode.AverageTime) + .mode(Mode.All) .timeUnit(TimeUnit.MICROSECONDS) .warmupTime(TimeValue.seconds(1)) .warmupIterations(2) @@ -92,8 +90,6 @@ public class TypeConverterTest { } @Benchmark - @BenchmarkMode(Mode.AverageTime) - @OutputTimeUnit(TimeUnit.MILLISECONDS) @Measurement(batchSize = 1000000) public void typeConvertIntegerToString(BenchmarkState state, Blackhole bh) { String id = state.camel.getTypeConverter().convertTo(String.class, 12345);