Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 5304 invoked from network); 12 Nov 2008 12:43:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Nov 2008 12:43:52 -0000 Received: (qmail 81487 invoked by uid 500); 12 Nov 2008 12:44:00 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 81428 invoked by uid 500); 12 Nov 2008 12:43:59 -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 81419 invoked by uid 99); 12 Nov 2008 12:43:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Nov 2008 04:43:59 -0800 X-ASF-Spam-Status: No, hits=-1998.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Nov 2008 12:42:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3897E2388A1B; Wed, 12 Nov 2008 04:42:52 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r713355 [5/5] - in /cxf/sandbox/2.2.x-continuations: ./ api/ api/src/ api/src/main/ api/src/main/java/ api/src/main/java/org/ api/src/main/java/org/apache/ api/src/main/java/org/apache/cxf/ api/src/main/java/org/apache/cxf/continuations/ rt... Date: Wed, 12 Nov 2008 12:42:49 -0000 To: commits@cxf.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081112124252.3897E2388A1B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ClientServerWrappedContinuationTest.java URL: http://svn.apache.org/viewvc/cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ClientServerWrappedContinuationTest.java?rev=713355&view=auto ============================================================================== --- cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ClientServerWrappedContinuationTest.java (added) +++ cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ClientServerWrappedContinuationTest.java Wed Nov 12 04:42:46 2008 @@ -0,0 +1,114 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.systest.jaxws.continuations; + +import java.net.URL; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import javax.xml.namespace.QName; +import javax.xml.ws.Endpoint; + +import org.apache.cxf.Bus; +import org.apache.cxf.BusFactory; +import org.apache.cxf.bus.spring.SpringBusFactory; +import org.apache.cxf.testutil.common.AbstractBusTestServerBase; +import org.apache.cxf.testutil.common.AbstractClientServerTestBase; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ClientServerWrappedContinuationTest extends AbstractClientServerTestBase { + + private static final String CONFIG_FILE = + "org/apache/cxf/systest/jaxws/continuations/cxf.xml"; + + public static class Server extends AbstractBusTestServerBase { + + protected void run() { + Object implementor = new HelloImplWithWrapppedContinuation(); + String address = "http://localhost:9092/hellocontinuation"; + Endpoint.publish(address, implementor); + } + + public static void main(String[] args) { + try { + Server s = new Server(); + s.start(); + } catch (Exception ex) { + ex.printStackTrace(); + System.exit(-1); + } finally { + System.out.println("done!"); + } + } + } + + @BeforeClass + public static void startServers() throws Exception { + assertTrue("server did not launch correctly", launchServer(Server.class)); + } + + @Test + public void testHttpWrappedContinuatuions() throws Exception { + SpringBusFactory bf = new SpringBusFactory(); + Bus bus = bf.createBus(CONFIG_FILE); + BusFactory.setDefaultBus(bus); + + QName serviceName = new QName("http://cxf.apache.org/systest/jaxws", "HelloContinuationService"); + + URL wsdlURL = new URL("http://localhost:9092/hellocontinuation?wsdl"); + HelloContinuationService service = new HelloContinuationService(wsdlURL, serviceName); + assertNotNull(service); + final HelloContinuation helloPort = service.getHelloContinuationPort(); + + ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 10, 0, TimeUnit.SECONDS, + new ArrayBlockingQueue(6)); + CountDownLatch startSignal = new CountDownLatch(1); + CountDownLatch controlDoneSignal = new CountDownLatch(5); + CountDownLatch helloDoneSignal = new CountDownLatch(5); + + executor.execute(new ControlWorker(helloPort, "Fred", startSignal, controlDoneSignal)); + executor.execute(new HelloWorker(helloPort, "Fred", "", startSignal, helloDoneSignal)); + + executor.execute(new ControlWorker(helloPort, "Barry", startSignal, controlDoneSignal)); + executor.execute(new HelloWorker(helloPort, "Barry", "Jameson", startSignal, helloDoneSignal)); + + executor.execute(new ControlWorker(helloPort, "Harry", startSignal, controlDoneSignal)); + executor.execute(new HelloWorker(helloPort, "Harry", "", startSignal, helloDoneSignal)); + + executor.execute(new ControlWorker(helloPort, "Rob", startSignal, controlDoneSignal)); + executor.execute(new HelloWorker(helloPort, "Rob", "Davidson", startSignal, helloDoneSignal)); + + executor.execute(new ControlWorker(helloPort, "James", startSignal, controlDoneSignal)); + executor.execute(new HelloWorker(helloPort, "James", "ServiceMix", startSignal, helloDoneSignal)); + + startSignal.countDown(); + + controlDoneSignal.await(10, TimeUnit.SECONDS); + helloDoneSignal.await(10, TimeUnit.SECONDS); + executor.shutdownNow(); + assertEquals("Not all invocations have been resumed", 0, controlDoneSignal.getCount()); + assertEquals("Not all invocations have completed", 0, helloDoneSignal.getCount()); + } + + +} Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ClientServerWrappedContinuationTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ClientServerWrappedContinuationTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ControlWorker.java URL: http://svn.apache.org/viewvc/cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ControlWorker.java?rev=713355&view=auto ============================================================================== --- cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ControlWorker.java (added) +++ cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ControlWorker.java Wed Nov 12 04:42:46 2008 @@ -0,0 +1,59 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.systest.jaxws.continuations; + +import java.util.concurrent.CountDownLatch; + +import org.junit.Assert; + +public class ControlWorker implements Runnable { + + private HelloContinuation helloPort; + private String firstName; + private CountDownLatch startSignal; + private CountDownLatch resumeSignal; + public ControlWorker(HelloContinuation helloPort, + String firstName, + CountDownLatch startSignal, + CountDownLatch resumeSignal) { + this.helloPort = helloPort; + this.firstName = firstName; + this.startSignal = startSignal; + this.resumeSignal = resumeSignal; + } + + public void run() { + try { + startSignal.await(); + if (!helloPort.isRequestSuspended(firstName)) { + Assert.fail("No suspended invocation for " + firstName); + } + helloPort.resumeRequest(firstName); + resumeSignal.countDown(); + } catch (InterruptedException ex) { + // ignore + } catch (RuntimeException ex) { + ex.printStackTrace(); + Assert.fail("Control thread for " + firstName + " failed"); + } + + } + +} Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ControlWorker.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/ControlWorker.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuation.java URL: http://svn.apache.org/viewvc/cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuation.java?rev=713355&view=auto ============================================================================== --- cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuation.java (added) +++ cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuation.java Wed Nov 12 04:42:46 2008 @@ -0,0 +1,36 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.systest.jaxws.continuations; + +import javax.jws.WebMethod; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; + +@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) +@WebService(name = "HelloContinuation", targetNamespace = "http://cxf.apache.org/systest/jaxws") +public interface HelloContinuation { + @WebMethod(operationName = "sayHi", exclude = false) + String sayHi(String firstName, String secondName); + + @WebMethod(operationName = "isRequestSuspended", exclude = false) + boolean isRequestSuspended(String name); + + @WebMethod(operationName = "resumeRequest", exclude = false) + void resumeRequest(String name); +} Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuation.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuation.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuationService.java URL: http://svn.apache.org/viewvc/cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuationService.java?rev=713355&view=auto ============================================================================== --- cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuationService.java (added) +++ cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuationService.java Wed Nov 12 04:42:46 2008 @@ -0,0 +1,49 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.systest.jaxws.continuations; + +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; + +/** + * + */ + +@WebServiceClient(name = "HelloService", + targetNamespace = "http://cxf.apache.org/systest/jaxws", + wsdlLocation = "testutils/hello.wsdl") +public class HelloContinuationService extends Service { + static final QName SERVICE = + new QName("http://cxf.apache.org/systest/jaxws", "HelloContinuationService"); + static final QName HELLO_PORT = + new QName("http://cxf.apache.org/systest/jaxws", "HelloContinuationPort"); + public HelloContinuationService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + @WebEndpoint(name = "HelloContinuationPort") + public HelloContinuation getHelloContinuationPort() { + return (HelloContinuation)super.getPort(HELLO_PORT, HelloContinuation.class); + } + +} Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuationService.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloContinuationService.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithContinuation.java URL: http://svn.apache.org/viewvc/cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithContinuation.java?rev=713355&view=auto ============================================================================== --- cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithContinuation.java (added) +++ cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithContinuation.java Wed Nov 12 04:42:46 2008 @@ -0,0 +1,128 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.systest.jaxws.continuations; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; +import javax.jws.WebService; +import javax.servlet.http.HttpServletRequest; +import javax.xml.ws.WebServiceContext; +import javax.xml.ws.handler.MessageContext; + +import org.mortbay.util.ajax.Continuation; +import org.mortbay.util.ajax.ContinuationSupport; + + +@WebService(name = "HelloContinuation", + serviceName = "HelloContinuationService", + portName = "HelloContinuationPort", + targetNamespace = "http://cxf.apache.org/systest/jaxws", + endpointInterface = "org.apache.cxf.systest.jaxws.continuations.HelloContinuation") +public class HelloImplWithContinuation implements HelloContinuation { + + + private Map suspended = + new HashMap(); + + + @Resource + private WebServiceContext context; + + public String sayHi(String firstName, String secondName) { + + Continuation continuation = getContinuation(firstName); + if (continuation == null) { + throw new RuntimeException("Failed to get continuation"); + } + synchronized (continuation) { + if (continuation.isNew()) { + Object userObject = secondName != null && secondName.length() > 0 + ? secondName : null; + continuation.setObject(userObject); + suspendInvocation(firstName, continuation); + } else { + StringBuilder sb = new StringBuilder(); + sb.append(firstName); + + // if the actual parameter is not null + if (secondName != null && secondName.length() > 0) { + String surname = continuation.getObject().toString(); + sb.append(' ').append(surname); + } + System.out.println("Saying hi to " + sb.toString()); + return "Hi " + sb.toString(); + } + } + + // unreachable + return null; + } + + public boolean isRequestSuspended(String name) { + synchronized (suspended) { + while (!suspended.containsKey(name)) { + try { + suspended.wait(10000); + } catch (InterruptedException ex) { + return false; + } + } + } + return true; + } + + public void resumeRequest(final String name) { + + Continuation suspendedCont = null; + synchronized (suspended) { + suspendedCont = suspended.get(name); + } + + if (suspendedCont != null) { + synchronized (suspendedCont) { + suspendedCont.resume(); + } + } + } + + private void suspendInvocation(String name, Continuation cont) { + try { + cont.suspend(20000); + } finally { + synchronized (suspended) { + suspended.put(name, cont); + suspended.notifyAll(); + } + } + } + + private Continuation getContinuation(String name) { + synchronized (suspended) { + Continuation suspendedCont = suspended.remove(name); + if (suspendedCont != null) { + return suspendedCont; + } + } + + HttpServletRequest request = + (HttpServletRequest)context.getMessageContext().get(MessageContext.SERVLET_REQUEST); + return ContinuationSupport.getContinuation(request, null); + } +} Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithContinuation.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithContinuation.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithWrapppedContinuation.java URL: http://svn.apache.org/viewvc/cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithWrapppedContinuation.java?rev=713355&view=auto ============================================================================== --- cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithWrapppedContinuation.java (added) +++ cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithWrapppedContinuation.java Wed Nov 12 04:42:46 2008 @@ -0,0 +1,125 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.systest.jaxws.continuations; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; +import javax.jws.WebService; +import javax.xml.ws.WebServiceContext; + +import org.apache.cxf.continuations.ContinuationProvider; +import org.apache.cxf.continuations.ContinuationWrapper; + + +@WebService(name = "HelloContinuation", + serviceName = "HelloContinuationService", + portName = "HelloContinuationPort", + targetNamespace = "http://cxf.apache.org/systest/jaxws", + endpointInterface = "org.apache.cxf.systest.jaxws.continuations.HelloContinuation") +public class HelloImplWithWrapppedContinuation implements HelloContinuation { + + + private Map suspended = + new HashMap(); + + + @Resource + private WebServiceContext context; + + public String sayHi(String firstName, String secondName) { + + ContinuationWrapper continuation = getContinuation(firstName); + if (continuation == null) { + throw new RuntimeException("Failed to get continuation"); + } + synchronized (continuation) { + if (continuation.isNew()) { + Object userObject = secondName != null && secondName.length() > 0 + ? secondName : null; + continuation.setObject(userObject); + suspendInvocation(firstName, continuation); + } else { + StringBuilder sb = new StringBuilder(); + sb.append(firstName); + + // if the actual parameter is not null + if (secondName != null && secondName.length() > 0) { + String surname = continuation.getObject().toString(); + sb.append(' ').append(surname); + } + System.out.println("Saying hi to " + sb.toString()); + return "Hi " + sb.toString(); + } + } + // unreachable + return null; + } + + public boolean isRequestSuspended(String name) { + synchronized (suspended) { + while (!suspended.containsKey(name)) { + try { + suspended.wait(10000); + } catch (InterruptedException ex) { + return false; + } + } + } + return true; + } + + public void resumeRequest(final String name) { + + ContinuationWrapper suspendedCont = null; + synchronized (suspended) { + suspendedCont = suspended.get(name); + } + + if (suspendedCont != null) { + synchronized (suspendedCont) { + suspendedCont.resume(); + } + } + } + + private void suspendInvocation(String name, ContinuationWrapper cont) { + try { + cont.suspend(20000); + } finally { + synchronized (suspended) { + suspended.put(name, cont); + suspended.notifyAll(); + } + } + } + + private ContinuationWrapper getContinuation(String name) { + synchronized (suspended) { + ContinuationWrapper suspendedCont = suspended.remove(name); + if (suspendedCont != null) { + return suspendedCont; + } + } + + ContinuationProvider provider = + (ContinuationProvider)context.getMessageContext().get(ContinuationProvider.class.getName()); + return provider.getContinuation(null); + } +} Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithWrapppedContinuation.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloImplWithWrapppedContinuation.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloWorker.java URL: http://svn.apache.org/viewvc/cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloWorker.java?rev=713355&view=auto ============================================================================== --- cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloWorker.java (added) +++ cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloWorker.java Wed Nov 12 04:42:46 2008 @@ -0,0 +1,67 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.systest.jaxws.continuations; + +import java.util.concurrent.CountDownLatch; + +import org.junit.Assert; + +public class HelloWorker implements Runnable { + + private HelloContinuation helloPort; + private String firstName; + private String secondName; + private CountDownLatch startSignal; + private CountDownLatch doneSignal; + public HelloWorker(HelloContinuation helloPort, + String firstName, + String secondName, + CountDownLatch startSignal, + CountDownLatch doneSignal) { + this.helloPort = helloPort; + this.firstName = firstName; + this.secondName = secondName; + this.startSignal = startSignal; + this.doneSignal = doneSignal; + } + + public void run() { + StringBuilder expected = new StringBuilder(); + expected.append(firstName); + if (secondName != null && secondName.length() > 0) { + expected.append(' ').append(secondName); + } + + try { + startSignal.await(); + + Assert.assertEquals("Wrong hello", "Hi " + expected.toString(), + helloPort.sayHi(firstName, secondName)); + doneSignal.countDown(); + } catch (InterruptedException ex) { + // ignore + } catch (RuntimeException ex) { + ex.printStackTrace(); + Assert.fail("Hello thread failed for : " + expected.toString()); + } + + } + +} Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloWorker.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/HelloWorker.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/cxf.xml URL: http://svn.apache.org/viewvc/cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/cxf.xml?rev=713355&view=auto ============================================================================== --- cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/cxf.xml (added) +++ cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/cxf.xml Wed Nov 12 04:42:46 2008 @@ -0,0 +1,33 @@ + + + + + + + + + Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/cxf.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/cxf.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/cxf.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/jetty-engine.xml URL: http://svn.apache.org/viewvc/cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/jetty-engine.xml?rev=713355&view=auto ============================================================================== --- cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/jetty-engine.xml (added) +++ cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/jetty-engine.xml Wed Nov 12 04:42:46 2008 @@ -0,0 +1,32 @@ + + + + + + + + \ No newline at end of file Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/jetty-engine.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/jetty-engine.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: cxf/sandbox/2.2.x-continuations/systests/src/test/java/org/apache/cxf/systest/jaxws/continuations/jetty-engine.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml