You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2016/02/26 04:50:53 UTC
[3/6] cxf git commit: [CXF-6800]add http-undertow transport
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/ApplicationContextTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/ApplicationContextTest.java b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/ApplicationContextTest.java
new file mode 100644
index 0000000..f3bae9f
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/ApplicationContextTest.java
@@ -0,0 +1,184 @@
+/**
+ * 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.transport.http_undertow.spring;
+
+import javax.xml.namespace.QName;
+
+import org.xml.sax.SAXParseException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.configuration.spring.ConfigurerImpl;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.test.TestApplicationContext;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transport.http_undertow.UndertowHTTPDestination;
+import org.apache.cxf.transport.http_undertow.UndertowHTTPServerEngine;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException;
+
+
+public class ApplicationContextTest extends Assert {
+
+ private static final String S1 =
+ ApplicationContextTest.class.getResource("/META-INF/cxf/cxf.xml").toString();
+
+ @Before
+ public void setUp() {
+ BusFactory.setDefaultBus(null);
+ }
+
+ @After
+ public void clearBus() {
+ BusFactory.setDefaultBus(null);
+ }
+
+
+ @Test
+ public void testInvalid() throws Exception {
+ String s4 = getClass()
+ .getResource("/org/apache/cxf/transport/http_undertow/spring/invalid-beans.xml").toString();
+
+ try {
+ new TestApplicationContext(new String[] {S1, s4}).close();
+ fail("Expected XmlBeanDefinitionStoreException not thrown.");
+ } catch (XmlBeanDefinitionStoreException ex) {
+ assertTrue(ex.getCause() instanceof SAXParseException);
+ }
+ }
+
+ @Test
+ public void testContext() throws Exception {
+ String s4 = getClass()
+ .getResource("/org/apache/cxf/transport/http_undertow/spring/beans.xml").toString();
+
+ TestApplicationContext ctx = new TestApplicationContext(
+ new String[] {S1, s4});
+
+
+ checkContext(ctx);
+ ctx.close();
+ ctx.destroy();
+ }
+ @Test
+ public void testContextWithProperties() throws Exception {
+ String s4 = getClass()
+ .getResource("/org/apache/cxf/transport/http_undertow/spring/beans-props.xml").toString();
+
+ TestApplicationContext ctx = new TestApplicationContext(
+ new String[] {S1, s4});
+ checkContext(ctx);
+ ctx.close();
+ ctx.destroy();
+ }
+ private void checkContext(TestApplicationContext ctx) throws Exception {
+ ConfigurerImpl cfg = new ConfigurerImpl(ctx);
+
+ EndpointInfo info = getEndpointInfo("bla", "Foo", "http://localhost:9000");
+
+ Bus bus = (Bus) ctx.getBean(Bus.DEFAULT_BUS_ID);
+ bus.setExtension(cfg, Configurer.class);
+
+ DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+ DestinationFactory factory = dfm.getDestinationFactory("http://cxf.apache.org/transports/http");
+ Destination d = factory.getDestination(info, bus);
+ assertTrue(d instanceof UndertowHTTPDestination);
+ UndertowHTTPDestination jd = (UndertowHTTPDestination) d;
+ assertEquals("foobar", jd.getServer().getContentEncoding());
+
+ UndertowHTTPServerEngine engine = (UndertowHTTPServerEngine)jd.getEngine();
+ assertEquals(111, engine.getThreadingParameters().getMinThreads());
+ assertEquals(120, engine.getThreadingParameters().getMaxThreads());
+
+
+ ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
+ ConduitInitiator ci = cim.getConduitInitiator("http://cxf.apache.org/transports/http");
+ HTTPConduit conduit = (HTTPConduit) ci.getConduit(info, bus);
+ assertEquals(97, conduit.getClient().getConnectionTimeout());
+
+ info.setName(new QName("urn:test:ns", "Bar"));
+ conduit = (HTTPConduit) ci.getConduit(info, bus);
+ assertEquals(79, conduit.getClient().getConnectionTimeout());
+
+ UndertowHTTPDestination jd2 =
+ (UndertowHTTPDestination)factory.getDestination(
+ getEndpointInfo("foo", "bar", "http://localhost:9001"), bus);
+
+ engine = (UndertowHTTPServerEngine)jd2.getEngine();
+ assertEquals(40000, engine.getMaxIdleTime());
+ assertEquals(99, engine.getThreadingParameters().getMinThreads());
+ assertEquals(777, engine.getThreadingParameters().getMaxThreads());
+
+ assertNotNull("The handlers should not be null", engine.getHandlers());
+ assertEquals(1, engine.getHandlers().size());
+
+ UndertowHTTPDestination jd3 =
+ (UndertowHTTPDestination)factory.getDestination(
+ getEndpointInfo("sna", "foo", "https://localhost:9002"), bus);
+
+ engine = (UndertowHTTPServerEngine)jd3.getEngine();
+ assertEquals(111, engine.getThreadingParameters().getMinThreads());
+ assertEquals(120, engine.getThreadingParameters().getMaxThreads());
+
+ assertEquals(engine.getTlsServerParameters().getClientAuthentication().isWant(), true);
+ assertEquals(engine.getTlsServerParameters().getClientAuthentication().isRequired(), true);
+
+ UndertowHTTPDestination jd4 =
+ (UndertowHTTPDestination)factory.getDestination(
+ getEndpointInfo("sna", "foo2", "https://localhost:9003"), bus);
+
+ engine = (UndertowHTTPServerEngine)jd4.getEngine();
+ assertEquals(engine.getTlsServerParameters().getClientAuthentication().isWant(), false);
+ assertEquals(engine.getTlsServerParameters().getClientAuthentication().isRequired(), false);
+
+ UndertowHTTPDestination jd5 =
+ (UndertowHTTPDestination)factory.getDestination(
+ getEndpointInfo("sna", "foo", "http://localhost:9100"), bus);
+
+ engine = (UndertowHTTPServerEngine)jd5.getEngine();
+ String r = "expected fallback thread parameters configured for port 0";
+ assertNotNull(r, engine.getThreadingParameters());
+ assertEquals(r, 21, engine.getThreadingParameters().getMinThreads());
+ assertEquals(r, 389, engine.getThreadingParameters().getMaxThreads());
+ }
+
+ private EndpointInfo getEndpointInfo(String serviceNS,
+ String endpointLocal,
+ String address) {
+ ServiceInfo serviceInfo2 = new ServiceInfo();
+ serviceInfo2.setName(new QName(serviceNS, "Service"));
+ EndpointInfo info2 = new EndpointInfo(serviceInfo2, "");
+ info2.setName(new QName("urn:test:ns", endpointLocal));
+ info2.setAddress(address);
+ return info2;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/TestDummyHandler.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/TestDummyHandler.java b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/TestDummyHandler.java
new file mode 100644
index 0000000..6c256c6
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/TestDummyHandler.java
@@ -0,0 +1,41 @@
+/**
+ * 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.transport.http_undertow.spring;
+
+import org.apache.cxf.transport.http_undertow.CXFUndertowHttpHandler;
+
+import io.undertow.server.HttpHandler;
+import io.undertow.server.HttpServerExchange;
+
+public class TestDummyHandler implements CXFUndertowHttpHandler {
+
+ private HttpHandler handler;
+
+ @Override
+ public void handleRequest(HttpServerExchange exchange) throws Exception {
+ handler.handleRequest(exchange);
+ }
+
+ @Override
+ public void setNext(HttpHandler nextHandler) {
+ this.handler = nextHandler;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/bean.properties
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/bean.properties b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/bean.properties
new file mode 100644
index 0000000..f92e1fc
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/bean.properties
@@ -0,0 +1,30 @@
+# 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.
+bar.connection.timeout=79
+foo.connection.timeout=97
+engine.port.zero=0
+engine.port.nine.zero=9000
+engine.port.nine.one=9001
+engine.port.nine.two=9002
+engine.port.nine.three=9003
+
+engine.port.zero.minThreads=21
+engine.port.zero.maxThreads=389
+engine.port.nine.one.minThreads=99
+engine.port.nine.one.maxThreads=777
+engine.port.nine.one.threadNamePrefix=AnotherPrefix
+engine.port.nine.one.maxIdle=40000
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/beans-props.xml
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/beans-props.xml b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/beans-props.xml
new file mode 100644
index 0000000..7273cf5
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/beans-props.xml
@@ -0,0 +1,74 @@
+<?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:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://cxf.apache.org/transports/http/configuration" xmlns:hj="http://cxf.apache.org/transports/http-undertow/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/transports/http-undertow/configuration http://cxf.apache.org/schemas/configuration/http-undertow.xsd">
+ <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="location" value="org/apache/cxf/transport/http_undertow/spring/bean.properties"/>
+ </bean>
+ <bean id="placeholderConfig2" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="location" value="org/apache/cxf/transport/http_undertow/spring/bean.properties"/>
+ <property name="placeholderPrefix" value="$("/>
+ <property name="placeholderSuffix" value=")"/>
+ </bean>
+ <bean id="placeholderConfig3" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="location" value="org/apache/cxf/transport/http_undertow/spring/bean.properties"/>
+ <property name="placeholderPrefix" value="#["/>
+ <property name="placeholderSuffix" value="]"/>
+ </bean>
+ <h:destination name="{urn:test:ns}Foo.http-destination">
+ <h:server ContentEncoding="foobar"/>
+ </h:destination>
+ <h:conduit name="{urn:test:ns}Foo.http-conduit">
+ <h:client ConnectionTimeout="${foo.connection.timeout}"/>
+ </h:conduit>
+ <h:conduit name="*Bar.http-conduit">
+ <h:client ConnectionTimeout="${bar.connection.timeout}"/>
+ </h:conduit>
+ <hj:engine-factory bus="cxf">
+ <hj:identifiedTLSServerParameters id="sample1">
+ <hj:tlsServerParameters jsseProvider="SUN" secureSocketProtocol="TLS">
+ <sec:clientAuthentication want="false" required="false"/>
+ </hj:tlsServerParameters>
+ </hj:identifiedTLSServerParameters>
+ <hj:identifiedThreadingParameters id="sampleThreading1">
+ <hj:threadingParameters minThreads="111" maxThreads="120" workerIOThreads="8"/>
+ </hj:identifiedThreadingParameters>
+ <hj:engine port="${engine.port.nine.zero}">
+ <hj:threadingParametersRef id="sampleThreading1"/>
+ </hj:engine>
+ <hj:engine port="#[engine.port.zero]">
+ <hj:threadingParameters minThreads="${engine.port.zero.minThreads}" maxThreads="${engine.port.zero.maxThreads}" workerIOThreads="8"/>
+ </hj:engine>
+ <hj:engine port="$(engine.port.nine.one)" maxIdleTime="$(engine.port.nine.one.maxIdle)">
+ <hj:threadingParameters minThreads="${engine.port.nine.one.minThreads}" maxThreads="${engine.port.nine.one.maxThreads}" workerIOThreads="8"/>
+ <hj:handlers>
+ <beans:bean class="org.apache.cxf.transport.http_undertow.spring.TestDummyHandler"/>
+ </hj:handlers>
+ </hj:engine>
+ <hj:engine port="${engine.port.nine.two}">
+ <hj:tlsServerParameters>
+ <sec:clientAuthentication want="true" required="true"/>
+ </hj:tlsServerParameters>
+ <hj:threadingParametersRef id="sampleThreading1"/>
+ </hj:engine>
+ <hj:engine port="${engine.port.nine.three}">
+ <hj:tlsServerParametersRef id="sample1"/>
+ </hj:engine>
+ </hj:engine-factory>
+</beans>
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/beans.xml
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/beans.xml b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/beans.xml
new file mode 100644
index 0000000..0676794
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/beans.xml
@@ -0,0 +1,61 @@
+<?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:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://cxf.apache.org/transports/http/configuration" xmlns:hj="http://cxf.apache.org/transports/http-undertow/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/transports/http-undertow/configuration http://cxf.apache.org/schemas/configuration/http-undertow.xsd">
+ <h:destination name="{urn:test:ns}Foo.http-destination">
+ <h:server ContentEncoding="foobar"/>
+ </h:destination>
+ <h:conduit name="{urn:test:ns}Foo.http-conduit">
+ <h:client ConnectionTimeout="97"/>
+ </h:conduit>
+ <h:conduit name="*Bar.http-conduit">
+ <h:client ConnectionTimeout="79"/>
+ </h:conduit>
+ <hj:engine-factory bus="cxf">
+ <hj:identifiedTLSServerParameters id="sample1">
+ <hj:tlsServerParameters jsseProvider="SUN" secureSocketProtocol="TLS">
+ <sec:clientAuthentication want="false" required="false"/>
+ </hj:tlsServerParameters>
+ </hj:identifiedTLSServerParameters>
+ <hj:identifiedThreadingParameters id="sampleThreading1">
+ <hj:threadingParameters minThreads="111" maxThreads="120" workerIOThreads="8"/>
+ </hj:identifiedThreadingParameters>
+ <hj:engine port="9000" maxIdleTime="30000">
+ <hj:threadingParametersRef id="sampleThreading1"/>
+ </hj:engine>
+ <hj:engine port="0">
+ <hj:threadingParameters minThreads="21" maxThreads="389" workerIOThreads="8"/>
+ </hj:engine>
+ <hj:engine port="9001" maxIdleTime="40000">
+ <hj:threadingParameters minThreads="99" maxThreads="777" workerIOThreads="8"/>
+ <hj:handlers>
+ <beans:bean class="org.apache.cxf.transport.http_undertow.spring.TestDummyHandler"/>
+ </hj:handlers>
+ </hj:engine>
+ <hj:engine port="9002">
+ <hj:tlsServerParameters>
+ <sec:clientAuthentication want="true" required="true"/>
+ </hj:tlsServerParameters>
+ <hj:threadingParametersRef id="sampleThreading1"/>
+ </hj:engine>
+ <hj:engine port="9003">
+ <hj:tlsServerParametersRef id="sample1"/>
+ </hj:engine>
+ </hj:engine-factory>
+</beans>
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/conduit.xml
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/conduit.xml b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/conduit.xml
new file mode 100644
index 0000000..8be7266
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/conduit.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<h:conduit xmlns:h="http://cxf.apache.org/transports/http/configuration">
+ <h:client ConnectionTimeout="97"/>
+</h:conduit>
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/destination.xml
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/destination.xml b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/destination.xml
new file mode 100644
index 0000000..7aafd0f
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/destination.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<h:destination xmlns:h="http://cxf.apache.org/transports/http/configuration">
+ <h:server ContentEncoding="foobar"/>
+ <h:contextMatchStrategy>exact</h:contextMatchStrategy>
+</h:destination>
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/invalid-beans.xml
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/invalid-beans.xml b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/invalid-beans.xml
new file mode 100644
index 0000000..bc8da5d
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/invalid-beans.xml
@@ -0,0 +1,27 @@
+<?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:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://cxf.apache.org/transports/http/configuration" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd">
+ <h:destination id="{urn:test:ns}Foo.http-destination">
+ <h:server ContentEncoding="foobar"/>
+ </h:destination>
+ <h:conduit id="{urn:test:ns}Foo.http-conduit">
+ <h:client ConnectionTimeout="97"/>
+ </h:conduit>
+</beans>
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/serverenginefactory.xml
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/serverenginefactory.xml b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/serverenginefactory.xml
new file mode 100644
index 0000000..49400a4
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/spring/serverenginefactory.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<hj:engine-factory xmlns:hj="http://cxf.apache.org/transports/http-undertow/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:beans="http://www.springframework.org/schema/beans" bus="cxf">
+ <hj:identifiedTLSServerParameters id="sample1">
+ <hj:tlsServerParameters jsseProvider="SUN" secureSocketProtocol="TLS">
+ <sec:clientAuthentication want="false" required="false"/>
+ </hj:tlsServerParameters>
+ </hj:identifiedTLSServerParameters>
+ <hj:identifiedThreadingParameters id="sampleThreading1">
+ <hj:threadingParameters minThreads="11" maxThreads="12"/>
+ </hj:identifiedThreadingParameters>
+ <hj:engine port="9000">
+ <hj:tlsServerParametersRef id="sample1"/>
+ <hj:threadingParameters minThreads="1" maxThreads="2"/>
+ </hj:engine>
+ <hj:engine port="9001">
+ <hj:tlsServerParameters>
+ <sec:clientAuthentication want="true" required="true"/>
+ </hj:tlsServerParameters>
+ <hj:threadingParametersRef id="sampleThreading1"/>
+ </hj:engine>
+ <hj:engine port="9002">
+ <hj:handlers>
+ <bean class="undertowhandler1"/>
+ <bean class="undertowhandler2"/>
+ </hj:handlers>
+ </hj:engine>
+</hj:engine-factory>
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/pom.xml
----------------------------------------------------------------------
diff --git a/rt/transports/pom.xml b/rt/transports/pom.xml
index c0c3227..5370c27 100644
--- a/rt/transports/pom.xml
+++ b/rt/transports/pom.xml
@@ -33,6 +33,7 @@
<module>local</module>
<module>http</module>
<module>http-jetty</module>
+ <module>http-undertow</module>
<module>http-hc</module>
<module>http-netty/netty-server</module>
<module>http-netty/netty-client</module>
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/pom.xml
----------------------------------------------------------------------
diff --git a/systests/pom.xml b/systests/pom.xml
index 3dfade6..b935926 100644
--- a/systests/pom.xml
+++ b/systests/pom.xml
@@ -36,6 +36,7 @@
<module>transports</module>
<module>transports-ssl3</module>
<module>transport-jms</module>
+ <module>transport-undertow</module>
<module>jaxws</module>
<module>databinding</module>
<module>jaxrs</module>
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/pom.xml
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/pom.xml b/systests/transport-undertow/pom.xml
new file mode 100644
index 0000000..b8aecbb
--- /dev/null
+++ b/systests/transport-undertow/pom.xml
@@ -0,0 +1,253 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>cxf-parent</artifactId>
+ <groupId>org.apache.cxf</groupId>
+ <version>3.2.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.cxf.systests</groupId>
+ <artifactId>cxf-systests-transport-undertow</artifactId>
+ <name>Apache CXF Undertow Transport System Tests</name>
+ <description>Apache CXF Undertow Transport System Tests</description>
+ <url>http://cxf.apache.org</url>
+ <build>
+ <testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
+ <testResources>
+ <testResource>
+ <directory>src/test/java</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-codegen-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <fork>${cxf.codegenplugin.forkmode}</fork>
+ <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
+ <testWsdlRoot>${basedir}/src/test/resources/wsdl_systest_transport</testWsdlRoot>
+ </configuration>
+ <goals>
+ <goal>wsdl2java</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-databinding-jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-js</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-soap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-databinding-aegis</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http-hc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-udp</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http-undertow</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-local</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-policy</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-testutils</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <scope>test</scope>
+ <version>${cxf.spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <scope>test</scope>
+ <version>${cxf.spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <scope>test</scope>
+ <version>${cxf.spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <scope>test</scope>
+ <version>${cxf.spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>httpunit</groupId>
+ <artifactId>httpunit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>nekohtml</groupId>
+ <artifactId>nekohtml</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>${cxf.spring.mock}</artifactId>
+ <version>${cxf.spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ </dependency>
+ <!-- make http://java.sun.com/dtd/web-app_2_3.dtd et al locally available during the tests -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.littleshoot</groupId>
+ <artifactId>littleproxy</artifactId>
+ <version>0.4</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/ClientServerSessionTest.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/ClientServerSessionTest.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/ClientServerSessionTest.java
new file mode 100644
index 0000000..10489d5
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/ClientServerSessionTest.java
@@ -0,0 +1,275 @@
+/**
+ * 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.http_undertow;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.WebServiceException;
+
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.GreeterService;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class ClientServerSessionTest extends AbstractBusClientServerTestBase {
+ public static final String PORT = SessionServer.PORT;
+ @BeforeClass
+ public static void startServers() throws Exception {
+
+ assertTrue("server did not launch correctly",
+ launchServer(SessionServer.class, true));
+
+ }
+
+
+ @Test
+ public void testInvocationWithSession() throws Exception {
+
+ GreeterService service = new GreeterService();
+ assertNotNull(service);
+
+ try {
+ Greeter greeter = service.getGreeterPort();
+
+ BindingProvider bp = (BindingProvider)greeter;
+ updateAddressPort(bp, PORT);
+ bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+
+
+ Map<String, List<String>> headers
+ = CastUtils.cast((Map<?, ?>)bp.getRequestContext().get("javax.xml.ws.http.request.headers"));
+
+ if (headers == null) {
+ headers = new HashMap<String, List<String>>();
+ bp.getRequestContext()
+ .put("javax.xml.ws.http.request.headers", headers);
+ }
+
+ List<String> cookies = Arrays.asList(new String[] {"a=a", "b=b"});
+ headers.put("Cookie", cookies);
+
+ String greeting = greeter.greetMe("Bonjour");
+ String cookie = "";
+ if (greeting.indexOf(';') != -1) {
+ cookie = greeting.substring(greeting.indexOf(';'));
+ greeting = greeting.substring(0, greeting.indexOf(';'));
+ }
+ assertNotNull("no response received from service", greeting);
+ assertEquals("Hello Bonjour", greeting);
+ assertTrue(cookie.contains("a=a"));
+ assertTrue(cookie.contains("b=b"));
+
+
+ greeting = greeter.greetMe("Hello");
+ cookie = "";
+ if (greeting.indexOf(';') != -1) {
+ cookie = greeting.substring(greeting.indexOf(';'));
+ greeting = greeting.substring(0, greeting.indexOf(';'));
+ }
+
+ assertNotNull("no response received from service", greeting);
+ assertEquals("Hello Bonjour", greeting);
+ assertTrue(cookie.contains("a=a"));
+ assertTrue(cookie.contains("b=b"));
+
+
+ greeting = greeter.greetMe("NiHao");
+ cookie = "";
+ if (greeting.indexOf(';') != -1) {
+ cookie = greeting.substring(greeting.indexOf(';'));
+ greeting = greeting.substring(0, greeting.indexOf(';'));
+ }
+ assertNotNull("no response received from service", greeting);
+ assertEquals("Hello Hello", greeting);
+ assertTrue(cookie.contains("a=a"));
+ assertTrue(cookie.contains("b=b"));
+ } catch (UndeclaredThrowableException ex) {
+ throw (Exception)ex.getCause();
+ }
+ }
+
+ @Test
+ public void testInvocationWithoutSession() throws Exception {
+
+ GreeterService service = new GreeterService();
+ assertNotNull(service);
+
+ try {
+ Greeter greeter = service.getGreeterPort();
+ updateAddressPort(greeter, PORT);
+
+ String greeting = greeter.greetMe("Bonjour");
+
+ assertNotNull("no response received from service", greeting);
+ assertEquals("Hello Bonjour", greeting);
+
+ greeting = greeter.greetMe("Hello");
+ assertNotNull("no response received from service", greeting);
+ assertEquals("Hello Hello", greeting);
+
+
+ greeting = greeter.greetMe("NiHao");
+ assertNotNull("no response received from service", greeting);
+ assertEquals("Hello NiHao", greeting);
+
+ } catch (UndeclaredThrowableException ex) {
+ throw (Exception)ex.getCause();
+ }
+ }
+
+ @Test
+ @Ignore("seem to get random failures on everything except Linux with this."
+ + " Maybe a undertow issue.")
+ public void testPublishOnBusyPort() {
+ boolean isWindows = System.getProperty("os.name").startsWith("Windows");
+
+ GreeterSessionImpl implementor = new GreeterSessionImpl();
+ String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
+ try {
+ Endpoint.publish(address, implementor);
+ if (!isWindows) {
+ fail("Should have failed to publish as the port is busy");
+ } else {
+ System.err.println("Should have failed to publish as the port is busy, but certains "
+ + "of Windows allow this.");
+ }
+ } catch (WebServiceException ex) {
+ //ignore
+ }
+ try {
+ //CXF-1589
+ Endpoint.publish(address, implementor);
+ if (!isWindows) {
+ fail("Should have failed to publish as the port is busy");
+ } else {
+ System.err.println("Should have failed to publish as the port is busy, but certains "
+ + "of Windows allow this.");
+ }
+ } catch (WebServiceException ex) {
+ //ignore
+ }
+
+ }
+
+ @Test
+ public void testInvocationWithSessionFactory() throws Exception {
+ doSessionsTest("http://localhost:" + PORT + "/Stateful1");
+ }
+ @Test
+ public void testInvocationWithSessionAnnotation() throws Exception {
+ doSessionsTest("http://localhost:" + PORT + "/Stateful2");
+ }
+ @Test
+ public void testInvocationWithPerRequestAnnotation() throws Exception {
+ GreeterService service = new GreeterService();
+ assertNotNull(service);
+
+ Greeter greeter = service.getGreeterPort();
+ BindingProvider bp = (BindingProvider)greeter;
+ bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:" + PORT + "/PerRequest");
+ bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+ String result = greeter.greetMe("World");
+ assertEquals("Hello World", result);
+ assertEquals("Bonjour default", greeter.sayHi());
+ }
+ @Test
+ public void testInvocationWithSpringBeanAnnotation() throws Exception {
+ GreeterService service = new GreeterService();
+ assertNotNull(service);
+
+ Greeter greeter = service.getGreeterPort();
+ BindingProvider bp = (BindingProvider)greeter;
+ bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:" + PORT + "/SpringBean");
+ bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+ String result = greeter.greetMe("World");
+ assertEquals("Hello World", result);
+ assertEquals("Bonjour World", greeter.sayHi());
+ }
+
+ @Test
+ public void testOnewayInvocationWithSession() throws Exception {
+
+ GreeterService service = new GreeterService();
+ assertNotNull(service);
+
+ try {
+ Greeter greeter = service.getGreeterPort();
+
+ BindingProvider bp = (BindingProvider)greeter;
+ updateAddressPort(bp, PORT);
+ bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+
+
+
+ greeter.greetMeOneWay("Bonjour");
+
+ String greeting = greeter.greetMe("Hello");
+ if (greeting.indexOf(';') != -1) {
+ greeting = greeting.substring(0, greeting.indexOf(';'));
+ }
+ assertNotNull("no response received from service", greeting);
+ assertEquals("Hello Bonjour", greeting);
+
+ } catch (UndeclaredThrowableException ex) {
+ throw (Exception)ex.getCause();
+ }
+ }
+
+ private void doSessionsTest(String url) {
+ GreeterService service = new GreeterService();
+ assertNotNull(service);
+
+ Greeter greeter = service.getGreeterPort();
+ Greeter greeter2 = service.getGreeterPort();
+
+ BindingProvider bp = (BindingProvider)greeter;
+
+ bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
+ bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+
+ bp = (BindingProvider)greeter2;
+
+ bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
+ bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+
+ String result = greeter.greetMe("World");
+ assertEquals("Hello World", result);
+ assertEquals("Bonjour World", greeter.sayHi());
+
+ result = greeter2.greetMe("Universe");
+ assertEquals("Hello Universe", result);
+ assertEquals("Bonjour Universe", greeter2.sayHi());
+
+ //make sure session 1 was maintained
+ assertEquals("Bonjour World", greeter.sayHi());
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/Dummy.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/Dummy.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/Dummy.java
new file mode 100644
index 0000000..1e0bc47
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/Dummy.java
@@ -0,0 +1,32 @@
+/**
+ * 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.http_undertow;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+public class Dummy implements DummyInterface {
+ @WebMethod
+ public String echo(String what) {
+ return what;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/DummyInterface.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/DummyInterface.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/DummyInterface.java
new file mode 100644
index 0000000..dd3227d
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/DummyInterface.java
@@ -0,0 +1,29 @@
+/**
+ * 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.http_undertow;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+public interface DummyInterface {
+ @WebMethod
+ String echo(String what);
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/GreeterImpl.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/GreeterImpl.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/GreeterImpl.java
new file mode 100644
index 0000000..00e3242
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/GreeterImpl.java
@@ -0,0 +1,144 @@
+/**
+ * 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.http_undertow;
+
+import java.util.concurrent.Future;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+import org.apache.hello_world_soap_http.BadRecordLitFault;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
+import org.apache.hello_world_soap_http.types.BareDocumentResponse;
+import org.apache.hello_world_soap_http.types.GreetMeLaterResponse;
+import org.apache.hello_world_soap_http.types.GreetMeResponse;
+import org.apache.hello_world_soap_http.types.GreetMeSometimeResponse;
+import org.apache.hello_world_soap_http.types.SayHiResponse;
+import org.apache.hello_world_soap_http.types.TestDocLitFaultResponse;
+import org.apache.hello_world_soap_http.types.TestNillableResponse;
+
+
+@WebService(serviceName = "SOAPServiceAddressing",
+ portName = "SoapPort",
+ endpointInterface = "org.apache.hello_world_soap_http.Greeter",
+ targetNamespace = "http://apache.org/hello_world_soap_http",
+ wsdlLocation = "testutils/hello_world.wsdl")
+public class GreeterImpl implements Greeter {
+
+ public String greetMe(String me) {
+ return "Hello " + me;
+ }
+
+ public String greetMeLater(long delay) {
+ //System.out.println("\n\n*** GreetMeLater called with: " + delay
+ // + " at: " + new java.util.Date().toString()
+ // + "***\n\n");
+ if (delay > 0) {
+ try {
+ Thread.sleep(delay);
+ } catch (InterruptedException ex) {
+ // ignore
+ }
+ }
+ return "Hello, finally";
+ }
+
+ public void greetMeOneWay(String requestType) {
+ }
+
+ public String sayHi() {
+ return null;
+ }
+
+ public void testDocLitFault(String faultType) throws BadRecordLitFault, NoSuchCodeLitFault {
+ }
+
+ public BareDocumentResponse testDocLitBare(String in) {
+ return null;
+ }
+
+ public String greetMeSometime(String me) {
+ return null;
+ }
+
+ public Future<?> greetMeSometimeAsync(String requestType,
+ AsyncHandler<GreetMeSometimeResponse> asyncHandler) {
+ return null;
+ }
+
+ public Response<GreetMeSometimeResponse> greetMeSometimeAsync(String requestType) {
+ return null;
+ }
+
+ public Response<TestDocLitFaultResponse> testDocLitFaultAsync(String faultType) {
+ return null;
+ }
+
+ public Response<BareDocumentResponse> testDocLitBareAsync(String bare) {
+ return null;
+ }
+
+ public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) {
+ return null;
+ }
+
+ public Response<GreetMeResponse> greetMeAsync(String requestType) {
+ return null;
+ }
+
+ public Future<?> greetMeLaterAsync(long requestType, AsyncHandler<GreetMeLaterResponse> asyncHandler) {
+ return null;
+ }
+
+ public Response<GreetMeLaterResponse> greetMeLaterAsync(long requestType) {
+ return null;
+ }
+
+ public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
+ return null;
+ }
+
+ public Response<SayHiResponse> sayHiAsync() {
+ return null;
+ }
+
+ public String testNillable(String nillElem, int intElem) {
+ return null;
+ }
+
+ public Response<TestNillableResponse> testNillableAsync(String nillElem,
+ int intElem) {
+ return null;
+ }
+
+ public Future<?> testNillableAsync(String nillElem,
+ int intElem,
+ AsyncHandler<TestNillableResponse> asyncHandler) {
+ return null;
+ }
+
+ public Future<?> testDocLitFaultAsync(String faultType,
+ AsyncHandler<TestDocLitFaultResponse> asyncHandler) {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/GreeterSessionImpl.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/GreeterSessionImpl.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/GreeterSessionImpl.java
new file mode 100644
index 0000000..34cbb26
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/GreeterSessionImpl.java
@@ -0,0 +1,154 @@
+/**
+ * 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.http_undertow;
+
+import java.util.concurrent.Future;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.types.GreetMeResponse;
+import org.apache.cxf.greeter_control.types.PingMeResponse;
+import org.apache.cxf.greeter_control.types.SayHiResponse;
+
+@WebService(serviceName = "GreeterService",
+ portName = "GreeterPort",
+ endpointInterface = "org.apache.cxf.greeter_control.Greeter",
+ targetNamespace = "http://cxf.apache.org/greeter_control")
+public class GreeterSessionImpl implements Greeter {
+ private static final Logger LOG =
+ LogUtils.getLogger(GreeterSessionImpl.class,
+ null,
+ GreeterSessionImpl.class.getPackage().getName());
+
+ @Resource
+ private WebServiceContext context;
+
+ // greetMe will use session to return last called name
+ public String greetMe(String me) {
+ LOG.info("Executing operation greetMe");
+ LOG.info("Message received: " + me);
+ MessageContext mc = context.getMessageContext();
+ HttpServletRequest req = (HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST);
+ Cookie cookies[] = req.getCookies();
+ String val = "";
+ if (cookies != null) {
+ for (Cookie cookie : cookies) {
+ val += ";" + cookie.getName() + "=" + cookie.getValue();
+ }
+ }
+
+
+ HttpSession session = req.getSession();
+ // Get a session property "counter" from context
+ if (session == null) {
+ throw new WebServiceException("No session in WebServiceContext");
+ }
+ String name = (String)session.getAttribute("name");
+ if (name == null) {
+ name = me;
+ LOG.info("Starting the Session");
+ }
+
+ session.setAttribute("name", me);
+
+ return "Hello " + name + val;
+ }
+
+
+ public String sayHi() {
+ LOG.info("Executing operation sayHi");
+
+ return "Bonjour ";
+ }
+
+ public void pingMe() {
+ }
+
+
+ public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<GreetMeResponse> greetMeAsync(String requestType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public void greetMeOneWay(String me) {
+ LOG.info("Executing operation greetMeOneWay");
+ LOG.info("Message received: " + me);
+ MessageContext mc = context.getMessageContext();
+ HttpServletRequest req = (HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST);
+
+ HttpSession session = req.getSession();
+ if (session == null) {
+ throw new WebServiceException("No session in WebServiceContext");
+ }
+ String name = (String)session.getAttribute("name");
+ if (name == null) {
+ name = me;
+ LOG.info("Starting the Session");
+ }
+
+ session.setAttribute("name", me);
+
+ }
+
+
+ public Future<?> pingMeAsync(AsyncHandler<PingMeResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<PingMeResponse> pingMeAsync() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<SayHiResponse> sayHiAsync() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/MapIdentityManager.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/MapIdentityManager.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/MapIdentityManager.java
new file mode 100644
index 0000000..bef86e7
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/MapIdentityManager.java
@@ -0,0 +1,126 @@
+/**
+ * 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.http_undertow;
+
+import java.nio.charset.Charset;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.Principal;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import io.undertow.security.idm.Account;
+import io.undertow.security.idm.Credential;
+import io.undertow.security.idm.DigestCredential;
+import io.undertow.security.idm.IdentityManager;
+import io.undertow.security.idm.PasswordCredential;
+import io.undertow.util.HexConverter;
+
+class MapIdentityManager implements IdentityManager {
+
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ private final Map<String, char[]> users;
+
+ public MapIdentityManager(final Map<String, char[]> users) {
+ this.users = users;
+ }
+
+ @Override
+ public Account verify(Account account) {
+ // An existing account so for testing assume still valid.
+ return account;
+ }
+
+ @Override
+ public Account verify(String id, Credential credential) {
+ Account account = getAccount(id);
+ if (account != null && verifyCredential(account, credential)) {
+ return account;
+ }
+
+ return null;
+ }
+
+ @Override
+ public Account verify(Credential credential) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private boolean verifyCredential(Account account, Credential credential) {
+ if (credential instanceof PasswordCredential) {
+ char[] password = ((PasswordCredential) credential).getPassword();
+ char[] expectedPassword = users.get(account.getPrincipal().getName());
+
+ return Arrays.equals(password, expectedPassword);
+ } else if (credential instanceof DigestCredential) {
+ DigestCredential digCred = (DigestCredential) credential;
+ MessageDigest digest = null;
+ try {
+ digest = digCred.getAlgorithm().getMessageDigest();
+
+ digest.update(account.getPrincipal().getName().getBytes(UTF_8));
+ digest.update((byte) ':');
+ digest.update(digCred.getRealm().getBytes(UTF_8));
+ digest.update((byte) ':');
+ char[] expectedPassword = users.get(account.getPrincipal().getName());
+ digest.update(new String(expectedPassword).getBytes(UTF_8));
+
+ return digCred.verifyHA1(HexConverter.convertToHexBytes(digest.digest()));
+ } catch (NoSuchAlgorithmException e) {
+ throw new IllegalStateException("Unsupported Algorithm", e);
+ } finally {
+ digest.reset();
+ }
+ }
+ return false;
+ }
+
+ private Account getAccount(final String id) {
+ if (users.containsKey(id)) {
+ return new Account() {
+
+ private final Principal principal = new Principal() {
+
+ @Override
+ public String getName() {
+ return id;
+ }
+ };
+
+ @Override
+ public Principal getPrincipal() {
+ return principal;
+ }
+
+ @Override
+ public Set<String> getRoles() {
+ return Collections.emptySet();
+ }
+
+ };
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/PerRequestAnnotationGreeterImpl.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/PerRequestAnnotationGreeterImpl.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/PerRequestAnnotationGreeterImpl.java
new file mode 100644
index 0000000..6b7ebef
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/PerRequestAnnotationGreeterImpl.java
@@ -0,0 +1,98 @@
+/**
+ * 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.http_undertow;
+
+import java.util.concurrent.Future;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+
+import org.apache.cxf.annotations.FactoryType;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.types.GreetMeResponse;
+import org.apache.cxf.greeter_control.types.PingMeResponse;
+import org.apache.cxf.greeter_control.types.SayHiResponse;
+
+@WebService(serviceName = "GreeterService",
+ portName = "GreeterPort",
+ endpointInterface = "org.apache.cxf.greeter_control.Greeter",
+ targetNamespace = "http://cxf.apache.org/greeter_control")
+@FactoryType(FactoryType.Type.PerRequest)
+public class PerRequestAnnotationGreeterImpl implements Greeter {
+ String name = "default";
+
+ // greetMe will use session to return last called name
+ public String greetMe(String me) {
+ name = me;
+ return "Hello " + me;
+ }
+
+
+ public String sayHi() {
+ return "Bonjour " + name;
+ }
+
+ public void pingMe() {
+ }
+
+
+ public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<GreetMeResponse> greetMeAsync(String requestType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public void greetMeOneWay(String requestType) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public Future<?> pingMeAsync(AsyncHandler<PingMeResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<PingMeResponse> pingMeAsync() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<SayHiResponse> sayHiAsync() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/Server.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/Server.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/Server.java
new file mode 100644
index 0000000..cf462d1
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/Server.java
@@ -0,0 +1,65 @@
+/**
+ * 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.http_undertow;
+
+
+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;
+
+
+public class Server extends AbstractBusTestServerBase {
+ static final String PORT = allocatePort(Server.class);
+ static final String ADDRESS = "http://localhost:" + PORT + "/SoapContext/SoapPort";
+
+ Endpoint ep;
+
+
+ protected void run() {
+
+ SpringBusFactory factory = new SpringBusFactory();
+ Bus bus = factory.createBus("org/apache/cxf/systest/http_undertow/server.xml");
+ BusFactory.setDefaultBus(bus);
+ setBus(bus);
+
+ GreeterImpl implementor = new GreeterImpl();
+ ep = Endpoint.publish(ADDRESS, implementor);
+ }
+
+ @Override
+ public void tearDown() {
+ if (ep != null) {
+ ep.stop();
+ }
+ }
+
+ public static void main(String[] args) {
+ try {
+ Server s = new Server();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SessionAnnotationGreeterImpl.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SessionAnnotationGreeterImpl.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SessionAnnotationGreeterImpl.java
new file mode 100644
index 0000000..1819c72
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SessionAnnotationGreeterImpl.java
@@ -0,0 +1,101 @@
+/**
+ * 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.http_undertow;
+
+import java.util.concurrent.Future;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+
+import org.apache.cxf.annotations.FactoryType;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.types.GreetMeResponse;
+import org.apache.cxf.greeter_control.types.PingMeResponse;
+import org.apache.cxf.greeter_control.types.SayHiResponse;
+
+@WebService(serviceName = "GreeterService",
+ portName = "GreeterPort",
+ endpointInterface = "org.apache.cxf.greeter_control.Greeter",
+ targetNamespace = "http://cxf.apache.org/greeter_control")
+@FactoryType(FactoryType.Type.Session)
+public class SessionAnnotationGreeterImpl implements Greeter {
+ String name;
+
+ public SessionAnnotationGreeterImpl() {
+ }
+
+ // greetMe will use session to return last called name
+ public String greetMe(String me) {
+ name = me;
+ return "Hello " + me;
+ }
+
+
+ public String sayHi() {
+ return "Bonjour " + name;
+ }
+
+ public void pingMe() {
+ }
+
+
+ public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<GreetMeResponse> greetMeAsync(String requestType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public void greetMeOneWay(String requestType) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public Future<?> pingMeAsync(AsyncHandler<PingMeResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<PingMeResponse> pingMeAsync() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<SayHiResponse> sayHiAsync() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SessionServer.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SessionServer.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SessionServer.java
new file mode 100644
index 0000000..59ee67b
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SessionServer.java
@@ -0,0 +1,58 @@
+/**
+ * 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.http_undertow;
+
+import java.net.URL;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class SessionServer extends AbstractBusTestServerBase {
+ public static final String PORT = allocatePort(SessionServer.class);
+ Bus bus;
+
+ @Override
+ protected void run() {
+ String configurationFile = "SessionServer.xml";
+ URL configure =
+ SessionServer.class.getResource(configurationFile);
+ bus = new SpringBusFactory().createBus(configure, true);
+ SpringBusFactory.setDefaultBus(bus);
+ }
+
+ @Override
+ public void tearDown() {
+ bus.shutdown(true);
+ bus = null;
+ }
+
+ public static void main(String[] args) {
+ try {
+ // System.out.println("!!!!start");
+ SessionServer s = new SessionServer();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SpringAnnotationGreeterImpl.java
----------------------------------------------------------------------
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SpringAnnotationGreeterImpl.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SpringAnnotationGreeterImpl.java
new file mode 100644
index 0000000..ffbe4fd
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/SpringAnnotationGreeterImpl.java
@@ -0,0 +1,99 @@
+/**
+ * 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.http_undertow;
+
+import java.util.concurrent.Future;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+import org.apache.cxf.annotations.FactoryType;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.types.GreetMeResponse;
+import org.apache.cxf.greeter_control.types.PingMeResponse;
+import org.apache.cxf.greeter_control.types.SayHiResponse;
+import org.apache.cxf.service.invoker.spring.SpringBeanFactory;
+
+@WebService(serviceName = "GreeterService",
+ portName = "GreeterPort",
+ endpointInterface = "org.apache.cxf.greeter_control.Greeter",
+ targetNamespace = "http://cxf.apache.org/greeter_control")
+@FactoryType(factoryClass = SpringBeanFactory.class, args = { "SpringBean" })
+public class SpringAnnotationGreeterImpl implements Greeter {
+ String name;
+
+
+ // greetMe will use session to return last called name
+ public String greetMe(String me) {
+ name = me;
+ return "Hello " + me;
+ }
+
+
+ public String sayHi() {
+ return "Bonjour " + name;
+ }
+
+ public void pingMe() {
+ }
+
+
+ public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<GreetMeResponse> greetMeAsync(String requestType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public void greetMeOneWay(String requestType) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ public Future<?> pingMeAsync(AsyncHandler<PingMeResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<PingMeResponse> pingMeAsync() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Response<SayHiResponse> sayHiAsync() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}