Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3BF3A200AC8 for ; Tue, 7 Jun 2016 19:05:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3A776160A36; Tue, 7 Jun 2016 17:05:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 80B8D160968 for ; Tue, 7 Jun 2016 19:05:05 +0200 (CEST) Received: (qmail 46384 invoked by uid 500); 7 Jun 2016 17:05:04 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 46375 invoked by uid 99); 7 Jun 2016 17:05:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jun 2016 17:05:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6C7CCDFC7E; Tue, 7 Jun 2016 17:05:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: Adding a test with multiple JAXRS proxy callbacks Date: Tue, 7 Jun 2016 17:05:04 +0000 (UTC) archived-at: Tue, 07 Jun 2016 17:05:06 -0000 Repository: cxf Updated Branches: refs/heads/master 471f8851f -> 94e99ce4a 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 Commit: 94e99ce4ae6e6fb31790c2fb84b3541268fde62f Parents: 471f885 Author: Sergey Beryozkin Authored: Tue Jun 7 18:04:48 2016 +0100 Committer: Sergey Beryozkin 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 bookHolder = new Holder(); + final InvocationCallback bookCallback = new InvocationCallback() { + public void completed(Book response) { + bookHolder.value = response; + } + public void failed(Throwable error) { + } + }; + final Holder booleanHolder = new Holder(); + final InvocationCallback booleanCallback = new InvocationCallback() { + public void completed(Boolean response) { + booleanHolder.value = response; + } + public void failed(Throwable error) { + } + }; + List> callbacks = new ArrayList>(); + 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"