add UndertowWebSocketDestination when Atmosphere isn't available with more tests
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
index bbd6f5a..40fd02e 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
@@ -43,6 +43,8 @@
     private static final boolean UNDERTOW_AVAILABLE = probeClass("io.undertow.websockets.core.WebSockets");
     private static final Constructor<?> JETTY9_WEBSOCKET_DESTINATION_CTR = 
         probeConstructor("org.apache.cxf.transport.websocket.jetty9.Jetty9WebSocketDestination");
+    private static final Constructor<?> UNDERTOW_WEBSOCKET_DESTINATION_CTR = 
+        probeUndertowConstructor("org.apache.cxf.transport.websocket.undertow.UndertowWebSocketDestination");
     private static final Constructor<?> ATMOSPHERE_WEBSOCKET_JETTY_DESTINATION_CTR = 
         probeConstructor("org.apache.cxf.transport.websocket.atmosphere.AtmosphereWebSocketJettyDestination");
     private static final Constructor<?> ATMOSPHERE_WEBSOCKET_UNDERTOW_DESTINATION_CTR = 
@@ -102,11 +104,20 @@
                 }
                 return null;
             } else {
-                // for the embedded mode, we stick to jetty
-                JettyHTTPServerEngineFactory serverEngineFactory = bus
-                    .getExtension(JettyHTTPServerEngineFactory.class);
-                return createJettyHTTPDestination(JETTY9_WEBSOCKET_DESTINATION_CTR, bus, registry,
+                if (JETTY_AVAILABLE) {
+                // for the embedded mode, we stick to jetty if jetty is available
+                    JettyHTTPServerEngineFactory serverEngineFactory = bus
+                        .getExtension(JettyHTTPServerEngineFactory.class);
+                    return createJettyHTTPDestination(JETTY9_WEBSOCKET_DESTINATION_CTR, bus, registry,
                                                   endpointInfo, serverEngineFactory);
+                } else if (UNDERTOW_AVAILABLE) {
+                    // use UndertowWebSocketDestination
+                    UndertowHTTPServerEngineFactory undertowServerEngineFactory = bus
+                        .getExtension(UndertowHTTPServerEngineFactory.class);
+                    return createUndertowHTTPDestination(UNDERTOW_WEBSOCKET_DESTINATION_CTR, bus,
+                                                         registry, endpointInfo, undertowServerEngineFactory);
+                }
+                return null;
             }
         } else {
             // REVISIT other way of getting the registry of http so that the plain cxf servlet finds the
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketUndertowDestination.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketUndertowDestination.java
index 4d1f427..d894482 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketUndertowDestination.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketUndertowDestination.java
@@ -194,7 +194,7 @@
                                 @Override
                                 protected void onFullTextMessage(WebSocketChannel channel,
                                                                  BufferedTextMessage message) {
-                                    handleReceivedMessage(channel, message);
+                                    handleReceivedMessage(channel, message, exchange);
 
                                 }
 
@@ -202,14 +202,12 @@
                                                                    BufferedBinaryMessage message)
                                                                        throws IOException {
 
-                                    handleReceivedMessage(channel, message);
+                                    handleReceivedMessage(channel, message, exchange);
 
                                 }
                             });
                             channel.resumeReceives();
-                            // handleNormalRequest(undertowExchange);
                         } catch (Exception e) {
-                            // TODO Auto-generated catch block
                             e.printStackTrace();
                         }
                     }
@@ -228,12 +226,7 @@
                 .getDeployment(), request, response, null);
 
             undertowExchange.putAttachment(ServletRequestContext.ATTACHMENT_KEY, servletRequestContext);
-            /*
-             * if (AtmosphereUtils.useAtmosphere(request)) { try {
-             * framework.doCometSupport(AtmosphereRequestImpl.wrap(request),
-             * AtmosphereResponseImpl.wrap(response)); } catch (ServletException e) { throw new
-             * IOException(e); } return; } else { super.handleRequest(undertowExchange); }
-             */
+            
             try {
                 framework.doCometSupport(AtmosphereRequestImpl.wrap(request),
                                          AtmosphereResponseImpl.wrap(response));
@@ -246,7 +239,6 @@
         public void handleNormalRequest(HttpServletRequest request, HttpServletResponse response)
             throws Exception {
 
-            // if (AtmosphereUtils.useAtmosphere(request)) {
             try {
                 framework.doCometSupport(AtmosphereRequestImpl.wrap(request),
                                          AtmosphereResponseImpl.wrap(response));
@@ -254,16 +246,16 @@
             } catch (ServletException e) {
                 throw new IOException(e);
             }
-            // }
+            
         }
 
-        private void handleReceivedMessage(WebSocketChannel channel, Object message) {
+        private void handleReceivedMessage(WebSocketChannel channel, Object message, HttpServerExchange exchange) {
             executor.execute(new Runnable() {
 
                 @Override
                 public void run() {
                     try {
-                        HttpServletRequest request = new WebSocketUndertowServletRequest(channel, message);
+                        HttpServletRequest request = new WebSocketUndertowServletRequest(channel, message, exchange);
                         HttpServletResponse response = new WebSocketUndertowServletResponse(channel);
                         if (request.getHeader(WebSocketConstants.DEFAULT_REQUEST_ID_KEY) != null) {
                             response.setHeader(WebSocketConstants.DEFAULT_RESPONSE_ID_KEY,
@@ -271,7 +263,7 @@
                         }
                         handleNormalRequest(request, response);
                     } catch (Exception ex) {
-                        ex.printStackTrace();
+                        LOG.log(Level.WARNING, "Failed to invoke service", ex);
                     }
                     
                 }
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/UndertowWebSocketDestination.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/UndertowWebSocketDestination.java
new file mode 100644
index 0000000..1d34169
--- /dev/null
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/UndertowWebSocketDestination.java
@@ -0,0 +1,232 @@
+/**
+ * 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.websocket.undertow;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executor;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.http.DestinationRegistry;
+import org.apache.cxf.transport.http_undertow.UndertowHTTPDestination;
+import org.apache.cxf.transport.http_undertow.UndertowHTTPHandler;
+import org.apache.cxf.transport.http_undertow.UndertowHTTPServerEngineFactory;
+import org.apache.cxf.transport.websocket.WebSocketConstants;
+import org.apache.cxf.transport.websocket.WebSocketDestinationService;
+import org.apache.cxf.workqueue.WorkQueueManager;
+import org.xnio.StreamConnection;
+
+import io.undertow.server.HttpServerExchange;
+import io.undertow.server.HttpUpgradeListener;
+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.Methods;
+import io.undertow.websockets.core.AbstractReceiveListener;
+import io.undertow.websockets.core.BufferedBinaryMessage;
+import io.undertow.websockets.core.BufferedTextMessage;
+import io.undertow.websockets.core.WebSocketChannel;
+import io.undertow.websockets.core.protocol.Handshake;
+import io.undertow.websockets.core.protocol.version07.Hybi07Handshake;
+import io.undertow.websockets.core.protocol.version08.Hybi08Handshake;
+import io.undertow.websockets.core.protocol.version13.Hybi13Handshake;
+import io.undertow.websockets.spi.AsyncWebSocketHttpServerExchange;
+
+/**
+ *
+ */
+public class UndertowWebSocketDestination extends UndertowHTTPDestination
+    implements WebSocketDestinationService {
+    private static final Logger LOG = LogUtils.getL7dLogger(UndertowWebSocketDestination.class);
+    private final Executor executor;
+        
+    public UndertowWebSocketDestination(Bus bus, DestinationRegistry registry, EndpointInfo ei,
+                                                  UndertowHTTPServerEngineFactory serverEngineFactory)
+                                                      throws IOException {
+        super(bus, registry, ei, serverEngineFactory);
+        executor = bus.getExtension(WorkQueueManager.class).getAutomaticWorkQueue();
+    }
+
+    @Override
+    public void invokeInternal(ServletConfig config, ServletContext context, HttpServletRequest req,
+                               HttpServletResponse resp) throws IOException {
+        super.invoke(config, context, req, resp);
+    }
+
+    private static String getNonWSAddress(EndpointInfo endpointInfo) {
+        String address = endpointInfo.getAddress();
+        if (address.startsWith("ws")) {
+            address = "http" + address.substring(2);
+        }
+        return address;
+    }
+
+    @Override
+    protected String getAddress(EndpointInfo endpointInfo) {
+        return getNonWSAddress(endpointInfo);
+    }
+
+    @Override
+    protected String getBasePath(String contextPath) throws IOException {
+        if (StringUtils.isEmpty(endpointInfo.getAddress())) {
+            return "";
+        }
+        return new URL(getAddress(endpointInfo)).getPath();
+    }
+
+    @Override
+    protected UndertowHTTPHandler createUndertowHTTPHandler(UndertowHTTPDestination jhd, boolean cmExact) {
+        return new AtmosphereUndertowWebSocketHandler(jhd, cmExact);
+    }
+
+
+
+    private class AtmosphereUndertowWebSocketHandler extends UndertowHTTPHandler {
+        private final Set<Handshake> handshakes;
+        private final Set<WebSocketChannel> peerConnections = Collections
+            .newSetFromMap(new ConcurrentHashMap<WebSocketChannel, Boolean>());
+
+        AtmosphereUndertowWebSocketHandler(UndertowHTTPDestination jhd, boolean cmExact) {
+            super(jhd, cmExact);
+            handshakes = new HashSet<>();
+            handshakes.add(new Hybi13Handshake());
+            handshakes.add(new Hybi08Handshake());
+            handshakes.add(new Hybi07Handshake());
+        }
+
+        @Override
+        public void handleRequest(HttpServerExchange undertowExchange) throws Exception {
+            if (undertowExchange.isInIoThread()) {
+                undertowExchange.dispatch(this);
+                return;
+            }
+            if (!undertowExchange.getRequestMethod().equals(Methods.GET)) {
+                // Only GET is supported to start the handshake
+                handleNormalRequest(undertowExchange);
+                return;
+            }
+            final AsyncWebSocketHttpServerExchange facade = new AsyncWebSocketHttpServerExchange(undertowExchange,
+                                                                                                 peerConnections);
+            Handshake handshaker = null;
+            for (Handshake method : handshakes) {
+                if (method.matches(facade)) {
+                    handshaker = method;
+                    break;
+                }
+            }
+
+            if (handshaker == null) {
+                handleNormalRequest(undertowExchange);
+            } else {
+                final Handshake selected = handshaker;
+                undertowExchange.upgradeChannel(new HttpUpgradeListener() {
+                    @Override
+                    public void handleUpgrade(StreamConnection streamConnection,
+                                              HttpServerExchange exchange) {
+                        try {
+                            
+                            WebSocketChannel channel = selected.createChannel(facade, streamConnection,
+                                                                              facade.getBufferPool());
+                            peerConnections.add(channel);
+                            channel.getReceiveSetter().set(new AbstractReceiveListener() {
+                                @Override
+                                protected void onFullTextMessage(WebSocketChannel channel,
+                                                                 BufferedTextMessage message) {
+                                    handleReceivedMessage(channel, message, exchange);
+
+                                }
+
+                                protected void onFullBinaryMessage(WebSocketChannel channel,
+                                                                   BufferedBinaryMessage message)
+                                                                       throws IOException {
+
+                                    handleReceivedMessage(channel, message, exchange);
+
+                                }
+                            });
+                            channel.resumeReceives();
+                            
+                        } catch (Exception e) {
+                            LOG.log(Level.WARNING, "Failed to invoke service", e);
+                        }
+                    }
+                });
+                handshaker.handshake(facade);
+            }
+
+        }
+
+        public void handleNormalRequest(HttpServerExchange undertowExchange) throws Exception {
+            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);
+            doService(request, response);
+        }
+
+        public void handleNormalRequest(HttpServletRequest request, HttpServletResponse response)
+            throws Exception {
+
+            doService(request, response);
+        }
+
+        private void handleReceivedMessage(WebSocketChannel channel, Object message, HttpServerExchange exchange) {
+            executor.execute(new Runnable() {
+
+                @Override
+                public void run() {
+                    try {
+                        HttpServletRequest request = new WebSocketUndertowServletRequest(channel, message, exchange);
+                        HttpServletResponse response = new WebSocketUndertowServletResponse(channel);
+                        if (request.getHeader(WebSocketConstants.DEFAULT_REQUEST_ID_KEY) != null) {
+                            response.setHeader(WebSocketConstants.DEFAULT_RESPONSE_ID_KEY,
+                                               request.getHeader(WebSocketConstants.DEFAULT_REQUEST_ID_KEY));
+                        }
+                        handleNormalRequest(request, response);
+                    } catch (Exception ex) {
+                        ex.printStackTrace();
+                    }
+                    
+                }
+                
+            });
+            
+        }
+    }
+}
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletRequest.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletRequest.java
index 0b1d884..27aa6d2 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletRequest.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/undertow/WebSocketUndertowServletRequest.java
@@ -57,6 +57,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.transport.websocket.WebSocketUtils;
 
+import io.undertow.server.HttpServerExchange;
 import io.undertow.websockets.core.BufferedBinaryMessage;
 import io.undertow.websockets.core.BufferedTextMessage;
 import io.undertow.websockets.core.WebSocketChannel;
@@ -71,8 +72,9 @@
     private Map<String, String> requestHeaders;
     private Map<String, Object> attributes;
     private InputStream in;
+    //private HttpServerExchange exchange;
 
-    public WebSocketUndertowServletRequest(WebSocketChannel channel, Object message)
+    public WebSocketUndertowServletRequest(WebSocketChannel channel, Object message, HttpServerExchange exchange)
         throws IOException {
         this.channel = channel;
         if (message instanceof BufferedBinaryMessage) {
@@ -469,7 +471,9 @@
 
     @Override
     public String getPathInfo() {
+        
         return null;
+      
     }
 
     @Override
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/JAXRSClientServerWebSocketNoAtmosphereTest.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/JAXRSClientServerWebSocketNoAtmosphereTest.java
new file mode 100644
index 0000000..fcb4b0b
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/JAXRSClientServerWebSocketNoAtmosphereTest.java
@@ -0,0 +1,51 @@
+/**
+ * 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.websocket;
+
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+
+
+/**
+ * JAXRSClientServerWebSocketTest without atmosphere
+ */
+public class JAXRSClientServerWebSocketNoAtmosphereTest extends JAXRSClientServerWebSocketTest {
+    private static final String PORT = BookServerWebSocket.PORT2;
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        System.setProperty("org.apache.cxf.transport.websocket.atmosphere.disabled", "true");
+        AbstractResourceInfo.clearAllMaps();
+        assertTrue("server did not launch correctly", launchServer(new BookServerWebSocket(PORT)));
+        createStaticBus();
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        System.clearProperty("org.apache.cxf.transport.websocket.atmosphere.disabled");
+    }
+
+    protected String getPort() {
+        return PORT;
+    }
+}
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/JAXRSClientServerWebSocketSpringNoAtmosphereTest.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/JAXRSClientServerWebSocketSpringNoAtmosphereTest.java
new file mode 100644
index 0000000..4f64875
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/JAXRSClientServerWebSocketSpringNoAtmosphereTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.websocket;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * JAXRSClientServerWebSocketSpringTest without atmosphere
+ */
+public class JAXRSClientServerWebSocketSpringNoAtmosphereTest extends JAXRSClientServerWebSocketSpringTest {
+    private static final String PORT = BookServerWebSocket.PORT2_SPRING;
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        System.setProperty("org.apache.cxf.transport.websocket.atmosphere.disabled", "true");
+        @SuppressWarnings({ "unused", "resource" })
+        ApplicationContext appctxt =
+            new ClassPathXmlApplicationContext(
+                JAXRSClientServerWebSocketSpringTest.class.getResource(
+                    "/jaxrs_websocket/beans-embedded2.xml").toString());
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        System.clearProperty("org.apache.cxf.transport.websocket.atmosphere.disabled");
+    }
+
+    protected String getPort() {
+        return PORT;
+    }
+}
diff --git a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/JAXRSClientServerWebSocketSpringTest.java b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/JAXRSClientServerWebSocketSpringTest.java
new file mode 100644
index 0000000..6689060
--- /dev/null
+++ b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/JAXRSClientServerWebSocketSpringTest.java
@@ -0,0 +1,48 @@
+/**
+ * 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.websocket;
+
+import org.junit.BeforeClass;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+/**
+ * JAXRSClientServerWebSocket test with jaxrs:server using the embedded undertow server.
+ */
+public class JAXRSClientServerWebSocketSpringTest extends JAXRSClientServerWebSocketTest {
+    private static final String PORT = BookServerWebSocket.PORT_SPRING;
+    @BeforeClass
+    public static void startServers() throws Exception {
+
+        @SuppressWarnings({ "unused", "resource" })
+        ApplicationContext appctxt =
+            new ClassPathXmlApplicationContext(
+                JAXRSClientServerWebSocketSpringTest.class.getResource(
+                    "/jaxrs_websocket/beans-embedded.xml").toString());
+
+    }
+
+    protected String getPort() {
+        return PORT;
+    }
+
+}
diff --git a/systests/transport-undertow/src/test/resources/jaxrs_websocket/WEB-INF/beans.xml b/systests/transport-undertow/src/test/resources/jaxrs_websocket/WEB-INF/beans.xml
new file mode 100644
index 0000000..2bdced4
--- /dev/null
+++ b/systests/transport-undertow/src/test/resources/jaxrs_websocket/WEB-INF/beans.xml
@@ -0,0 +1,54 @@
+<?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.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans" 
+   xmlns:http="http://cxf.apache.org/transports/http/configuration"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" 
+   xmlns:jaxrs="http://cxf.apache.org/jaxrs" 
+   xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+   xmlns:cxf="http://cxf.apache.org/core" 
+   xsi:schemaLocation="
+   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd 
+   http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd
+   http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+   http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+   http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+   http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
+    <import resource="classpath:META-INF/cxf/cxf.xml"/>
+    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+
+    <bean class="org.apache.cxf.systest.http_undertow.websocket.BookStoreWebSocket" id="serviceBean"/>
+
+    <jaxrs:server id="bookserviceWS" address="/websocket" transportId="http://cxf.apache.org/transports/websocket">
+        <jaxrs:serviceBeans>
+            <ref bean="serviceBean"/>
+        </jaxrs:serviceBeans>
+        <jaxrs:providers>
+            <bean class="org.apache.cxf.jaxrs.provider.StreamingResponseProvider"/>
+        </jaxrs:providers>
+    </jaxrs:server>
+    <jaxrs:server id="bookserviceHTTP" address="/http">
+        <jaxrs:serviceBeans>
+            <ref bean="serviceBean"/>
+        </jaxrs:serviceBeans>
+    </jaxrs:server>
+    
+</beans>
+<!-- END SNIPPET: beans -->
diff --git a/systests/transport-undertow/src/test/resources/jaxrs_websocket/WEB-INF/web.xml b/systests/transport-undertow/src/test/resources/jaxrs_websocket/WEB-INF/web.xml
new file mode 100644
index 0000000..76d7687
--- /dev/null
+++ b/systests/transport-undertow/src/test/resources/jaxrs_websocket/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<!--
+        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.
+-->
+<!-- START SNIPPET: webxml -->
+<web-app>
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>WEB-INF/beans.xml</param-value>
+    </context-param>
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+    <servlet>
+        <servlet-name>CXFServlet</servlet-name>
+        <display-name>CXF Servlet</display-name>
+        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>CXFServlet</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+</web-app>
+<!-- END SNIPPET: webxml -->
diff --git a/systests/transport-undertow/src/test/resources/jaxrs_websocket/beans-embedded.xml b/systests/transport-undertow/src/test/resources/jaxrs_websocket/beans-embedded.xml
new file mode 100644
index 0000000..d05429b
--- /dev/null
+++ b/systests/transport-undertow/src/test/resources/jaxrs_websocket/beans-embedded.xml
@@ -0,0 +1,48 @@
+<?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.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans" 
+   xmlns:http="http://cxf.apache.org/transports/http/configuration"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" 
+   xmlns:jaxrs="http://cxf.apache.org/jaxrs" 
+   xmlns:cxf="http://cxf.apache.org/core" 
+   xsi:schemaLocation="
+   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd 
+   http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd
+   http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+   http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+   http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
+    <import resource="classpath:META-INF/cxf/cxf.xml"/>
+    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+        
+    <bean class="org.apache.cxf.systest.http_undertow.websocket.BookStoreWebSocket" id="serviceBean"/>
+
+    <jaxrs:server id="bookservice" address="ws://localhost:${testutil.ports.org.apache.cxf.systest.http_undertow.websocket.BookServerWebSocket.2}/websocket">
+        <jaxrs:serviceBeans>
+            <ref bean="serviceBean"/>
+        </jaxrs:serviceBeans>
+        <jaxrs:providers>
+            <bean class="org.apache.cxf.jaxrs.provider.StreamingResponseProvider"/>
+        </jaxrs:providers>
+    </jaxrs:server>
+</beans>
+<!-- END SNIPPET: beans -->
diff --git a/systests/transport-undertow/src/test/resources/jaxrs_websocket/beans-embedded2.xml b/systests/transport-undertow/src/test/resources/jaxrs_websocket/beans-embedded2.xml
new file mode 100644
index 0000000..08d381f
--- /dev/null
+++ b/systests/transport-undertow/src/test/resources/jaxrs_websocket/beans-embedded2.xml
@@ -0,0 +1,48 @@
+<?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.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans" 
+   xmlns:http="http://cxf.apache.org/transports/http/configuration"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" 
+   xmlns:jaxrs="http://cxf.apache.org/jaxrs" 
+   xmlns:cxf="http://cxf.apache.org/core" 
+   xsi:schemaLocation="
+   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd 
+   http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd
+   http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+   http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+   http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
+    <import resource="classpath:META-INF/cxf/cxf.xml"/>
+    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+        
+    <bean class="org.apache.cxf.systest.http_undertow.websocket.BookStoreWebSocket" id="serviceBean"/>
+
+    <jaxrs:server id="bookservice" address="ws://localhost:${testutil.ports.org.apache.cxf.systest.http_undertow.websocket.BookServerWebSocket.5}/websocket">
+        <jaxrs:serviceBeans>
+            <ref bean="serviceBean"/>
+        </jaxrs:serviceBeans>
+        <jaxrs:providers>
+            <bean class="org.apache.cxf.jaxrs.provider.StreamingResponseProvider"/>
+        </jaxrs:providers>
+    </jaxrs:server>
+</beans>
+<!-- END SNIPPET: beans -->
diff --git a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
deleted file mode 100644
index 75129bf..0000000
--- a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
+++ /dev/null
@@ -1,52 +0,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.
- */
-package org.apache.cxf.systest.ws.rm;
-
-
-import org.apache.cxf.test.AbstractCXFSpringTest;
-import org.apache.cxf.testutil.common.TestUtil;
-
-import org.junit.Test;
-
-import org.springframework.context.support.GenericApplicationContext;
-
-
-
-//CXF-4875
-public class WSRMPolicyResolveTest extends AbstractCXFSpringTest {
-    public static final String PORT = TestUtil.getPortNumber(WSRMPolicyResolveTest.class);
-    /** {@inheritDoc}*/
-    @Override
-    protected void additionalSpringConfiguration(GenericApplicationContext context) throws Exception {
-    }
-
-    @Test
-    public void testHello() throws Exception {
-        BasicDocEndpoint port = getApplicationContext().getBean("TestClient",
-                  BasicDocEndpoint.class);
-        Object retObj = port.echo("Hello");
-        assertEquals("Hello", retObj);
-    }
-
-    /** {@inheritDoc}*/
-    @Override
-    protected String[] getConfigLocations() {
-        return new String[] {"classpath:/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml" };
-    }
-}
\ No newline at end of file
diff --git a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java
deleted file mode 100644
index 0157759..0000000
--- a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java
+++ /dev/null
@@ -1,148 +0,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.
- */
-
-package org.apache.cxf.systest.ws.policy;
-
-import java.io.Closeable;
-import java.util.logging.Logger;
-
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.greeter_control.Greeter;
-import org.apache.cxf.greeter_control.PingMeFault;
-import org.apache.cxf.greeter_control.ReliableGreeterService;
-import org.apache.cxf.systest.ws.util.ConnectionHelper;
-import org.apache.cxf.systest.ws.util.MessageFlow;
-import org.apache.cxf.testutil.common.TestUtil;
-import org.apache.cxf.testutil.recorders.MessageRecorder;
-import org.apache.cxf.ws.rm.RM10Constants;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Tests the use of the WS-Policy Framework to automatically engage WS-RM 1.0 in response to Policies defined for the
- * endpoint via an direct attachment to the wsdl.
- */
-public class RM10PolicyWsdlTest extends RMPolicyWsdlTestBase {
-
-    public static final String PORT = allocatePort(Server.class);
-
-    private static final Logger LOG = LogUtils.getLogger(RM10PolicyWsdlTest.class);
-
-    public static class Server extends ServerBase {
-
-        public static void main(String[] args) {
-            try {
-                Server s = new Server();
-                s.start();
-            } catch (Exception ex) {
-                ex.printStackTrace();
-                System.exit(-1);
-            } finally {
-                System.out.println("done!");
-            }
-        }
-
-        @Override
-        protected String getConfigPath() {
-            return "org/apache/cxf/systest/ws/policy/rm10wsdl_server.xml";
-        }
-    }
-
-
-    @BeforeClass
-    public static void startServers() throws Exception {
-        TestUtil.getNewPortNumber("decoupled");
-        assertTrue("server did not launch correctly", launchServer(Server.class, true));
-    }
-
-    @Test
-    public void testUsingRM() throws Exception {
-        setUpBus(PORT);
-        ReliableGreeterService gs = new ReliableGreeterService();
-        Greeter greeter = gs.getGreeterPort();
-        updateAddressPort(greeter, PORT);
-        LOG.fine("Created greeter client.");
-
-        ConnectionHelper.setKeepAliveConnection(greeter, true);
-
-
-        // two-way
-
-        assertEquals("CXF", greeter.greetMe("cxf"));
-
-        // oneway
-
-        greeter.greetMeOneWay("CXF");
-
-        // exception
-
-        try {
-            greeter.pingMe();
-        } catch (PingMeFault ex) {
-            fail("First invocation should have succeeded.");
-        }
-
-        try {
-            greeter.pingMe();
-            fail("Expected PingMeFault not thrown.");
-        } catch (PingMeFault ex) {
-            assertEquals(2, ex.getFaultInfo().getMajor());
-            assertEquals(1, ex.getFaultInfo().getMinor());
-        }
-
-        MessageRecorder mr = new MessageRecorder(outRecorder, inRecorder);
-        mr.awaitMessages(5, 4, 5000);
-//        mr.awaitMessages(5, 9, 5000);
-
-        MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(),
-                                         inRecorder.getInboundMessages(),
-                                         "http://schemas.xmlsoap.org/ws/2004/08/addressing",
-                                         "http://schemas.xmlsoap.org/ws/2005/02/rm");
-
-
-        mf.verifyMessages(5, true);
-        String[] expectedActions = new String[] {RM10Constants.INSTANCE.getCreateSequenceAction(),
-                                                 GREETME_ACTION,
-                                                 GREETMEONEWAY_ACTION,
-                                                 PINGME_ACTION,
-                                                 PINGME_ACTION};
-        mf.verifyActions(expectedActions, true);
-        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3", "4"}, true);
-        mf.verifyLastMessage(new boolean[] {false, false, false, false, false}, true);
-        mf.verifyAcknowledgements(new boolean[] {false, false, true, false, true}, true);
-
-        mf.verifyMessages(4, false);
-//        mf.verifyMessages(9, false);
-//        mf.verifyPartialResponses(5);
-//        mf.purgePartialResponses();
-
-        expectedActions = new String[] {
-            RM10Constants.INSTANCE.getCreateSequenceResponseAction(),
-            GREETME_RESPONSE_ACTION,
-            PINGME_RESPONSE_ACTION,
-            GREETER_FAULT_ACTION
-        };
-        mf.verifyActions(expectedActions, false);
-        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3"}, false);
-        mf.verifyLastMessage(new boolean[] {false, false, false, false}, false);
-        mf.verifyAcknowledgements(new boolean[] {false, true, true, true}, false);
-        ((Closeable)greeter).close();
-    }
-}
diff --git a/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java b/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
deleted file mode 100644
index 21d7dbb..0000000
--- a/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
+++ /dev/null
@@ -1,921 +0,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.
- */
-
-package org.apache.cxf.tools.wadlto.jaxrs;
-
-import java.io.File;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.List;
-
-import javax.validation.Valid;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.apache.cxf.helpers.FileUtils;
-import org.apache.cxf.jaxrs.ext.multipart.Multipart;
-import org.apache.cxf.tools.common.ProcessorTestBase;
-import org.apache.cxf.tools.common.ToolContext;
-import org.apache.cxf.tools.wadlto.WadlToolConstants;
-
-import org.junit.Test;
-
-public class JAXRSContainerTest extends ProcessorTestBase {
-
-    @Test
-    public void testNoTargetNamespace() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/resourceSchemaNoTargetNamespace.xml"));
-            context.put(WadlToolConstants.CFG_SCHEMA_PACKAGENAME, "=custom");
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-            List<File> files = FileUtils.getFilesRecurse(output, ".+\\.class" + "$");
-            assertEquals(3, files.size());
-            assertTrue(checkContains(files, "application" + ".Resource.class"));
-            assertTrue(checkContains(files, "custom" + ".TestCompositeObject.class"));
-            assertTrue(checkContains(files, "custom" + ".ObjectFactory.class"));
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenInterfaces() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstore.xml"));
-            context.put(WadlToolConstants.CFG_MEDIA_TYPE_MAP,
-                        "application/xml=javax.xml.transform.Source");
-            context.put(WadlToolConstants.CFG_MEDIA_TYPE_MAP,
-                        "multipart/form-data=org.apache.cxf.jaxrs.ext.multipart.MultipartBody");
-            context.put(WadlToolConstants.CFG_NO_VOID_FOR_EMPTY_RESPONSES, "true");
-            context.put(WadlToolConstants.CFG_GENERATE_RESPONSE_IF_HEADERS_SET, "true");
-            context.put(WadlToolConstants.CFG_GENERATE_RESPONSE_FOR_METHODS, "getName");
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", true, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 11, true);
-            verifyFiles("class", true, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 11, true);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testInheritParameters() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/test.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-            context.put(WadlToolConstants.CFG_SCHEMA_TYPE_MAP,
-                        "{http://www.w3.org/2001/XMLSchema}anyType="
-                        + "java.io.InputStream");
-            context.put(WadlToolConstants.CFG_INHERIT_PARAMS, "last");
-            context.put(WadlToolConstants.CFG_CREATE_JAVA_DOCS, "true");
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(1, files.size());
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenInterfacesMultipleInXmlReps() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstore.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-            context.put(WadlToolConstants.CFG_MULTIPLE_XML_REPS, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", true, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 11, true);
-            verifyFiles("class", true, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 11, true);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenInterfacesWithBinding() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstore.xml"));
-            context.put(WadlToolConstants.CFG_BINDING, getLocation("/wadl/jaxbBinding.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", true, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 11, true);
-            verifyFiles("class", true, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 11, true);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenWithImportedSchema() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstoreImport.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", false, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 9);
-            verifyFiles("class", false, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 9);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenWithImportedSchemaWithParentRefs() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/sub/bookstoreImport.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", false, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 9);
-            verifyFiles("class", false, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 9);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenWithMultipleInlinedSchemas() {
-        doTestInlinedSchemasWithImport("/wadl/bookstoreMultipleSchemas.xml");
-    }
-
-    @Test
-    public void testCodeGenWithInlinedSchemaAndImport() {
-        doTestInlinedSchemasWithImport("/wadl/bookstoreInlinedSchemaWithImport.xml");
-    }
-
-    private void doTestInlinedSchemasWithImport(String loc) {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation(loc));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(8, files.size());
-            assertTrue(checkContains(files, "org.apache.cxf.jaxrs.model.wadl" + ".BookStore.class"));
-            assertTrue(checkContains(files, "org.apache.cxf.jaxrs.model.wadl" + ".PATCH.class"));
-            assertTrue(checkContains(files, "superbooks" + ".Book.class"));
-            assertTrue(checkContains(files, "superbooks" + ".ObjectFactory.class"));
-            assertTrue(checkContains(files, "superbooks" + ".package-info.class"));
-            assertTrue(checkContains(files, "superchapters" + ".Chapter.class"));
-            assertTrue(checkContains(files, "superchapters" + ".ObjectFactory.class"));
-            assertTrue(checkContains(files, "superchapters" + ".package-info.class"));
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-    @Test
-    public void testResourceWithEPR() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/resourceWithEPR.xml"));
-            context.put(WadlToolConstants.CFG_SCHEMA_TYPE_MAP,
-                        "{http://www.w3.org/2001/XMLSchema}date=javax.xml.datatype.XMLGregorianCalendar");
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(4, files.size());
-            assertTrue(checkContains(files, "application" + ".BookstoreResource.class"));
-            assertTrue(checkContains(files, "superbooks" + ".Book.class"));
-            assertTrue(checkContains(files, "superbooks" + ".ObjectFactory.class"));
-            assertTrue(checkContains(files, "superbooks" + ".package-info.class"));
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testResourceWithEPRNoSchemaGen() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/resourceWithEPR.xml"));
-            context.put(WadlToolConstants.CFG_SCHEMA_TYPE_MAP,
-                "{http://www.w3.org/2005/08/addressing}EndpointReferenceType="
-                + "javax.xml.ws.wsaddressing.W3CEndpointReference");
-            context.put(WadlToolConstants.CFG_NO_ADDRESS_BINDING, "true");
-            context.put(WadlToolConstants.CFG_NO_TYPES, "true");
-
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(1, files.size());
-            assertTrue(checkContains(files, "application" + ".BookstoreResource.class"));
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testQueryMultipartParam() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/testQueryMultipartParam.wadl"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(2, files.size());
-            assertTrue(checkContains(files, "application.Test1.class"));
-            assertTrue(checkContains(files, "application.Test2.class"));
-
-            @SuppressWarnings("resource")
-            ClassLoader loader = new URLClassLoader(new URL[] {output.toURI().toURL() });
-
-            Class<?> test1 = loader.loadClass("application.Test1");
-            Method[] test1Methods = test1.getDeclaredMethods();
-            assertEquals(1, test1Methods.length);
-
-            assertEquals(2, test1Methods[0].getAnnotations().length);
-            assertNotNull(test1Methods[0].getAnnotation(PUT.class));
-            Consumes consumes1 = test1Methods[0].getAnnotation(Consumes.class);
-            assertNotNull(consumes1);
-            assertEquals(1, consumes1.value().length);
-            assertEquals("multipart/mixed", consumes1.value()[0]);
-
-            assertEquals("put", test1Methods[0].getName());
-            Class<?>[] paramTypes = test1Methods[0].getParameterTypes();
-            assertEquals(3, paramTypes.length);
-            Annotation[][] paramAnns = test1Methods[0].getParameterAnnotations();
-            assertEquals(Boolean.class, paramTypes[0]);
-            assertEquals(1, paramAnns[0].length);
-            QueryParam test1QueryParam1 = (QueryParam)paramAnns[0][0];
-            assertEquals("standalone", test1QueryParam1.value());
-            assertEquals(String.class, paramTypes[1]);
-            assertEquals(1, paramAnns[1].length);
-            Multipart test1MultipartParam1 = (Multipart)paramAnns[1][0];
-            assertEquals("action", test1MultipartParam1.value());
-            assertTrue(test1MultipartParam1.required());
-            assertEquals(String.class, paramTypes[2]);
-            assertEquals(1, paramAnns[2].length);
-            Multipart test1MultipartParam2 = (Multipart)paramAnns[2][0];
-            assertEquals("sources", test1MultipartParam2.value());
-            assertFalse(test1MultipartParam2.required());
-
-            Class<?> test2 = loader.loadClass("application.Test2");
-            Method[] test2Methods = test2.getDeclaredMethods();
-            assertEquals(1, test2Methods.length);
-
-            assertEquals(2, test2Methods[0].getAnnotations().length);
-            assertNotNull(test2Methods[0].getAnnotation(PUT.class));
-            Consumes consumes2 = test2Methods[0].getAnnotation(Consumes.class);
-            assertNotNull(consumes2);
-            assertEquals(1, consumes2.value().length);
-            assertEquals("application/json", consumes2.value()[0]);
-
-            assertEquals("put", test2Methods[0].getName());
-            Class<?>[] paramTypes2 = test2Methods[0].getParameterTypes();
-            assertEquals(2, paramTypes2.length);
-            Annotation[][] paramAnns2 = test2Methods[0].getParameterAnnotations();
-            assertEquals(boolean.class, paramTypes2[0]);
-            assertEquals(1, paramAnns2[0].length);
-            QueryParam test2QueryParam1 = (QueryParam)paramAnns2[0][0];
-            assertEquals("snapshot", test2QueryParam1.value());
-            assertEquals(String.class, paramTypes2[1]);
-            assertEquals(0, paramAnns2[1].length);
-
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testComplexPath() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/testComplexPath.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(1, files.size());
-            assertTrue(checkContains(files, "application.Resource.class"));
-            @SuppressWarnings("resource")
-            ClassLoader loader = new URLClassLoader(new URL[] {output.toURI().toURL() });
-
-            Class<?> test1 = loader.loadClass("application.Resource");
-            Method[] test1Methods = test1.getDeclaredMethods();
-            assertEquals(2, test1Methods.length);
-            assertEquals(2, test1Methods[0].getAnnotations().length);
-            if ("getGetaddmethod2".equals(test1Methods[0].getName())) {
-                Method tmp = test1Methods[0];
-                test1Methods[0] = test1Methods[1];
-                test1Methods[1] = tmp;
-            }
-            checkComplexPathMethod(test1Methods[0], "");
-            checkComplexPathMethod(test1Methods[1], "2");
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    private void checkComplexPathMethod(Method m, String suffix) {
-        assertNotNull(m.getAnnotation(GET.class));
-        Path path = m.getAnnotation(Path.class);
-        assertNotNull(path);
-        assertEquals("/get-add-method", path.value());
-        assertEquals("getGetaddmethod" + suffix, m.getName());
-        Class<?>[] paramTypes = m.getParameterTypes();
-        assertEquals(1, paramTypes.length);
-        Annotation[][] paramAnns = m.getParameterAnnotations();
-        assertEquals(String.class, paramTypes[0]);
-        assertEquals(1, paramAnns[0].length);
-        PathParam methodPathParam1 = (PathParam)paramAnns[0][0];
-        assertEquals("id", methodPathParam1.value());
-    }
-
-    @Test
-    public void testBeanValidation() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/resourceSameTargetNsSchemas.xml"));
-            context.put(WadlToolConstants.CFG_BEAN_VALIDATION, "true");
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(4, files.size());
-            assertTrue(checkContains(files, "application.Resource.class"));
-            @SuppressWarnings("resource")
-            ClassLoader loader = new URLClassLoader(new URL[] {output.toURI().toURL() });
-
-            Class<?> test1 = loader.loadClass("application.Resource");
-            Method[] test1Methods = test1.getDeclaredMethods();
-            assertEquals(1, test1Methods.length);
-            Method m = test1Methods[0];
-            assertEquals(5, m.getAnnotations().length);
-            assertNotNull(m.getAnnotation(Valid.class));
-            assertNotNull(m.getAnnotation(Path.class));
-            assertNotNull(m.getAnnotation(Consumes.class));
-            assertNotNull(m.getAnnotation(Produces.class));
-            assertNotNull(m.getAnnotation(PUT.class));
-
-            Class<?>[] paramTypes = m.getParameterTypes();
-            assertEquals(2, paramTypes.length);
-            Annotation[][] paramAnns = m.getParameterAnnotations();
-            assertEquals(String.class, paramTypes[0]);
-            assertEquals(1, paramAnns[0].length);
-            PathParam methodPathParam1 = (PathParam)paramAnns[0][0];
-            assertEquals("id", methodPathParam1.value());
-
-            assertEquals(1, paramAnns[1].length);
-            assertTrue(paramAnns[1][0] instanceof Valid);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenWithImportedSchemaAndResourceSet() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstoreResourceRef.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", false, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 9);
-            verifyFiles("class", false, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 9);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenWithImportedSchemaAndBinding() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstoreImport.xml"));
-            context.put(WadlToolConstants.CFG_BINDING, getLocation("/wadl/jaxbBindingWithSchemaLoc.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", false, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 9);
-            verifyFiles("class", false, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 9);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenWithImportedSchemaAndCatalog() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstoreImportCatalog.xml"));
-            context.put(WadlToolConstants.CFG_CATALOG, getLocation("/wadl/jax-rs-catalog.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", false, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 9);
-            verifyFiles("class", false, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 9);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenNoIds() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/singleResource.xml"));
-            context.put(WadlToolConstants.CFG_RESOURCENAME, "CustomResource");
-            context.put(WadlToolConstants.CFG_GENERATE_ENUMS, "true");
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> javaFiles = FileUtils.getFilesRecurse(output, ".+\\." + "java" + "$");
-            assertEquals(2, javaFiles.size());
-            assertTrue(checkContains(javaFiles, "application.CustomResource.java"));
-            assertTrue(checkContains(javaFiles, "application.Theid.java"));
-
-            List<File> classFiles = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(2, classFiles.size());
-            assertTrue(checkContains(classFiles, "application.CustomResource.class"));
-            assertTrue(checkContains(classFiles, "application.Theid.class"));
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenNoIds2() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/multipleResources.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> javaFiles = FileUtils.getFilesRecurse(output, ".+\\." + "java" + "$");
-            assertEquals(2, javaFiles.size());
-            assertTrue(checkContains(javaFiles, "application.BookstoreResource.java"));
-            assertTrue(checkContains(javaFiles, "application.BooksResource.java"));
-            List<File> classFiles = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(2, classFiles.size());
-            assertTrue(checkContains(classFiles, "application.BookstoreResource.class"));
-            assertTrue(checkContains(classFiles, "application.BooksResource.class"));
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenNoIds3() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/resourcesNoId.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-            context.put(WadlToolConstants.CFG_INHERIT_PARAMS, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> javaFiles = FileUtils.getFilesRecurse(output, ".+\\." + "java" + "$");
-            assertEquals(1, javaFiles.size());
-            assertTrue(checkContains(javaFiles, "application.TestRsResource.java"));
-            List<File> classFiles = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(1, classFiles.size());
-            assertTrue(checkContains(classFiles, "application.TestRsResource.class"));
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeTwoSchemasSameTargetNs() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/resourceSameTargetNsSchemas.xml"));
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            List<File> javaFiles = FileUtils.getFilesRecurse(output, ".+\\." + "java" + "$");
-            assertEquals(4, javaFiles.size());
-            assertTrue(checkContains(javaFiles, "application.Resource.java"));
-            assertTrue(checkContains(javaFiles, "com.example.test.ObjectFactory.java"));
-            assertTrue(checkContains(javaFiles, "com.example.test.package-info.java"));
-            assertTrue(checkContains(javaFiles, "com.example.test.TestCompositeObject.java"));
-            List<File> classFiles = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(4, classFiles.size());
-            assertTrue(checkContains(classFiles, "application.Resource.class"));
-            assertTrue(checkContains(classFiles, "com.example.test.ObjectFactory.class"));
-            assertTrue(checkContains(classFiles, "com.example.test.package-info.class"));
-            assertTrue(checkContains(classFiles, "com.example.test.TestCompositeObject.class"));
-
-
-            assertNotNull(output.list());
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-    @Test
-    public void testCodeGenWithResourceSet() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/singleResourceWithRefs.xml"));
-            context.put(WadlToolConstants.CFG_RESOURCENAME, "CustomResource");
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            List<File> javaFiles = FileUtils.getFilesRecurse(output, ".+\\." + "java" + "$");
-            assertEquals(1, javaFiles.size());
-            assertTrue(checkContains(javaFiles, "application.CustomResource.java"));
-
-            List<File> classFiles = FileUtils.getFilesRecurse(output, ".+\\." + "class" + "$");
-            assertEquals(1, classFiles.size());
-            assertTrue(checkContains(classFiles, "application.CustomResource.class"));
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenInterfacesCustomPackage() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstore.xml"));
-            context.put(WadlToolConstants.CFG_PACKAGENAME, "custom.books");
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", true, false, "superbooks", "custom.books", 11, true);
-            verifyFiles("class", true, false, "superbooks", "custom.books", 11, true);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenInterfacesCustomPackageForResourcesAndSchemas() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstore.xml"));
-            context.put(WadlToolConstants.CFG_PACKAGENAME, "custom.books.service");
-            context.put(WadlToolConstants.CFG_SCHEMA_PACKAGENAME, "http://superbooks=custom.books.schema");
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", true, false, "custom.books.schema", "custom.books.service", 11, true);
-            verifyFiles("class", true, false, "custom.books.schema", "custom.books.service", 11, true);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    @Test
-    public void testCodeGenImpl() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstore.xml"));
-            context.put(WadlToolConstants.CFG_IMPL, "true");
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", true, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 11, true);
-            verifyFiles("class", true, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 11, true);
-        } catch (Exception e) {
-            fail();
-            e.printStackTrace();
-        }
-    }
-
-    @Test
-    public void testCodeGenInterfaceAndImpl() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstore.xml"));
-            context.put(WadlToolConstants.CFG_INTERFACE, "true");
-            context.put(WadlToolConstants.CFG_IMPL, "true");
-            context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyFiles("java", true, true, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 14, true);
-            verifyFiles("class", true, true, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 14, true);
-        } catch (Exception e) {
-            fail();
-            e.printStackTrace();
-        }
-    }
-
-    @Test
-    public void testCodeGenTypesOnly() {
-        try {
-            JAXRSContainer container = new JAXRSContainer(null);
-
-            ToolContext context = new ToolContext();
-            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
-            context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstore.xml"));
-            context.put(WadlToolConstants.CFG_TYPES, "true");
-
-            container.setContext(context);
-            container.execute();
-
-            assertNotNull(output.list());
-
-            verifyTypes("superbooks", "java", true);
-
-        } catch (Exception e) {
-            fail();
-            e.printStackTrace();
-        }
-    }
-
-    private void verifyFiles(String ext, boolean subresourceExpected, boolean interfacesAndImpl,
-                             String schemaPackage, String resourcePackage, int expectedCount) {
-        verifyFiles(ext, subresourceExpected, interfacesAndImpl, schemaPackage, resourcePackage,
-                    expectedCount, false);
-    }
-
-    private void verifyFiles(String ext, boolean subresourceExpected, boolean interfacesAndImpl,
-                             String schemaPackage, String resourcePackage, int expectedCount,
-                             boolean enumTypeExpected) {
-        List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + ext + "$");
-        int offset = enumTypeExpected ? 1 : 2;
-        int size = interfacesAndImpl ? expectedCount : expectedCount - offset;
-        if (!subresourceExpected) {
-            size--;
-        }
-        assertEquals(size, files.size());
-        doVerifyTypes(files, schemaPackage, ext);
-        if (subresourceExpected) {
-            assertTrue(checkContains(files, resourcePackage + ".FormInterface." + ext));
-            assertTrue(checkContains(files, resourcePackage + ".FormInterface2." + ext));
-        }
-        assertTrue(checkContains(files, resourcePackage + ".BookStore." + ext));
-        if (interfacesAndImpl) {
-            if (subresourceExpected) {
-                assertTrue(checkContains(files, resourcePackage + ".FormInterfaceImpl." + ext));
-                assertTrue(checkContains(files, resourcePackage + ".FormInterface2Impl." + ext));
-            }
-            assertTrue(checkContains(files, resourcePackage + ".BookStoreImpl." + ext));
-        }
-    }
-
-    private void verifyTypes(String schemaPackage, String ext, boolean enumTypeExpected) {
-        List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + ext + "$");
-        assertEquals(enumTypeExpected ? 6 : 5, files.size());
-        doVerifyTypes(files, schemaPackage, ext);
-    }
-
-    private void doVerifyTypes(List<File> files, String schemaPackage, String ext) {
-        assertTrue(checkContains(files, schemaPackage + ".Book." + ext));
-        assertTrue(checkContains(files, schemaPackage + ".TheBook2." + ext));
-        assertTrue(checkContains(files, schemaPackage + ".Chapter." + ext));
-        assertTrue(checkContains(files, schemaPackage + ".ObjectFactory." + ext));
-        assertTrue(checkContains(files, schemaPackage + ".package-info." + ext));
-    }
-
-    private boolean checkContains(List<File> clsFiles, String name) {
-        for (File f : clsFiles) {
-            if (f.getAbsolutePath().replace(File.separatorChar, '.').endsWith(name)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    protected String getLocation(String wsdlFile) throws URISyntaxException {
-        return getClass().getResource(wsdlFile).toString();
-    }
-}