diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java index fd52abddcd..44b13fd6f1 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java @@ -17,16 +17,16 @@ package org.springframework.messaging.handler.annotation.support; import java.lang.reflect.Method; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; -import org.springframework.core.ExceptionDepthComparator; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.messaging.handler.annotation.MessageExceptionHandler; import org.springframework.messaging.handler.method.AbstractExceptionHandlerMethodResolver; import org.springframework.messaging.handler.method.HandlerMethodSelector; -import org.springframework.util.Assert; -import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils.MethodFilter; @@ -41,7 +41,6 @@ import org.springframework.util.ReflectionUtils.MethodFilter; */ public class AnnotationExceptionHandlerMethodResolver extends AbstractExceptionHandlerMethodResolver { - /** * A constructor that finds {@link MessageExceptionHandler} methods in the given type. * @param handlerType the type to introspect diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/condition/AbstractMessageCondition.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/condition/AbstractMessageCondition.java index baae838943..fb6098ffae 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/condition/AbstractMessageCondition.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/condition/AbstractMessageCondition.java @@ -16,8 +16,6 @@ package org.springframework.messaging.handler.condition; -import org.springframework.web.servlet.mvc.condition.RequestCondition; - import java.util.Collection; import java.util.Iterator; diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/condition/DestinationPatternsMessageCondition.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/condition/DestinationPatternsMessageCondition.java index f45f4ae516..a3ef608862 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/condition/DestinationPatternsMessageCondition.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/condition/DestinationPatternsMessageCondition.java @@ -16,15 +16,22 @@ package org.springframework.messaging.handler.condition; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + import org.springframework.messaging.Message; import org.springframework.messaging.handler.method.AbstractMethodMessageHandler; import org.springframework.util.AntPathMatcher; -import org.springframework.util.Assert; import org.springframework.util.PathMatcher; import org.springframework.util.StringUtils; -import java.util.*; - /** * A {@link MessageCondition} for matching the destination of a Message against one or * more destination patterns using a {@link PathMatcher}. diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SimpAnnotationMethodMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SimpAnnotationMethodMessageHandler.java index 603e770f91..a0dccc54fb 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SimpAnnotationMethodMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SimpAnnotationMethodMessageHandler.java @@ -17,7 +17,13 @@ package org.springframework.messaging.simp.handler; import java.lang.reflect.Method; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.ConfigurableApplicationContext; @@ -28,9 +34,18 @@ import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.core.AbstractMessageSendingTemplate; import org.springframework.messaging.handler.annotation.MessageMapping; -import org.springframework.messaging.handler.annotation.support.*; +import org.springframework.messaging.handler.annotation.support.AnnotationExceptionHandlerMethodResolver; +import org.springframework.messaging.handler.annotation.support.HeaderMethodArgumentResolver; +import org.springframework.messaging.handler.annotation.support.HeadersMethodArgumentResolver; +import org.springframework.messaging.handler.annotation.support.MessageMethodArgumentResolver; +import org.springframework.messaging.handler.annotation.support.PathVariableMethodArgumentResolver; +import org.springframework.messaging.handler.annotation.support.PayloadArgumentResolver; import org.springframework.messaging.handler.condition.DestinationPatternsMessageCondition; -import org.springframework.messaging.handler.method.*; +import org.springframework.messaging.handler.method.AbstractExceptionHandlerMethodResolver; +import org.springframework.messaging.handler.method.AbstractMethodMessageHandler; +import org.springframework.messaging.handler.method.HandlerMethod; +import org.springframework.messaging.handler.method.HandlerMethodArgumentResolver; +import org.springframework.messaging.handler.method.HandlerMethodReturnValueHandler; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.messaging.simp.SimpMessageSendingOperations; import org.springframework.messaging.simp.SimpMessagingTemplate; @@ -255,7 +270,7 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan } @Override - protected Comparator getMappingComparator(final Message message) { + protected Comparator getMappingComparator(final Message message) { return new Comparator() { @Override public int compare(SimpMessageMappingInfo info1, SimpMessageMappingInfo info2) { @@ -292,4 +307,4 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan return new AnnotationExceptionHandlerMethodResolver(beanType); } -} \ No newline at end of file +} diff --git a/spring-messaging/src/main/java/org/springframework/messaging/support/tcp/ReactorTcpConnection.java b/spring-messaging/src/main/java/org/springframework/messaging/support/tcp/ReactorTcpConnection.java index 85904617e1..248f2f4e25 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/support/tcp/ReactorTcpConnection.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/support/tcp/ReactorTcpConnection.java @@ -16,20 +16,10 @@ package org.springframework.messaging.support.tcp; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - import org.springframework.messaging.Message; import org.springframework.util.concurrent.ListenableFuture; -import org.springframework.util.concurrent.ListenableFutureCallback; -import org.springframework.util.concurrent.ListenableFutureCallbackRegistry; -import reactor.core.composable.Deferred; import reactor.core.composable.Promise; -import reactor.core.composable.spec.DeferredPromiseSpec; -import reactor.function.Consumer; - public class ReactorTcpConnection

implements TcpConnection

{ diff --git a/spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PathVariableMethodArgumentResolverTests.java b/spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PathVariableMethodArgumentResolverTests.java index a81e1d3b64..d4d31bf546 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PathVariableMethodArgumentResolverTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PathVariableMethodArgumentResolverTests.java @@ -28,7 +28,6 @@ import org.springframework.core.MethodParameter; import org.springframework.core.convert.support.DefaultConversionService; import org.springframework.messaging.Message; import org.springframework.messaging.handler.annotation.PathVariable; -import org.springframework.messaging.simp.handler.SimpAnnotationMethodMessageHandler; import org.springframework.messaging.support.MessageBuilder; import static org.junit.Assert.*; @@ -45,12 +44,12 @@ public class PathVariableMethodArgumentResolverTests { private MethodParameter paramAnnotatedValue; private MethodParameter paramNotAnnotated; + @Before public void setup() throws Exception { this.resolver = new PathVariableMethodArgumentResolver(new DefaultConversionService()); - Method method = getClass().getDeclaredMethod("handleMessage", - String.class, String.class, String.class); + Method method = getClass().getDeclaredMethod("handleMessage", String.class, String.class, String.class); this.paramAnnotated = new MethodParameter(method, 0); this.paramAnnotatedValue = new MethodParameter(method, 1); this.paramNotAnnotated = new MethodParameter(method, 2); @@ -70,15 +69,15 @@ public class PathVariableMethodArgumentResolverTests { @Test public void resolveArgument() throws Exception { - Map pathParams = new HashMap(); - pathParams.put("foo","bar"); - pathParams.put("name","value"); - Message message = MessageBuilder.withPayload(new byte[0]) - .setHeader(PathVariableMethodArgumentResolver.PATH_TEMPLATE_VARIABLES_HEADER, pathParams).build(); + Map pathParams = new HashMap(); + pathParams.put("foo", "bar"); + pathParams.put("name", "value"); + Message message = MessageBuilder.withPayload(new byte[0]).setHeader( + PathVariableMethodArgumentResolver.PATH_TEMPLATE_VARIABLES_HEADER, pathParams).build(); Object result = this.resolver.resolveArgument(this.paramAnnotated, message); - assertEquals("bar",result); + assertEquals("bar", result); result = this.resolver.resolveArgument(this.paramAnnotatedValue, message); - assertEquals("value",result); + assertEquals("value", result); } @Test(expected = MessageHandlingException.class) @@ -88,9 +87,6 @@ public class PathVariableMethodArgumentResolverTests { } @SuppressWarnings("unused") - private void handleMessage( - @PathVariable String foo, - @PathVariable(value = "name") String param1, - String param3) { + private void handleMessage(@PathVariable String foo, @PathVariable(value = "name") String param1, String param3) { } } \ No newline at end of file diff --git a/spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpMessageTypeMessageConditionTests.java b/spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpMessageTypeMessageConditionTests.java index 4e3d6d2bbf..3358a789ef 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpMessageTypeMessageConditionTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpMessageTypeMessageConditionTests.java @@ -16,17 +16,13 @@ package org.springframework.messaging.simp.handler; - import org.junit.Test; import org.springframework.messaging.Message; -import org.springframework.messaging.handler.condition.DestinationPatternsMessageCondition; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.messaging.simp.SimpMessageType; import org.springframework.messaging.support.MessageBuilder; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertNull; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; /** * Unit tests for SimpMessageTypeMessageCondition. @@ -35,7 +31,6 @@ import static org.junit.Assert.assertEquals; */ public class SimpMessageTypeMessageConditionTests { - @Test public void combineEmptySets() { SimpMessageTypeMessageCondition c1 = condition(); @@ -85,7 +80,6 @@ public class SimpMessageTypeMessageConditionTests { assertEquals(0, condition(SimpMessageType.MESSAGE).compareTo(condition(SimpMessageType.MESSAGE), message)); } - private Message message(SimpMessageType messageType) { MessageBuilder builder = MessageBuilder.withPayload(new byte[0]); if (messageType != null) { diff --git a/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerTests.java b/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerTests.java index 7a668bb5bb..de5adabd29 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerTests.java @@ -15,27 +15,26 @@ */ package org.springframework.messaging.simp.stomp; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Callable; + import org.junit.Before; import org.junit.Test; -import org.springframework.messaging.*; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageChannel; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.messaging.simp.SimpMessageType; import org.springframework.messaging.support.MessageBuilder; -import org.springframework.messaging.support.channel.ExecutorSubscribableChannel; import org.springframework.messaging.support.tcp.ReconnectStrategy; import org.springframework.messaging.support.tcp.TcpConnection; import org.springframework.messaging.support.tcp.TcpConnectionHandler; import org.springframework.messaging.support.tcp.TcpOperations; import org.springframework.util.concurrent.ListenableFuture; -import org.springframework.util.concurrent.ListenableFutureAdapter; import org.springframework.util.concurrent.ListenableFutureTask; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.Callable; - -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; /** * Unit tests for StompBrokerRelayMessageHandler. @@ -169,12 +168,14 @@ public class StompBrokerRelayMessageHandlerTests { @Override + @SuppressWarnings("unchecked") public boolean send(Message message) { this.messages.add((Message) message); return true; } @Override + @SuppressWarnings("unchecked") public boolean send(Message message, long timeout) { this.messages.add((Message) message); return true; diff --git a/spring-messaging/src/test/java/org/springframework/messaging/support/channel/PublishSubscibeChannelTests.java b/spring-messaging/src/test/java/org/springframework/messaging/support/channel/PublishSubscibeChannelTests.java index 5db559e7d0..5f4e1639d7 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/support/channel/PublishSubscibeChannelTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/support/channel/PublishSubscibeChannelTests.java @@ -34,7 +34,6 @@ import org.springframework.messaging.support.MessageBuilder; import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; import static org.mockito.BDDMockito.*; -import static org.mockito.Mockito.*; /** * Tests for {@link ExecutorSubscribableChannel}. @@ -46,7 +45,6 @@ public class PublishSubscibeChannelTests { @Rule public ExpectedException thrown = ExpectedException.none(); - private ExecutorSubscribableChannel channel = new ExecutorSubscribableChannel(); @Mock @@ -118,7 +116,7 @@ public class PublishSubscibeChannelTests { try { this.channel.send(message); } - catch(MessageDeliveryException actualException) { + catch (MessageDeliveryException actualException) { assertThat((RuntimeException) actualException.getCause(), equalTo(ex)); } verifyZeroInteractions(secondHandler); @@ -127,6 +125,7 @@ public class PublishSubscibeChannelTests { @Test public void concurrentModification() throws Exception { this.channel.subscribe(new MessageHandler() { + @Override public void handleMessage(Message message) throws MessagingException { channel.unsubscribe(handler);