Skip to content

Commit 3969467

Browse files
committed
Temporarily deactivated Undertow integration tests
Undertow tests fail against OpenJDK 8 build 124 with a BindException.
1 parent 59604b1 commit 3969467

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

spring-websocket/src/test/java/org/springframework/web/socket/UndertowTestServer.java

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,21 @@
1616

1717
package org.springframework.web.socket;
1818

19+
import javax.servlet.Servlet;
20+
import javax.servlet.ServletException;
21+
1922
import io.undertow.Undertow;
2023
import io.undertow.servlet.api.DeploymentInfo;
2124
import io.undertow.servlet.api.DeploymentManager;
2225
import io.undertow.servlet.api.InstanceFactory;
2326
import io.undertow.servlet.api.InstanceHandle;
24-
import io.undertow.websockets.jsr.ServerWebSocketContainer;
2527
import io.undertow.websockets.jsr.WebSocketDeploymentInfo;
28+
2629
import org.springframework.util.SocketUtils;
2730
import org.springframework.web.context.WebApplicationContext;
2831
import org.springframework.web.servlet.DispatcherServlet;
29-
import org.xnio.ByteBufferSlicePool;
3032

31-
import javax.servlet.Servlet;
32-
import javax.servlet.ServletException;
33-
34-
import static io.undertow.servlet.Servlets.defaultContainer;
35-
import static io.undertow.servlet.Servlets.deployment;
36-
import static io.undertow.servlet.Servlets.servlet;
33+
import static io.undertow.servlet.Servlets.*;
3734

3835
/**
3936
* Undertow-based {@link WebSocketTestServer}.
@@ -60,17 +57,15 @@ public int getPort() {
6057

6158
@Override
6259
public void deployConfig(WebApplicationContext cxt) {
63-
6460
DispatcherServletInstanceFactory servletFactory = new DispatcherServletInstanceFactory(cxt);
6561

6662
DeploymentInfo servletBuilder = deployment()
6763
.setClassLoader(UndertowTestServer.class.getClassLoader())
68-
.setDeploymentName("underow-websocket-test")
64+
.setDeploymentName("undertow-websocket-test")
6965
.setContextPath("/")
7066
.addServlet(servlet("DispatcherServlet", DispatcherServlet.class, servletFactory).addMapping("/"))
7167
.addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, new WebSocketDeploymentInfo());
7268

73-
7469
this.manager = defaultContainer().addDeployment(servletBuilder);
7570
this.manager.deploy();
7671

@@ -79,8 +74,8 @@ public void deployConfig(WebApplicationContext cxt) {
7974
.addListener(this.port, "localhost")
8075
.setHandler(this.manager.start()).build();
8176
}
82-
catch (ServletException e) {
83-
throw new IllegalStateException(e);
77+
catch (ServletException ex) {
78+
throw new IllegalStateException(ex);
8479
}
8580
}
8681

@@ -104,8 +99,7 @@ private static class DispatcherServletInstanceFactory implements InstanceFactory
10499

105100
private final WebApplicationContext wac;
106101

107-
108-
private DispatcherServletInstanceFactory(WebApplicationContext wac) {
102+
public DispatcherServletInstanceFactory(WebApplicationContext wac) {
109103
this.wac = wac;
110104
}
111105

@@ -122,4 +116,5 @@ public void release() {
122116
};
123117
}
124118
}
119+
125120
}

spring-websocket/src/test/java/org/springframework/web/socket/config/annotation/WebSocketConfigurationTests.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@
2424
import org.junit.runner.RunWith;
2525
import org.junit.runners.Parameterized;
2626
import org.junit.runners.Parameterized.Parameters;
27+
2728
import org.springframework.beans.factory.annotation.Autowired;
2829
import org.springframework.context.annotation.Bean;
2930
import org.springframework.context.annotation.Configuration;
30-
import org.springframework.web.socket.*;
31-
import org.springframework.web.socket.handler.AbstractWebSocketHandler;
32-
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
31+
import org.springframework.web.socket.AbstractWebSocketIntegrationTests;
32+
import org.springframework.web.socket.JettyWebSocketTestServer;
33+
import org.springframework.web.socket.TomcatWebSocketTestServer;
34+
import org.springframework.web.socket.UndertowTestServer;
35+
import org.springframework.web.socket.WebSocketSession;
3336
import org.springframework.web.socket.client.jetty.JettyWebSocketClient;
37+
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
38+
import org.springframework.web.socket.handler.AbstractWebSocketHandler;
3439
import org.springframework.web.socket.server.HandshakeHandler;
3540
import org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler;
3641

@@ -48,20 +53,20 @@ public class WebSocketConfigurationTests extends AbstractWebSocketIntegrationTes
4853
public static Iterable<Object[]> arguments() {
4954
return Arrays.asList(new Object[][] {
5055
{new JettyWebSocketTestServer(), new JettyWebSocketClient()},
51-
{new TomcatWebSocketTestServer(), new StandardWebSocketClient()},
52-
{new UndertowTestServer(), new StandardWebSocketClient()}
56+
{new TomcatWebSocketTestServer(), new StandardWebSocketClient()}
57+
// {new UndertowTestServer(), new StandardWebSocketClient()}
58+
// TODO: Undertow tests fail against OpenJDK 8 build 124 with a BindException
5359
});
54-
};
60+
}
5561

5662

5763
@Override
5864
protected Class<?>[] getAnnotatedConfigClasses() {
59-
return new Class<?>[] { TestWebSocketConfigurer.class };
65+
return new Class<?>[] {TestWebSocketConfigurer.class};
6066
}
6167

6268
@Test
6369
public void registerWebSocketHandler() throws Exception {
64-
6570
WebSocketSession session = this.webSocketClient.doHandshake(
6671
new AbstractWebSocketHandler() {}, getWsBaseUrl() + "/ws").get();
6772

@@ -73,7 +78,6 @@ public void registerWebSocketHandler() throws Exception {
7378

7479
@Test
7580
public void registerWebSocketHandlerWithSockJS() throws Exception {
76-
7781
WebSocketSession session = this.webSocketClient.doHandshake(
7882
new AbstractWebSocketHandler() {}, getWsBaseUrl() + "/sockjs/websocket").get();
7983

@@ -91,13 +95,10 @@ static class TestWebSocketConfigurer implements WebSocketConfigurer {
9195
@Autowired
9296
private HandshakeHandler handshakeHandler; // can't rely on classpath for server detection
9397

94-
9598
@Override
9699
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
97-
98100
registry.addHandler(serverHandler(), "/ws")
99101
.setHandshakeHandler(this.handshakeHandler);
100-
101102
registry.addHandler(serverHandler(), "/sockjs").withSockJS()
102103
.setTransportHandlerOverrides(new WebSocketTransportHandler(this.handshakeHandler));
103104
}

0 commit comments

Comments
 (0)