This is an automated email from the ASF dual-hosted git repository.

sergeyb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 201f4a6  Updating the Flowable test
201f4a6 is described below

commit 201f4a681622767e6e199ba2ee364731bcdc05f6
Author: Sergey Beryozkin <[email protected]>
AuthorDate: Wed Dec 20 15:53:37 2017 +0000

    Updating the Flowable test
---
 .../jaxrs/reactive/RxJava2FlowableService.java       | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/RxJava2FlowableService.java
 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/RxJava2FlowableService.java
index c8fea92..d4be1ea 100644
--- 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/RxJava2FlowableService.java
+++ 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/RxJava2FlowableService.java
@@ -32,6 +32,7 @@ import javax.ws.rs.container.Suspended;
 import org.apache.cxf.jaxrs.reactivestreams.server.AbstractSubscriber;
 import 
org.apache.cxf.jaxrs.reactivestreams.server.JsonStreamingAsyncSubscriber;
 
+import io.reactivex.BackpressureStrategy;
 import io.reactivex.Flowable;
 import io.reactivex.schedulers.Schedulers;
 
@@ -79,7 +80,24 @@ public class RxJava2FlowableService {
     @Produces("application/json")
     @Path("textJsonImplicitList")
     public Flowable<HelloWorldBean> getJsonImplicitList() {
-        return Flowable.just("Hello", "Ciao").map(HelloWorldBean::new);
+        return Flowable.create(subscriber -> {
+            Thread t = new Thread(() -> {
+                subscriber.onNext(new HelloWorldBean("Hello"));
+                sleep();
+                subscriber.onNext(new HelloWorldBean("Ciao"));
+                sleep();
+                subscriber.onComplete();
+            });
+            t.start();
+        }, BackpressureStrategy.MISSING);
+    }
+    
+    private static void sleep() {
+        try {
+            Thread.sleep(1000);
+        } catch (InterruptedException ex) {
+            // ignore
+        }
     }
     
     @GET

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to