diff --git a/.travis.yml b/.travis.yml index 681d088f..584c1ddd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: java jdk: - oraclejdk8 + - openjdk11 after_success: - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index 85e07896..fbaebf62 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -73,8 +73,18 @@ 2.1.10 - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.junit.jupiter + junit-jupiter-engine test diff --git a/benchmarks/src/test/java/com/salesforce/reactivegrpc/jmh/BenchmarkTest.java b/benchmarks/src/test/java/com/salesforce/reactivegrpc/jmh/BenchmarkTest.java index 077c41dc..4ce98e13 100644 --- a/benchmarks/src/test/java/com/salesforce/reactivegrpc/jmh/BenchmarkTest.java +++ b/benchmarks/src/test/java/com/salesforce/reactivegrpc/jmh/BenchmarkTest.java @@ -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) @@ -43,16 +33,18 @@ public void run() throws RunnerException { RunResult result = runner.runSingle(); } - @Parameterized.Parameters(name = "{1}") - public static Collection data() { + public static Stream data() { BenchmarkList benchmarkList = BenchmarkList.fromResource("META-INF/BenchmarkList"); - List 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.", "") + ); + }); } } diff --git a/checkstyle.xml b/checkstyle.xml index 89a039e3..bd8c36cd 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -47,23 +47,18 @@ - - - - - - - - - - - - - + + + + + - - + + + + + diff --git a/common/reactive-grpc-common/pom.xml b/common/reactive-grpc-common/pom.xml index 5e6d35b1..f184e9fc 100644 --- a/common/reactive-grpc-common/pom.xml +++ b/common/reactive-grpc-common/pom.xml @@ -20,12 +20,17 @@ reactive-grpc-common - 1.6 + 1.7 ${java.version} ${java.version} + + javax.annotation + javax.annotation-api + 1.3.2 + org.reactivestreams reactive-streams @@ -36,8 +41,18 @@ grpc-stub - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.junit.jupiter + junit-jupiter-engine test diff --git a/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/AbstractSubscriberAndProducerTest.java b/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/AbstractSubscriberAndProducerTest.java index 0be6bbba..64666170 100644 --- a/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/AbstractSubscriberAndProducerTest.java +++ b/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/AbstractSubscriberAndProducerTest.java @@ -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 unhandledThrowable = new ConcurrentLinkedQueue(); - @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() { @Override @@ -67,6 +56,7 @@ public void accept(Throwable throwable) { } @Test + @RepeatedTest(2) public void shouldSupportOnlySingleSubscribersTest() throws InterruptedException { final TestCallStreamObserver downstream = new TestCallStreamObserver(executorService); for (int i = 0; i < 1000; i++) { @@ -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); @@ -135,6 +126,7 @@ public void run() { } @Test + @RepeatedTest(2) public void regularModeWithRacingTest() { final AtomicLong requested = new AtomicLong(); final AtomicBoolean pingPing = new AtomicBoolean(); @@ -180,6 +172,7 @@ public void accept(Integer integer) { } @Test + @RepeatedTest(2) public void asyncModeWithRacingTest() { List integers = Flowable.range(0, 10000000) .toList() @@ -205,6 +198,7 @@ public void asyncModeWithRacingTest() { } @Test + @RepeatedTest(2) public void syncModeWithRacingTest() throws InterruptedException { List integers = Flowable.range(0, 10000000) .toList() @@ -237,6 +231,7 @@ public void run() { } @Test + @RepeatedTest(2) public void regularModeWithRacingAndOnErrorTest() { final AtomicBoolean pingPing = new AtomicBoolean(); List integers = Flowable.range(0, 10000000) @@ -285,6 +280,7 @@ public void accept(Integer integer) { } @Test + @RepeatedTest(2) public void asyncModeWithRacingAndOnErrorTest() { List integers = Flowable.range(0, 10000000) @@ -317,6 +313,7 @@ public void asyncModeWithRacingAndOnErrorTest() { } @Test + @RepeatedTest(2) public void asyncModeWithRacingAndErrorTest() throws InterruptedException { final CountDownLatch cancellationLatch = new CountDownLatch(1); List integers = Flowable.range(0, 10000000) @@ -364,6 +361,7 @@ public Integer apply(Integer i) { } @Test + @RepeatedTest(2) public void syncModeWithRacingAndErrorTest() throws InterruptedException { final CountDownLatch cancellationLatch = new CountDownLatch(1); List integers = Flowable.range(0, 100000) @@ -417,6 +415,7 @@ public void run() { } @Test + @RepeatedTest(2) public void regularModeWithRacingAndOnErrorOverOnNextTest() throws InterruptedException { final AtomicLong requested = new AtomicLong(); @@ -472,6 +471,7 @@ public void accept(long r) { } @Test + @RepeatedTest(2) public void asyncModeWithRacingAndOnErrorOverOnNextTest() throws InterruptedException { final CountDownLatch cancellationLatch = new CountDownLatch(1); @@ -511,6 +511,7 @@ public void run() { } @Test + @RepeatedTest(2) public void syncModeWithRacingAndOnErrorOverOnNextTest() throws InterruptedException { final CountDownLatch cancellationLatch = new CountDownLatch(1); List integers = Flowable.range(0, 100000) @@ -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(); @@ -607,6 +609,7 @@ public void accept(long r) { } @Test + @RepeatedTest(2) public void asyncModeWithRacingAndCancellationTest() throws InterruptedException { final CountDownLatch cancellationLatch = new CountDownLatch(1); @@ -645,6 +648,7 @@ public void run() { } @Test + @RepeatedTest(2) public void syncModeWithRacingAndCancellationTest() throws InterruptedException { final CountDownLatch cancellationLatch = new CountDownLatch(1); diff --git a/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/BackpressureChunkingTest.java b/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/BackpressureChunkingTest.java index ebbcadf0..03a9ad3c 100644 --- a/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/BackpressureChunkingTest.java +++ b/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/BackpressureChunkingTest.java @@ -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; diff --git a/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/CancellableStreamObserverTest.java b/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/CancellableStreamObserverTest.java index 348f7f4d..08959cfd 100644 --- a/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/CancellableStreamObserverTest.java +++ b/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/CancellableStreamObserverTest.java @@ -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; diff --git a/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/StreamObserverAndPublisherTest.java b/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/StreamObserverAndPublisherTest.java index ba7738ac..331afff3 100644 --- a/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/StreamObserverAndPublisherTest.java +++ b/common/reactive-grpc-common/src/test/java/com/salesforce/reactivegrpc/common/StreamObserverAndPublisherTest.java @@ -23,23 +23,16 @@ import io.reactivex.plugins.RxJavaPlugins; import io.reactivex.subscribers.TestSubscriber; 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 static com.salesforce.reactivegrpc.common.AbstractStreamObserverAndPublisher.DEFAULT_CHUNK_SIZE; -@RunWith(Parameterized.class) public class StreamObserverAndPublisherTest { static final int PART_OF_CHUNK = DEFAULT_CHUNK_SIZE * 2 / 3; - @Parameterized.Parameters - public static Object[][] data() { - return new Object[1][0]; - } - static final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); static final ExecutorService requestExecutorService = @@ -47,10 +40,8 @@ public static Object[][] data() { final Queue unhandledThrowable = new ConcurrentLinkedQueue(); - public StreamObserverAndPublisherTest() { - } - @Before + @BeforeEach public void setUp() { RxJavaPlugins.setErrorHandler(new Consumer() { @Override @@ -61,6 +52,7 @@ public void accept(Throwable throwable) { } @Test + @RepeatedTest(2) public void multithreadingRegularTest() { TestStreamObserverAndPublisher processor = new TestStreamObserverAndPublisher(null); @@ -98,6 +90,7 @@ public void run() { } @Test + @RepeatedTest(2) public void multithreadingFussedTest() { TestStreamObserverAndPublisher processor = @@ -136,6 +129,7 @@ public void run() { } @Test + @RepeatedTest(2) public void shouldSupportOnlySingleSubscriberTest() throws InterruptedException { for (int i = 0; i < 1000; i++) { final TestSubscriber downstream1 = new TestSubscriber(0); @@ -170,6 +164,7 @@ public void run() { } @Test + @RepeatedTest(2) public void shouldSupportOnlySingleSubscriptionTest() throws InterruptedException { for (int i = 0; i < 1000; i++) { final AtomicReference throwableAtomicReference = new AtomicReference(); @@ -208,6 +203,7 @@ public void run() { } @Test + @RepeatedTest(2) public void shouldSupportOnlySinglePrefetchTest() throws InterruptedException { for (int i = 0; i < 10; i++) { final TestSubscriber downstream = new TestSubscriber(0); diff --git a/pom.xml b/pom.xml index a6ec960a..34022fff 100644 --- a/pom.xml +++ b/pom.xml @@ -68,15 +68,18 @@ 3.1.9.RELEASE - 4.12 + 5.4.0 3.6.2 2.0.0 2.7.5 UTF-8 1.8 + 1.8 ${java.version} ${java.version} + ${java.test.version} + ${java.test.version} @@ -165,9 +168,21 @@ test - junit - junit - ${junit.version} + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit.jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-engine + ${junit.jupiter.version} test @@ -200,18 +215,20 @@ ${maven.compiler.source} ${maven.compiler.target} + ${maven.compiler.test.source} + ${maven.compiler.test.target} org.apache.maven.plugins maven-checkstyle-plugin - 2.17 + 3.0.0 com.puppycrawl.tools checkstyle - 7.1.2 + 8.19 @@ -237,18 +254,38 @@ 0.8.3 + prepare-agent prepare-agent report + prepare-package + + report + + + + post-unit-test test report + + + + target/jacoco.exec + + target/jacoco-ut + + + + target/jacoco.exec + + @@ -263,7 +300,7 @@ maven-javadoc-plugin 3.0.1 - -Xdoclint:none + -Xdoclint:none @@ -304,6 +341,18 @@ + + maven-surefire-plugin + 3.0.0-M3 + + + org.junit.platform + junit-platform-surefire-provider + 1.3.2 + + + + org.sonatype.plugins nexus-staging-maven-plugin diff --git a/reactor/reactor-grpc-stub/pom.xml b/reactor/reactor-grpc-stub/pom.xml index cde004b0..dca5585f 100644 --- a/reactor/reactor-grpc-stub/pom.xml +++ b/reactor/reactor-grpc-stub/pom.xml @@ -43,8 +43,18 @@ test - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.junit.jupiter + junit-jupiter-engine test diff --git a/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/GrpcRetryTest.java b/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/GrpcRetryTest.java index 4c786397..f42cffa5 100644 --- a/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/GrpcRetryTest.java +++ b/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/GrpcRetryTest.java @@ -7,7 +7,7 @@ package com.salesforce.reactorgrpc.stub; import com.salesforce.reactorgrpc.GrpcRetry; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.FluxSink; import reactor.core.publisher.Mono; diff --git a/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/ReactorClientStreamObserverAndPublisherTest.java b/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/ReactorClientStreamObserverAndPublisherTest.java index 826cbde2..dd44527c 100644 --- a/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/ReactorClientStreamObserverAndPublisherTest.java +++ b/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/ReactorClientStreamObserverAndPublisherTest.java @@ -9,7 +9,7 @@ import java.util.concurrent.ForkJoinPool; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.Fuseable; import reactor.core.publisher.Flux; import reactor.core.scheduler.Schedulers; diff --git a/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/SubscribeOnlyOnceTest.java b/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/SubscribeOnlyOnceTest.java index 78bb6c44..f8e7f939 100644 --- a/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/SubscribeOnlyOnceTest.java +++ b/reactor/reactor-grpc-stub/src/test/java/com/salesforce/reactorgrpc/stub/SubscribeOnlyOnceTest.java @@ -7,7 +7,7 @@ package com.salesforce.reactorgrpc.stub; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.reactivestreams.Subscription; import reactor.core.CoreSubscriber; diff --git a/reactor/reactor-grpc-tck/pom.xml b/reactor/reactor-grpc-tck/pom.xml index 34253c75..8531de73 100644 --- a/reactor/reactor-grpc-tck/pom.xml +++ b/reactor/reactor-grpc-tck/pom.xml @@ -52,10 +52,6 @@ ${reactive.streams.version} test - - io.grpc - grpc-core - io.netty netty-buffer diff --git a/reactor/reactor-grpc-test-32/pom.xml b/reactor/reactor-grpc-test-32/pom.xml index 57d172dc..8d611e1a 100644 --- a/reactor/reactor-grpc-test-32/pom.xml +++ b/reactor/reactor-grpc-test-32/pom.xml @@ -57,8 +57,18 @@ test - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.junit.jupiter + junit-jupiter-engine test diff --git a/reactor/reactor-grpc-test/pom.xml b/reactor/reactor-grpc-test/pom.xml index 0a76368d..6702f9d5 100644 --- a/reactor/reactor-grpc-test/pom.xml +++ b/reactor/reactor-grpc-test/pom.xml @@ -63,8 +63,18 @@ test - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.junit.jupiter + junit-jupiter-engine test diff --git a/reactor/reactor-grpc-test/src/test/java/com/salesforce/reactorgrpc/BackpressureIntegrationTest.java b/reactor/reactor-grpc-test/src/test/java/com/salesforce/reactorgrpc/BackpressureIntegrationTest.java index 11d3a6bf..d64e7cf7 100644 --- a/reactor/reactor-grpc-test/src/test/java/com/salesforce/reactorgrpc/BackpressureIntegrationTest.java +++ b/reactor/reactor-grpc-test/src/test/java/com/salesforce/reactorgrpc/BackpressureIntegrationTest.java @@ -31,7 +31,7 @@ @SuppressWarnings("Duplicates") @RunWith(Parameterized.class) public class BackpressureIntegrationTest { - private static final int NUMBER_OF_STREAM_ELEMENTS = 512 + (512 * 3 / 4); + private static final int NUMBER_OF_STREAM_ELEMENTS = 512 * 12; @Parameterized.Parameters @@ -93,7 +93,7 @@ public void clientToServerBackpressure() { .expectComplete() .verify(Duration.ofSeconds(15)); - assertThat(numberOfWaits.get()).isBetween(1L, 2L); + assertThat(numberOfWaits.get()).isGreaterThan(0L); } @Test @@ -119,7 +119,7 @@ public void serverToClientBackpressure() { .expectComplete() .verify(Duration.ofSeconds(15)); - assertThat(numberOfWaits.get()).isBetween(1L, 2L); + assertThat(numberOfWaits.get()).isGreaterThan(0L); } @Test @@ -149,7 +149,7 @@ public void bidiResponseBackpressure() { .expectComplete() .verify(Duration.ofSeconds(15)); - assertThat(numberOfWaits.get()).isBetween(1L, 2L); + assertThat(numberOfWaits.get()).isGreaterThan(0L); } @Test @@ -181,7 +181,7 @@ public void bidiRequestBackpressure() { .expectComplete() .verify(Duration.ofSeconds(15)); - assertThat(numberOfWaits.get()).isBetween(1L, 2L); + assertThat(numberOfWaits.get()).isGreaterThan(0L); } diff --git a/rx-java/rxgrpc-stub/pom.xml b/rx-java/rxgrpc-stub/pom.xml index 08759d32..0fcbd59d 100644 --- a/rx-java/rxgrpc-stub/pom.xml +++ b/rx-java/rxgrpc-stub/pom.xml @@ -20,7 +20,7 @@ rxgrpc-stub - 1.6 + 1.7 ${java.version} ${java.version} @@ -43,8 +43,18 @@ test - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.junit.jupiter + junit-jupiter-engine test diff --git a/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/GrpcContextOnScheduleHookTest.java b/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/GrpcContextOnScheduleHookTest.java index ccb98f92..36e62577 100644 --- a/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/GrpcContextOnScheduleHookTest.java +++ b/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/GrpcContextOnScheduleHookTest.java @@ -15,9 +15,9 @@ import io.reactivex.plugins.RxJavaPlugins; import io.reactivex.schedulers.Schedulers; import org.awaitility.Duration; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.concurrent.atomic.AtomicBoolean; @@ -26,12 +26,12 @@ public class GrpcContextOnScheduleHookTest { - @Before + @BeforeEach public void before() { RxJavaPlugins.setScheduleHandler(new GrpcContextOnScheduleHook()); } - @After + @AfterEach public void after() { RxJavaPlugins.setScheduleHandler(null); } diff --git a/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/GrpcRetryTest.java b/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/GrpcRetryTest.java index 45cfc86e..afb7cf4c 100644 --- a/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/GrpcRetryTest.java +++ b/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/GrpcRetryTest.java @@ -12,7 +12,7 @@ import io.reactivex.functions.Function; import io.reactivex.observers.TestObserver; import io.reactivex.subscribers.TestSubscriber; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.concurrent.TimeUnit; diff --git a/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/SubscribeOnlyOnceTest.java b/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/SubscribeOnlyOnceTest.java index faaac0cf..288eee38 100644 --- a/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/SubscribeOnlyOnceTest.java +++ b/rx-java/rxgrpc-stub/src/test/java/com/salesforce/rxgrpc/stub/SubscribeOnlyOnceTest.java @@ -10,7 +10,7 @@ import io.reactivex.SingleObserver; import io.reactivex.disposables.Disposable; import org.assertj.core.api.ThrowableAssert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.reactivestreams.Subscriber; import org.reactivestreams.Subscription; diff --git a/rx-java/rxgrpc-test/pom.xml b/rx-java/rxgrpc-test/pom.xml index 4b1ef798..ad5cb47d 100644 --- a/rx-java/rxgrpc-test/pom.xml +++ b/rx-java/rxgrpc-test/pom.xml @@ -57,8 +57,18 @@ test - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.junit.jupiter + junit-jupiter-engine test diff --git a/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/BackpressureIntegrationTest.java b/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/BackpressureIntegrationTest.java index 28386272..f1ef6fde 100644 --- a/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/BackpressureIntegrationTest.java +++ b/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/BackpressureIntegrationTest.java @@ -34,7 +34,7 @@ public class BackpressureIntegrationTest { @Rule public UnhandledRxJavaErrorRule errorRule = new UnhandledRxJavaErrorRule().autoVerifyNoError(); - private static final int NUMBER_OF_STREAM_ELEMENTS = 512 + (512 * 3 / 4); + private static final int NUMBER_OF_STREAM_ELEMENTS = 512 * 12; private static AtomicLong lastValueTime; private static AtomicLong numberOfWaits; @@ -94,7 +94,7 @@ public void clientToServerBackpressure() { rxResponse.assertComplete() .assertValue(v -> v.getNumber(0) == NUMBER_OF_STREAM_ELEMENTS - 1); - assertThat(numberOfWaits.get()).isBetween(1L, 2L); + assertThat(numberOfWaits.get()).isGreaterThan(0L); } @Test @@ -113,7 +113,7 @@ public void serverToClientBackpressure() { rxResponse.assertComplete() .assertValueCount(NUMBER_OF_STREAM_ELEMENTS); - assertThat(numberOfWaits.get()).isBetween(1L, 2L); + assertThat(numberOfWaits.get()).isGreaterThan(0L); } @Test @@ -131,7 +131,7 @@ public void bidiResponseBackpressure() { rxResponse.assertComplete() .assertValueCount(NUMBER_OF_STREAM_ELEMENTS); - assertThat(numberOfWaits.get()).isBetween(1L, 2L); + assertThat(numberOfWaits.get()).isGreaterThan(0L); } @Test @@ -151,7 +151,7 @@ public void bidiRequestBackpressure() { rxResponse.assertComplete() .assertValue(v -> v.getNumber(0) == NUMBER_OF_STREAM_ELEMENTS - 1); - assertThat(numberOfWaits.get()).isBetween(1L, 2L); + assertThat(numberOfWaits.get()).isGreaterThan(0L); } diff --git a/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/ShareIntegrationTest.java b/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/ShareIntegrationTest.java index 7408d057..bf5adfdb 100644 --- a/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/ShareIntegrationTest.java +++ b/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/ShareIntegrationTest.java @@ -164,7 +164,10 @@ public void clientShareShouldWork() { public Flowable sayHelloRespStream(Single request) { return request // Always return Alpha, Bravo, Charlie - .flatMapPublisher(x -> Flowable.just("Alpha", "Bravo", "Charlie")) + .flatMapPublisher(x -> { + System.out.println("Flatten : " + x); + return Flowable.just("Alpha", "Bravo", "Charlie"); + }) .map(n -> HelloResponse.newBuilder().setMessage(n).build()); } };