Polishing
This commit is contained in:
parent
304c85ec70
commit
605e2477b9
|
@ -34,8 +34,8 @@ import org.springframework.util.StringValueResolver;
|
||||||
*
|
*
|
||||||
* <p>As of Spring 3.1, {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer
|
* <p>As of Spring 3.1, {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer
|
||||||
* PropertySourcesPlaceholderConfigurer} should be used preferentially over this implementation; it is
|
* PropertySourcesPlaceholderConfigurer} should be used preferentially over this implementation; it is
|
||||||
* more flexible through taking advantage of the {@link org.springframework.core.env.Environment Environment} and
|
* more flexible through taking advantage of the {@link org.springframework.core.env.Environment} and
|
||||||
* {@link org.springframework.core.env.PropertySource PropertySource} mechanisms also made available in Spring 3.1.
|
* {@link org.springframework.core.env.PropertySource} mechanisms also made available in Spring 3.1.
|
||||||
*
|
*
|
||||||
* <p>{@link PropertyPlaceholderConfigurer} is still appropriate for use when:
|
* <p>{@link PropertyPlaceholderConfigurer} is still appropriate for use when:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
@ -118,8 +118,8 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
|
||||||
* to pass external values in as JVM system properties: This can easily be
|
* to pass external values in as JVM system properties: This can easily be
|
||||||
* achieved in a startup script, even for existing environment variables.
|
* achieved in a startup script, even for existing environment variables.
|
||||||
* @see #setSystemPropertiesMode
|
* @see #setSystemPropertiesMode
|
||||||
* @see java.lang.System#getProperty(String)
|
* @see System#getProperty(String)
|
||||||
* @see java.lang.System#getenv(String)
|
* @see System#getenv(String)
|
||||||
*/
|
*/
|
||||||
public void setSearchSystemEnvironment(boolean searchSystemEnvironment) {
|
public void setSearchSystemEnvironment(boolean searchSystemEnvironment) {
|
||||||
this.searchSystemEnvironment = searchSystemEnvironment;
|
this.searchSystemEnvironment = searchSystemEnvironment;
|
||||||
|
|
|
@ -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) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue