cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject [4/6] cxf git commit: [CXF-6800]add http-undertow transport
Date Fri, 26 Feb 2016 03:50:54 GMT
http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/resources/META-INF/spring.handlers
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/resources/META-INF/spring.handlers b/rt/transports/http-undertow/src/main/resources/META-INF/spring.handlers
new file mode 100644
index 0000000..5fc9e3b
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/resources/META-INF/spring.handlers
@@ -0,0 +1,21 @@
+#
+#
+#    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.
+#
+#
+http\://cxf.apache.org/transports/http-undertow/configuration=org.apache.cxf.transport.http_undertow.spring.NamespaceHandler

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/resources/META-INF/spring.schemas
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/resources/META-INF/spring.schemas b/rt/transports/http-undertow/src/main/resources/META-INF/spring.schemas
new file mode 100644
index 0000000..1deed7a
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/resources/META-INF/spring.schemas
@@ -0,0 +1,21 @@
+#
+#
+#    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.
+#
+#
+http\://cxf.apache.org/schemas/configuration/http-undertow.xsd=schemas/configuration/http-undertow.xsd

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/resources/schemas/configuration/http-undertow.xsd
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/resources/schemas/configuration/http-undertow.xsd b/rt/transports/http-undertow/src/main/resources/schemas/configuration/http-undertow.xsd
new file mode 100644
index 0000000..d6b677f
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/resources/schemas/configuration/http-undertow.xsd
@@ -0,0 +1,195 @@
+<?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.
+-->
+
+<xs:schema targetNamespace="http://cxf.apache.org/transports/http-undertow/configuration" 
+           xmlns:tns="http://cxf.apache.org/transports/http-undertow/configuration" 
+           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+           xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+           xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" 
+           xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+           xmlns:sec="http://cxf.apache.org/configuration/security"
+  		   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  		   xmlns:ptp="http://cxf.apache.org/configuration/parameterized-types" 
+  		   xsi:schemaLocation="
+  		     http://www.springframework.org/schema/beans
+  		       http://www.springframework.org/schema/beans/spring-beans.xsd"
+           elementFormDefault="qualified" 
+           attributeFormDefault="unqualified"
+           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+           jaxb:version="2.0">
+
+    <xs:import namespace="http://cxf.apache.org/configuration/security"
+               schemaLocation="http://cxf.apache.org/schemas/configuration/security.xsd"/>
+    <xs:import namespace="http://cxf.apache.org/configuration/parameterized-types"
+               schemaLocation="http://cxf.apache.org/schemas/configuration/parameterized-types.xsd"/>
+    
+    <!-- Is this really supposed to be supperceeded by http-conf:HTTPListenerPolicy? -->
+    <xs:complexType name="ThreadingParametersType">
+       <xs:attribute name="minThreads" type="ptp:ParameterizedUShort">
+          <xs:annotation>
+             <xs:documentation>Specify the number of "core" threads for the worker task thread pool. Generally this should be reasonably high, at least 10 per CPU core.</xs:documentation>
+          </xs:annotation>
+       </xs:attribute>
+       <xs:attribute name="maxThreads" type="ptp:ParameterizedUShort">
+       <xs:annotation>
+             <xs:documentation>Specify the maximum number of threads for the worker task thread pool.</xs:documentation>
+          </xs:annotation>
+       </xs:attribute>
+       <xs:attribute name="workerIOThreads" type="ptp:ParameterizedUShort">
+       <xs:annotation>
+             <xs:documentation>Specify the number of I/O threads to create for the worker.  If not specified, a default will be chosen. One IO thread per CPU core is a reasonable default.</xs:documentation>
+          </xs:annotation>
+       </xs:attribute>
+    </xs:complexType>
+    
+    <xs:complexType name="ThreadingParametersIdentifiedType">
+       <xs:sequence>
+         <xs:element name="threadingParameters" type="tns:ThreadingParametersType">
+            <xs:annotation>
+               <xs:documentation>Specifies the thread pool properties for the parameter set.</xs:documentation>
+            </xs:annotation>
+         </xs:element>
+       </xs:sequence>
+         <xs:attribute name="id" type="xs:string">
+             <xs:annotation>
+                <xs:documentation>Specifies a unique identifier by which the property set can be referred.</xs:documentation>
+             </xs:annotation>
+         </xs:attribute>
+    </xs:complexType>
+    
+    <xs:complexType name="TLSServerParametersIdentifiedType">
+       <xs:sequence>
+          <xs:element name="tlsServerParameters" type="sec:TLSServerParametersType">
+             <xs:annotation>
+                <xs:documentation>Specifies the properties for the parameter set.</xs:documentation>
+             </xs:annotation>
+          </xs:element>
+       </xs:sequence>
+          <xs:attribute name="id" type="xs:string">
+             <xs:annotation>
+                <xs:documentation>Specifies a unique identifier by which the property set can be referred.</xs:documentation>
+             </xs:annotation>
+          </xs:attribute>
+    </xs:complexType>
+    
+    <xs:complexType name="ParametersRefType">
+       <xs:attribute name="id" type="xs:string" use="required"/>
+    </xs:complexType>
+    
+    <xs:complexType name="UndertowHTTPServerEngineConfigType">
+       <xs:sequence>
+         <xs:choice minOccurs="0" maxOccurs="1">
+          <xs:element name="tlsServerParameters" 
+                      type="sec:TLSServerParametersType">
+             <xs:annotation>
+                <xs:documentation>Specifies an instance of the security parameters for the Undertow instance.</xs:documentation>
+             </xs:annotation>
+          </xs:element>
+          <xs:element name="tlsServerParametersRef"
+                      type="tns:ParametersRefType">
+             <xs:annotation>
+                <xs:documentation>Specifies a reference to a reusable set of security parameters.</xs:documentation>
+             </xs:annotation>
+          </xs:element>
+         </xs:choice>
+         <xs:choice minOccurs="0" maxOccurs="1">
+          <xs:element name="threadingParameters" 
+                      type="tns:ThreadingParametersType">
+             <xs:annotation>
+                <xs:documentation>Specifies an instance of the threading configuration use for the Undertow engine.</xs:documentation>
+             </xs:annotation>
+          </xs:element>
+          <xs:element name="threadingParametersRef"
+                      type="tns:ParametersRefType">
+             <xs:annotation>
+                <xs:documentation>Specifies a reference to a reusable set of threading parameters.</xs:documentation>
+             </xs:annotation>
+          </xs:element>
+         </xs:choice>         
+         <xs:element name="handlers" type="xsd:anyType" minOccurs="0"/>
+       </xs:sequence>
+       
+       <xs:attribute name="port" type="ptp:ParameterizedInt" use="required">
+             <xs:annotation>
+                <xs:documentation>Specifies the port used by the Undertow instance.
+                You can specify a value of 0 for the port attribute. Any threading 
+                properties specified in an engine element with its port attribute
+                set to 0 are used as the configuration for all Undertow listeners that are not explicitly configured.</xs:documentation>
+             </xs:annotation>
+       </xs:attribute>
+       <xs:attribute name="host" type="xs:string">
+             <xs:annotation>
+                <xs:documentation>
+                  Specifies the listen address used by the Undertow instance.
+                  Value can be a hostname or ip address.
+                  If not specified, Undertow will listen on all local addresses.
+                </xs:documentation>
+             </xs:annotation>
+       </xs:attribute>
+       <xs:attribute name="continuationsEnabled" type="ptp:ParameterizedBoolean">
+           <xs:annotation>
+                <xs:documentation>Specifies if Undertow Continuations will be explicitly supported
+                by Undertow destinations. Continuations will be checked if this attribute is set to true or omitted, ignored otherwise.</xs:documentation>
+             </xs:annotation>
+       </xs:attribute>
+
+       <xs:attribute name="maxIdleTime" type="ptp:ParameterizedInt">
+           <xs:annotation>  
+                <xs:documentation>Specifies the maximum idle time for a undertow connection. The timer is reset whenever there are any read or write actions on the underlying stream.</xs:documentation> 
+           </xs:annotation>
+       </xs:attribute>
+
+    </xs:complexType>
+    
+    <xs:complexType name="UndertowHTTPServerEngineFactoryConfigType">
+       <xs:sequence>
+           <xs:element name="identifiedTLSServerParameters" 
+                       type="tns:TLSServerParametersIdentifiedType"
+                       minOccurs="0" maxOccurs="unbounded">
+              <xs:annotation>
+                 <xs:documentation>Specifies a reusable set of properties for securing an HTTP service provider.</xs:documentation>
+              </xs:annotation>
+           </xs:element>
+           <xs:element name="identifiedThreadingParameters"
+                       type="tns:ThreadingParametersIdentifiedType"
+                       minOccurs="0" maxOccurs="unbounded">
+              <xs:annotation>
+                 <xs:documentation>Specifies a reusable set of properties for controlling a Undertow instance's thread pool.</xs:documentation>
+              </xs:annotation>
+           </xs:element>
+           <xs:element name="engine" 
+                       type="tns:UndertowHTTPServerEngineConfigType" 
+                       minOccurs="0" maxOccurs="unbounded">
+              <xs:annotation>
+                 <xs:documentation>Specifies the configuration for a particular Undertow runtime instance.</xs:documentation>
+              </xs:annotation>
+           </xs:element>
+       </xs:sequence>
+       <xs:attribute name="bus" type="xs:string" default="cxf"/>
+       <xs:attribute name="id" type="xs:ID" use="optional"/>
+    </xs:complexType>
+    
+    <xs:element name="engine-factory" 
+                type="tns:UndertowHTTPServerEngineFactoryConfigType">
+       <xs:annotation>
+          <xs:documentation>Contains the configuration for a Undertow instance.</xs:documentation>
+       </xs:annotation>
+    </xs:element>
+ </xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java
new file mode 100644
index 0000000..bc51936
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java
@@ -0,0 +1,892 @@
+/**
+ * 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;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.extension.ExtensionManagerBus;
+import org.apache.cxf.common.util.Base64Utility;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.continuations.SuspendedInvocationException;
+import org.apache.cxf.endpoint.EndpointResolverRegistry;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.io.AbstractWrappedOutputStream;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.policy.PolicyDataEngine;
+import org.apache.cxf.security.transport.TLSSessionInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.http.AbstractHTTPDestination;
+import org.apache.cxf.transport.http.ContinuationProviderFactory;
+import org.apache.cxf.transport.http.DestinationRegistry;
+import org.apache.cxf.transport.http.HTTPTransportFactory;
+import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.EndpointReferenceUtils;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.easymock.EasyMock;
+
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Test;
+
+import io.undertow.util.HeaderMap;
+import io.undertow.util.HttpString;
+
+public class UndertowHTTPDestinationTest extends Assert {
+    protected static final String AUTH_HEADER = "Authorization";
+    protected static final String USER = "copernicus";
+    protected static final String PASSWD = "epicycles";
+    protected static final String BASIC_AUTH =
+        "Basic " + Base64Utility.encode((USER + ":" + PASSWD).getBytes());   
+
+    private static final String NOWHERE = "http://nada.nothing.nowhere.null/";
+    private static final String PAYLOAD = "message payload";
+    private static final String CHALLENGE_HEADER = "WWW-Authenticate";
+    private static final String BASIC_CHALLENGE = "Basic realm=terra";
+    private static final String DIGEST_CHALLENGE = "Digest realm=luna";
+    private static final String CUSTOM_CHALLENGE = "Custom realm=sol";
+    private Bus bus;
+    private Bus threadDefaultBus;
+    private Conduit decoupledBackChannel;
+    private EndpointInfo endpointInfo;
+    private EndpointReferenceType address;
+    private UndertowHTTPServerEngine engine;
+    private HTTPServerPolicy policy;
+    private UndertowHTTPDestination destination;
+    private HttpServletRequest request;
+    private HttpServletResponse response;
+    private Message inMessage;
+    private Message outMessage;
+    private MessageObserver observer;
+    private ServletInputStream is;
+    private ServletOutputStream os;
+    private HTTPTransportFactory transportFactory; 
+
+    /**
+     * This class replaces the engine in the Undertow Destination.
+     */
+    private class EasyMockUndertowHTTPDestination
+        extends UndertowHTTPDestination {
+
+        EasyMockUndertowHTTPDestination(Bus bus,
+                                            DestinationRegistry registry,
+                                            EndpointInfo endpointInfo,
+                                            UndertowHTTPServerEngineFactory serverEngineFactory,
+                                            UndertowHTTPServerEngine easyMockEngine) throws IOException {
+            super(bus, registry, endpointInfo, serverEngineFactory);
+            engine = easyMockEngine;
+        }
+        
+        @Override
+        public void retrieveEngine() {
+            // Leave engine alone.
+        }
+    }
+    @After
+    public void tearDown() {
+        if (bus != null) {
+            bus.shutdown(true);
+        }
+        bus = null;
+        transportFactory = null;
+        decoupledBackChannel = null;
+        address = null;
+        engine = null;
+        request = null;
+        response = null;
+        inMessage = null;
+        outMessage = null;
+        is = null;
+        os = null;
+        destination = null;
+        BusFactory.setDefaultBus(null); 
+    }
+    
+    @Test
+    public void testGetAddress() throws Exception {
+        destination = setUpDestination();
+        EndpointReferenceType ref = destination.getAddress();
+        assertNotNull("unexpected null address", ref);
+        assertEquals("unexpected address",
+                     EndpointReferenceUtils.getAddress(ref),
+                     StringUtils.addDefaultPortIfMissing(EndpointReferenceUtils.getAddress(address)));
+        assertEquals("unexpected service name local part",
+                     EndpointReferenceUtils.getServiceName(ref, bus).getLocalPart(),
+                     "Service");
+        assertEquals("unexpected portName",
+                     EndpointReferenceUtils.getPortName(ref),
+                     "Port");
+    }
+    
+    @Test
+    public void testRandomPortAllocation() throws Exception {
+        bus = BusFactory.getDefaultBus(true);
+        transportFactory = new HTTPTransportFactory();
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));
+        EndpointInfo ei = new EndpointInfo(serviceInfo, "");
+        ei.setName(new QName("bla", "Port"));
+        
+        Destination d1 = transportFactory.getDestination(ei, bus);
+        URL url = new URL(d1.getAddress().getAddress().getValue());
+        assertTrue("No random port has been allocated", 
+                   url.getPort() > 0);
+        
+    }
+    
+    @Test
+    public void testSuspendedException() throws Exception {
+        destination = setUpDestination(false, false);
+        setUpDoService(false);
+        final RuntimeException ex = new RuntimeException();
+        observer = new MessageObserver() {
+            public void onMessage(Message m) {
+                throw new SuspendedInvocationException(ex);
+            }
+        };
+        destination.setMessageObserver(observer);
+        try {
+            destination.doService(request, response);
+            fail("Suspended invocation swallowed");
+        } catch (RuntimeException runtimeEx) {
+            assertSame("Original exception is not preserved", ex, runtimeEx);
+        }
+    }
+    
+    
+    @Test
+    public void testContinuationsIgnored() throws Exception {
+        
+        HttpServletRequest httpRequest = EasyMock.createMock(HttpServletRequest.class);
+        
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));
+        EndpointInfo ei = new EndpointInfo(serviceInfo, "");
+        ei.setName(new QName("bla", "Port"));
+        
+        final UndertowHTTPServerEngine httpEngine = new UndertowHTTPServerEngine();
+        httpEngine.setContinuationsEnabled(false);
+        UndertowHTTPServerEngineFactory factory = new UndertowHTTPServerEngineFactory() {
+            @Override
+            public UndertowHTTPServerEngine retrieveUndertowHTTPServerEngine(int port) {
+                return httpEngine;
+            }
+        };
+        Bus b2 = new ExtensionManagerBus();
+        transportFactory = new HTTPTransportFactory();
+        b2.setExtension(factory, UndertowHTTPServerEngineFactory.class);
+        
+        TestUndertowDestination testDestination = 
+            new TestUndertowDestination(b2, 
+                                     transportFactory.getRegistry(), 
+                                     ei,
+                                     factory);
+        testDestination.finalizeConfig();
+        Message mi = testDestination.retrieveFromContinuation(httpRequest);
+        assertNull("Continuations must be ignored", mi);
+    }
+    
+    @Test
+    public void testGetMultiple() throws Exception {
+        bus = BusFactory.getDefaultBus(true);
+        transportFactory = new HTTPTransportFactory();
+        
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));        
+        EndpointInfo ei = new EndpointInfo(serviceInfo, "");
+        ei.setName(new QName("bla", "Port"));
+        ei.setAddress("http://foo");
+        Destination d1 = transportFactory.getDestination(ei, bus);
+        
+        Destination d2 = transportFactory.getDestination(ei, bus);
+        
+        // Second get should not generate a new destination. It should just retrieve the existing one
+        assertEquals(d1, d2);
+        
+        d2.shutdown();
+        
+        Destination d3 = transportFactory.getDestination(ei, bus);
+        // Now a new destination should have been created
+        assertNotSame(d1, d3);
+    }
+    
+    
+    @Test
+    public void testRemoveServant() throws Exception {
+        destination = setUpDestination();
+        setUpRemoveServant();
+        destination.setMessageObserver(null);
+    }
+
+    @Test
+    public void testDoServiceRedirectURL() throws Exception {
+        destination = setUpDestination(false, false);
+        setUpDoService(true);
+        destination.doService(request, response);
+        
+    }
+
+    @Test
+    public void testDoService() throws Exception {
+        Bus defaultBus = new ExtensionManagerBus();
+        assertSame("Default thread bus has not been set",
+                   defaultBus, BusFactory.getThreadDefaultBus()); 
+        destination = setUpDestination(false, false);
+        setUpDoService(false);
+        assertSame("Default thread bus has been unexpectedly reset",
+                   defaultBus, BusFactory.getThreadDefaultBus());
+        destination.doService(request, response);
+        verifyDoService();
+        assertSame("Default thread bus has not been reset",
+                    defaultBus, BusFactory.getThreadDefaultBus());
+    }
+    
+    @Test
+    public void testDoServiceWithHttpGET() throws Exception {
+        destination = setUpDestination(false, false);
+        setUpDoService(false,
+                       false,
+                       false,
+                       "GET",
+                       "?customerId=abc&cutomerAdd=def",
+                       200);
+        destination.doService(request, response);
+        
+        assertNotNull("unexpected null message", inMessage);
+        assertEquals("unexpected method",
+                     inMessage.get(Message.HTTP_REQUEST_METHOD),
+                     "GET");
+        assertEquals("unexpected path",
+                     inMessage.get(Message.PATH_INFO),
+                     "/bar/foo");
+        assertEquals("unexpected query",
+                     inMessage.get(Message.QUERY_STRING),
+                     "?customerId=abc&cutomerAdd=def");
+
+    }
+
+    @Test
+    public void testGetAnonBackChannel() throws Exception {
+        destination = setUpDestination(false, false);
+        setUpDoService(false);
+        destination.doService(request, response);
+        setUpInMessage();
+        Conduit backChannel = destination.getBackChannel(inMessage);
+        
+        assertNotNull("expected back channel", backChannel);
+        assertEquals("unexpected target",
+                     EndpointReferenceUtils.ANONYMOUS_ADDRESS,
+                     backChannel.getTarget().getAddress().getValue());
+    }
+    
+    @Test
+    public void testGetBackChannelSend() throws Exception {
+        destination = setUpDestination(false, false);
+        setUpDoService(false, true);
+        destination.doService(request, response);
+        setUpInMessage();
+        Conduit backChannel =
+            destination.getBackChannel(inMessage);
+        outMessage = setUpOutMessage();
+        backChannel.prepare(outMessage);
+        verifyBackChannelSend(backChannel, outMessage, 200);
+    }
+
+    @Test
+    public void testGetBackChannelSendFault() throws Exception {
+        destination = setUpDestination(false, false);
+        setUpDoService(false, true, 500);
+        destination.doService(request, response);
+        setUpInMessage();
+        Conduit backChannel =
+            destination.getBackChannel(inMessage);
+        outMessage = setUpOutMessage();
+        backChannel.prepare(outMessage);
+        verifyBackChannelSend(backChannel, outMessage, 500);
+    }
+    
+    @Test
+    public void testGetBackChannelSendOneway() throws Exception {
+        destination = setUpDestination(false, false);
+        setUpDoService(false, true, 500);
+        destination.doService(request, response);
+        setUpInMessage();
+        Conduit backChannel =
+            destination.getBackChannel(inMessage);
+        outMessage = setUpOutMessage();
+        backChannel.prepare(outMessage);
+        verifyBackChannelSend(backChannel, outMessage, 500, true);
+    }
+
+    @Test
+    public void testGetBackChannelSendDecoupled() throws Exception {
+        destination = setUpDestination(false, false);
+        setUpDoService(false, true, true, 202);
+        destination.doService(request, response);
+        setUpInMessage();
+        
+        Message partialResponse = setUpOutMessage();
+        partialResponse.put(Message.PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE);
+        Conduit partialBackChannel =
+            destination.getBackChannel(inMessage);
+        partialBackChannel.prepare(partialResponse);
+        verifyBackChannelSend(partialBackChannel, partialResponse, 202);
+
+        outMessage = setUpOutMessage();
+        Conduit fullBackChannel =
+            destination.getBackChannel(inMessage);
+
+        fullBackChannel.prepare(outMessage);
+    }
+    
+    @Test
+    public void testServerPolicyInServiceModel()
+        throws Exception {
+        policy = new HTTPServerPolicy();
+        address = getEPR("bar/foo");
+        bus = BusFactory.getDefaultBus(true);
+        
+        transportFactory = new HTTPTransportFactory();
+        
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));        
+        endpointInfo = new EndpointInfo(serviceInfo, "");
+        endpointInfo.setName(new QName("bla", "Port"));
+        endpointInfo.addExtensor(policy);
+        
+        engine = EasyMock.createMock(UndertowHTTPServerEngine.class);
+        EasyMock.replay();
+        endpointInfo.setAddress(NOWHERE + "bar/foo");
+        
+        UndertowHTTPDestination dest = 
+            new EasyMockUndertowHTTPDestination(
+                    bus, transportFactory.getRegistry(), endpointInfo, null, engine);
+        assertEquals(policy, dest.getServer());
+    }
+        
+    @Test
+    public void testMultiplexGetAddressWithId() throws Exception {
+        destination = setUpDestination();
+        final String id = "ID2";
+        EndpointReferenceType refWithId = destination.getAddressWithId(id);
+        assertNotNull(refWithId);
+        assertNotNull(refWithId.getReferenceParameters());
+        assertNotNull(refWithId.getReferenceParameters().getAny());
+        assertTrue("it is an element", 
+                   refWithId.getReferenceParameters().getAny().get(0) instanceof JAXBElement);
+        JAXBElement<?> el = (JAXBElement<?>) refWithId.getReferenceParameters().getAny().get(0);
+        assertEquals("match our id", el.getValue(), id);
+    }
+    
+    @Test
+    public void testMultiplexGetAddressWithIdForAddress() throws Exception {
+        destination = setUpDestination();
+        destination.setMultiplexWithAddress(true);
+        
+        final String id = "ID3";
+        EndpointReferenceType refWithId = destination.getAddressWithId(id);
+        assertNotNull(refWithId);
+        assertNull(refWithId.getReferenceParameters());
+        assertTrue("match our id", EndpointReferenceUtils.getAddress(refWithId).indexOf(id) != -1);
+    }
+    
+    @Test
+    public void testMultiplexGetIdForAddress() throws Exception {
+        destination = setUpDestination();
+        destination.setMultiplexWithAddress(true);
+        
+        final String id = "ID3";
+        EndpointReferenceType refWithId = destination.getAddressWithId(id);
+        String pathInfo = EndpointReferenceUtils.getAddress(refWithId);
+        
+        Map<String, Object> context = new HashMap<String, Object>();
+        assertNull("fails with no context", destination.getId(context));
+        
+        context.put(Message.PATH_INFO, pathInfo);
+        String result = destination.getId(context);
+        assertNotNull(result);
+        assertEquals("match our id", result, id);
+    }
+    
+    @Test
+    public void testMultiplexGetId() throws Exception {
+        destination = setUpDestination();
+        
+        final String id = "ID3";
+        EndpointReferenceType refWithId = destination.getAddressWithId(id);
+        
+        Map<String, Object> context = new HashMap<String, Object>();
+        assertNull("fails with no context", destination.getId(context));
+        
+        AddressingProperties maps = EasyMock.createMock(AddressingProperties.class);
+        maps.getToEndpointReference();
+        EasyMock.expectLastCall().andReturn(refWithId);
+        EasyMock.replay(maps);      
+        context.put(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND, maps);
+        String result = destination.getId(context);
+        assertNotNull(result);
+        assertEquals("match our id", result, id);
+    }
+    
+    private UndertowHTTPDestination setUpDestination()
+        throws Exception {
+        return setUpDestination(false, false);
+    };
+    
+    private UndertowHTTPDestination setUpDestination(
+            boolean contextMatchOnStem, boolean mockedBus)
+        throws Exception {
+        policy = new HTTPServerPolicy();
+        address = getEPR("bar/foo");
+        
+
+        transportFactory = new HTTPTransportFactory();
+
+        final ConduitInitiator ci = new ConduitInitiator() {
+            public Conduit getConduit(EndpointInfo targetInfo, Bus b) throws IOException {
+                return decoupledBackChannel;
+            }
+
+            public Conduit getConduit(EndpointInfo localInfo, EndpointReferenceType target, Bus b)
+                throws IOException {
+                return decoupledBackChannel;
+            }
+
+            public List<String> getTransportIds() {
+                return null;
+            }
+
+            public Set<String> getUriPrefixes() {
+                return new HashSet<String>(Collections.singletonList("http"));
+            }
+            
+        };
+        ConduitInitiatorManager mgr = new ConduitInitiatorManager() {
+            public void deregisterConduitInitiator(String name) {
+            }
+
+            public ConduitInitiator getConduitInitiator(String name) throws BusException {
+                return null;
+            }
+
+            public ConduitInitiator getConduitInitiatorForUri(String uri) {
+                return ci;
+            }
+
+            public void registerConduitInitiator(String name, ConduitInitiator factory) {
+            }
+        };
+        
+        if (!mockedBus) {
+            bus = new ExtensionManagerBus();
+            bus.setExtension(mgr, ConduitInitiatorManager.class);
+        } else {
+            bus = EasyMock.createMock(Bus.class);
+            bus.getExtension(EndpointResolverRegistry.class);
+            EasyMock.expectLastCall().andReturn(null);
+            bus.getExtension(ContinuationProviderFactory.class);
+            EasyMock.expectLastCall().andReturn(null).anyTimes();
+            bus.getExtension(PolicyDataEngine.class);
+            EasyMock.expectLastCall().andReturn(null).anyTimes();
+            bus.hasExtensionByName("org.apache.cxf.ws.policy.PolicyEngine");
+            EasyMock.expectLastCall().andReturn(false);
+            bus.getExtension(ClassLoader.class);
+            EasyMock.expectLastCall().andReturn(this.getClass().getClassLoader());
+            EasyMock.replay(bus);
+        }
+        
+        
+        engine = EasyMock.createNiceMock(UndertowHTTPServerEngine.class);
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));        
+        endpointInfo = new EndpointInfo(serviceInfo, "");
+        endpointInfo.setName(new QName("bla", "Port"));
+        endpointInfo.setAddress(NOWHERE + "bar/foo");
+       
+        endpointInfo.addExtensor(policy);
+        engine.addServant(EasyMock.eq(new URL(NOWHERE + "bar/foo")),
+                          EasyMock.isA(UndertowHTTPHandler.class));
+        EasyMock.expectLastCall();
+        engine.getContinuationsEnabled();
+        EasyMock.expectLastCall().andReturn(true);
+        EasyMock.replay(engine);
+        
+        UndertowHTTPDestination dest = new EasyMockUndertowHTTPDestination(bus,
+                                                             transportFactory.getRegistry(),
+                                                             endpointInfo,
+                                                             null,
+                                                             engine);
+        dest.retrieveEngine();
+        policy = dest.getServer();
+        observer = new MessageObserver() {
+            public void onMessage(Message m) {
+                inMessage = m;
+                threadDefaultBus = BusFactory.getThreadDefaultBus();
+            }
+        };
+        dest.setMessageObserver(observer);
+        return dest;
+    }
+        
+    private void setUpRemoveServant() throws Exception {
+        EasyMock.reset(engine);
+        engine.removeServant(EasyMock.eq(new URL(NOWHERE + "bar/foo")));
+        EasyMock.expectLastCall();
+        EasyMock.replay(engine);
+    }
+    
+    private void setUpDoService(boolean setRedirectURL) throws Exception {
+        setUpDoService(setRedirectURL, false);
+    }
+
+    private void setUpDoService(boolean setRedirectURL,
+                                boolean sendResponse) throws Exception {
+        setUpDoService(setRedirectURL,
+                       sendResponse,
+                       false);
+    }      
+
+    private void setUpDoService(boolean setRedirectURL,
+                                boolean sendResponse, int status) throws Exception {
+        String method = "POST";
+        String query = "?name";
+        setUpDoService(setRedirectURL, sendResponse, false, method, query, status);
+    }
+    
+    private void setUpDoService(boolean setRedirectURL,
+                                boolean sendResponse, boolean decoupled, int status) throws Exception {
+        String method = "POST";
+        String query = "?name";
+        setUpDoService(setRedirectURL, sendResponse, decoupled, method, query, status);
+    }
+    
+    private void setUpDoService(boolean setRedirectURL,
+            boolean sendResponse,
+            boolean decoupled) throws Exception {
+        String method = "POST";
+        String query = "?name";
+        setUpDoService(setRedirectURL, sendResponse, decoupled, method, query, 200);
+    }
+
+    private void setUpDoService(boolean setRedirectURL,
+                                boolean sendResponse,
+                                boolean decoupled,
+                                String method,
+                                String query,
+                                int status
+                                ) throws Exception {
+       
+        is = EasyMock.createMock(ServletInputStream.class);
+        os = EasyMock.createMock(ServletOutputStream.class);
+        request = EasyMock.createMock(HttpServletRequest.class);
+        response = EasyMock.createMock(HttpServletResponse.class);
+        request.getMethod();
+        EasyMock.expectLastCall().andReturn(method).atLeastOnce();
+        request.getUserPrincipal();
+        EasyMock.expectLastCall().andReturn(null).anyTimes();
+        
+        if (setRedirectURL) {
+            policy.setRedirectURL(NOWHERE + "foo/bar");
+            response.sendRedirect(EasyMock.eq(NOWHERE + "foo/bar"));
+            EasyMock.expectLastCall();
+            response.flushBuffer();
+            EasyMock.expectLastCall();
+            EasyMock.expectLastCall();
+        } else { 
+            //getQueryString for if statement
+            request.getQueryString();
+            EasyMock.expectLastCall().andReturn(query);      
+            
+            if ("GET".equals(method) && "?wsdl".equals(query)) {
+                verifyGetWSDLQuery();                
+            } else { // test for the post
+                EasyMock.expect(request.getAttribute(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE))
+                    .andReturn(null);
+                
+                       
+                EasyMock.expect(request.getInputStream()).andReturn(is);
+                EasyMock.expect(request.getContextPath()).andReturn("/bar");
+                EasyMock.expect(request.getServletPath()).andReturn("");
+                EasyMock.expect(request.getPathInfo()).andReturn("/foo");
+                EasyMock.expect(request.getRequestURI()).andReturn("/foo");
+                EasyMock.expect(request.getRequestURL())
+                    .andReturn(new StringBuffer("http://localhost/foo")).anyTimes();
+                EasyMock.expect(request.getCharacterEncoding()).andReturn(StandardCharsets.UTF_8.name());
+                EasyMock.expect(request.getQueryString()).andReturn(query);    
+                EasyMock.expect(request.getHeader("Accept")).andReturn("*/*");  
+                EasyMock.expect(request.getContentType()).andReturn("text/xml charset=utf8").times(2);
+                EasyMock.expect(request.getAttribute("http.service.redirection")).andReturn(null).anyTimes();
+                
+                HeaderMap httpFields = new HeaderMap();
+                httpFields.add(new HttpString("content-type"), "text/xml");
+                httpFields.add(new HttpString("content-type"), "charset=utf8");
+                httpFields.put(new HttpString(UndertowHTTPDestinationTest.AUTH_HEADER), 
+                               UndertowHTTPDestinationTest.BASIC_AUTH);
+                List<String> headers = new ArrayList<String>();
+                for (HttpString header : httpFields.getHeaderNames()) {
+                    headers.add(header.toString());
+                }
+                EasyMock.expect(request.getHeaderNames()).andReturn(Collections.enumeration(headers));
+                request.getHeaders("content-type");
+                EasyMock.expectLastCall().andReturn(Collections.enumeration(httpFields.get("content-type")));
+                request.getHeaders(UndertowHTTPDestinationTest.AUTH_HEADER);
+                EasyMock.expectLastCall().andReturn(Collections.enumeration(
+                                                    httpFields.get(UndertowHTTPDestinationTest.AUTH_HEADER)));
+                 
+                EasyMock.expect(request.getInputStream()).andReturn(is);
+                EasyMock.expectLastCall();  
+                response.flushBuffer();
+                EasyMock.expectLastCall();
+                if (sendResponse) {
+                    response.setStatus(status);
+                    EasyMock.expectLastCall();
+                    response.setContentType("text/xml charset=utf8");
+                    EasyMock.expectLastCall();
+                    response.addHeader(EasyMock.isA(String.class), EasyMock.isA(String.class));
+                    EasyMock.expectLastCall().anyTimes();
+                    response.setContentLength(0);
+                    EasyMock.expectLastCall().anyTimes();
+                    response.getOutputStream();
+                    EasyMock.expectLastCall().andReturn(os);
+                    response.getStatus();
+                    EasyMock.expectLastCall().andReturn(status).anyTimes();
+                    response.flushBuffer();
+                    EasyMock.expectLastCall();                
+                }
+                request.getAttribute("javax.servlet.request.cipher_suite");
+                EasyMock.expectLastCall().andReturn("anythingwilldoreally");
+                request.getAttribute("javax.net.ssl.session");
+                EasyMock.expectLastCall().andReturn(null);
+                request.getAttribute("javax.servlet.request.X509Certificate");
+                EasyMock.expectLastCall().andReturn(null);
+            }
+        }
+        
+        if (decoupled) {
+            setupDecoupledBackChannel();
+        }
+        EasyMock.replay(response);
+        EasyMock.replay(request);
+    }
+    
+    private void setupDecoupledBackChannel() throws IOException {
+        decoupledBackChannel = EasyMock.createMock(Conduit.class);
+        decoupledBackChannel.setMessageObserver(EasyMock.isA(MessageObserver.class));           
+        decoupledBackChannel.prepare(EasyMock.isA(Message.class));
+        EasyMock.expectLastCall();
+        EasyMock.replay(decoupledBackChannel);
+    }
+    
+    private void setUpInMessage() {
+        inMessage.setExchange(new ExchangeImpl());
+    }
+    
+    private Message setUpOutMessage() {
+        Message outMsg = new MessageImpl();
+        outMsg.putAll(inMessage);
+        outMsg.setExchange(new ExchangeImpl());
+        outMsg.put(Message.PROTOCOL_HEADERS,
+                   new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER));
+        return outMsg;
+    }
+    
+    private void setUpResponseHeaders(Message outMsg) {
+        Map<String, List<String>> responseHeaders =
+            CastUtils.cast((Map<?, ?>)outMsg.get(Message.PROTOCOL_HEADERS));
+        assertNotNull("expected response headers", responseHeaders);
+        List<String> challenges = new ArrayList<String>();
+        challenges.add(BASIC_CHALLENGE);
+        challenges.add(DIGEST_CHALLENGE);
+        challenges.add(CUSTOM_CHALLENGE);
+        responseHeaders.put(CHALLENGE_HEADER, challenges);
+    }
+    
+    private void verifyGetWSDLQuery() throws Exception {
+        EasyMock.reset(bus);        
+        request.getRequestURL();
+        EasyMock.expectLastCall().andReturn(new StringBuffer("http://localhost/bar/foo")).times(2);
+        request.getPathInfo();
+        EasyMock.expectLastCall().andReturn("/bar/foo");
+        request.getCharacterEncoding();
+        EasyMock.expectLastCall().andReturn(StandardCharsets.UTF_8.name());
+        request.getQueryString();
+        EasyMock.expectLastCall().andReturn("wsdl");    
+        response.setContentType("text/xml");
+        EasyMock.expectLastCall();        
+        response.getOutputStream();
+        EasyMock.expectLastCall().andReturn(os).anyTimes();
+        EasyMock.expectLastCall();
+        EasyMock.replay(bus);
+    }
+
+    private void verifyDoService() throws Exception {
+        assertSame("Default thread bus has not been set for request",
+                    bus, threadDefaultBus);
+        assertNotNull("unexpected null message", inMessage);
+        assertSame("unexpected HTTP request",
+                   inMessage.get(UndertowHTTPDestination.HTTP_REQUEST),
+                   request);
+        assertSame("unexpected HTTP response",
+                   inMessage.get(UndertowHTTPDestination.HTTP_RESPONSE),
+                   response);
+        assertEquals("unexpected method",
+                     inMessage.get(Message.HTTP_REQUEST_METHOD),
+                     "POST");
+        assertEquals("unexpected path",
+                     inMessage.get(Message.PATH_INFO),
+                     "/bar/foo");
+        assertEquals("unexpected query",
+                     inMessage.get(Message.QUERY_STRING),
+                     "?name");        
+        assertNotNull("unexpected query",
+                   inMessage.get(TLSSessionInfo.class));
+        verifyRequestHeaders();
+                
+    }
+
+    private void verifyRequestHeaders() throws Exception {
+        Map<String, List<String>> requestHeaders =
+            CastUtils.cast((Map<?, ?>)inMessage.get(Message.PROTOCOL_HEADERS));
+        assertNotNull("expected request headers",
+                      requestHeaders);        
+        List<String> values = requestHeaders.get("content-type");
+        assertNotNull("expected field", values);
+        assertEquals("unexpected values", 2, values.size());
+        assertTrue("expected value", values.contains("text/xml"));
+        assertTrue("expected value", values.contains("charset=utf8"));
+        values = requestHeaders.get(AUTH_HEADER);
+        assertNotNull("expected field", values);
+        assertEquals("unexpected values", 1, values.size());
+        assertTrue("expected value", values.contains(BASIC_AUTH));
+        
+        AuthorizationPolicy authpolicy =
+            inMessage.get(AuthorizationPolicy.class);
+        assertNotNull("Expected some auth tokens", policy);
+        assertEquals("expected user",
+                     USER,
+                     authpolicy.getUserName());
+        assertEquals("expected passwd",
+                     PASSWD,
+                     authpolicy.getPassword());
+    }
+    
+    private void verifyResponseHeaders(Message outMsg) throws Exception {
+        Map<String, List<String>> responseHeaders =
+            CastUtils.cast((Map<?, ?>)outMsg.get(Message.PROTOCOL_HEADERS));
+        assertNotNull("expected response headers",
+                      responseHeaders);
+        
+    }
+    
+    private void verifyBackChannelSend(Conduit backChannel,
+                                       Message outMsg,
+                                       int status) throws Exception {
+        verifyBackChannelSend(backChannel, outMsg, status, false);
+    }
+    
+    private void verifyBackChannelSend(Conduit backChannel,
+                                       Message outMsg,
+                                       int status,
+                                       boolean oneway) throws Exception {
+        outMsg.getExchange().setOneWay(oneway);
+
+        assertTrue("unexpected back channel type",
+                   backChannel instanceof UndertowHTTPDestination.BackChannelConduit);
+        assertTrue("unexpected content formats",
+                   outMsg.getContentFormats().contains(OutputStream.class));
+        OutputStream responseOS = outMsg.getContent(OutputStream.class);
+        assertNotNull("expected output stream", responseOS);
+        assertTrue("unexpected output stream type",
+                   responseOS instanceof AbstractWrappedOutputStream);
+               
+        outMsg.put(Message.RESPONSE_CODE, status);          
+        responseOS.write(PAYLOAD.getBytes());
+        
+        setUpResponseHeaders(outMsg);
+        
+        responseOS.flush();        
+        assertEquals("unexpected status",
+                     status,
+                     response.getStatus());
+        
+        verifyResponseHeaders(outMsg);     
+        
+        if (oneway) {
+            assertNull("unexpected HTTP response",
+                       outMsg.get(UndertowHTTPDestination.HTTP_RESPONSE));
+        } else {
+            assertNotNull("expected HTTP response",
+                           outMsg.get(UndertowHTTPDestination.HTTP_RESPONSE));
+            responseOS.close();            
+        }
+    }
+    
+    static EndpointReferenceType getEPR(String s) {
+        return EndpointReferenceUtils.getEndpointReference(NOWHERE + s);
+    }
+    
+    private static class TestUndertowDestination extends UndertowHTTPDestination {
+        TestUndertowDestination(Bus bus,
+                                    DestinationRegistry registry,
+                                    EndpointInfo endpointInfo,
+                                    UndertowHTTPServerEngineFactory serverEngineFactory) throws IOException {
+            super(bus, registry, endpointInfo, serverEngineFactory);
+        }
+        
+        @Override
+        public Message retrieveFromContinuation(HttpServletRequest request) {
+            return super.retrieveFromContinuation(request);
+        }
+        
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngineFactoryTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngineFactoryTest.java b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngineFactoryTest.java
new file mode 100644
index 0000000..e1ac2d0
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngineFactoryTest.java
@@ -0,0 +1,145 @@
+/**
+ * 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;
+
+import java.net.URL;
+
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.transport.http.HTTPTransportFactory;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+
+public class UndertowHTTPServerEngineFactoryTest
+        extends Assert {
+    Bus bus;
+    
+    @BeforeClass
+    public static void classUp() {
+        // Get rid of any notion of a default bus set by other 
+        // rogue tests.
+        BusFactory.setDefaultBus(null);
+    }
+    
+    @AfterClass
+    public static void classDown() {
+        // Clean up.
+        BusFactory.setDefaultBus(null);
+    }
+    
+    @After
+    public void tearDown() {
+        if (bus != null) {
+            bus.shutdown(false);
+            bus = null;
+        }
+    }
+    
+    /**
+     * This test makes sure that a default Spring initialized bus will 
+     * have the UndertowHTTPServerEngineFactory (absent of <httpu:engine-factory>
+     * configuration.
+     */
+    @Test
+    public void testMakeSureTransportFactoryHasEngineFactory() throws Exception {
+        bus = BusFactory.getDefaultBus(true);
+        
+        assertNotNull("Cannot get bus", bus);
+        
+        // Make sure we got the Transport Factory.
+        DestinationFactoryManager destFM = 
+            bus.getExtension(DestinationFactoryManager.class);
+        assertNotNull("Cannot get DestinationFactoryManager", destFM);
+        DestinationFactory destF = 
+            destFM.getDestinationFactory(
+                    "http://cxf.apache.org/transports/http");
+        assertNotNull("No DestinationFactory", destF);
+        assertTrue(HTTPTransportFactory.class.isInstance(destF));
+
+        // And the UndertowHTTPServerEngineFactory should be there.
+        UndertowHTTPServerEngineFactory factory =
+            bus.getExtension(UndertowHTTPServerEngineFactory.class);
+        assertNotNull("EngineFactory is not configured.", factory);
+    }
+    
+    /**
+     * This test makes sure that with a <httpu:engine-factory bus="cxf">
+     * that the bus is configured with the rightly configured Undertow
+     * HTTP Server Engine Factory.  Port 1234 should have be configured
+     * for TLS.
+     */
+    @Test
+    public void testMakeSureTransportFactoryHasEngineFactoryConfigured() throws Exception {
+        
+        // This file configures the factory to configure
+        // port 1234 with default TLS.
+        
+        URL config = getClass().getResource("server-engine-factory.xml");
+        
+        bus = new SpringBusFactory().createBus(config, true);
+        
+        UndertowHTTPServerEngineFactory factory =
+            bus.getExtension(UndertowHTTPServerEngineFactory.class);
+        
+        assertNotNull("EngineFactory is not configured.", factory);
+        
+        // The Engine for port 1234 should be configured for TLS.
+        // This will throw an error if it is not.
+        UndertowHTTPServerEngine engine = null;
+        engine = factory.createUndertowHTTPServerEngine(1234, "https");
+        
+        assertNotNull("Engine is not available.", engine);
+        assertEquals(1234, engine.getPort());
+        assertEquals("Not https", "https", engine.getProtocol());
+        
+        try {
+            engine = factory.createUndertowHTTPServerEngine(1234, "http");
+            fail("The engine's protocol should be https");
+        } catch (Exception e) {
+            // expect the exception
+        }
+    }
+    
+    @Test
+    public void testAnInvalidConfiguresfile() {
+        
+        // This file configures the factory to configure
+        // port 1234 with default TLS.
+        
+        URL config = getClass().getResource("invalid-engines.xml");
+
+        bus = new SpringBusFactory().createBus(config);
+            
+        UndertowHTTPServerEngineFactory factory =
+            bus.getExtension(UndertowHTTPServerEngineFactory.class);
+            
+        assertNotNull("EngineFactory is not configured.", factory);
+    }   
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngineTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngineTest.java b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngineTest.java
new file mode 100644
index 0000000..a909822
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngineTest.java
@@ -0,0 +1,266 @@
+/**
+ * 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;
+
+
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.lang.management.ManagementFactory;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.configuration.jsse.TLSServerParameters;
+import org.apache.cxf.configuration.spring.ConfigurerImpl;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.management.InstrumentationManager;
+import org.apache.cxf.testutil.common.TestUtil;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class UndertowHTTPServerEngineTest extends Assert {
+    private static final int PORT1 
+        = Integer.valueOf(TestUtil.getPortNumber(UndertowHTTPServerEngineTest.class, 1));
+    private static final int PORT2
+        = Integer.valueOf(TestUtil.getPortNumber(UndertowHTTPServerEngineTest.class, 2));
+    private static final int PORT3 
+        = Integer.valueOf(TestUtil.getPortNumber(UndertowHTTPServerEngineTest.class, 3));
+    
+
+    private Bus bus;
+    private IMocksControl control;
+    private UndertowHTTPServerEngineFactory factory;
+
+    @Before
+    public void setUp() throws Exception {
+        control = EasyMock.createNiceControl();
+        bus = control.createMock(Bus.class);
+        
+        Configurer configurer = new ConfigurerImpl();
+        bus.getExtension(Configurer.class);
+        EasyMock.expectLastCall().andReturn(configurer).anyTimes();
+        
+        InstrumentationManager iManager = control.createMock(InstrumentationManager.class);
+        iManager.getMBeanServer();
+        EasyMock.expectLastCall().andReturn(ManagementFactory.getPlatformMBeanServer()).anyTimes();
+        
+        bus.getExtension(InstrumentationManager.class);
+        EasyMock.expectLastCall().andReturn(iManager).anyTimes();
+        
+        control.replay();
+
+        factory = new UndertowHTTPServerEngineFactory();
+        factory.setBus(bus);
+
+    }
+    
+    
+    
+    @Test
+    public void testEngineRetrieval() throws Exception {
+        UndertowHTTPServerEngine engine =
+            factory.createUndertowHTTPServerEngine(PORT1, "http");
+
+        assertTrue(
+            "Engine references for the same port should point to the same instance",
+            engine == factory.retrieveUndertowHTTPServerEngine(PORT1));
+
+        UndertowHTTPServerEngineFactory.destroyForPort(PORT1);
+    }
+
+    @Test
+    public void testHttpAndHttps() throws Exception {
+        UndertowHTTPServerEngine engine =
+            factory.createUndertowHTTPServerEngine(PORT1, "http");
+
+        assertTrue("Protocol must be http",
+                "http".equals(engine.getProtocol()));
+
+        engine = new UndertowHTTPServerEngine();
+        engine.setPort(PORT2);
+        engine.setMaxIdleTime(30000);
+        engine.setTlsServerParameters(new TLSServerParameters());
+        engine.finalizeConfig();
+
+        List<UndertowHTTPServerEngine> list = new ArrayList<UndertowHTTPServerEngine>();
+        list.add(engine);
+        factory.setEnginesList(list);
+        engine = factory.createUndertowHTTPServerEngine(PORT2, "https");
+        UndertowHTTPTestHandler handler1 = new UndertowHTTPTestHandler("string1", true);
+        
+        engine.addServant(new URL("https://localhost:" + PORT2 + "/test"), handler1);
+        assertTrue("Protocol must be https",
+                "https".equals(engine.getProtocol()));
+        
+        assertEquals("Get the wrong maxIdleTime.", 30000, engine.getMaxIdleTime());
+
+        factory.setTLSServerParametersForPort(PORT1, new TLSServerParameters());
+        engine = factory.createUndertowHTTPServerEngine(PORT1, "https");
+        assertTrue("Protocol must be https",
+                   "https".equals(engine.getProtocol()));
+
+        factory.setTLSServerParametersForPort(PORT3, new TLSServerParameters());
+        engine = factory.createUndertowHTTPServerEngine(PORT3, "https");
+        assertTrue("Protocol must be https",
+                   "https".equals(engine.getProtocol()));
+
+        UndertowHTTPServerEngineFactory.destroyForPort(PORT1);
+        UndertowHTTPServerEngineFactory.destroyForPort(PORT2);
+        UndertowHTTPServerEngineFactory.destroyForPort(PORT3);
+    }
+
+
+    
+
+    @Test
+    public void testaddServants() throws Exception {
+        String urlStr = "http://localhost:" + PORT1 + "/hello/test";
+        String urlStr2 = "http://localhost:" + PORT1 + "/hello233/test";
+        UndertowHTTPServerEngine engine =
+            factory.createUndertowHTTPServerEngine(PORT1, "http");
+        engine.setMaxIdleTime(30000);
+        engine.addServant(new URL(urlStr), new UndertowHTTPTestHandler("string1", true));
+        assertEquals("Get the wrong maxIdleTime.", 30000, engine.getMaxIdleTime());
+        
+        String response = null;
+        response = getResponse(urlStr);
+        assertEquals("The undertow http handler did not take effect", response, "string1");
+
+        try {
+            engine.addServant(new URL(urlStr), new UndertowHTTPTestHandler("string2", true));
+            fail("We don't support to publish the two service at the same context path");
+        } catch (Exception ex) {
+            assertTrue("Get a wrong exception message", ex.getMessage().indexOf("hello/test") > 0);
+        }
+        
+        try {
+            engine.addServant(new URL(urlStr + "/test"), new UndertowHTTPTestHandler("string2", true));
+            fail("We don't support to publish the two service at the same context path");
+        } catch (Exception ex) {
+            assertTrue("Get a wrong exception message", ex.getMessage().indexOf("hello/test/test") > 0);
+        }
+        
+        try {
+            engine.addServant(new URL("http://localhost:" + PORT1 + "/hello"), 
+                              new UndertowHTTPTestHandler("string2", true));
+            fail("We don't support to publish the two service at the same context path");
+        } catch (Exception ex) {
+            assertTrue("Get a wrong exception message", ex.getMessage().indexOf("hello") > 0);
+        }
+        
+        // check if the system property change could work
+        System.setProperty("org.apache.cxf.transports.http_undertow.DontCheckUrl", "true");
+        engine.addServant(new URL(urlStr + "/test"), new UndertowHTTPTestHandler("string2", true));
+        // clean up the System property setting
+        System.clearProperty("org.apache.cxf.transports.http_undertow.DontCheckUrl");
+        
+        engine.addServant(new URL(urlStr2), new UndertowHTTPTestHandler("string2", true));
+        
+        Set<ObjectName>  s = CastUtils.cast(ManagementFactory.getPlatformMBeanServer().
+            queryNames(new ObjectName("org.xnio:type=Xnio,provider=\"nio\""), null));
+        assertEquals("Could not find Undertow Server: " + s, 1, s.size());
+        
+        engine.removeServant(new URL(urlStr));
+        engine.shutdown();
+        response = getResponse(urlStr2);
+        assertEquals("The undertow http handler did not take effect", response, "string2");
+        // set the get request
+        UndertowHTTPServerEngineFactory.destroyForPort(PORT1);
+
+    }
+    
+    /**
+     * Test that multiple UndertowHTTPServerEngine instances can be used simultaneously
+     * without having name collisions.
+     */
+    @Test
+    public void testJmxSupport() throws Exception {
+        String urlStr = "http://localhost:" + PORT1 + "/hello/test";
+        String urlStr2 = "http://localhost:" + PORT2 + "/hello/test";
+        UndertowHTTPServerEngine engine =
+            factory.createUndertowHTTPServerEngine(PORT1, "http");
+        UndertowHTTPServerEngine engine2 =
+            factory.createUndertowHTTPServerEngine(PORT2, "http");
+        UndertowHTTPTestHandler handler1 = new UndertowHTTPTestHandler("string1", true);
+        UndertowHTTPTestHandler handler2 = new UndertowHTTPTestHandler("string2", true);
+        
+        engine.addServant(new URL(urlStr), handler1);
+        
+        Set<ObjectName>  s = CastUtils.cast(ManagementFactory.getPlatformMBeanServer().
+            queryNames(new ObjectName("org.xnio:type=Xnio,provider=\"nio\""), null));
+        assertEquals("Could not find 1 Undertow Server: " + s, 1, s.size());
+        
+        engine2.addServant(new URL(urlStr2), handler2);
+        
+        s = CastUtils.cast(ManagementFactory.getPlatformMBeanServer().
+            queryNames(new ObjectName("org.xnio:type=Xnio,provider=\"nio\",worker=\"*\""), null));
+        assertEquals("Could not find 2 Undertow Server: " + s, 2, s.size());
+        
+        engine.removeServant(new URL(urlStr));
+        engine2.removeServant(new URL(urlStr2));
+        
+        
+        engine.shutdown();
+        
+        s = CastUtils.cast(ManagementFactory.getPlatformMBeanServer().
+            queryNames(new ObjectName("org.xnio:type=Xnio,provider=\"nio\",worker=\"*\""), null));
+        assertEquals("Could not find 2 Undertow Server: " + s, 1, s.size());
+        
+        engine2.shutdown();
+        
+        s = CastUtils.cast(ManagementFactory.getPlatformMBeanServer().
+            queryNames(new ObjectName("org.xnio:type=Xnio,provider=\"nio\",worker=\"*\""), null));
+        assertEquals("Could not find 0 Undertow Server: " + s, 0, s.size());
+        
+        UndertowHTTPServerEngineFactory.destroyForPort(PORT1);
+        UndertowHTTPServerEngineFactory.destroyForPort(PORT2);
+    }
+
+     
+    
+
+    private String getResponse(String target) throws Exception {
+        URL url = new URL(target);
+
+        URLConnection connection = url.openConnection();
+
+        assertTrue(connection instanceof HttpURLConnection);
+        connection.connect();
+        InputStream in = connection.getInputStream();
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        IOUtils.copy(in, buffer);
+        return buffer.toString();
+    }
+    
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPTestHandler.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPTestHandler.java b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPTestHandler.java
new file mode 100644
index 0000000..00101f9
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPTestHandler.java
@@ -0,0 +1,78 @@
+/**
+ * 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;
+
+
+import io.undertow.io.Sender;
+import io.undertow.server.HttpServerExchange;
+import io.undertow.servlet.handlers.ServletRequestContext;
+import io.undertow.servlet.spec.HttpServletRequestImpl;
+import io.undertow.servlet.spec.HttpServletResponseImpl;
+import io.undertow.servlet.spec.ServletContextImpl;
+import io.undertow.util.Headers;
+
+public class UndertowHTTPTestHandler extends UndertowHTTPHandler {
+       
+    private String responseStr;
+
+    public UndertowHTTPTestHandler(String s, boolean cmExact) {
+        super(null, cmExact);
+        responseStr = s;
+    }
+
+    
+    @Override
+    public void handleRequest(HttpServerExchange undertowExchange) throws Exception {
+        try {
+            
+            HttpServletResponseImpl response = new HttpServletResponseImpl(undertowExchange,
+                                                                           (ServletContextImpl)servletContext);
+            HttpServletRequestImpl request = new HttpServletRequestImpl(undertowExchange,
+                                                                        (ServletContextImpl)servletContext);
+
+            ServletRequestContext servletRequestContext = new ServletRequestContext(((ServletContextImpl)servletContext)
+                .getDeployment(), request, response, null);
+            
+             
+            undertowExchange.putAttachment(ServletRequestContext.ATTACHMENT_KEY, servletRequestContext);
+            request.setAttribute("HTTP_HANDLER", this);
+            request.setAttribute("UNDERTOW_DESTINATION", undertowHTTPDestination);
+                        
+            // just return the response for testing
+            response.getOutputStream().write(responseStr.getBytes());
+            response.flushBuffer();
+        } catch (Throwable t) {
+            t.printStackTrace();
+            if (undertowExchange.isResponseChannelAvailable()) {
+                undertowExchange.setResponseCode(500);
+                final String errorPage = "<html><head><title>Error</title>"
+                    + "</head><body>Internal Error 500" + t.getMessage()
+                    + "</body></html>";
+                undertowExchange.getResponseHeaders().put(Headers.CONTENT_LENGTH,
+                                                          "" + errorPage.length());
+                undertowExchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/html");
+                Sender sender = undertowExchange.getResponseSender();
+                sender.send(errorPage);
+            }
+        }
+    }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/blueprint/HTTPUndertowTransportNamespaceHandlerTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/blueprint/HTTPUndertowTransportNamespaceHandlerTest.java b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/blueprint/HTTPUndertowTransportNamespaceHandlerTest.java
new file mode 100644
index 0000000..28c55ad
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/blueprint/HTTPUndertowTransportNamespaceHandlerTest.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.transport.http_undertow.blueprint;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class HTTPUndertowTransportNamespaceHandlerTest extends Assert {
+    @Test
+    public void testGetSchemaLocation() {
+        HTTPUndertowTransportNamespaceHandler handler = new HTTPUndertowTransportNamespaceHandler();
+        
+        assertNotNull(handler.getSchemaLocation("http://cxf.apache.org/transports/http-undertow/configuration"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/invalid-engines.xml
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/invalid-engines.xml b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/invalid-engines.xml
new file mode 100644
index 0000000..80252e6
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/invalid-engines.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+<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:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpu="http://cxf.apache.org/transports/http-undertow/configuration" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xsi:schemaLocation="                    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            http://www.springframework.org/schema/beans               http://www.springframework.org/schema/beans/spring-beans.xsd">
+    <httpu:engine-factory bus="cxf">
+        <httpu:engine port="1234">
+            <httpu:tlsServerParameters>
+                <sec:clientAuthentication want="true" required="true"/>
+            </httpu:tlsServerParameters>
+        </httpu:engine>
+    </httpu: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/server-engine-factory.xml
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/server-engine-factory.xml b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/server-engine-factory.xml
new file mode 100644
index 0000000..d634930
--- /dev/null
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/server-engine-factory.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpu="http://cxf.apache.org/transports/http-undertow/configuration" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xsi:schemaLocation="                    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            http://www.springframework.org/schema/beans               http://www.springframework.org/schema/beans/spring-beans.xsd">
+    <httpu:engine-factory bus="cxf">
+        <httpu:engine port="1234">
+            <httpu:tlsServerParameters>
+                <sec:clientAuthentication want="true" required="true"/>
+            </httpu:tlsServerParameters>
+        </httpu:engine>
+    </httpu:engine-factory>
+</beans>


Mime
View raw message