Repository: salesforce/reactive-grpc
Pull request #63 (2018-03-08 00:08:02)

Update Kotlin to 1.2.30


Patch:
diff --git a/demos/ReactorChat-Kotlin/ReactorChat-Client-Kt/pom.xml b/demos/ReactorChat-Kotlin/ReactorChat-Client-Kt/pom.xml
index 738001e..41893a6 100644
--- a/demos/ReactorChat-Kotlin/ReactorChat-Client-Kt/pom.xml
+++ b/demos/ReactorChat-Kotlin/ReactorChat-Client-Kt/pom.xml
@@ -89,8 +89,4 @@
             </plugin>
         </plugins>
     </build>
-
-    <properties>
-        <kotlin.version>1.1.51</kotlin.version>
-    </properties>
 </project>
\ No newline at end of file
diff --git a/demos/ReactorChat-Kotlin/ReactorChat-Server-Kt/pom.xml b/demos/ReactorChat-Kotlin/ReactorChat-Server-Kt/pom.xml
index c0ccf82..bbd366e 100644
--- a/demos/ReactorChat-Kotlin/ReactorChat-Server-Kt/pom.xml
+++ b/demos/ReactorChat-Kotlin/ReactorChat-Server-Kt/pom.xml
@@ -51,6 +51,16 @@
             <artifactId>kotlin-stdlib-jre8</artifactId>
             <version>${kotlin.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.jetbrains.kotlin</groupId>
+            <artifactId>kotlin-stdlib</artifactId>
+            <version>${kotlin.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jetbrains.kotlin</groupId>
+            <artifactId>kotlin-stdlib-jre7</artifactId>
+            <version>${kotlin.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.jetbrains.kotlin</groupId>
             <artifactId>kotlin-reflect</artifactId>
@@ -60,7 +70,7 @@
         <dependency>
             <groupId>io.projectreactor</groupId>
             <artifactId>reactor-core</artifactId>
-            <version>3.1.1.RELEASE</version>
+            <version>${reactor.version}</version>
         </dependency>
     </dependencies>
 
@@ -92,7 +102,7 @@
                 <executions>
                     <execution>
                         <id>compile</id>
-                        <phase>compile</phase>
+                        <phase>process-sources</phase>
                         <goals>
                             <goal>compile</goal>
                         </goals>
@@ -116,10 +126,6 @@
         </plugins>
     </build>
 
-    <properties>
-        <kotlin.version>1.2.0</kotlin.version>
-    </properties>
-
     <repositories>
         <repository>
             <id>spring-milestones</id>
diff --git a/demos/ReactorChat-Kotlin/pom.xml b/demos/ReactorChat-Kotlin/pom.xml
index b512c2d..9129ae0 100644
--- a/demos/ReactorChat-Kotlin/pom.xml
+++ b/demos/ReactorChat-Kotlin/pom.xml
@@ -25,6 +25,10 @@
         <module>ReactorChat-Client-Kt</module>
     </modules>
 
+    <properties>
+        <kotlin.version>1.2.30</kotlin.version>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>io.grpc</groupId>
diff --git a/demos/ReactorChat/ReactorChat-Server/pom.xml b/demos/ReactorChat/ReactorChat-Server/pom.xml
index 5f8623a..2d0a34f 100644
--- a/demos/ReactorChat/ReactorChat-Server/pom.xml
+++ b/demos/ReactorChat/ReactorChat-Server/pom.xml
@@ -51,7 +51,7 @@
         <dependency>
             <groupId>io.projectreactor</groupId>
             <artifactId>reactor-core</artifactId>
-            <version>3.1.1.RELEASE</version>
+            <version>${reactor.version}</version>
         </dependency>
     </dependencies>
 
diff --git a/pom.xml b/pom.xml
index 32cb137..67cca75 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,6 +57,8 @@
         <protoc.version>3.5.1</protoc.version> <!-- Same version as grpc-proto -->
         <grpc.contrib.version>0.8.0</grpc.contrib.version>
 
+        <reactor.version>3.1.1.RELEASE</reactor.version>
+
         <!-- Test Dependency Versions -->
         <junit.version>4.12</junit.version>
         <assertj.version>3.6.2</assertj.version>
diff --git a/reactor/reactor-grpc-stub/pom.xml b/reactor/reactor-grpc-stub/pom.xml
index ed3008b..140ee16 100644
--- a/reactor/reactor-grpc-stub/pom.xml
+++ b/reactor/reactor-grpc-stub/pom.xml
@@ -28,12 +28,12 @@
         <dependency>
             <groupId>io.projectreactor</groupId>
             <artifactId>reactor-core</artifactId>
-            <version>3.1.1.RELEASE</version>
+            <version>${reactor.version}</version>
         </dependency>
         <dependency>
             <groupId>io.projectreactor</groupId>
             <artifactId>reactor-test</artifactId>
-            <version>3.1.1.RELEASE</version>
+            <version>${reactor.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>


Test patch:
diff --git a/reactor/reactor-grpc-test/pom.xml b/reactor/reactor-grpc-test/pom.xml
index 8587b82..daf6735 100644
--- a/reactor/reactor-grpc-test/pom.xml
+++ b/reactor/reactor-grpc-test/pom.xml
@@ -34,7 +34,7 @@
         <dependency>
             <groupId>io.projectreactor</groupId>
             <artifactId>reactor-test</artifactId>
-            <version>3.1.1.RELEASE</version>
+            <version>${reactor.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/reactor/reactor-grpc-test/src/test/java/com/salesforce/reactorgrpc/ClientThreadIntegrationTest.java b/reactor/reactor-grpc-test/src/test/java/com/salesforce/reactorgrpc/ClientThreadIntegrationTest.java
deleted file mode 100644
index 598c103..0000000
--- a/reactor/reactor-grpc-test/src/test/java/com/salesforce/reactorgrpc/ClientThreadIntegrationTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *  Copyright (c) 2017, salesforce.com, inc.
- *  All rights reserved.
- *  Licensed under the BSD 3-Clause license.
- *  For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
- */
-
-package com.salesforce.reactorgrpc;
-
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import io.grpc.ManagedChannel;
-import io.grpc.ManagedChannelBuilder;
-import io.grpc.Server;
-import io.grpc.ServerBuilder;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-import reactor.test.StepVerifier;
-
-import java.time.Duration;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicReference;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * This test verifies that the thread pools passed to gRPC are the same thread pools used by downstream reactive code.
- */
-@SuppressWarnings("Duplicates")
-public class ClientThreadIntegrationTest {
-    private Server server;
-    private ManagedChannel channel;
-
-    private AtomicReference<String> serverThreadName = new AtomicReference<>();
-
-    @Before
-    public void setupServer() throws Exception {
-        StepVerifier.setDefaultTimeout(Duration.ofSeconds(3));
-
-        ReactorGreeterGrpc.GreeterImplBase svc = new ReactorGreeterGrpc.GreeterImplBase() {
-
-            @Override
-            public Mono<HelloResponse> sayHello(Mono<HelloRequest> reactorRequest) {
-                serverThreadName.set(Thread.currentThread().getName());
-                return reactorRequest.map(protoRequest -> greet("Hello", protoRequest));
-            }
-
-            @Override
-            public Flux<HelloResponse> sayHelloBothStream(Flux<HelloRequest> reactorRequest) {
-                serverThreadName.set(Thread.currentThread().getName());
-                return reactorRequest
-                        .map(HelloRequest::getName)
-                        .buffer(2)
-                        .map(names -> greet("Hello", String.join(" and ", names)));
-            }
-
-            private HelloResponse greet(String greeting, HelloRequest request) {
-                return greet(greeting, request.getName());
-            }
-
-            private HelloResponse greet(String greeting, String name) {
-                return HelloResponse.newBuilder().setMessage(greeting + " " + name).build();
-            }
-        };
-
-        server = ServerBuilder
-                .forPort(0)
-                .addService(svc)
-                .executor(Executors.newSingleThreadExecutor(
-                        new ThreadFactoryBuilder().setNameFormat("TheGrpcServer").build()))
-                .build()
-                .start();
-        channel = ManagedChannelBuilder
-                .forAddress("localhost", server.getPort())
-                .usePlaintext(true)
-                .executor(Executors.newSingleThreadExecutor(
-                        new ThreadFactoryBuilder().setNameFormat("TheGrpcClient").build()))
-                .build();
-    }
-
-    @After
-    public void stopServer() throws InterruptedException {
-        server.shutdown();
-        server.awaitTermination();
-        channel.shutdown();
-
-        server = null;
-        channel = null;
-    }
-
-    @Test
-    public void oneToOne() {
-        ReactorGreeterGrpc.ReactorGreeterStub stub = ReactorGreeterGrpc.newReactorStub(channel);
-        Mono<HelloRequest> req = Mono.just(HelloRequest.newBuilder().setName("reactorjava").build());
-        Mono<HelloResponse> resp = stub.sayHello(req);
-
-        AtomicReference<String> clientThreadName = new AtomicReference<>();
-
-        StepVerifier
-                .create(resp
-                        .map(HelloResponse::getMessage)
-                        .doOnSuccess(x -> clientThreadName.set(Thread.currentThread().getName())))
-                .expectNext("Hello reactorjava")
-                .verifyComplete();
-
-        assertThat(clientThreadName.get()).isEqualTo("TheGrpcClient");
-        assertThat(serverThreadName.get()).isEqualTo("TheGrpcServer");
-    }
-
-    @Test
-    public void manyToMany() {
-        ReactorGreeterGrpc.ReactorGreeterStub stub = ReactorGreeterGrpc.newReactorStub(channel);
-        Flux<HelloRequest> req = Flux.just(
-                HelloRequest.newBuilder().setName("a").build(),
-                HelloRequest.newBuilder().setName("b").build(),
-                HelloRequest.newBuilder().setName("c").build(),
-                HelloRequest.newBuilder().setName("d").build(),
-                HelloRequest.newBuilder().setName("e").build());
-
-        Flux<HelloResponse> resp = stub.sayHelloBothStream(req);
-
-        AtomicReference<String> clientThreadName = new AtomicReference<>();
-
-        StepVerifier
-                .create(resp
-                        .map(HelloResponse::getMessage)
-                        .doOnNext(x -> clientThreadName.set(Thread.currentThread().getName())))
-                .expectNext("Hello a and b", "Hello c and d", "Hello e")
-                .verifyComplete();
-
-        assertThat(clientThreadName.get()).isEqualTo("TheGrpcClient");
-        assertThat(serverThreadName.get()).isEqualTo("TheGrpcServer");
-    }
-}
diff --git a/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/ClientThreadIntegrationTest.java b/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/ClientThreadIntegrationTest.java
deleted file mode 100644
index 44617fe..0000000
--- a/rx-java/rxgrpc-test/src/test/java/com/salesforce/rxgrpc/ClientThreadIntegrationTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *  Copyright (c) 2017, salesforce.com, inc.
- *  All rights reserved.
- *  Licensed under the BSD 3-Clause license.
- *  For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
- */
-
-package com.salesforce.rxgrpc;
-
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import io.grpc.ManagedChannel;
-import io.grpc.ManagedChannelBuilder;
-import io.grpc.Server;
-import io.grpc.ServerBuilder;
-import io.reactivex.Flowable;
-import io.reactivex.Single;
-import io.reactivex.observers.TestObserver;
-import io.reactivex.subscribers.TestSubscriber;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * This test verifies that the thread pools passed to gRPC are the same thread pools used by downstream reactive code.
- */
-@SuppressWarnings("Duplicates")
-public class ClientThreadIntegrationTest {
-    private Server server;
-    private ManagedChannel channel;
-
-    private AtomicReference<String> serverThreadName = new AtomicReference<>();
-
-    @Before
-    public void setupServer() throws Exception {
-        RxGreeterGrpc.GreeterImplBase svc = new RxGreeterGrpc.GreeterImplBase() {
-
-            @Override
-            public Single<HelloResponse> sayHello(Single<HelloRequest> rxRequest) {
-                serverThreadName.set(Thread.currentThread().getName());
-                return rxRequest.map(protoRequest -> greet("Hello", protoRequest));
-            }
-
-            @Override
-            public Flowable<HelloResponse> sayHelloBothStream(Flowable<HelloRequest> rxRequest) {
-                serverThreadName.set(Thread.currentThread().getName());
-                return rxRequest
-                        .map(HelloRequest::getName)
-                        .buffer(2)
-                        .map(names -> greet("Hello", String.join(" and ", names)));
-            }
-
-            private HelloResponse greet(String greeting, HelloRequest request) {
-                return greet(greeting, request.getName());
-            }
-
-            private HelloResponse greet(String greeting, String name) {
-                return HelloResponse.newBuilder().setMessage(greeting + " " + name).build();
-            }
-        };
-
-        server = ServerBuilder
-                .forPort(0)
-                .addService(svc)
-                .executor(Executors.newSingleThreadExecutor(
-                        new ThreadFactoryBuilder().setNameFormat("TheGrpcServer").build()))
-                .build()
-                .start();
-        channel = ManagedChannelBuilder
-                .forAddress("localhost", server.getPort())
-                .usePlaintext(true)
-                .executor(Executors.newSingleThreadExecutor(
-                        new ThreadFactoryBuilder().setNameFormat("TheGrpcClient").build()))
-                .build();
-    }
-
-    @After
-    public void stopServer() throws InterruptedException {
-        server.shutdown();
-        server.awaitTermination();
-        channel.shutdown();
-
-        server = null;
-        channel = null;
-    }
-
-    @Test
-    public void oneToOne() {
-        RxGreeterGrpc.RxGreeterStub stub = RxGreeterGrpc.newRxStub(channel);
-        Single<HelloRequest> req = Single.just(HelloRequest.newBuilder().setName("rxjava").build());
-        Single<HelloResponse> resp = stub.sayHello(req);
-
-        AtomicReference<String> clientThreadName = new AtomicReference<>();
-
-        TestObserver<String> testObserver = resp
-                .map(HelloResponse::getMessage)
-                .doOnSuccess(x -> clientThreadName.set(Thread.currentThread().getName()))
-                .test();
-        testObserver.awaitTerminalEvent(3, TimeUnit.SECONDS);
-
-        assertThat(clientThreadName.get()).isEqualTo("TheGrpcClient");
-        assertThat(serverThreadName.get()).isEqualTo("TheGrpcServer");
-    }
-
-    @Test
-    public void manyToMany() {
-        RxGreeterGrpc.RxGreeterStub stub = RxGreeterGrpc.newRxStub(channel);
-        Flowable<HelloRequest> req = Flowable.just(
-                HelloRequest.newBuilder().setName("a").build(),
-                HelloRequest.newBuilder().setName("b").build(),
-                HelloRequest.newBuilder().setName("c").build(),
-                HelloRequest.newBuilder().setName("d").build(),
-                HelloRequest.newBuilder().setName("e").build());
-
-        AtomicReference<String> clientThreadName = new AtomicReference<>();
-
-        Flowable<HelloResponse> resp = stub.sayHelloBothStream(req);
-
-        TestSubscriber<String> testSubscriber = resp
-                .map(HelloResponse::getMessage)
-                .doOnNext(x -> clientThreadName.set(Thread.currentThread().getName()))
-                .test();
-        testSubscriber.awaitTerminalEvent(3, TimeUnit.SECONDS);
-        testSubscriber.assertComplete();
-
-        assertThat(clientThreadName.get()).isEqualTo("TheGrpcClient");
-        assertThat(serverThreadName.get()).isEqualTo("TheGrpcServer");
-    }
-}