Author: asoldano
Date: 2013-12-17 11:03:49 -0500 (Tue, 17 Dec 2013)
New Revision: 18197
Added:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/socket/
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/socket/tcp/
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/socket/tcp/SSLNoDelaySocketFactory.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SSLNoDelaySocketFactoryTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleService.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleServiceImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3745/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3745/WEB-INF/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3745/WEB-INF/web.xml
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
Log:
[JBWS-3745] Allow disabling Nagle's algorithm on Web Service calls (patch from Navin
Surtani, modifyied to use a new Bus for each client creation, to stop the deployment when
the test is done and other minor things)
Added:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/socket/tcp/SSLNoDelaySocketFactory.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/socket/tcp/SSLNoDelaySocketFactory.java
(rev 0)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/socket/tcp/SSLNoDelaySocketFactory.java 2013-12-17
16:03:49 UTC (rev 18197)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.wsf.stack.cxf.client.socket.tcp;
+
+import javax.net.ssl.SSLSocketFactory;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+/**
+ * A wrapper SocketFactory implementation that will call setTcpNoDelay(true) whenever
createSocket() is called. This
+ * is done as a feature for the JIRA issue: JBWS-3745.
+ *
+ * @author navssurtani
+ */
+public class SSLNoDelaySocketFactory extends SSLSocketFactory
+{
+
+ private final SSLSocketFactory targetFactory;
+
+ public SSLNoDelaySocketFactory(SSLSocketFactory targetFactory)
+ {
+ this.targetFactory = targetFactory;
+ }
+
+
+ @Override
+ public String[] getDefaultCipherSuites()
+ {
+ return targetFactory.getDefaultCipherSuites();
+ }
+
+ @Override
+ public String[] getSupportedCipherSuites()
+ {
+ return targetFactory.getSupportedCipherSuites();
+ }
+
+ @Override
+ public Socket createSocket() throws IOException {
+ Socket toReturn = targetFactory.createSocket();
+ toReturn.setTcpNoDelay(true);
+ return toReturn;
+ }
+
+ @Override
+ public Socket createSocket(Socket socket, String s, int i, boolean b) throws
IOException
+ {
+ Socket toReturn = targetFactory.createSocket(socket, s, i, b);
+ toReturn.setTcpNoDelay(true);
+ return toReturn;
+ }
+
+ @Override
+ public Socket createSocket(String s, int i) throws IOException, UnknownHostException
+ {
+ Socket toReturn = targetFactory.createSocket(s, i);
+ toReturn.setTcpNoDelay(true);
+ return toReturn;
+ }
+
+ @Override
+ public Socket createSocket(String s, int i, InetAddress inetAddress, int i2) throws
IOException, UnknownHostException
+ {
+ Socket toReturn = targetFactory.createSocket(s, i, inetAddress, i2);
+ toReturn.setTcpNoDelay(true);
+ return toReturn;
+ }
+
+ @Override
+ public Socket createSocket(InetAddress inetAddress, int i) throws IOException
+ {
+ Socket toReturn = targetFactory.createSocket(inetAddress, i);
+ toReturn.setTcpNoDelay(true);
+ return toReturn;
+ }
+
+ @Override
+ public Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress2,
int i2) throws IOException
+ {
+ Socket toReturn = targetFactory.createSocket(inetAddress, i, inetAddress2, i2);
+ toReturn.setTcpNoDelay(true);
+ return toReturn;
+ }
+}
Property changes on:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/socket/tcp/SSLNoDelaySocketFactory.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2013-12-17
11:35:35 UTC (rev 18196)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2013-12-17
16:03:49 UTC (rev 18197)
@@ -488,6 +488,14 @@
</fileset>
</jar>
+ <!-- jaxws-cxf-jbws3745 -->
+ <war destfile="${tests.output.dir}/test-libs/jaxws-cxf-jbws3745.war"
+
webxml="${tests.output.dir}/test-resources/jaxws/cxf/jbws3745/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleService*.class"
/>
+ </classes>
+ </war>
+
<!-- jaxws-cxf-logging -->
<jar destfile="${tests.output.dir}/test-libs/jaxws-cxf-logging.jar">
<fileset dir="${tests.output.dir}/test-classes">
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SSLNoDelaySocketFactoryTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SSLNoDelaySocketFactoryTestCase.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SSLNoDelaySocketFactoryTestCase.java 2013-12-17
16:03:49 UTC (rev 18197)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.test.ws.jaxws.cxf.jbws3745;
+
+import java.net.InetAddress;
+import java.net.Socket;
+
+import javax.net.ssl.SSLSocketFactory;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.apache.cxf.configuration.jsse.TLSClientParameters;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.jboss.wsf.stack.cxf.client.UseNewBusFeature;
+import org.jboss.wsf.stack.cxf.client.socket.tcp.SSLNoDelaySocketFactory;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Simple test case for {@link
org.jboss.wsf.stack.cxf.client.socket.tcp.SSLNoDelaySocketFactory}
+ * <p/>
+ * We will get an {@link javax.net.ssl.SSLSocketFactory} from the client. This should be
an instance of an
+ * SSLNoDelaySocketFactory. Once we have this we will simply create the socket and check
if the tcp no delay flag has
+ * been enabled.
+ *
+ * @author navssurtani
+ */
+public class SSLNoDelaySocketFactoryTestCase extends JBossWSTest
+{
+ /* The SocketFactory instance that will be used to get hold of the socket to be tested
*/
+ private SSLSocketFactory fromClient = null;
+
+ private static final int SERVER_PORT = 8080;
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(SSLNoDelaySocketFactoryTestCase.class,
"jaxws-cxf-jbws3745.war");
+ }
+
+ public void setUp() throws Exception
+ {
+ // First we need the client parameters
+ Client client = ClientProxy.getClient(getPort());
+ HTTPConduit conduit = (HTTPConduit) client.getConduit();
+ TLSClientParameters tls = conduit.getTlsClientParameters();
+
+ // Now we need to build the socket factory
+ SSLSocketFactory defaultSocketFactory = (SSLSocketFactory)
SSLSocketFactory.getDefault();
+ SSLNoDelaySocketFactory noDelay = new
SSLNoDelaySocketFactory(defaultSocketFactory);
+
+ // Now set the socket factory and make a simple check.
+ tls.setSSLSocketFactory(noDelay);
+ fromClient = tls.getSSLSocketFactory();
+ assertEquals(fromClient.getClass(), SSLNoDelaySocketFactory.class);
+ }
+
+ public void tearDown() throws Exception {
+ fromClient = null;
+ }
+
+ public void testCreateSocket0() throws Exception
+ {
+ Socket toTest = null;
+ try {
+ toTest = fromClient.createSocket();
+ assertTrue(toTest.getTcpNoDelay());
+ } finally {
+ if (toTest != null)
+ toTest.close();
+ }
+ }
+
+ public void testCreateSocket1() throws Exception
+ {
+ Socket toTest = null;
+ try {
+ toTest = fromClient.createSocket(getServerHost(), SERVER_PORT);
+ assertTrue(toTest.getTcpNoDelay());
+ } finally {
+ if (toTest != null)
+ toTest.close();
+ }
+ }
+
+ public void testCreateSocket3() throws Exception
+ {
+ Socket toTest = null;
+ try {
+ toTest = fromClient.createSocket(InetAddress.getByName(getServerHost()),
SERVER_PORT);
+ assertTrue(toTest.getTcpNoDelay());
+ } finally {
+ if (toTest != null)
+ toTest.close();
+ }
+ }
+
+ private SimpleService getPort() throws Exception
+ {
+ final QName qname = new QName("http://org.jboss.ws/jaxws/cxf/jbws3745",
"SimpleService");
+ final Service service = Service.create(qname, new UseNewBusFeature());
+ return service.getPort(SimpleService.class);
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SSLNoDelaySocketFactoryTestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleService.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleService.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleService.java 2013-12-17
16:03:49 UTC (rev 18197)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.test.ws.jaxws.cxf.jbws3745;
+
+import javax.jws.WebService;
+
+/**
+ * A simple, dummy web service
+ *
+ * @author navssurtani
+ */
+@WebService (name = "SimpleService", targetNamespace =
"http://org.jboss.ws.jaxws/cxf/jbws3745",
+ serviceName = "simple")
+public interface SimpleService
+{
+ public String sayHi();
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleService.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleServiceImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleServiceImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleServiceImpl.java 2013-12-17
16:03:49 UTC (rev 18197)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.test.ws.jaxws.cxf.jbws3745;
+
+import javax.jws.WebService;
+
+/**
+ * Implementation for {@link org.jboss.test.ws.jaxws.cxf.jbws3745.SimpleService}
+ *
+ * @author navssurtani
+ */
+@WebService (name = "SimpleService", targetNamespace =
"http://org.jboss.ws.jaxws/cxf/jbws3745",
+ serviceName = "simple")
+public class SimpleServiceImpl implements SimpleService
+{
+ @Override
+ public String sayHi()
+ {
+ return "Hi!";
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3745/SimpleServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3745/WEB-INF/web.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3745/WEB-INF/web.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3745/WEB-INF/web.xml 2013-12-17
16:03:49 UTC (rev 18197)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>SimpleService</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.cxf.jbws3745.SimpleServiceImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>SimpleService</servlet-name>
+ <url-pattern>/SimpleService</url-pattern>
+ </servlet-mapping>
+
+</web-app>
\ No newline at end of file
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3745/WEB-INF/web.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native