cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [31/36] cxf git commit: [CXF-6833] Adding a client test manually converting to Observable
Date Sun, 01 May 2016 19:36:47 GMT
[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-jaxrs-2.1
Commit: 2fb1ccf60f1ba4e9d70f8c2a6329fa1a65e6a352
Parents: 04d072e
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Fri Apr 29 17:43:52 2016 +0100
Committer: Sergey Beryozkin <sberyozkin@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);
+    }
 }


Mime
View raw message