You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2016/04/29 18:44:10 UTC

cxf git commit: [CXF-6833] Adding a client test manually converting to Observable

Repository: cxf
Updated Branches:
  refs/heads/master 04d072e84 -> 2fb1ccf60


[CXF-6833] Adding a client test manually converting to Observable


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2fb1ccf6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2fb1ccf6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2fb1ccf6

Branch: refs/heads/master
Commit: 2fb1ccf60f1ba4e9d70f8c2a6329fa1a65e6a352
Parents: 04d072e
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Fri Apr 29 17:43:52 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Fri Apr 29 17:43:52 2016 +0100

----------------------------------------------------------------------
 .../jaxrs/reactive/JAXRSReactiveTest.java       | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2fb1ccf6/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/JAXRSReactiveTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/JAXRSReactiveTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/JAXRSReactiveTest.java
index 582ab4b..808c722 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/JAXRSReactiveTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/reactive/JAXRSReactiveTest.java
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.systest.jaxrs.reactive;
 
+import java.util.concurrent.Future;
+
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -26,6 +28,8 @@ import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import rx.Observable;
+
 public class JAXRSReactiveTest extends AbstractBusClientServerTestBase {
     public static final String PORT = ReactiveServer.PORT;
     @BeforeClass
@@ -49,6 +53,19 @@ public class JAXRSReactiveTest extends AbstractBusClientServerTestBase {
         String text = wc.accept("text/plain").get(String.class);
         assertEquals("Hello, world!", text);
     }
+    
+    @Test
+    public void testGetHelloWorldAsyncObservable() throws Exception {
+        String address = "http://localhost:" + PORT + "/reactive/textAsync";
+        WebClient wc = WebClient.create(address);
+        Observable<String> obs = 
+            getObservable(wc.accept("text/plain").async().get(String.class));
+        obs.subscribe(s -> assertResponse(s));
+    }
+    
+    private void assertResponse(String s) {
+        assertEquals("Hello, world!", s);
+    }
     @Test
     public void testGetHelloWorldJson() throws Exception {
         String address = "http://localhost:" + PORT + "/reactive/textJson";
@@ -58,4 +75,7 @@ public class JAXRSReactiveTest extends AbstractBusClientServerTestBase {
                    || "{\"greeting\":\"Hello\",\"audience\":\"World\"}".equals(text));
     }
     
+    private Observable<String> getObservable(Future<String> future) {
+        return Observable.from(future);
+    }
 }