Upgrade to Undertow 1.4 CR3 (and Jackson 2.8 GA)
This commit also renames WebSocketIntegrationTests to WebSocketHandshakeTests. Issue: SPR-14328
This commit is contained in:
		
							parent
							
								
									acdb43f470
								
							
						
					
					
						commit
						12d373659a
					
				
							
								
								
									
										14
									
								
								build.gradle
								
								
								
								
							
							
						
						
									
										14
									
								
								build.gradle
								
								
								
								
							| 
						 | 
					@ -49,7 +49,7 @@ configure(allprojects) { project ->
 | 
				
			||||||
	ext.hsqldbVersion        = "2.3.4"
 | 
						ext.hsqldbVersion        = "2.3.4"
 | 
				
			||||||
	ext.httpasyncVersion     = "4.1.2"
 | 
						ext.httpasyncVersion     = "4.1.2"
 | 
				
			||||||
	ext.httpclientVersion    = "4.5.2"
 | 
						ext.httpclientVersion    = "4.5.2"
 | 
				
			||||||
	ext.jackson2Version      = "2.8.0.rc2"
 | 
						ext.jackson2Version      = "2.8.0"
 | 
				
			||||||
	ext.jasperreportsVersion = "6.2.1"  // our tests fail with JR-internal NPEs against 6.2.2 and higher
 | 
						ext.jasperreportsVersion = "6.2.1"  // our tests fail with JR-internal NPEs against 6.2.2 and higher
 | 
				
			||||||
	ext.javamailVersion      = "1.5.5"
 | 
						ext.javamailVersion      = "1.5.5"
 | 
				
			||||||
	ext.jettyVersion         = "9.3.10.v20160621"
 | 
						ext.jettyVersion         = "9.3.10.v20160621"
 | 
				
			||||||
| 
						 | 
					@ -58,7 +58,7 @@ configure(allprojects) { project ->
 | 
				
			||||||
	ext.junitVersion         = "4.12"
 | 
						ext.junitVersion         = "4.12"
 | 
				
			||||||
	ext.junitJupiterVersion  = '5.0.0-SNAPSHOT'
 | 
						ext.junitJupiterVersion  = '5.0.0-SNAPSHOT'
 | 
				
			||||||
	ext.junitPlatformVersion = '1.0.0-SNAPSHOT'
 | 
						ext.junitPlatformVersion = '1.0.0-SNAPSHOT'
 | 
				
			||||||
	ext.log4JVersion         = '2.6.1'
 | 
						ext.log4jVersion         = '2.6.1'
 | 
				
			||||||
	ext.nettyVersion         = "4.1.1.Final"
 | 
						ext.nettyVersion         = "4.1.1.Final"
 | 
				
			||||||
	ext.okhttpVersion        = "2.7.5"
 | 
						ext.okhttpVersion        = "2.7.5"
 | 
				
			||||||
	ext.okhttp3Version       = "3.3.1"
 | 
						ext.okhttp3Version       = "3.3.1"
 | 
				
			||||||
| 
						 | 
					@ -72,7 +72,7 @@ configure(allprojects) { project ->
 | 
				
			||||||
	ext.tiles3Version        = "3.0.5"
 | 
						ext.tiles3Version        = "3.0.5"
 | 
				
			||||||
	ext.tomcatVersion        = "8.5.3"
 | 
						ext.tomcatVersion        = "8.5.3"
 | 
				
			||||||
	ext.tyrusVersion         = "1.13"
 | 
						ext.tyrusVersion         = "1.13"
 | 
				
			||||||
	ext.undertowVersion      = "1.4.0.CR2"
 | 
						ext.undertowVersion      = "1.4.0.CR3"
 | 
				
			||||||
	ext.xmlunitVersion       = "1.6"
 | 
						ext.xmlunitVersion       = "1.6"
 | 
				
			||||||
	ext.xstreamVersion       = "1.4.9"
 | 
						ext.xstreamVersion       = "1.4.9"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -139,9 +139,8 @@ configure(allprojects) { project ->
 | 
				
			||||||
			exclude group:'org.hamcrest', module:'hamcrest-core'
 | 
								exclude group:'org.hamcrest', module:'hamcrest-core'
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		testCompile("org.hamcrest:hamcrest-all:${hamcrestVersion}")
 | 
							testCompile("org.hamcrest:hamcrest-all:${hamcrestVersion}")
 | 
				
			||||||
 | 
							testRuntime("org.apache.logging.log4j:log4j-core:${log4jVersion}")
 | 
				
			||||||
		testRuntime("org.apache.logging.log4j:log4j-core:${log4JVersion}")
 | 
							testRuntime("org.apache.logging.log4j:log4j-jcl:${log4jVersion}")
 | 
				
			||||||
		testRuntime("org.apache.logging.log4j:log4j-jcl:${log4JVersion}")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		sniffer("org.codehaus.mojo:animal-sniffer-ant-tasks:${snifferVersion}")
 | 
							sniffer("org.codehaus.mojo:animal-sniffer-ant-tasks:${snifferVersion}")
 | 
				
			||||||
		javaApiSignature("org.codehaus.mojo.signature:java18:1.0@signature")
 | 
							javaApiSignature("org.codehaus.mojo.signature:java18:1.0@signature")
 | 
				
			||||||
| 
						 | 
					@ -840,12 +839,15 @@ project("spring-websocket") {
 | 
				
			||||||
		optional("io.undertow:undertow-websockets-jsr:${undertowVersion}") {
 | 
							optional("io.undertow:undertow-websockets-jsr:${undertowVersion}") {
 | 
				
			||||||
			exclude group: "org.jboss.spec.javax.websocket", module: "jboss-websocket-api_1.1_spec"
 | 
								exclude group: "org.jboss.spec.javax.websocket", module: "jboss-websocket-api_1.1_spec"
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							optional("org.jboss.xnio:xnio-api:3.3.7.Final")
 | 
				
			||||||
		optional("com.fasterxml.jackson.core:jackson-databind:${jackson2Version}")
 | 
							optional("com.fasterxml.jackson.core:jackson-databind:${jackson2Version}")
 | 
				
			||||||
		testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
 | 
							testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
 | 
				
			||||||
		testCompile("org.apache.tomcat.embed:tomcat-embed-websocket:${tomcatVersion}")
 | 
							testCompile("org.apache.tomcat.embed:tomcat-embed-websocket:${tomcatVersion}")
 | 
				
			||||||
		testCompile("io.projectreactor:reactor-net:${reactorVersion}")
 | 
							testCompile("io.projectreactor:reactor-net:${reactorVersion}")
 | 
				
			||||||
		testCompile("io.netty:netty-all:${nettyVersion}")
 | 
							testCompile("io.netty:netty-all:${nettyVersion}")
 | 
				
			||||||
		testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
 | 
							testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
 | 
				
			||||||
 | 
							testRuntime("org.jboss.xnio:xnio-nio:3.3.7.Final")
 | 
				
			||||||
 | 
							testRuntime("org.jboss.logging:jboss-logging:3.3.0.Final")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,7 +64,7 @@ import org.springframework.web.socket.sockjs.frame.SockJsFrame;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * An XHR transport based on Undertow's {@link io.undertow.client.UndertowClient}.
 | 
					 * An XHR transport based on Undertow's {@link io.undertow.client.UndertowClient}.
 | 
				
			||||||
 * Requires Undertow 1.3 or higher, as of Spring Framework 5.0.
 | 
					 * Requires Undertow 1.3 or 1.4, including XNIO, as of Spring Framework 5.0.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * <p>When used for testing purposes (e.g. load testing) or for specific use cases
 | 
					 * <p>When used for testing purposes (e.g. load testing) or for specific use cases
 | 
				
			||||||
 * (like HTTPS configuration), a custom OptionMap should be provided:
 | 
					 * (like HTTPS configuration), a custom OptionMap should be provided:
 | 
				
			||||||
| 
						 | 
					@ -461,7 +461,7 @@ public class UndertowXhrTransport extends AbstractXhrTransport {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public void onFailure(Throwable failure) {
 | 
							public void onFailure(Throwable failure) {
 | 
				
			||||||
			IoUtils.safeClose(this.connection);
 | 
								IoUtils.safeClose(this.connection);
 | 
				
			||||||
			if (connectFuture.setException(failure)) {
 | 
								if (this.connectFuture.setException(failure)) {
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (this.session.isDisconnected()) {
 | 
								if (this.session.isDisconnected()) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,6 @@ import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.apache.commons.logging.Log;
 | 
					import org.apache.commons.logging.Log;
 | 
				
			||||||
import org.apache.commons.logging.LogFactory;
 | 
					import org.apache.commons.logging.LogFactory;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.junit.After;
 | 
					import org.junit.After;
 | 
				
			||||||
import org.junit.Before;
 | 
					import org.junit.Before;
 | 
				
			||||||
import org.junit.Rule;
 | 
					import org.junit.Rule;
 | 
				
			||||||
| 
						 | 
					@ -48,8 +47,6 @@ import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public abstract class AbstractWebSocketIntegrationTests {
 | 
					public abstract class AbstractWebSocketIntegrationTests {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected Log logger = LogFactory.getLog(getClass());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private static Map<Class<?>, Class<?>> upgradeStrategyConfigTypes = new HashMap<>();
 | 
						private static Map<Class<?>, Class<?>> upgradeStrategyConfigTypes = new HashMap<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static {
 | 
						static {
 | 
				
			||||||
| 
						 | 
					@ -58,6 +55,7 @@ public abstract class AbstractWebSocketIntegrationTests {
 | 
				
			||||||
		upgradeStrategyConfigTypes.put(UndertowTestServer.class, UndertowUpgradeStrategyConfig.class);
 | 
							upgradeStrategyConfigTypes.put(UndertowTestServer.class, UndertowUpgradeStrategyConfig.class);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Rule
 | 
						@Rule
 | 
				
			||||||
	public final TestName testName = new TestName();
 | 
						public final TestName testName = new TestName();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,12 +65,13 @@ public abstract class AbstractWebSocketIntegrationTests {
 | 
				
			||||||
	@Parameter(1)
 | 
						@Parameter(1)
 | 
				
			||||||
	public WebSocketClient webSocketClient;
 | 
						public WebSocketClient webSocketClient;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						protected final Log logger = LogFactory.getLog(getClass());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected AnnotationConfigWebApplicationContext wac;
 | 
						protected AnnotationConfigWebApplicationContext wac;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Before
 | 
						@Before
 | 
				
			||||||
	public void setup() throws Exception {
 | 
						public void setup() throws Exception {
 | 
				
			||||||
 | 
					 | 
				
			||||||
		logger.debug("Setting up '" + this.testName.getMethodName() + "', client=" +
 | 
							logger.debug("Setting up '" + this.testName.getMethodName() + "', client=" +
 | 
				
			||||||
				this.webSocketClient.getClass().getSimpleName() + ", server=" +
 | 
									this.webSocketClient.getClass().getSimpleName() + ", server=" +
 | 
				
			||||||
				this.server.getClass().getSimpleName());
 | 
									this.server.getClass().getSimpleName());
 | 
				
			||||||
| 
						 | 
					@ -155,6 +154,7 @@ public abstract class AbstractWebSocketIntegrationTests {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Configuration
 | 
						@Configuration
 | 
				
			||||||
	static class TomcatUpgradeStrategyConfig extends AbstractRequestUpgradeStrategyConfig {
 | 
						static class TomcatUpgradeStrategyConfig extends AbstractRequestUpgradeStrategyConfig {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -164,6 +164,7 @@ public abstract class AbstractWebSocketIntegrationTests {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Configuration
 | 
						@Configuration
 | 
				
			||||||
	static class UndertowUpgradeStrategyConfig extends AbstractRequestUpgradeStrategyConfig {
 | 
						static class UndertowUpgradeStrategyConfig extends AbstractRequestUpgradeStrategyConfig {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2002-2015 the original author or authors.
 | 
					 * Copyright 2002-2016 the original author or authors.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 * you may not use this file except in compliance with the License.
 | 
					 * you may not use this file except in compliance with the License.
 | 
				
			||||||
| 
						 | 
					@ -46,9 +46,10 @@ import static org.junit.Assert.*;
 | 
				
			||||||
 * Client and server-side WebSocket integration tests.
 | 
					 * Client and server-side WebSocket integration tests.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @author Rossen Stoyanchev
 | 
					 * @author Rossen Stoyanchev
 | 
				
			||||||
 | 
					 * @author Juergen Hoeller
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@RunWith(Parameterized.class)
 | 
					@RunWith(Parameterized.class)
 | 
				
			||||||
public class WebSocketIntegrationTests extends  AbstractWebSocketIntegrationTests {
 | 
					public class WebSocketHandshakeTests extends AbstractWebSocketIntegrationTests {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Parameters(name = "server [{0}], client [{1}]")
 | 
						@Parameters(name = "server [{0}], client [{1}]")
 | 
				
			||||||
	public static Iterable<Object[]> arguments() {
 | 
						public static Iterable<Object[]> arguments() {
 | 
				
			||||||
| 
						 | 
					@ -62,7 +63,7 @@ public class WebSocketIntegrationTests extends  AbstractWebSocketIntegrationTest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	protected Class<?>[] getAnnotatedConfigClasses() {
 | 
						protected Class<?>[] getAnnotatedConfigClasses() {
 | 
				
			||||||
		return new Class<?>[] { TestConfig.class };
 | 
							return new Class<?>[] {TestConfig.class};
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Test
 | 
						@Test
 | 
				
			||||||
| 
						 | 
					@ -75,11 +76,8 @@ public class WebSocketIntegrationTests extends  AbstractWebSocketIntegrationTest
 | 
				
			||||||
		session.close();
 | 
							session.close();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// SPR-12727
 | 
						@Test  // SPR-12727
 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Test
 | 
					 | 
				
			||||||
	public void unsolicitedPongWithEmptyPayload() throws Exception {
 | 
						public void unsolicitedPongWithEmptyPayload() throws Exception {
 | 
				
			||||||
 | 
					 | 
				
			||||||
		String url = getWsBaseUrl() + "/ws";
 | 
							String url = getWsBaseUrl() + "/ws";
 | 
				
			||||||
		WebSocketSession session = this.webSocketClient.doHandshake(new AbstractWebSocketHandler() {}, url).get();
 | 
							WebSocketSession session = this.webSocketClient.doHandshake(new AbstractWebSocketHandler() {}, url).get();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -126,7 +124,6 @@ public class WebSocketIntegrationTests extends  AbstractWebSocketIntegrationTest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		private Throwable transportError;
 | 
							private Throwable transportError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void setWaitMessageCount(int waitMessageCount) {
 | 
							public void setWaitMessageCount(int waitMessageCount) {
 | 
				
			||||||
			this.waitMessageCount = waitMessageCount;
 | 
								this.waitMessageCount = waitMessageCount;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2002-2015 the original author or authors.
 | 
					 * Copyright 2002-2016 the original author or authors.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 * you may not use this file except in compliance with the License.
 | 
					 * you may not use this file except in compliance with the License.
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,7 @@ public class WebSocketConfigurationTests extends AbstractWebSocketIntegrationTes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	protected Class<?>[] getAnnotatedConfigClasses() {
 | 
						protected Class<?>[] getAnnotatedConfigClasses() {
 | 
				
			||||||
		return new Class<?>[] { TestConfig.class };
 | 
							return new Class<?>[] {TestConfig.class};
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Test
 | 
						@Test
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue