Browse Source

Clean up & suppress warnings in spring-messaging

pull/757/head
Sam Brannen 10 years ago
parent
commit
9930a8715f
  1. 3
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/StreamingSockJsSession.java
  2. 9
      spring-websocket/src/test/java/org/springframework/web/socket/TomcatWebSocketTestServer.java
  3. 2
      spring-websocket/src/test/java/org/springframework/web/socket/WebSocketIntegrationTests.java
  4. 2
      spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java
  5. 9
      spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java
  6. 2
      spring-websocket/src/test/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandlerTests.java
  7. 2
      spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/TestTransport.java
  8. 4
      spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java
  9. 3
      spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/session/WebSocketServerSockJsSessionTests.java

3
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/StreamingSockJsSession.java

@ -1,5 +1,5 @@ @@ -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,7 +22,6 @@ import java.util.Map; @@ -22,7 +22,6 @@ import java.util.Map;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.util.Assert;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.sockjs.SockJsTransportFailureException;
import org.springframework.web.socket.sockjs.frame.SockJsFrame;

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

@ -1,5 +1,5 @@ @@ -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.
@ -18,8 +18,7 @@ package org.springframework.web.socket; @@ -18,8 +18,7 @@ package org.springframework.web.socket;
import java.io.File;
import java.io.IOException;
import java.util.EnumSet;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import org.apache.catalina.Context;
@ -105,10 +104,6 @@ public class TomcatWebSocketTestServer implements WebSocketTestServer { @@ -105,10 +104,6 @@ public class TomcatWebSocketTestServer implements WebSocketTestServer {
}
}
private EnumSet<DispatcherType> getDispatcherTypes() {
return EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.ASYNC);
}
@Override
public void undeployConfig() {
if (this.context != null) {

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

@ -29,7 +29,6 @@ import java.util.concurrent.TimeUnit; @@ -29,7 +29,6 @@ import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -114,6 +113,7 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTest @@ -114,6 +113,7 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTest
}
@SuppressWarnings("rawtypes")
private static class TestWebSocketHandler extends AbstractWebSocketHandler {
private List<WebSocketMessage> receivedMessages = new ArrayList<>();

2
spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java

@ -23,7 +23,6 @@ import java.util.List; @@ -23,7 +23,6 @@ import java.util.List;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.CustomScopeConfigurer;
@ -98,6 +97,7 @@ public class MessageBrokerBeanDefinitionParserTests { @@ -98,6 +97,7 @@ public class MessageBrokerBeanDefinitionParserTests {
@Test
@SuppressWarnings("unchecked")
public void simpleBroker() throws Exception {
loadBeanDefinitions("websocket-config-broker-simple.xml");

9
spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -36,9 +36,9 @@ import static org.junit.Assert.*; @@ -36,9 +36,9 @@ import static org.junit.Assert.*;
*
* @author Rossen Stoyanchev
*/
@SuppressWarnings("resource")
public class ConcurrentWebSocketSessionDecoratorTests {
@Test
public void send() throws IOException {
@ -218,11 +218,6 @@ public class ConcurrentWebSocketSessionDecoratorTests { @@ -218,11 +218,6 @@ public class ConcurrentWebSocketSessionDecoratorTests {
}
}
public void release() {
if (this.releaseLatch.get() != null) {
this.releaseLatch.get().countDown();
}
}
}
// @Test

2
spring-websocket/src/test/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandlerTests.java

@ -23,7 +23,6 @@ import org.junit.Before; @@ -23,7 +23,6 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;
@ -145,6 +144,7 @@ public class SubProtocolWebSocketHandlerTests { @@ -145,6 +144,7 @@ public class SubProtocolWebSocketHandlerTests {
}
@Test
@SuppressWarnings("unchecked")
public void checkSession() throws Exception {
TestWebSocketSession session1 = new TestWebSocketSession("id1");
TestWebSocketSession session2 = new TestWebSocketSession("id2");

2
spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/TestTransport.java

@ -21,7 +21,6 @@ import java.util.Arrays; @@ -21,7 +21,6 @@ import java.util.Arrays;
import java.util.List;
import org.mockito.ArgumentCaptor;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.ListenableFutureCallback;
import org.springframework.web.socket.TextMessage;
@ -36,6 +35,7 @@ import static org.mockito.Mockito.*; @@ -36,6 +35,7 @@ import static org.mockito.Mockito.*;
*
* @author Rossen Stoyanchev
*/
@SuppressWarnings("rawtypes")
class TestTransport implements Transport {
private final String name;

4
spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java

@ -18,13 +18,14 @@ package org.springframework.web.socket.sockjs.support; @@ -18,13 +18,14 @@ package org.springframework.web.socket.sockjs.support;
import java.io.IOException;
import java.util.Arrays;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
@ -156,6 +157,7 @@ public class SockJsServiceTests extends AbstractHttpRequestTests { @@ -156,6 +157,7 @@ public class SockJsServiceTests extends AbstractHttpRequestTests {
}
@Test // SPR-11919
@SuppressWarnings("unchecked")
public void handleInfoGetWildflyNPE() throws Exception {
HttpServletResponse mockResponse = mock(HttpServletResponse.class);
ServletOutputStream ous = mock(ServletOutputStream.class);

3
spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/session/WebSocketServerSockJsSessionTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 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.
@ -82,6 +82,7 @@ public class WebSocketServerSockJsSessionTests extends AbstractSockJsSessionTest @@ -82,6 +82,7 @@ public class WebSocketServerSockJsSessionTests extends AbstractSockJsSessionTest
}
@Test
@SuppressWarnings("resource")
public void afterSessionInitializedOpenFrameFirst() throws Exception {
TextWebSocketHandler handler = new TextWebSocketHandler() {
@Override

Loading…
Cancel
Save