Polishing (backported from master)

This commit is contained in:
Juergen Hoeller
2016-07-06 15:29:15 +02:00
parent 16d5ba9b3a
commit 92d78c10a2
62 changed files with 273 additions and 415 deletions

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@ import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -48,9 +47,7 @@ import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
*/
public abstract class AbstractWebSocketIntegrationTests {
protected Log logger = LogFactory.getLog(getClass());
private static Map<Class<?>, Class<?>> upgradeStrategyConfigTypes = new HashMap<Class<?>, Class<?>>();
private static Map<Class<?>, Class<?>> upgradeStrategyConfigTypes = new HashMap<>();
static {
upgradeStrategyConfigTypes.put(JettyWebSocketTestServer.class, JettyUpgradeStrategyConfig.class);
@@ -58,6 +55,7 @@ public abstract class AbstractWebSocketIntegrationTests {
upgradeStrategyConfigTypes.put(UndertowTestServer.class, UndertowUpgradeStrategyConfig.class);
}
@Rule
public final TestName testName = new TestName();
@@ -67,12 +65,13 @@ public abstract class AbstractWebSocketIntegrationTests {
@Parameter(1)
public WebSocketClient webSocketClient;
protected final Log logger = LogFactory.getLog(getClass());
protected AnnotationConfigWebApplicationContext wac;
@Before
public void setup() throws Exception {
logger.debug("Setting up '" + this.testName.getMethodName() + "', client=" +
this.webSocketClient.getClass().getSimpleName() + ", server=" +
this.server.getClass().getSimpleName());
@@ -155,6 +154,7 @@ public abstract class AbstractWebSocketIntegrationTests {
}
}
@Configuration
static class TomcatUpgradeStrategyConfig extends AbstractRequestUpgradeStrategyConfig {
@@ -164,6 +164,7 @@ public abstract class AbstractWebSocketIntegrationTests {
}
}
@Configuration
static class UndertowUpgradeStrategyConfig extends AbstractRequestUpgradeStrategyConfig {

View File

@@ -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");
* 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.
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller
*/
@RunWith(Parameterized.class)
public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests {
public class WebSocketHandshakeTests extends AbstractWebSocketIntegrationTests {
@Parameters(name = "server [{0}], client [{1}]")
public static Iterable<Object[]> arguments() {
@@ -62,7 +63,7 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTest
@Override
protected Class<?>[] getAnnotatedConfigClasses() {
return new Class<?>[] { TestConfig.class };
return new Class<?>[] {TestConfig.class};
}
@Test
@@ -75,11 +76,8 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTest
session.close();
}
// SPR-12727
@Test
@Test // SPR-12727
public void unsolicitedPongWithEmptyPayload() throws Exception {
String url = getWsBaseUrl() + "/ws";
WebSocketSession session = this.webSocketClient.doHandshake(new AbstractWebSocketHandler() {}, url).get();
@@ -126,7 +124,6 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTest
private Throwable transportError;
public void setWaitMessageCount(int waitMessageCount) {
this.waitMessageCount = waitMessageCount;
}