Spring Cleaning in December

- Delete unused imports
- Delete unused code
- Clean up warnings
This commit is contained in:
Sam Brannen
2015-12-17 20:27:33 +01:00
parent 0e68d2e951
commit 5b3edcd9f9
36 changed files with 61 additions and 128 deletions

View File

@@ -17,9 +17,7 @@
package org.springframework.web.socket.server.standard;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -33,6 +31,14 @@ import javax.websocket.Endpoint;
import javax.websocket.Extension;
import javax.websocket.server.ServerEndpointConfig;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.socket.server.HandshakeFailureException;
import org.xnio.StreamConnection;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.HttpUpgradeListener;
import io.undertow.servlet.api.InstanceFactory;
@@ -52,13 +58,6 @@ import io.undertow.websockets.jsr.handshake.JsrHybi07Handshake;
import io.undertow.websockets.jsr.handshake.JsrHybi08Handshake;
import io.undertow.websockets.jsr.handshake.JsrHybi13Handshake;
import io.undertow.websockets.spi.WebSocketHttpExchange;
import org.xnio.StreamConnection;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.socket.server.HandshakeFailureException;
/**
* A WebSocket {@code RequestUpgradeStrategy} for use with WildFly and its

View File

@@ -23,7 +23,6 @@ import java.util.regex.Pattern;
import org.springframework.http.MediaType;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.socket.WebSocketHandler;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 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.
@@ -22,8 +22,9 @@ import java.util.Map;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.api.UpgradeResponse;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.web.socket.handler.TestPrincipal;
@@ -38,16 +39,11 @@ import static org.mockito.BDDMockito.*;
*/
public class JettyWebSocketSessionTests {
private Map<String,Object> attributes;
@Before
public void setup() {
this.attributes = new HashMap<>();
}
private final Map<String, Object> attributes = new HashMap<>();
@Test
@SuppressWarnings("resource")
public void getPrincipalWithConstructorArg() {
TestPrincipal user = new TestPrincipal("joe");
JettyWebSocketSession session = new JettyWebSocketSession(attributes, user);
@@ -56,8 +52,8 @@ public class JettyWebSocketSessionTests {
}
@Test
@SuppressWarnings("resource")
public void getPrincipalFromNativeSession() {
TestPrincipal user = new TestPrincipal("joe");
UpgradeRequest request = Mockito.mock(UpgradeRequest.class);
@@ -80,8 +76,8 @@ public class JettyWebSocketSessionTests {
}
@Test
@SuppressWarnings("resource")
public void getPrincipalNotAvailable() {
UpgradeRequest request = Mockito.mock(UpgradeRequest.class);
given(request.getUserPrincipal()).willReturn(null);
@@ -102,8 +98,8 @@ public class JettyWebSocketSessionTests {
}
@Test
@SuppressWarnings("resource")
public void getAcceptedProtocol() {
String protocol = "foo";
UpgradeRequest request = Mockito.mock(UpgradeRequest.class);

View File

@@ -1,4 +1,4 @@
/* Copyright 2002-2014 the original author or authors.
/* Copyright 2002-2015 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.
@@ -19,8 +19,8 @@ import java.util.HashMap;
import java.util.Map;
import javax.websocket.Session;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.http.HttpHeaders;
@@ -36,19 +36,13 @@ import static org.mockito.BDDMockito.*;
*/
public class StandardWebSocketSessionTests {
private HttpHeaders headers;
private final HttpHeaders headers = new HttpHeaders();
private Map<String,Object> attributes;
@Before
public void setup() {
this.headers = new HttpHeaders();
this.attributes = new HashMap<>();
}
private final Map<String, Object> attributes = new HashMap<>();
@Test
@SuppressWarnings("resource")
public void getPrincipalWithConstructorArg() {
TestPrincipal user = new TestPrincipal("joe");
StandardWebSocketSession session = new StandardWebSocketSession(this.headers, this.attributes, null, null, user);
@@ -57,8 +51,8 @@ public class StandardWebSocketSessionTests {
}
@Test
@SuppressWarnings("resource")
public void getPrincipalWithNativeSession() {
TestPrincipal user = new TestPrincipal("joe");
Session nativeSession = Mockito.mock(Session.class);
@@ -71,8 +65,8 @@ public class StandardWebSocketSessionTests {
}
@Test
@SuppressWarnings("resource")
public void getPrincipalNone() {
Session nativeSession = Mockito.mock(Session.class);
given(nativeSession.getUserPrincipal()).willReturn(null);
@@ -86,8 +80,8 @@ public class StandardWebSocketSessionTests {
}
@Test
@SuppressWarnings("resource")
public void getAcceptedProtocol() {
String protocol = "foo";
Session nativeSession = Mockito.mock(Session.class);