cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Adding a test with multiple JAXRS proxy callbacks
Date Tue, 07 Jun 2016 17:05:40 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes c3bef354c -> f7db188bb


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/f7db188b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f7db188b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f7db188b

Branch: refs/heads/3.1.x-fixes
Commit: f7db188bb0da238dac2e7714285d5ae3463d6428
Parents: c3bef35
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:05:27 2016 +0100

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


http://git-wip-us.apache.org/repos/asf/cxf/blob/f7db188b/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