Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2868DE107 for ; Tue, 22 Jan 2013 20:38:32 +0000 (UTC) Received: (qmail 47984 invoked by uid 500); 22 Jan 2013 20:38:32 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 47942 invoked by uid 500); 22 Jan 2013 20:38:32 -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 47935 invoked by uid 99); 22 Jan 2013 20:38:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Jan 2013 20:38:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED 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; Tue, 22 Jan 2013 20:38:29 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id CFE5D238896F; Tue, 22 Jan 2013 20:38:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1437152 - in /cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature: FaultToEndpointServer.java WSAFaultToClientServerTest.java Date: Tue, 22 Jan 2013 20:38:08 -0000 To: commits@cxf.apache.org From: ay@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130122203808.CFE5D238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ay Date: Tue Jan 22 20:38:08 2013 New Revision: 1437152 URL: http://svn.apache.org/viewvc?rev=1437152&view=rev Log: fix the connection hanging issue for systests/ws-specs Modified: cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/FaultToEndpointServer.java cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAFaultToClientServerTest.java Modified: cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/FaultToEndpointServer.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/FaultToEndpointServer.java?rev=1437152&r1=1437151&r2=1437152&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/FaultToEndpointServer.java (original) +++ cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/FaultToEndpointServer.java Tue Jan 22 20:38:08 2013 @@ -19,6 +19,8 @@ package org.apache.cxf.systest.ws.addr_feature; import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; import java.util.concurrent.Future; import javax.jws.WebService; @@ -50,6 +52,7 @@ import org.eclipse.jetty.server.handler. public class FaultToEndpointServer extends AbstractBusTestServerBase { static final String FAULT_PORT = allocatePort(FaultToEndpointServer.class); + static final String FAULT_PORT2 = allocatePort(FaultToEndpointServer.class, 2); static final String PORT = allocatePort(FaultToEndpointServer.class, 1); EndpointImpl ep; @@ -113,14 +116,25 @@ public class FaultToEndpointServer exten public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html;charset=utf-8"); + + //System.out.println("In handler: " + request.getContentLength()); + + byte bytes[] = new byte[1024]; + InputStream in = request.getInputStream(); + while (in.read(bytes) > -1) { + //nothing + } + faultRequestPath = request.getPathInfo(); if ("/faultTo".equals(faultRequestPath)) { - response.setStatus(HttpServletResponse.SC_OK); + response.setStatus(HttpServletResponse.SC_ACCEPTED); } else { response.setStatus(HttpServletResponse.SC_NOT_FOUND); } + PrintWriter writer = response.getWriter(); + writer.println("Received"); + writer.close(); baseRequest.setHandled(true); - response.getWriter().println("Received"); } public static String getFaultRequestPath() { Modified: cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAFaultToClientServerTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAFaultToClientServerTest.java?rev=1437152&r1=1437151&r2=1437152&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAFaultToClientServerTest.java (original) +++ cxf/branches/2.6.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_feature/WSAFaultToClientServerTest.java Tue Jan 22 20:38:08 2013 @@ -27,8 +27,10 @@ import javax.xml.namespace.QName; import javax.xml.ws.BindingProvider; import javax.xml.ws.soap.AddressingFeature; +import org.apache.cxf.frontend.ClientProxy; import org.apache.cxf.systest.ws.AbstractWSATestBase; import org.apache.cxf.systest.ws.addr_feature.FaultToEndpointServer.HelloHandler; +import org.apache.cxf.transport.http.HTTPConduit; import org.apache.cxf.ws.addressing.AddressingProperties; import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.EndpointReferenceType; @@ -88,11 +90,15 @@ public class WSAFaultToClientServerTest public void testTwoWayFaultTo() throws Exception { ByteArrayOutputStream input = setupInLogging(); AddNumbersPortType port = getTwoWayPort(); - + + //setup a real decoupled endpoint that will process the fault correctly + HTTPConduit c = (HTTPConduit)ClientProxy.getClient(port).getConduit(); + c.getClient().setDecoupledEndpoint("http://localhost:" + FaultToEndpointServer.FAULT_PORT2 + "/sendFaultHere"); + EndpointReferenceType faultTo = new EndpointReferenceType(); AddressingProperties addrProperties = new AddressingPropertiesImpl(); AttributedURIType epr = new AttributedURIType(); - epr.setValue("http://localhost:" + FaultToEndpointServer.FAULT_PORT + "/faultTo"); + epr.setValue("http://localhost:" + FaultToEndpointServer.FAULT_PORT2 + "/sendFaultHere"); faultTo.setAddress(epr); addrProperties.setFaultTo(faultTo); @@ -108,14 +114,16 @@ public class WSAFaultToClientServerTest } catch (Exception e) { //do nothing } - - assertTrue("The response from faultTo endpoint is expected and actual response is " - + new String(input.toByteArray()) , - new String(input.toByteArray()).indexOf("The server sent HTTP status code :200") > -1); + + String in = new String(input.toByteArray()); + assertTrue("The response from faultTo endpoint is expected and actual response is " + in, + in.indexOf("Address: http://localhost:" + FaultToEndpointServer.FAULT_PORT2 + + "/sendFaultHere") > -1); assertTrue("WS addressing header is expected", - new String(input.toByteArray()).indexOf("http://www.w3.org/2005/08/addressing") > -1); + in.indexOf("http://www.w3.org/2005/08/addressing") > -1); assertTrue("Fault deatil is expected", - new String(input.toByteArray()).indexOf("Negative numbers cant be added") > -1); + in.indexOf("Negative numbers cant be added") > -1); + ((Closeable)port).close(); }