|
|
|
@ -445,27 +445,23 @@ public class MessageBrokerBeanDefinitionParserTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void testChannel(String channelName, List<Class<? extends MessageHandler>> subscriberTypes, |
|
|
|
private void testChannel( |
|
|
|
int interceptorCount) { |
|
|
|
String channelName, List<Class<? extends MessageHandler>> subscriberTypes, int interceptorCount) { |
|
|
|
|
|
|
|
|
|
|
|
AbstractSubscribableChannel channel = this.appContext.getBean(channelName, AbstractSubscribableChannel.class); |
|
|
|
AbstractSubscribableChannel channel = this.appContext.getBean(channelName, AbstractSubscribableChannel.class); |
|
|
|
|
|
|
|
|
|
|
|
for (Class<? extends MessageHandler> subscriberType : subscriberTypes) { |
|
|
|
for (Class<? extends MessageHandler> subscriberType : subscriberTypes) { |
|
|
|
MessageHandler subscriber = this.appContext.getBean(subscriberType); |
|
|
|
MessageHandler subscriber = this.appContext.getBean(subscriberType); |
|
|
|
assertNotNull("No subscription for " + subscriberType, subscriber); |
|
|
|
assertNotNull("No subscription for " + subscriberType, subscriber); |
|
|
|
assertTrue(channel.hasSubscription(subscriber)); |
|
|
|
assertTrue(channel.hasSubscription(subscriber)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<ChannelInterceptor> interceptors = channel.getInterceptors(); |
|
|
|
List<ChannelInterceptor> interceptors = channel.getInterceptors(); |
|
|
|
assertEquals(interceptorCount, interceptors.size()); |
|
|
|
assertEquals(interceptorCount, interceptors.size()); |
|
|
|
assertEquals(ImmutableMessageChannelInterceptor.class, interceptors.get(interceptors.size()-1).getClass()); |
|
|
|
assertEquals(ImmutableMessageChannelInterceptor.class, interceptors.get(interceptors.size()-1).getClass()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void testExecutor(String channelName, int corePoolSize, int maxPoolSize, int keepAliveSeconds) { |
|
|
|
private void testExecutor(String channelName, int corePoolSize, int maxPoolSize, int keepAliveSeconds) { |
|
|
|
|
|
|
|
|
|
|
|
ThreadPoolTaskExecutor taskExecutor = |
|
|
|
ThreadPoolTaskExecutor taskExecutor = |
|
|
|
this.appContext.getBean(channelName + "Executor", ThreadPoolTaskExecutor.class); |
|
|
|
this.appContext.getBean(channelName + "Executor", ThreadPoolTaskExecutor.class); |
|
|
|
|
|
|
|
|
|
|
|
assertEquals(corePoolSize, taskExecutor.getCorePoolSize()); |
|
|
|
assertEquals(corePoolSize, taskExecutor.getCorePoolSize()); |
|
|
|
assertEquals(maxPoolSize, taskExecutor.getMaxPoolSize()); |
|
|
|
assertEquals(maxPoolSize, taskExecutor.getMaxPoolSize()); |
|
|
|
assertEquals(keepAliveSeconds, taskExecutor.getKeepAliveSeconds()); |
|
|
|
assertEquals(keepAliveSeconds, taskExecutor.getKeepAliveSeconds()); |
|
|
|
@ -483,6 +479,7 @@ public class MessageBrokerBeanDefinitionParserTests { |
|
|
|
return (handler instanceof WebSocketHandlerDecorator) ? |
|
|
|
return (handler instanceof WebSocketHandlerDecorator) ? |
|
|
|
((WebSocketHandlerDecorator) handler).getLastHandler() : handler; |
|
|
|
((WebSocketHandlerDecorator) handler).getLastHandler() : handler; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -509,7 +506,6 @@ class CustomReturnValueHandler implements HandlerMethodReturnValueHandler { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message) throws Exception { |
|
|
|
public void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -540,12 +536,15 @@ class TestWebSocketHandlerDecorator extends WebSocketHandlerDecorator { |
|
|
|
class TestStompErrorHandler extends StompSubProtocolErrorHandler { |
|
|
|
class TestStompErrorHandler extends StompSubProtocolErrorHandler { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestValidator implements Validator { |
|
|
|
class TestValidator implements Validator { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean supports(Class<?> clazz) { |
|
|
|
public boolean supports(Class<?> clazz) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void validate(@Nullable Object target, Errors errors) { } |
|
|
|
public void validate(@Nullable Object target, Errors errors) { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|