You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Andrea Smyth <an...@iona.com> on 2007/06/29 16:03:26 UTC
Re: svn commit: r551872 - in /incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws:
addressing/ policy/ rm/ util/
Glen Mazza wrote:
>Since we don't know if this problem occurs with all versions of HP-UX,
>other OS' besides HP-UX, or with certain servlet containers, etc., I
>wonder if the solution below should be generalized and made
>user-configurable.
>
>I still don't know enough about the CXF architecture. But is there some
>configuration file for which we can add a "keepaliveconnections"
>parameter or similar, that when set by the user, will activate the logic
>that is presently hardcoded just to HP-UX below?
>
Hi Glen,
Yes, there is (the Connection attribute in HTTPClientPolicy), see e.g.
cxf-hpux.xml.
But as it happens, the programmatic change requires usually usually less
code than providing separate cfg files for HP and non-HP platforms, and
in any case the choice of the cfg files needs to be coded somewhere.
I should add that with the changes I committed I got a complete build
passing on HP-UX.
Cheers,
Andrea.
>Then it would just be
>a simple website FAQ item for the user to set this parameter whenever
>his particular setup appears to need it. Do you think this would be a
>useful change, or a little bit of overkill right now?
>
>Thanks,
>Glen
>
>
>Am Freitag, den 29.06.2007, 12:36 +0000 schrieb andreasmyth@apache.org:
>
>
>>Author: andreasmyth
>>Date: Fri Jun 29 05:36:41 2007
>>New Revision: 551872
>>
>>URL: http://svn.apache.org/viewvc?view=rev&rev=551872
>>Log:
>>[JIRA CXF-755] Configure clients on HP to use keep-alive connections when
>>ReplyTo is non-anonymous.
>>
>>Added:
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf-hpux.xml (with props)
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/ConnectionHelper.java (with props)
>>Modified:
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingOptionalPolicyTest.java
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledBareTest.java
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
>> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java Fri Jun 29 05:36:41 2007
>>@@ -19,6 +19,13 @@
>>
>> package org.apache.cxf.systest.ws.addressing;
>>
>>+import java.lang.reflect.UndeclaredThrowableException;
>>+import java.net.SocketException;
>>+import org.apache.cxf.message.Message;
>>+import org.apache.cxf.phase.AbstractPhaseInterceptor;
>>+import org.apache.cxf.phase.Phase;
>>+import org.apache.cxf.systest.ws.util.ConnectionHelper;
>>+import org.apache.hello_world_soap_http.BadRecordLitFault;
>> import org.junit.Test;
>>
>>
>>@@ -27,8 +34,12 @@
>> */
>> public class MAPTest extends MAPTestBase {
>>
>>- private static final String CONFIG =
>>- "org/apache/cxf/systest/ws/addressing/cxf.xml";
>>+ private static final String CONFIG;
>>+ static {
>>+ CONFIG = "org/apache/cxf/systest/ws/addressing/cxf"
>>+ + ("HP-UX".equals(System.getProperty("os.name")) ? "-hpux" : "")
>>+ + ".xml";
>>+ }
>>
>> public String getConfigFileName() {
>> return CONFIG;
>>@@ -38,6 +49,91 @@
>> public void foo() {
>>
>> }
>>+
>>+ @Test
>>+ public void testUsingKeepAliveConnection() throws Exception {
>>+ if (!"HP-UX".equals(System.getProperty("os.name"))) {
>>+ return;
>>+ }
>>+ int n = 100;
>>+ for (int i = 0; i < n; i++) {
>>+ greeter.greetMeOneWay("oneway on keep-alive connection");
>>+ }
>>+ for (int i = 0; i < n; i++) {
>>+ assertNotNull(greeter.greetMe("twoway on keep-alive connection"));
>>+ }
>>+ for (int i = 0; i < 0; i++) {
>>+ try {
>>+ greeter.testDocLitFault("BadRecordLitFault");
>>+ fail("expected fault from service");
>>+ } catch (BadRecordLitFault brlf) {
>>+ //checkVerification();
>>+ } catch (UndeclaredThrowableException ex) {
>>+ throw (Exception)ex.getCause();
>>+ }
>>+ }
>>+ }
>>
>>+ /**
>>+ * On HP-UX, the server seems to close the connection by the time the
>>+ * thread servicing the requests terminates and therefore possibly before
>>+ * the client has had a chance to read the response (the client throws
>>+ * a SocketException: Broken pipe). This may be a bug
>>+ * in Jetty or in the HP-UX JDK. It can be worked around by
>>+ * adding a sleep to the end of method handle in
>>+ * org.apache.cxf.transport.http_jetty.JettyHTTPHandler or,
>>+ * preferrably, by ensuring the client uses keep alive
>>+ * connections.
>>+ */
>>+ @Test
>>+ public void testDelayReadingPartialResponse() throws Exception {
>>+ if (!"HP-UX".equals(System.getProperty("os.name"))) {
>>+ return;
>>+ }
>>+
>>+ assertTrue(ConnectionHelper.isKeepAliveConnection(greeter));
>>+ ConnectionHelper.setKeepAliveConnection(greeter, false);
>>+
>>+ class DelayInterceptor extends AbstractPhaseInterceptor<Message> {
>>+ long delay = 100L;
>>+ DelayInterceptor() {
>>+ super(Phase.RECEIVE);
>>+ }
>>+ public void handleMessage(Message msg) {
>>+ try {
>>+ Thread.sleep(delay);
>>+ } catch (Exception ex) {
>>+ // ignore
>>+ } finally {
>>+ if (delay < 1000L) {
>>+ delay += 100L;
>>+ }
>>+ }
>>+ }
>>+ }
>>+ DelayInterceptor interceptor = new DelayInterceptor();
>>+ staticBus.getInInterceptors().add(interceptor);
>>+
>>+ int n = 100;
>>+ try {
>>+ for (int i = 0; i < n; i++) {
>>+ greeter.greetMeOneWay("delay reading partial reponse");
>>+ }
>>+ fail("Expected SocketException not thrown");
>>+ } catch (Exception ex) {
>>+ Throwable t = ex.getCause();
>>+ while (null != t.getCause()) {
>>+ t = t.getCause();
>>+ }
>>+ assertTrue("Unexpected exception type: " + t.getClass().getName(),
>>+ t instanceof SocketException);
>>+ } finally {
>>+ // need to reset to Keep-Alive for subsequenct tests
>>+ // (all tests are using the same conduit selector, and
>>+ // thus the same conduit)
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ staticBus.getInInterceptors().remove(interceptor);
>>+ }
>>+ }
>> }
>>
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java Fri Jun 29 05:36:41 2007
>>@@ -61,9 +61,12 @@
>> */
>> public abstract class MAPTestBase extends AbstractClientServerTestBase implements VerificationCache {
>>
>>+ protected static Bus staticBus;
>>+
>> static final String INBOUND_KEY = "inbound";
>> static final String OUTBOUND_KEY = "outbound";
>>
>>+
>> private static MAPVerifier mapVerifier;
>> private static HeaderVerifier headerVerifier;
>>
>>@@ -76,9 +79,7 @@
>>
>> private static Map<Object, Map<String, String>> messageIDs =
>> new HashMap<Object, Map<String, String>>();
>>- private static Bus staticBus;
>>-
>>- private Greeter greeter;
>>+ protected Greeter greeter;
>> private String verified;
>>
>>
>>
>>Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf-hpux.xml
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf-hpux.xml?view=auto&rev=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf-hpux.xml (added)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf-hpux.xml Fri Jun 29 05:36:41 2007
>>@@ -0,0 +1,33 @@
>>+<?xml version="1.0" encoding="UTF-8"?>
>>+<!--
>>+ 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.
>>+-->
>>+<beans xmlns="http://www.springframework.org/schema/beans"
>>+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
>>+ xsi:schemaLocation="
>>+http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
>>+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
>>+
>>+ <http:conduit name="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit">
>>+ <http:client Connection="Keep-Alive" DecoupledEndpoint="http://localhost:9999/decoupled_endpoint"/>
>>+ </http:conduit>
>>+
>>+ <import resource="wsa_interceptors.xml"/>
>>+</beans>
>>+
>>
>>Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf-hpux.xml
>>------------------------------------------------------------------------------
>> svn:eol-style = native
>>
>>Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf-hpux.xml
>>------------------------------------------------------------------------------
>> svn:keywords = Rev Date
>>
>>Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf-hpux.xml
>>------------------------------------------------------------------------------
>> svn:mime-type = text/xml
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java Fri Jun 29 05:36:41 2007
>>@@ -34,6 +34,7 @@
>> import org.apache.cxf.greeter_control.PingMeFault;
>> import org.apache.cxf.interceptor.Interceptor;
>> import org.apache.cxf.service.model.ServiceInfo;
>>+import org.apache.cxf.systest.ws.util.ConnectionHelper;
>> import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
>> import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
>> import org.apache.cxf.ws.policy.ServerPolicyInInterceptor;
>>@@ -92,6 +93,10 @@
>> BasicGreeterService gs = new BasicGreeterService();
>> final Greeter greeter = gs.getGreeterPort();
>> LOG.fine("Created greeter client.");
>>+
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ }
>>
>> Client client = ClientProxy.getClient(greeter);
>> List<ServiceInfo> sis = client.getEndpoint().getService().getServiceInfos();
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingOptionalPolicyTest.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingOptionalPolicyTest.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingOptionalPolicyTest.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingOptionalPolicyTest.java Fri Jun 29 05:36:41 2007
>>@@ -31,6 +31,7 @@
>> import org.apache.cxf.greeter_control.PingMeFault;
>> import org.apache.cxf.interceptor.LoggingInInterceptor;
>> import org.apache.cxf.interceptor.LoggingOutInterceptor;
>>+import org.apache.cxf.systest.ws.util.ConnectionHelper;
>> import org.apache.cxf.systest.ws.util.InMessageRecorder;
>> import org.apache.cxf.systest.ws.util.MessageFlow;
>> import org.apache.cxf.systest.ws.util.OutMessageRecorder;
>>@@ -104,6 +105,10 @@
>> final Greeter greeter = gs.getGreeterPort();
>> LOG.fine("Created greeter client.");
>>
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ }
>>+
>> // oneway
>>
>> greeter.greetMeOneWay("CXF");
>>@@ -150,6 +155,10 @@
>> BasicGreeterService gs = new BasicGreeterService();
>> final Greeter greeter = gs.getGreeterPort();
>> LOG.fine("Created greeter client.");
>>+
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ }
>>
>> // oneway
>>
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java Fri Jun 29 05:36:41 2007
>>@@ -31,6 +31,7 @@
>> import org.apache.cxf.greeter_control.PingMeFault;
>> import org.apache.cxf.interceptor.LoggingInInterceptor;
>> import org.apache.cxf.interceptor.LoggingOutInterceptor;
>>+import org.apache.cxf.systest.ws.util.ConnectionHelper;
>> import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
>> import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
>> import org.junit.BeforeClass;
>>@@ -98,6 +99,9 @@
>> BasicGreeterService gs = new BasicGreeterService();
>> final Greeter greeter = gs.getGreeterPort();
>> LOG.fine("Created greeter client.");
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ }
>>
>> // oneway
>>
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java Fri Jun 29 05:36:41 2007
>>@@ -31,6 +31,7 @@
>> import org.apache.cxf.greeter_control.PingMeFault;
>> import org.apache.cxf.interceptor.LoggingInInterceptor;
>> import org.apache.cxf.interceptor.LoggingOutInterceptor;
>>+import org.apache.cxf.systest.ws.util.ConnectionHelper;
>> import org.apache.cxf.systest.ws.util.InMessageRecorder;
>> import org.apache.cxf.systest.ws.util.MessageFlow;
>> import org.apache.cxf.systest.ws.util.MessageRecorder;
>>@@ -107,6 +108,10 @@
>> final Greeter greeter = gs.getGreeterPort();
>> LOG.fine("Created greeter client.");
>>
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+
>>+ }
>> // oneway
>>
>> greeter.greetMeOneWay("CXF");
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java Fri Jun 29 05:36:41 2007
>>@@ -31,6 +31,7 @@
>> import org.apache.cxf.greeter_control.ReliableGreeterService;
>> import org.apache.cxf.interceptor.LoggingInInterceptor;
>> import org.apache.cxf.interceptor.LoggingOutInterceptor;
>>+import org.apache.cxf.systest.ws.util.ConnectionHelper;
>> import org.apache.cxf.systest.ws.util.InMessageRecorder;
>> import org.apache.cxf.systest.ws.util.MessageFlow;
>> import org.apache.cxf.systest.ws.util.MessageRecorder;
>>@@ -106,6 +107,10 @@
>> ReliableGreeterService gs = new ReliableGreeterService();
>> final Greeter greeter = gs.getGreeterPort();
>> LOG.fine("Created greeter client.");
>>+
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ }
>>
>> // oneway
>>
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledBareTest.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledBareTest.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledBareTest.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledBareTest.java Fri Jun 29 05:36:41 2007
>>@@ -27,6 +27,7 @@
>> import org.apache.cxf.Bus;
>> import org.apache.cxf.BusFactory;
>> import org.apache.cxf.bus.spring.SpringBusFactory;
>>+import org.apache.cxf.systest.ws.util.ConnectionHelper;
>> import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
>> import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
>> import org.apache.hello_world_soap_http.DocLitBare;
>>@@ -87,6 +88,10 @@
>> assertNotNull(service);
>>
>> DocLitBare greeter = service.getSoapPort();
>>+
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ }
>>
>> BareDocumentResponse bareres = greeter.testDocLitBare("MySimpleDocument");
>> assertNotNull("no response for operation testDocLitBare", bareres);
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java Fri Jun 29 05:36:41 2007
>>@@ -30,6 +30,7 @@
>> import org.apache.cxf.greeter_control.GreeterService;
>> import org.apache.cxf.interceptor.LoggingInInterceptor;
>> import org.apache.cxf.interceptor.LoggingOutInterceptor;
>>+import org.apache.cxf.systest.ws.util.ConnectionHelper;
>> import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
>> import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
>> import org.junit.BeforeClass;
>>@@ -100,7 +101,11 @@
>> GreeterService gs = new GreeterService();
>> final Greeter greeter = gs.getGreeterPort();
>> LOG.fine("Created greeter client.");
>>-
>>+
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ }
>>+
>> class TwowayThread extends Thread {
>>
>> String response;
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java Fri Jun 29 05:36:41 2007
>>@@ -43,6 +43,7 @@
>> import org.apache.cxf.message.Message;
>> import org.apache.cxf.phase.AbstractPhaseInterceptor;
>> import org.apache.cxf.phase.Phase;
>>+import org.apache.cxf.systest.ws.util.ConnectionHelper;
>> import org.apache.cxf.systest.ws.util.InMessageRecorder;
>> import org.apache.cxf.systest.ws.util.MessageFlow;
>> import org.apache.cxf.systest.ws.util.MessageRecorder;
>>@@ -166,6 +167,10 @@
>> greeter = gs.getGreeterPort();
>> LOG.fine("Created greeter client.");
>>
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ }
>>+
>> greeter.greetMeOneWay("once");
>>
>> }
>>@@ -1308,6 +1313,10 @@
>>
>> greeter = gs.getGreeterPort();
>> LOG.fine("Created greeter client.");
>>+
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ }
>>
>> if (!useDecoupledEndpoint) {
>> return;
>>
>>Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java?view=diff&rev=551872&r1=551871&r2=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java (original)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java Fri Jun 29 05:36:41 2007
>>@@ -34,6 +34,7 @@
>> import org.apache.cxf.greeter_control.Greeter;
>> import org.apache.cxf.greeter_control.GreeterService;
>> import org.apache.cxf.greeter_control.types.GreetMeResponse;
>>+import org.apache.cxf.systest.ws.util.ConnectionHelper;
>> import org.apache.cxf.systest.ws.util.InMessageRecorder;
>> import org.apache.cxf.systest.ws.util.MessageFlow;
>> import org.apache.cxf.systest.ws.util.MessageRecorder;
>>@@ -101,14 +102,18 @@
>> LOG.fine("Created bus " + greeterBus + " with cfg : " + CFG);
>> BusFactory.setDefaultBus(greeterBus);
>>
>>- // avoid soon cliejt resends
>>+ // avoid early client resends
>> greeterBus.getExtension(RMManager.class).getRMAssertion().getBaseRetransmissionInterval()
>> .setMilliseconds(new BigInteger("60000"));
>> GreeterService gs = new GreeterService();
>> Greeter greeter = gs.getGreeterPort();
>>
>> LOG.fine("Created greeter client.");
>>-
>>+
>>+ if ("HP-UX".equals(System.getProperty("os.name"))) {
>>+ ConnectionHelper.setKeepAliveConnection(greeter, true);
>>+ }
>>+
>> Client c = ClientProxy.getClient(greeter);
>> HTTPConduit hc = (HTTPConduit)(c.getConduit());
>> HTTPClientPolicy cp = hc.getClient();
>>@@ -148,7 +153,8 @@
>> }
>>
>> void verifyMissingResponse(Response<GreetMeResponse> responses[]) throws Exception {
>>- awaitMessages(4, 7);
>>+ awaitMessages(4, 7, 20000);
>>+
>> // wait another while to prove that response to second request is indeed lost
>> Thread.sleep(1000);
>> int nDone = 0;
>>@@ -216,7 +222,7 @@
>> }
>>
>>
>>- private void awaitMessages(int nExpectedOut, int nExpectedIn) {
>>+ protected void awaitMessages(int nExpectedOut, int nExpectedIn) {
>> awaitMessages(nExpectedOut, nExpectedIn, 10000);
>> }
>>
>>
>>Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/ConnectionHelper.java
>>URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/ConnectionHelper.java?view=auto&rev=551872
>>==============================================================================
>>--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/ConnectionHelper.java (added)
>>+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/ConnectionHelper.java Fri Jun 29 05:36:41 2007
>>@@ -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.ws.util;
>>+
>>+import org.apache.cxf.endpoint.Client;
>>+import org.apache.cxf.frontend.ClientProxy;
>>+import org.apache.cxf.transport.http.HTTPConduit;
>>+import org.apache.cxf.transports.http.configuration.ConnectionType;
>>+import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
>>+
>>+/**
>>+ *
>>+ */
>>+public final class ConnectionHelper {
>>+
>>+ private ConnectionHelper() {
>>+ }
>>+
>>+ public static void setKeepAliveConnection(Object proxy, boolean keepAlive) {
>>+ Client client = ClientProxy.getClient(proxy);
>>+ HTTPConduit hc = (HTTPConduit)client.getConduit();
>>+ HTTPClientPolicy cp = hc.getClient();
>>+ cp.setConnection(keepAlive ? ConnectionType.KEEP_ALIVE : ConnectionType.CLOSE);
>>+ }
>>+
>>+ public static boolean isKeepAliveConnection(Object proxy) {
>>+ Client client = ClientProxy.getClient(proxy);
>>+ HTTPConduit hc = (HTTPConduit)client.getConduit();
>>+ HTTPClientPolicy cp = hc.getClient();
>>+ return cp.getConnection() == ConnectionType.KEEP_ALIVE;
>>+ }
>>+}
>>
>>Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/ConnectionHelper.java
>>------------------------------------------------------------------------------
>> svn:eol-style = native
>>
>>Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/ConnectionHelper.java
>>------------------------------------------------------------------------------
>> svn:keywords = Rev Date
>>
>>
>>
>>
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: svn commit: r551872 - in
/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws:
addressing/ policy/ rm/ util/
Posted by Glen Mazza <gl...@verizon.net>.
Am Freitag, den 29.06.2007, 15:03 +0100 schrieb Andrea Smyth:
> Glen Mazza wrote:
>
> >Since we don't know if this problem occurs with all versions of HP-UX,
> >other OS' besides HP-UX, or with certain servlet containers, etc., I
> >wonder if the solution below should be generalized and made
> >user-configurable.
> >
> >I still don't know enough about the CXF architecture. But is there some
> >configuration file for which we can add a "keepaliveconnections"
> >parameter or similar, that when set by the user, will activate the logic
> >that is presently hardcoded just to HP-UX below?
> >
> Hi Glen,
>
> Yes, there is (the Connection attribute in HTTPClientPolicy), see e.g.
> cxf-hpux.xml.
> But as it happens, the programmatic change requires usually usually less
> code than providing separate cfg files for HP and non-HP platforms, and
> in any case the choice of the cfg files needs to be coded somewhere.
> I should add that with the changes I committed I got a complete build
> passing on HP-UX.
>
Oh, my error here, never mind--I didn't notice this hardcoded
configuration was just for the testing module, not production use.
Glen
> Cheers,
> Andrea.
>
> >Then it would just be
> >a simple website FAQ item for the user to set this parameter whenever
> >his particular setup appears to need it. Do you think this would be
> a
> >useful change, or a little bit of overkill right now?
> >
> >Thanks,
> >Glen
> >
> >
> >Am Freitag, den 29.06.2007, 12:36 +0000 schrieb
> andreasmyth@apache.org:
> >
> >
> >>Author: andreasmyth
> >>Date: Fri Jun 29 05:36:41 2007
> >>New Revision: 551872
> >>
> >>URL: http://svn.apache.org/viewvc?view=rev&rev=551872
> >>Log:
> >>[JIRA CXF-755] Configure clients on HP to use keep-alive connections
> when
> >>ReplyTo is non-anonymous.
> >>
> >>Added:
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf-hpux.xml (with props)
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/ConnectionHelper.java (with props)
> >>Modified:
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingOptionalPolicyTest.java
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyTest.java
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledBareTest.java
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
> >>
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
> >>