cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [12/22] cxf git commit: Adding a test with multiple JAXRS proxy callbacks
Date Wed, 08 Jun 2016 01:48:22 GMT
Adding a test with multiple JAXRS proxy callbacks


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

Branch: refs/heads/master-jaxrs-2.1
Commit: 94e99ce4ae6e6fb31790c2fb84b3541268fde62f
Parents: 471f885
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Tue Jun 7 18:04:48 2016 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Tue Jun 7 18:04:48 2016 +0100

----------------------------------------------------------------------
 .../cxf/systest/jaxrs/JAXRSAsyncClientTest.java | 38 ++++++++++++++++++++
 1 file changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/94e99ce4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
index cd5580f..8713229 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
@@ -302,6 +302,44 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase
{
         assertNotNull(holder.value);
         assertEquals(123L, holder.value.getId());
     }
+    @Test
+    public void testAsyncProxyMultipleCallbacks() throws Exception {
+        String address = "http://localhost:" + PORT;
+        final Holder<Book> bookHolder = new Holder<Book>();
+        final InvocationCallback<Book> bookCallback = new InvocationCallback<Book>()
{
+            public void completed(Book response) {
+                bookHolder.value = response;
+            }
+            public void failed(Throwable error) {
+            }
+        };
+        final Holder<Boolean> booleanHolder = new Holder<Boolean>();
+        final InvocationCallback<Boolean> booleanCallback = new InvocationCallback<Boolean>()
{
+            public void completed(Boolean response) {
+                booleanHolder.value = response;
+            }
+            public void failed(Throwable error) {
+            }
+        };
+        List<InvocationCallback<?>> callbacks = new ArrayList<InvocationCallback<?>>();
+        callbacks.add(bookCallback);
+        callbacks.add(booleanCallback);
+        
+        BookStore store = JAXRSClientFactory.create(address, BookStore.class);
+        WebClient.getConfig(store).getRequestContext().put(InvocationCallback.class.getName(),
callbacks);
+        
+        
+        
+        Book book = store.getBookByMatrixParams("12", "3");
+        assertNull(book);
+        Thread.sleep(3000);
+        assertNotNull(bookHolder.value);
+        assertEquals(123L, bookHolder.value.getId());
+        
+        store.checkBook(123L);
+        Thread.sleep(3000);
+        assertTrue(booleanHolder.value);
+    }
     
     @SuppressWarnings({
      "unchecked", "rawtypes"


Mime
View raw message