Extended test coverage
This commit is contained in:
@@ -105,12 +105,18 @@ public class MessageEndpointAnnotationPostProcessor implements BeanPostProcessor
|
||||
if (endpointAnnotation == null) {
|
||||
return bean;
|
||||
}
|
||||
if (this.messageBus == null) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn(this.getClass().getSimpleName() + " is disabled since no 'messageBus' was provided");
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
DefaultMessageEndpoint endpoint = new DefaultMessageEndpoint();
|
||||
this.configureInput(bean, beanName, endpointAnnotation, endpoint);
|
||||
MessageHandlerChain handlerChain = this.createHandlerChain(bean);
|
||||
endpoint.setHandler(handlerChain);
|
||||
this.configureDefaultOutput(bean, beanName, endpointAnnotation, endpoint);
|
||||
this.messageBus.registerEndpoint(bean + "-endpoint", endpoint);
|
||||
this.messageBus.registerEndpoint(beanName + "-endpoint", endpoint);
|
||||
return bean;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,12 @@ public class SubscriberAnnotationPostProcessor implements BeanPostProcessor {
|
||||
if (targetClass == null) {
|
||||
return bean;
|
||||
}
|
||||
if (this.messageBus == null) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn(this.getClass().getSimpleName() + " is disabled since no 'messageBus' was provided");
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() {
|
||||
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
|
||||
Annotation annotation = method.getAnnotation(subscriberAnnotationType);
|
||||
|
||||
@@ -47,10 +47,6 @@ public class ChannelPollingMessageRetriever implements MessageRetriever {
|
||||
}
|
||||
|
||||
|
||||
public MessageChannel getChannel() {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
public Collection<Message<?>> retrieveMessages() {
|
||||
List<Message<?>> messages = new LinkedList<Message<?>>();
|
||||
while (messages.size() < this.channel.getDispatcherPolicy().getMaxMessagesPerTask()) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.integration.handler.AbstractMessageHandlerAdapter;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.util.SimpleMethodInvoker;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* MessageHandler adapter for methods annotated with {@link Splitter @Splitter}.
|
||||
@@ -37,7 +38,8 @@ import org.springframework.integration.util.SimpleMethodInvoker;
|
||||
*/
|
||||
public class SplitterMessageHandlerAdapter extends AbstractMessageHandlerAdapter implements ChannelRegistryAware {
|
||||
|
||||
private static final String CHANNEL_KEY = "channel";
|
||||
public static final String CHANNEL_KEY = "channel";
|
||||
|
||||
|
||||
private Map<String, ?> attributes;
|
||||
|
||||
@@ -47,7 +49,12 @@ public class SplitterMessageHandlerAdapter extends AbstractMessageHandlerAdapter
|
||||
|
||||
|
||||
public SplitterMessageHandlerAdapter(Object object, Method method, Map<String, ?> attributes) {
|
||||
Assert.notNull(object, "'object' must not be null");
|
||||
Assert.notNull(method, "'method' must not be null");
|
||||
Assert.isTrue(attributes != null && attributes.get(CHANNEL_KEY) != null,
|
||||
"the 'channel' attribute is required");
|
||||
this.setObject(object);
|
||||
this.setMethodName(method.getName());
|
||||
this.method = method;
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user