Temporarily deactivated Undertow integration tests

Undertow tests fail against OpenJDK 8 build 124 with a BindException.
This commit is contained in:
Juergen Hoeller
2014-01-22 11:34:27 +01:00
parent 59604b1cd5
commit 3969467851
2 changed files with 23 additions and 27 deletions

View File

@@ -16,24 +16,21 @@
package org.springframework.web.socket;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import io.undertow.Undertow;
import io.undertow.servlet.api.DeploymentInfo;
import io.undertow.servlet.api.DeploymentManager;
import io.undertow.servlet.api.InstanceFactory;
import io.undertow.servlet.api.InstanceHandle;
import io.undertow.websockets.jsr.ServerWebSocketContainer;
import io.undertow.websockets.jsr.WebSocketDeploymentInfo;
import org.springframework.util.SocketUtils;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
import org.xnio.ByteBufferSlicePool;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import static io.undertow.servlet.Servlets.defaultContainer;
import static io.undertow.servlet.Servlets.deployment;
import static io.undertow.servlet.Servlets.servlet;
import static io.undertow.servlet.Servlets.*;
/**
* Undertow-based {@link WebSocketTestServer}.
@@ -60,17 +57,15 @@ public class UndertowTestServer implements WebSocketTestServer {
@Override
public void deployConfig(WebApplicationContext cxt) {
DispatcherServletInstanceFactory servletFactory = new DispatcherServletInstanceFactory(cxt);
DeploymentInfo servletBuilder = deployment()
.setClassLoader(UndertowTestServer.class.getClassLoader())
.setDeploymentName("underow-websocket-test")
.setDeploymentName("undertow-websocket-test")
.setContextPath("/")
.addServlet(servlet("DispatcherServlet", DispatcherServlet.class, servletFactory).addMapping("/"))
.addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, new WebSocketDeploymentInfo());
this.manager = defaultContainer().addDeployment(servletBuilder);
this.manager.deploy();
@@ -79,8 +74,8 @@ public class UndertowTestServer implements WebSocketTestServer {
.addListener(this.port, "localhost")
.setHandler(this.manager.start()).build();
}
catch (ServletException e) {
throw new IllegalStateException(e);
catch (ServletException ex) {
throw new IllegalStateException(ex);
}
}
@@ -104,8 +99,7 @@ public class UndertowTestServer implements WebSocketTestServer {
private final WebApplicationContext wac;
private DispatcherServletInstanceFactory(WebApplicationContext wac) {
public DispatcherServletInstanceFactory(WebApplicationContext wac) {
this.wac = wac;
}
@@ -122,4 +116,5 @@ public class UndertowTestServer implements WebSocketTestServer {
};
}
}
}

View File

@@ -24,13 +24,18 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.*;
import org.springframework.web.socket.handler.AbstractWebSocketHandler;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.AbstractWebSocketIntegrationTests;
import org.springframework.web.socket.JettyWebSocketTestServer;
import org.springframework.web.socket.TomcatWebSocketTestServer;
import org.springframework.web.socket.UndertowTestServer;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.client.jetty.JettyWebSocketClient;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.handler.AbstractWebSocketHandler;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler;
@@ -48,20 +53,20 @@ public class WebSocketConfigurationTests extends AbstractWebSocketIntegrationTes
public static Iterable<Object[]> arguments() {
return Arrays.asList(new Object[][] {
{new JettyWebSocketTestServer(), new JettyWebSocketClient()},
{new TomcatWebSocketTestServer(), new StandardWebSocketClient()},
{new UndertowTestServer(), new StandardWebSocketClient()}
{new TomcatWebSocketTestServer(), new StandardWebSocketClient()}
// {new UndertowTestServer(), new StandardWebSocketClient()}
// TODO: Undertow tests fail against OpenJDK 8 build 124 with a BindException
});
};
}
@Override
protected Class<?>[] getAnnotatedConfigClasses() {
return new Class<?>[] { TestWebSocketConfigurer.class };
return new Class<?>[] {TestWebSocketConfigurer.class};
}
@Test
public void registerWebSocketHandler() throws Exception {
WebSocketSession session = this.webSocketClient.doHandshake(
new AbstractWebSocketHandler() {}, getWsBaseUrl() + "/ws").get();
@@ -73,7 +78,6 @@ public class WebSocketConfigurationTests extends AbstractWebSocketIntegrationTes
@Test
public void registerWebSocketHandlerWithSockJS() throws Exception {
WebSocketSession session = this.webSocketClient.doHandshake(
new AbstractWebSocketHandler() {}, getWsBaseUrl() + "/sockjs/websocket").get();
@@ -91,13 +95,10 @@ public class WebSocketConfigurationTests extends AbstractWebSocketIntegrationTes
@Autowired
private HandshakeHandler handshakeHandler; // can't rely on classpath for server detection
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(serverHandler(), "/ws")
.setHandshakeHandler(this.handshakeHandler);
registry.addHandler(serverHandler(), "/sockjs").withSockJS()
.setTransportHandlerOverrides(new WebSocketTransportHandler(this.handshakeHandler));
}