Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 63030 invoked from network); 23 May 2007 06:26:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 May 2007 06:26:42 -0000 Received: (qmail 94084 invoked by uid 500); 23 May 2007 06:26:47 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 93958 invoked by uid 500); 23 May 2007 06:26:47 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 93949 invoked by uid 99); 23 May 2007 06:26:47 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 May 2007 23:26:47 -0700 X-ASF-Spam-Status: No, hits=-98.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 May 2007 23:26:40 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 4C4331A981A; Tue, 22 May 2007 23:26:20 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r540855 - /incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Date: Wed, 23 May 2007 06:26:20 -0000 To: cxf-commits@incubator.apache.org From: ffang@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070523062620.4C4331A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ffang Date: Tue May 22 23:26:19 2007 New Revision: 540855 URL: http://svn.apache.org/viewvc?view=rev&rev=540855 Log: [CXF-544] add test to prove JAXWS Client Proxy use executor assigned to JAXWS Service in async invocations Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?view=diff&rev=540855&r1=540854&r2=540855 ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Tue May 22 23:26:19 2007 @@ -20,6 +20,7 @@ package org.apache.cxf.systest.jaxws; + import java.io.InputStream; import java.lang.reflect.UndeclaredThrowableException; import java.net.HttpURLConnection; @@ -29,9 +30,11 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import java.util.logging.Logger; import javax.xml.namespace.QName; import javax.xml.ws.AsyncHandler; @@ -48,10 +51,8 @@ import org.apache.cxf.binding.soap.Soap11; import org.apache.cxf.endpoint.Client; import org.apache.cxf.endpoint.dynamic.DynamicClientFactory; -//import org.apache.cxf.bus.spring.SpringBusFactory; import org.apache.cxf.helpers.XMLUtils; import org.apache.cxf.helpers.XPathUtils; -//import org.apache.cxf.jaxws.ServiceImpl; import org.apache.cxf.message.Message; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; import org.apache.hello_world_soap_http.BadRecordLitFault; @@ -70,6 +71,7 @@ public class ClientServerTest extends AbstractBusClientServerTestBase { + static final Logger LOG = Logger.getLogger(ClientServerTest.class.getName()); private final QName serviceName = new QName("http://apache.org/hello_world_soap_http", "SOAPService"); private final QName portName = new QName("http://apache.org/hello_world_soap_http", @@ -416,12 +418,52 @@ } @Test - public void testAsyncCallWithHandler() throws Exception { + public void testAsyncCallUseProperAssignedExecutor() throws Exception { URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); assertNotNull(wsdl); SOAPService service = new SOAPService(wsdl, serviceName); + class TestExecutor implements Executor { + + private int count; + + public void execute(Runnable command) { + count++; + LOG.info("asyn call time " + count); + command.run(); + } + + public int getCount() { + return count; + } + } + Executor executor = new TestExecutor(); + service.setExecutor(executor); + assertNotNull(service); + assertSame(executor, service.getExecutor()); + + + assertEquals(((TestExecutor)executor).getCount(), 0); + try { + Greeter greeter = (Greeter)service.getPort(portName, Greeter.class); + for (int i = 0; i < 5; i++) { + greeter.greetMeAsync("asyn call" + i); + } + } catch (UndeclaredThrowableException ex) { + throw (Exception)ex.getCause(); + } + + assertEquals(((TestExecutor)executor).getCount(), 5); + } + + + @Test + public void testAsyncCallWithHandler() throws Exception { + URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); + assertNotNull(wsdl); + + SOAPService service = new SOAPService(wsdl, serviceName); assertNotNull(service); MyHandler h = new MyHandler();