Skip to content

Commit

Permalink
Merge pull request #156 from salesforce/feature/#155
Browse files Browse the repository at this point in the history
provides draft support for java 11
  • Loading branch information
rmichela authored Apr 3, 2019
2 parents bbf1fa1 + f66b552 commit fffc92c
Show file tree
Hide file tree
Showing 25 changed files with 232 additions and 121 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: java
jdk:
- oraclejdk8
- openjdk11

after_success:
- bash <(curl -s https://codecov.io/bash)
14 changes: 12 additions & 2 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,18 @@
<version>2.1.10</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,25 @@
*/
package com.salesforce.reactivegrpc.jmh;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Collections;
import java.util.stream.Stream;

import jdk.nashorn.internal.ir.annotations.Ignore;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.BenchmarkList;
import org.openjdk.jmh.runner.BenchmarkListEntry;
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.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

@RunWith(Parameterized.class)
public class BenchmarkTest {
private final String benchmark;


public BenchmarkTest(String benchmark, String name) {
this.benchmark = benchmark;
}

@Test
@Ignore
public void run() throws RunnerException {
@MethodSource("data")
public void run(String benchmark, String name) throws RunnerException {
Options opt = new OptionsBuilder()
.include(benchmark)
.shouldFailOnError(true)
Expand All @@ -43,16 +33,18 @@ public void run() throws RunnerException {
RunResult result = runner.runSingle();
}

@Parameterized.Parameters(name = "{1}")
public static Collection<Object[]> data() {
public static Stream<Arguments> data() {
BenchmarkList benchmarkList = BenchmarkList.fromResource("META-INF/BenchmarkList");

List<Object[]> ret = new ArrayList<>();
for (BenchmarkListEntry benchmark : benchmarkList.getAll(null, Collections.emptyList())) {
String method = benchmark.getUsername();
ret.add(new Object[] {method, method.replace("com.salesforce.reactivegrpc.jmh.", "")});
}

return ret;
return benchmarkList
.getAll(null, Collections.emptyList())
.stream()
.map(benchmark1 -> {
String method = benchmark1.getUsername();
return Arguments.of(
method,
method.replace("com.salesforce.reactivegrpc.jmh.", "")
);
});
}
}
25 changes: 10 additions & 15 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,18 @@
<property name="fileExtensions" value="java"/>
</module>

<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
</module>

<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="CHECKSTYLE DISABLE ([\w\|]+) FOR (-?\d+) LINES"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="$2"/>
</module>


<module name="TreeWalker">
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
</module>

<module name="FileContentsHolder"/>

<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="CHECKSTYLE DISABLE ([\w\|]+) FOR (-?\d+) LINES"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="$2"/>
</module>

<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
Expand Down
21 changes: 18 additions & 3 deletions common/reactive-grpc-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@
<artifactId>reactive-grpc-common</artifactId>

<properties>
<java.version>1.6</java.version>
<java.version>1.7</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
Expand All @@ -36,8 +41,18 @@
<artifactId>grpc-stub</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,20 @@
import io.reactivex.plugins.RxJavaPlugins;
import io.reactivex.schedulers.Schedulers;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Subscription;

@RunWith(Parameterized.class)
public class AbstractSubscriberAndProducerTest {

private final Queue<Throwable> unhandledThrowable = new ConcurrentLinkedQueue<Throwable>();

@Parameterized.Parameters
public static Object[][] data() {
return new Object[5][0];
}

public AbstractSubscriberAndProducerTest() {
}


private static final ExecutorService executorService =
Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());


@Before
@BeforeEach
public void setUp() {
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
@Override
Expand All @@ -67,6 +56,7 @@ public void accept(Throwable throwable) {
}

@Test
@RepeatedTest(2)
public void shouldSupportOnlySingleSubscribersTest() throws InterruptedException {
final TestCallStreamObserver<Integer> downstream = new TestCallStreamObserver<Integer>(executorService);
for (int i = 0; i < 1000; i++) {
Expand Down Expand Up @@ -104,6 +94,7 @@ public void run() {
}

@Test
@RepeatedTest(2)
public void shouldSupportOnlySingleSubscriptionTest() throws InterruptedException {
for (int i = 0; i < 1000; i++) {
final CountDownLatch cancelLatch = new CountDownLatch(1);
Expand Down Expand Up @@ -135,6 +126,7 @@ public void run() {
}

@Test
@RepeatedTest(2)
public void regularModeWithRacingTest() {
final AtomicLong requested = new AtomicLong();
final AtomicBoolean pingPing = new AtomicBoolean();
Expand Down Expand Up @@ -180,6 +172,7 @@ public void accept(Integer integer) {
}

@Test
@RepeatedTest(2)
public void asyncModeWithRacingTest() {
List<Integer> integers = Flowable.range(0, 10000000)
.toList()
Expand All @@ -205,6 +198,7 @@ public void asyncModeWithRacingTest() {
}

@Test
@RepeatedTest(2)
public void syncModeWithRacingTest() throws InterruptedException {
List<Integer> integers = Flowable.range(0, 10000000)
.toList()
Expand Down Expand Up @@ -237,6 +231,7 @@ public void run() {
}

@Test
@RepeatedTest(2)
public void regularModeWithRacingAndOnErrorTest() {
final AtomicBoolean pingPing = new AtomicBoolean();
List<Integer> integers = Flowable.range(0, 10000000)
Expand Down Expand Up @@ -285,6 +280,7 @@ public void accept(Integer integer) {
}

@Test
@RepeatedTest(2)
public void asyncModeWithRacingAndOnErrorTest() {

List<Integer> integers = Flowable.range(0, 10000000)
Expand Down Expand Up @@ -317,6 +313,7 @@ public void asyncModeWithRacingAndOnErrorTest() {
}

@Test
@RepeatedTest(2)
public void asyncModeWithRacingAndErrorTest() throws InterruptedException {
final CountDownLatch cancellationLatch = new CountDownLatch(1);
List<Integer> integers = Flowable.range(0, 10000000)
Expand Down Expand Up @@ -364,6 +361,7 @@ public Integer apply(Integer i) {
}

@Test
@RepeatedTest(2)
public void syncModeWithRacingAndErrorTest() throws InterruptedException {
final CountDownLatch cancellationLatch = new CountDownLatch(1);
List<Integer> integers = Flowable.range(0, 100000)
Expand Down Expand Up @@ -417,6 +415,7 @@ public void run() {
}

@Test
@RepeatedTest(2)
public void regularModeWithRacingAndOnErrorOverOnNextTest()
throws InterruptedException {
final AtomicLong requested = new AtomicLong();
Expand Down Expand Up @@ -472,6 +471,7 @@ public void accept(long r) {
}

@Test
@RepeatedTest(2)
public void asyncModeWithRacingAndOnErrorOverOnNextTest()
throws InterruptedException {
final CountDownLatch cancellationLatch = new CountDownLatch(1);
Expand Down Expand Up @@ -511,6 +511,7 @@ public void run() {
}

@Test
@RepeatedTest(2)
public void syncModeWithRacingAndOnErrorOverOnNextTest() throws InterruptedException {
final CountDownLatch cancellationLatch = new CountDownLatch(1);
List<Integer> integers = Flowable.range(0, 100000)
Expand Down Expand Up @@ -555,6 +556,7 @@ public void run() {
}

@Test
@RepeatedTest(2)
public void regularModeWithRacingAndCancellationTest() throws InterruptedException {
final AtomicLong requested = new AtomicLong();
final AtomicLong produced = new AtomicLong();
Expand Down Expand Up @@ -607,6 +609,7 @@ public void accept(long r) {
}

@Test
@RepeatedTest(2)
public void asyncModeWithRacingAndCancellationTest() throws InterruptedException {
final CountDownLatch cancellationLatch = new CountDownLatch(1);

Expand Down Expand Up @@ -645,6 +648,7 @@ public void run() {
}

@Test
@RepeatedTest(2)
public void syncModeWithRacingAndCancellationTest() throws InterruptedException {
final CountDownLatch cancellationLatch = new CountDownLatch(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subscribers.TestSubscriber;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;

import static com.salesforce.reactivegrpc.common.AbstractStreamObserverAndPublisher.DEFAULT_CHUNK_SIZE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io.reactivex.Flowable;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subscribers.TestSubscriber;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
Expand Down
Loading

0 comments on commit fffc92c

Please sign in to comment.