checkstyle FinalClassCheck
fixes fixModifiers after fixFinal Revert CachingSessionFactory Class is spied in tests. checkstyle - Import Rules checkstyle InterfaceIsType checkstyle InnerTypeLast checkstyle OneStatementPerLine CovariantEquals OneTopLevelClass * Revert `'\n'` -> `System.lineSeparator()` in the Gradle scripts to meet Git `autocrlf = true` on Windows * Fix timing issue with the `LastModifiedFileListFilterTests`, when the `age = 1` might not be enough for the file object when we have some delay before checking
This commit is contained in:
committed by
Artem Bilan
parent
43af472c3a
commit
4ac3a79df7
@@ -16,9 +16,8 @@
|
||||
|
||||
package org.springframework.integration.annotation;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
@@ -28,7 +27,7 @@ import java.lang.annotation.Target;
|
||||
* @since 4.0
|
||||
*/
|
||||
@Target({ })
|
||||
@Retention(RUNTIME)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface GatewayHeader {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2016 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.
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
package org.springframework.integration.annotation;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.integration.scheduling.PollerMetadata;
|
||||
@@ -43,7 +42,7 @@ import org.springframework.scheduling.support.PeriodicTrigger;
|
||||
* @since 4.0
|
||||
*/
|
||||
@Target({})
|
||||
@Retention(RUNTIME)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Poller {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -108,7 +108,7 @@ public class PublisherAnnotationAdvisor extends AbstractPointcutAdvisor implemen
|
||||
}
|
||||
|
||||
|
||||
private static class MetaAnnotationMatchingPointcut implements Pointcut {
|
||||
private static final class MetaAnnotationMatchingPointcut implements Pointcut {
|
||||
|
||||
private final ClassFilter classFilter;
|
||||
|
||||
@@ -168,7 +168,7 @@ public class PublisherAnnotationAdvisor extends AbstractPointcutAdvisor implemen
|
||||
}
|
||||
|
||||
|
||||
private static class MetaAnnotationMethodMatcher extends AnnotationMethodMatcher {
|
||||
private static final class MetaAnnotationMethodMatcher extends AnnotationMethodMatcher {
|
||||
|
||||
private final Class<? extends Annotation> annotationType;
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport
|
||||
}
|
||||
|
||||
|
||||
private class MessageChannelWrapper {
|
||||
private final class MessageChannelWrapper {
|
||||
|
||||
private final MessageChannel channel;
|
||||
|
||||
@@ -237,11 +237,11 @@ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport
|
||||
this.expireAt = expireAt;
|
||||
}
|
||||
|
||||
public final long getExpireAt() {
|
||||
public long getExpireAt() {
|
||||
return this.expireAt;
|
||||
}
|
||||
|
||||
public final MessageChannel getChannel() {
|
||||
public MessageChannel getChannel() {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public class PriorityChannel extends QueueChannel {
|
||||
return message;
|
||||
}
|
||||
|
||||
private static class SequenceFallbackComparator implements Comparator<Message<?>> {
|
||||
private static final class SequenceFallbackComparator implements Comparator<Message<?>> {
|
||||
|
||||
private final Comparator<Message<?>> targetComparator;
|
||||
|
||||
@@ -136,7 +136,7 @@ public class PriorityChannel extends QueueChannel {
|
||||
}
|
||||
|
||||
//we need this because of INT-2508
|
||||
private class MessageWrapper implements Message<Object> {
|
||||
private final class MessageWrapper implements Message<Object> {
|
||||
private final Message<?> rootMessage;
|
||||
private final long sequence;
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public abstract class ThreadStatePropagationChannelInterceptor<S>
|
||||
protected abstract void populatePropagatedContext(S state, Message<?> message, MessageChannel channel);
|
||||
|
||||
|
||||
private static class MessageWithThreadState<S> implements Message<Object> {
|
||||
private static final class MessageWithThreadState<S> implements Message<Object> {
|
||||
|
||||
private final Message<?> message;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
|
||||
* @since 4.0
|
||||
*
|
||||
*/
|
||||
public class FixedSubscriberChannelBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
|
||||
public final class FixedSubscriberChannelBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
|
||||
|
||||
private final Map<String, String> candidateFixedChannelHandlerMap;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -84,7 +84,7 @@ public class ServiceActivatorAnnotationPostProcessor extends AbstractMethodAnnot
|
||||
return serviceActivator;
|
||||
}
|
||||
|
||||
private class ReplyProducingMessageHandlerWrapper extends AbstractReplyProducingMessageHandler
|
||||
private final class ReplyProducingMessageHandlerWrapper extends AbstractReplyProducingMessageHandler
|
||||
implements Lifecycle {
|
||||
|
||||
private final MessageHandler target;
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.integration.config.xml;
|
||||
|
||||
import static org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.ID_ATTRIBUTE;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -39,6 +37,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.support.ManagedMap;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.core.Conventions;
|
||||
@@ -407,7 +406,7 @@ public abstract class IntegrationNamespaceUtils {
|
||||
|
||||
public static String[] generateAlias(Element element) {
|
||||
String[] handlerAlias = null;
|
||||
String id = element.getAttribute(ID_ATTRIBUTE);
|
||||
String id = element.getAttribute(AbstractBeanDefinitionParser.ID_ATTRIBUTE);
|
||||
if (StringUtils.hasText(id)) {
|
||||
handlerAlias = new String[] {id + IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX};
|
||||
}
|
||||
@@ -517,7 +516,7 @@ public abstract class IntegrationNamespaceUtils {
|
||||
}
|
||||
|
||||
public static String createDirectChannel(Element element, ParserContext parserContext) {
|
||||
String channelId = element.getAttribute(ID_ATTRIBUTE);
|
||||
String channelId = element.getAttribute(AbstractBeanDefinitionParser.ID_ATTRIBUTE);
|
||||
if (!StringUtils.hasText(channelId)) {
|
||||
parserContext.getReaderContext().error("The channel-adapter's 'id' attribute is required when no 'channel' "
|
||||
+ "reference has been provided, because that 'id' would be used for the created channel.", element);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -26,12 +26,12 @@ import org.springframework.core.task.support.TaskExecutorAdapter;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.messaging.core.MessagePostProcessor;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public class AsyncMessagingTemplate extends MessagingTemplate implements AsyncMessagingOperations {
|
||||
@@ -45,177 +45,219 @@ public class AsyncMessagingTemplate extends MessagingTemplate implements AsyncMe
|
||||
(AsyncTaskExecutor) executor : new TaskExecutorAdapter(executor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> asyncSend(final Message<?> message) {
|
||||
return this.executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
send(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> asyncSend(final MessageChannel channel, final Message<?> message) {
|
||||
return this.executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
send(channel, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> asyncSend(final String channelName, final Message<?> message) {
|
||||
return this.executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
send(channelName, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> asyncConvertAndSend(final Object object) {
|
||||
return this.executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
convertAndSend(object);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> asyncConvertAndSend(final MessageChannel channel, final Object object) {
|
||||
return this.executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
convertAndSend(channel, object);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> asyncConvertAndSend(final String channelName, final Object object) {
|
||||
return this.executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
convertAndSend(channelName, object);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Message<?>> asyncReceive() {
|
||||
return this.executor.submit(new Callable<Message<?>>() {
|
||||
@Override
|
||||
public Message<?> call() throws Exception {
|
||||
return receive();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Message<?>> asyncReceive(final PollableChannel channel) {
|
||||
return this.executor.submit(new Callable<Message<?>>() {
|
||||
@Override
|
||||
public Message<?> call() throws Exception {
|
||||
return receive(channel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Message<?>> asyncReceive(final String channelName) {
|
||||
return this.executor.submit(new Callable<Message<?>>() {
|
||||
@Override
|
||||
public Message<?> call() throws Exception {
|
||||
return receive(channelName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncReceiveAndConvert() {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
@Override
|
||||
public R call() throws Exception {
|
||||
return (R) receiveAndConvert(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncReceiveAndConvert(final PollableChannel channel) {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
@Override
|
||||
public R call() throws Exception {
|
||||
return (R) receiveAndConvert(channel, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncReceiveAndConvert(final String channelName) {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
@Override
|
||||
public R call() throws Exception {
|
||||
return (R) receiveAndConvert(channelName, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Message<?>> asyncSendAndReceive(final Message<?> requestMessage) {
|
||||
return this.executor.submit(new Callable<Message<?>>() {
|
||||
@Override
|
||||
public Message<?> call() throws Exception {
|
||||
return sendAndReceive(requestMessage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Message<?>> asyncSendAndReceive(final MessageChannel channel, final Message<?> requestMessage) {
|
||||
return this.executor.submit(new Callable<Message<?>>() {
|
||||
@Override
|
||||
public Message<?> call() throws Exception {
|
||||
return sendAndReceive(channel, requestMessage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Message<?>> asyncSendAndReceive(final String channelName, final Message<?> requestMessage) {
|
||||
return this.executor.submit(new Callable<Message<?>>() {
|
||||
@Override
|
||||
public Message<?> call() throws Exception {
|
||||
return sendAndReceive(channelName, requestMessage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncConvertSendAndReceive(final Object request) {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
@Override
|
||||
public R call() throws Exception {
|
||||
return (R) convertSendAndReceive(request, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncConvertSendAndReceive(final MessageChannel channel, final Object request) {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
@Override
|
||||
public R call() throws Exception {
|
||||
return (R) convertSendAndReceive(channel, request, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncConvertSendAndReceive(final String channelName, final Object request) {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
@Override
|
||||
public R call() throws Exception {
|
||||
return (R) convertSendAndReceive(channelName, request, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncConvertSendAndReceive(final Object request, final MessagePostProcessor requestPostProcessor) {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
@Override
|
||||
public R call() throws Exception {
|
||||
return (R) convertSendAndReceive(request, null, requestPostProcessor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncConvertSendAndReceive(final MessageChannel channel, final Object request, final MessagePostProcessor requestPostProcessor) {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
@Override
|
||||
public R call() throws Exception {
|
||||
return (R) convertSendAndReceive(channel, request, null, requestPostProcessor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> Future<R> asyncConvertSendAndReceive(final String channelName, final Object request, final MessagePostProcessor requestPostProcessor) {
|
||||
return this.executor.submit(new Callable<R>() {
|
||||
@Override
|
||||
public R call() throws Exception {
|
||||
return (R) convertSendAndReceive(channelName, request, null, requestPostProcessor);
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
|
||||
/**
|
||||
* Default Poller implementation
|
||||
*/
|
||||
private class Poller implements Runnable {
|
||||
private final class Poller implements Runnable {
|
||||
|
||||
private final Callable<Boolean> pollingTask;
|
||||
|
||||
|
||||
@@ -537,7 +537,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc
|
||||
* change detection, and the timestamp of the last refresh attempt
|
||||
* (updated every time the cache entry gets re-validated).
|
||||
*/
|
||||
private class PropertiesHolder {
|
||||
private final class PropertiesHolder {
|
||||
|
||||
private Properties properties;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class GatewayCompletableFutureProxyFactoryBean extends GatewayProxyFactor
|
||||
return super.invoke(invocation);
|
||||
}
|
||||
|
||||
private class Invoker implements Supplier<Object> {
|
||||
private final class Invoker implements Supplier<Object> {
|
||||
|
||||
private final MethodInvocation invocation;
|
||||
|
||||
|
||||
@@ -613,7 +613,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
|
||||
}
|
||||
|
||||
|
||||
private static class MethodInvocationGateway extends MessagingGatewaySupport {
|
||||
private static final class MethodInvocationGateway extends MessagingGatewaySupport {
|
||||
|
||||
private MethodInvocationGateway(GatewayMethodInboundMessageMapper messageMapper) {
|
||||
this.setRequestMapper(messageMapper);
|
||||
@@ -622,7 +622,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
|
||||
}
|
||||
|
||||
|
||||
private class AsyncInvocationTask implements Callable<Object> {
|
||||
private final class AsyncInvocationTask implements Callable<Object> {
|
||||
|
||||
private final MethodInvocation invocation;
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ExpressionCommandMessageProcessor extends AbstractMessageProcessor<
|
||||
}
|
||||
|
||||
|
||||
private static class ExpressionCommandMethodResolver extends ReflectiveMethodResolver {
|
||||
private static final class ExpressionCommandMethodResolver extends ReflectiveMethodResolver {
|
||||
|
||||
private final MethodFilter methodFilter;
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ public abstract class AbstractRequestHandlerAdvice extends IntegrationObjectSupp
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private class ThrowableHolderException extends RuntimeException {
|
||||
private final class ThrowableHolderException extends RuntimeException {
|
||||
|
||||
private ThrowableHolderException(Throwable cause) {
|
||||
super(cause);
|
||||
|
||||
@@ -95,7 +95,7 @@ public class RequestHandlerCircuitBreakerAdvice extends AbstractRequestHandlerAd
|
||||
/**
|
||||
* An exception thrown when the circuit breaker is in an open state.
|
||||
*/
|
||||
public static class CircuitBreakerOpenException extends RuntimeException {
|
||||
public static final class CircuitBreakerOpenException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -37,7 +37,7 @@ import org.springframework.util.StringUtils;
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MessageHistory implements List<Properties>, Serializable {
|
||||
public final class MessageHistory implements List<Properties>, Serializable {
|
||||
|
||||
public static final String HEADER_NAME = "history";
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.Collections;
|
||||
* @author Gary Russell
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JsonHeaders {
|
||||
public final class JsonHeaders {
|
||||
|
||||
private JsonHeaders() {
|
||||
super();
|
||||
|
||||
@@ -58,6 +58,7 @@ import org.springframework.messaging.Message;
|
||||
* </pre>
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 4.1
|
||||
*/
|
||||
public class ExpressionEvaluatingRoutingSlipRouteStrategy
|
||||
@@ -101,6 +102,11 @@ public class ExpressionEvaluatingRoutingSlipRouteStrategy
|
||||
String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ExpressionEvaluatingRoutingSlipRouteStrategy for: [" + this.expression.getExpressionString() + "]";
|
||||
}
|
||||
|
||||
public static class RequestAndReply {
|
||||
|
||||
private final Message<?> request;
|
||||
@@ -122,10 +128,4 @@ public class ExpressionEvaluatingRoutingSlipRouteStrategy
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ExpressionEvaluatingRoutingSlipRouteStrategy for: [" + this.expression.getExpressionString() + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ public abstract class AbstractKeyValueMessageStore extends AbstractMessageGroupS
|
||||
return (Message<?>) message;
|
||||
}
|
||||
|
||||
private class MessageGroupIterator implements Iterator<MessageGroup> {
|
||||
private final class MessageGroupIterator implements Iterator<MessageGroup> {
|
||||
|
||||
private final Iterator<?> idIterator;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.util.StringUtils;
|
||||
* @since 4.0
|
||||
*
|
||||
*/
|
||||
public class MutableMessageBuilder<T> extends AbstractIntegrationMessageBuilder<T> {
|
||||
public final class MutableMessageBuilder<T> extends AbstractIntegrationMessageBuilder<T> {
|
||||
|
||||
private final MutableMessage<T> mutableMessage;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
|
||||
* @since 4.0
|
||||
*
|
||||
*/
|
||||
public class IntegrationUtils {
|
||||
public final class IntegrationUtils {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(IntegrationUtils.class);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class DefaultTransactionSynchronizationFactory implements TransactionSync
|
||||
|
||||
/**
|
||||
*/
|
||||
private class DefaultTransactionalResourceSynchronization extends IntegrationResourceHolderSynchronization {
|
||||
private final class DefaultTransactionalResourceSynchronization extends IntegrationResourceHolderSynchronization {
|
||||
|
||||
private DefaultTransactionalResourceSynchronization(Object resourceKey) {
|
||||
super(new IntegrationResourceHolder(), resourceKey);
|
||||
|
||||
@@ -922,7 +922,7 @@ public class MessagingMethodInvokerHelper<T> extends AbstractExpressionEvaluator
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class IneligibleMethodException extends RuntimeException {
|
||||
private static final class IneligibleMethodException extends RuntimeException {
|
||||
|
||||
private IneligibleMethodException(String message) {
|
||||
super(message);
|
||||
|
||||
@@ -23,7 +23,7 @@ package org.springframework.integration.util;
|
||||
* @since 3.0
|
||||
*
|
||||
*/
|
||||
public class StackTraceUtils {
|
||||
public final class StackTraceUtils {
|
||||
|
||||
private StackTraceUtils() {}
|
||||
|
||||
|
||||
@@ -16,8 +16,14 @@
|
||||
|
||||
package org.springframework.integration.aggregator;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -16,23 +16,26 @@
|
||||
|
||||
package org.springframework.integration.aggregator;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.store.SimpleMessageGroup;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import static org.hamcrest.Matchers.hasItems;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.integration.store.SimpleMessageGroup;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
* @author Iwein Fuld
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class ResequencingMessageGroupProcessorTests {
|
||||
|
||||
private ResequencingMessageGroupProcessor processor = new ResequencingMessageGroupProcessor();
|
||||
private final ResequencingMessageGroupProcessor processor = new ResequencingMessageGroupProcessor();
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Test
|
||||
@@ -49,7 +52,7 @@ public class ResequencingMessageGroupProcessorTests {
|
||||
List<Message> processedMessages = (List<Message>) processor.processMessageGroup(group);
|
||||
assertThat(processedMessages, hasItems(message1, message2, message3));
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Test
|
||||
public void shouldPartiallProcessIncompleteSequence() {
|
||||
@@ -66,4 +69,5 @@ public class ResequencingMessageGroupProcessorTests {
|
||||
assertThat(processedMessages, hasItems(message1));
|
||||
assertThat(processedMessages.size(), is(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,27 +16,31 @@
|
||||
|
||||
package org.springframework.integration.aggregator.scenarios;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
import org.springframework.integration.IntegrationMessageHeaderAccessor;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.IntegrationMessageHeaderAccessor;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Iwein Fuld
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@@ -54,6 +58,7 @@ public class PartialSequencesWithGapsTests {
|
||||
@Before
|
||||
public void collectOutput() {
|
||||
out.subscribe(new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
received.add(message);
|
||||
}
|
||||
@@ -81,4 +86,5 @@ public class PartialSequencesWithGapsTests {
|
||||
.setSequenceSize(sequenceSize)
|
||||
.setCorrelationId("foo").build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -23,12 +23,12 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.dispatcher.RoundRobinLoadBalancingStrategy;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class DirectChannelParserTests {
|
||||
|
||||
@@ -40,6 +40,7 @@ public class DirectChannelParserTests {
|
||||
assertEquals(DirectChannel.class, channel.getClass());
|
||||
DirectFieldAccessor dcAccessor = new DirectFieldAccessor(((DirectChannel)channel).getDispatcher());
|
||||
assertTrue(dcAccessor.getPropertyValue("loadBalancingStrategy") instanceof RoundRobinLoadBalancingStrategy);
|
||||
context.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -16,15 +16,17 @@
|
||||
|
||||
package org.springframework.integration.channel.config;
|
||||
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -38,6 +40,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*
|
||||
* @author Iwein Fuld
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @see ChannelWithCustomQueueParserTests
|
||||
*/
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
|
||||
package org.springframework.integration.channel.interceptor;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
|
||||
package org.springframework.integration.config.annotation;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -81,7 +83,7 @@ public class MessagingAnnotationPostProcessorTests {
|
||||
inputChannel.send(new GenericMessage<String>("world"));
|
||||
Message<?> reply = outputChannel.receive(0);
|
||||
assertEquals("hello world", reply.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -100,7 +102,7 @@ public class MessagingAnnotationPostProcessorTests {
|
||||
inputChannel.send(messageToSend);
|
||||
message = outputChannel.receive(1000);
|
||||
assertEquals("hello world advised", message.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -113,7 +115,7 @@ public class MessagingAnnotationPostProcessorTests {
|
||||
inputChannel.send(new GenericMessage<String>("world"));
|
||||
Message<?> message = outputChannel.receive(1000);
|
||||
assertEquals("hello world", message.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -126,7 +128,7 @@ public class MessagingAnnotationPostProcessorTests {
|
||||
inputChannel.send(new GenericMessage<String>("123"));
|
||||
Message<?> message = outputChannel.receive(1000);
|
||||
assertEquals(246, message.getPayload());
|
||||
context.stop();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -353,6 +355,7 @@ public class MessagingAnnotationPostProcessorTests {
|
||||
|
||||
private static class SimpleAnnotatedEndpointImplementation implements SimpleAnnotatedEndpointInterface {
|
||||
|
||||
@Override
|
||||
@ServiceActivator(inputChannel="inputChannel", outputChannel="outputChannel")
|
||||
public String test(String input) {
|
||||
return "test-" + input;
|
||||
|
||||
@@ -142,7 +142,8 @@ public class ControlBusRecipientListRouterTests {
|
||||
MessagingTemplate messagingTemplate = new MessagingTemplate();
|
||||
messagingTemplate.setReceiveTimeout(1000);
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();map.put("channel6","true");
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("channel6","true");
|
||||
Message<?> message = MessageBuilder.withPayload("@'simpleRouter.handler'.setRecipientMappings(headers.recipientMap)").setHeader("recipientMap", map).build();
|
||||
this.input.send(message);
|
||||
message = new GenericMessage<Integer>(1);
|
||||
|
||||
@@ -16,24 +16,26 @@
|
||||
|
||||
package org.springframework.integration.dispatcher;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.atLeast;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
|
||||
/**
|
||||
* @author Iwein Fuld
|
||||
@@ -43,7 +45,7 @@ import static org.mockito.Mockito.*;
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class RoundRobinDispatcherTests {
|
||||
|
||||
private UnicastingDispatcher dispatcher = new UnicastingDispatcher();
|
||||
private final UnicastingDispatcher dispatcher = new UnicastingDispatcher();
|
||||
|
||||
@Mock
|
||||
private MessageHandler handler;
|
||||
@@ -84,7 +86,7 @@ public class RoundRobinDispatcherTests {
|
||||
dispatcher.dispatch(message);
|
||||
}
|
||||
verify(handler, times(4)).handleMessage(message);
|
||||
verify(differentHandler, times(3)).handleMessage(message);
|
||||
verify(differentHandler, times(3)).handleMessage(message);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -16,8 +16,11 @@
|
||||
|
||||
package org.springframework.integration.endpoint;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -29,7 +32,7 @@ import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -86,6 +89,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
adapter.setOutputChannel(outputChannel);
|
||||
adapter.setSource(new MessageSource<String>() {
|
||||
|
||||
@Override
|
||||
public Message<String> receive() {
|
||||
GenericMessage<String> message = new GenericMessage<String>("foo");
|
||||
IntegrationResourceHolder holder =
|
||||
@@ -127,7 +131,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
|
||||
@Test
|
||||
public void testTransactionSynchronizationFactoryBean() {
|
||||
ApplicationContext ctx = new AnnotationConfigApplicationContext(TestTxSyncConfiguration.class);
|
||||
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(TestTxSyncConfiguration.class);
|
||||
|
||||
TransactionSynchronizationFactory syncFactory = ctx.getBean(TransactionSynchronizationFactory.class);
|
||||
|
||||
@@ -141,6 +145,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
adapter.setOutputChannel(outputChannel);
|
||||
adapter.setSource(new MessageSource<String>() {
|
||||
|
||||
@Override
|
||||
public Message<String> receive() {
|
||||
GenericMessage<String> message = new GenericMessage<String>("foo");
|
||||
IntegrationResourceHolder holder =
|
||||
@@ -165,6 +170,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
TransactionSynchronizationUtils.triggerAfterCompletion(TransactionSynchronization.STATUS_COMMITTED);
|
||||
TransactionSynchronizationManager.clearSynchronization();
|
||||
TransactionSynchronizationManager.setActualTransactionActive(false);
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -187,6 +193,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
adapter.setOutputChannel(outputChannel);
|
||||
adapter.setSource(new MessageSource<String>() {
|
||||
|
||||
@Override
|
||||
public Message<String> receive() {
|
||||
GenericMessage<String> message = new GenericMessage<String>("foo");
|
||||
((IntegrationResourceHolder) TransactionSynchronizationManager.getResource(this))
|
||||
@@ -212,6 +219,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
TransactionTemplate transactionTemplate = new TransactionTemplate(new PseudoTransactionManager());
|
||||
transactionTemplate.execute(new TransactionCallback<Object>() {
|
||||
|
||||
@Override
|
||||
public Object doInTransaction(TransactionStatus status) {
|
||||
SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter();
|
||||
ExpressionEvaluatingTransactionSynchronizationProcessor syncProcessor =
|
||||
@@ -231,6 +239,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
adapter.setOutputChannel(outputChannel);
|
||||
adapter.setSource(new MessageSource<String>() {
|
||||
|
||||
@Override
|
||||
public Message<String> receive() {
|
||||
GenericMessage<String> message = new GenericMessage<String>("foo");
|
||||
IntegrationResourceHolder holder =
|
||||
@@ -260,6 +269,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
try {
|
||||
transactionTemplate.execute(new TransactionCallback<Object>() {
|
||||
|
||||
@Override
|
||||
public Object doInTransaction(TransactionStatus status) {
|
||||
|
||||
SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter();
|
||||
@@ -278,6 +288,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
adapter.setOutputChannel(outputChannel);
|
||||
adapter.setSource(new MessageSource<String>() {
|
||||
|
||||
@Override
|
||||
public Message<String> receive() {
|
||||
GenericMessage<String> message = new GenericMessage<String>("foo");
|
||||
((IntegrationResourceHolder) TransactionSynchronizationManager.getResource(this))
|
||||
@@ -305,6 +316,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
TransactionTemplate transactionTemplate = new TransactionTemplate(new PseudoTransactionManager());
|
||||
transactionTemplate.execute(new TransactionCallback<Object>() {
|
||||
|
||||
@Override
|
||||
public Object doInTransaction(TransactionStatus status) {
|
||||
|
||||
SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter();
|
||||
@@ -323,6 +335,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
adapter.setOutputChannel(outputChannel);
|
||||
adapter.setSource(new MessageSource<String>() {
|
||||
|
||||
@Override
|
||||
public Message<String> receive() {
|
||||
GenericMessage<String> message = new GenericMessage<String>("foo");
|
||||
((IntegrationResourceHolder) TransactionSynchronizationManager.getResource(this))
|
||||
@@ -347,6 +360,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
|
||||
adapter.setSource(new MessageSource<String>() {
|
||||
|
||||
@Override
|
||||
public Message<String> receive() {
|
||||
return null;
|
||||
}
|
||||
@@ -370,6 +384,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
|
||||
TransactionSynchronizationFactory syncFactory = new TransactionSynchronizationFactory() {
|
||||
|
||||
@Override
|
||||
public TransactionSynchronization create(Object key) {
|
||||
return new TransactionSynchronizationAdapter() {
|
||||
@Override
|
||||
@@ -383,6 +398,7 @@ public class PseudoTransactionalMessageSourceTests {
|
||||
adapter.setTransactionSynchronizationFactory(syncFactory);
|
||||
adapter.setSource(new MessageSource<String>() {
|
||||
|
||||
@Override
|
||||
public Message<String> receive() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -16,14 +16,11 @@
|
||||
|
||||
package org.springframework.integration.json;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.integration.history.MessageHistory;
|
||||
@@ -32,8 +29,14 @@ import org.springframework.integration.support.context.NamedComponent;
|
||||
import org.springframework.integration.support.json.JsonOutboundMessageMapper;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* @author Jeremy Grelle
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public class JsonOutboundMessageMapperTests {
|
||||
@@ -128,10 +131,12 @@ public class JsonOutboundMessageMapperTests {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "testName-" + this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "testType-" + this.id;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -16,10 +16,8 @@
|
||||
|
||||
package org.springframework.integration.json;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.integration.support.json.BoonJsonObjectMapper;
|
||||
@@ -27,9 +25,13 @@ import org.springframework.integration.support.json.Jackson2JsonObjectMapper;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public class JsonToObjectTransformerTests {
|
||||
|
||||
@@ -16,13 +16,16 @@
|
||||
|
||||
package org.springframework.integration.json;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -44,6 +47,8 @@ import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -16,26 +16,29 @@
|
||||
|
||||
package org.springframework.integration.router.config;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.IntegrationMessageHeaderAccessor;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.integration.handler.ReplyRequiredException;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.IntegrationMessageHeaderAccessor;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.handler.ReplyRequiredException;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Iwein Fuld
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class SplitterParserTests {
|
||||
|
||||
@@ -56,6 +59,7 @@ public class SplitterParserTests {
|
||||
Message<?> result4 = output.receive(1000);
|
||||
assertEquals("test", result4.getPayload());
|
||||
assertNull(output.receive(0));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -75,6 +79,7 @@ public class SplitterParserTests {
|
||||
Message<?> result4 = output.receive(1000);
|
||||
assertEquals("test", result4.getPayload());
|
||||
assertNull(output.receive(0));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -94,6 +99,7 @@ public class SplitterParserTests {
|
||||
Message<?> result4 = output.receive(1000);
|
||||
assertEquals("test", result4.getPayload());
|
||||
assertNull(output.receive(0));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test(expected = ReplyRequiredException.class)
|
||||
@@ -103,6 +109,7 @@ public class SplitterParserTests {
|
||||
context.start();
|
||||
DirectChannel inputChannel = context.getBean("requiresReplyInput", DirectChannel.class);
|
||||
inputChannel.send(MessageBuilder.withPayload(Collections.emptyList()).build());
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -116,7 +123,7 @@ public class SplitterParserTests {
|
||||
Message<?> message = output.receive(1000);
|
||||
assertThat(new IntegrationMessageHeaderAccessor(message).getSequenceNumber(), is(0));
|
||||
assertThat(new IntegrationMessageHeaderAccessor(message).getSequenceSize(), is(0));
|
||||
context.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
ref="splitterImpl"
|
||||
input-channel="splitterImplementationInput"
|
||||
output-channel="output"/>
|
||||
|
||||
|
||||
<splitter id="splitterImplementationRequiresReply"
|
||||
input-channel="requiresReplyInput"
|
||||
output-channel="output"
|
||||
output-channel="output"
|
||||
requires-reply="true"/>
|
||||
|
||||
<splitter id="splitterBeanNoSequence"
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
|
||||
package org.springframework.integration.splitter;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -39,6 +41,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -32,13 +32,13 @@ import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.annotation.MessageEndpoint;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.annotation.Splitter;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.annotation.DirtiesContext.ClassMode;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -48,6 +48,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
* @author Iwein Fuld
|
||||
* @author Alexander Peters
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@@ -70,9 +71,9 @@ public class SplitterIntegrationTests {
|
||||
@Qualifier("splitter.handler")
|
||||
MethodInvokingSplitter splitter;
|
||||
|
||||
private String sentence = "The quick brown fox jumped over the lazy dog";
|
||||
private final String sentence = "The quick brown fox jumped over the lazy dog";
|
||||
|
||||
private List<String> words = Arrays.asList(sentence.split("\\s"));
|
||||
private final List<String> words = Arrays.asList(sentence.split("\\s"));
|
||||
|
||||
@Autowired
|
||||
Receiver receiver;
|
||||
@@ -84,7 +85,7 @@ public class SplitterIntegrationTests {
|
||||
|
||||
@MessageEndpoint
|
||||
public static class Receiver {
|
||||
private List<String> receivedWords = new ArrayList<String>();
|
||||
private final List<String> receivedWords = new ArrayList<String>();
|
||||
|
||||
@ServiceActivator(inputChannel = "out")
|
||||
public void deliveredWords(String string) {
|
||||
@@ -137,7 +138,8 @@ public class SplitterIntegrationTests {
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void delimitersNotAllowedWithRef() throws Throwable {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("SplitterIntegrationTests-invalidRef.xml", SplitterIntegrationTests.class);
|
||||
new ClassPathXmlApplicationContext("SplitterIntegrationTests-invalidRef.xml",
|
||||
SplitterIntegrationTests.class).close();
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
Throwable cause = e.getMostSpecificCause();
|
||||
@@ -151,7 +153,8 @@ public class SplitterIntegrationTests {
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void delimitersNotAllowedWithInnerBean() throws Throwable {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("SplitterIntegrationTests-invalidInnerBean.xml", SplitterIntegrationTests.class);
|
||||
new ClassPathXmlApplicationContext("SplitterIntegrationTests-invalidInnerBean.xml",
|
||||
SplitterIntegrationTests.class).close();
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
Throwable cause = e.getMostSpecificCause();
|
||||
@@ -165,7 +168,8 @@ public class SplitterIntegrationTests {
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void delimitersNotAllowedWithExpression() throws Throwable {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("SplitterIntegrationTests-invalidExpression.xml", SplitterIntegrationTests.class);
|
||||
new ClassPathXmlApplicationContext("SplitterIntegrationTests-invalidExpression.xml",
|
||||
SplitterIntegrationTests.class).close();
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
Throwable cause = e.getMostSpecificCause();
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
|
||||
package org.springframework.integration.splitter;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -47,6 +49,7 @@ import org.springframework.messaging.support.GenericMessage;
|
||||
/**
|
||||
* @author Alex Peters
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 4.1
|
||||
*/
|
||||
public class StreamingSplitterTests {
|
||||
@@ -72,6 +75,7 @@ public class StreamingSplitterTests {
|
||||
List<Message<?>> receivedMessages = replyChannel.clear();
|
||||
Collections.sort(receivedMessages, new Comparator<Message<?>>() {
|
||||
|
||||
@Override
|
||||
public int compare(Message<?> o1, Message<?> o2) {
|
||||
return o1.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.class)
|
||||
.compareTo(o2.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.class));
|
||||
@@ -146,6 +150,7 @@ public class StreamingSplitterTests {
|
||||
|
||||
new EventDrivenConsumer(replyChannel, new MessageHandler() {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
assertThat("Failure with msg: " + message,
|
||||
message.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.class),
|
||||
@@ -167,6 +172,7 @@ public class StreamingSplitterTests {
|
||||
final AtomicInteger receivedMessageCounter = new AtomicInteger(0);
|
||||
new EventDrivenConsumer(replyChannel, new MessageHandler() {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message<?> message)
|
||||
throws MessageRejectedException, MessageHandlingException,
|
||||
MessageDeliveryException {
|
||||
@@ -196,10 +202,12 @@ public class StreamingSplitterTests {
|
||||
public Iterator<String> annotatedMethod(String input) {
|
||||
return new Iterator<String>() {
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return counter.get() < max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String next() {
|
||||
if (!hasNext()) {
|
||||
throw new IllegalStateException("Last element reached!");
|
||||
@@ -207,6 +215,7 @@ public class StreamingSplitterTests {
|
||||
return String.valueOf(counter.incrementAndGet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new AssertionError("not implemented!");
|
||||
|
||||
@@ -230,14 +239,17 @@ public class StreamingSplitterTests {
|
||||
public Iterable<String> annotatedMethod(String input) {
|
||||
return new Iterable<String>() {
|
||||
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
|
||||
return new Iterator<String>() {
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return counter.get() < max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String next() {
|
||||
if (!hasNext()) {
|
||||
throw new IllegalStateException(
|
||||
@@ -246,6 +258,7 @@ public class StreamingSplitterTests {
|
||||
return String.valueOf(counter.incrementAndGet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new AssertionError("not implemented!");
|
||||
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
|
||||
package org.springframework.integration.transformer;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
package org.springframework.integration.transformer;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
/**
|
||||
@@ -29,16 +30,21 @@ import org.springframework.core.convert.converter.Converter;
|
||||
public class PayloadTypeConvertingTransformerTests {
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.integration.transformer.PayloadTypeConvertingTransformer#transformPayload(java.lang.Object)}.
|
||||
* Test method for
|
||||
* {@link org.springframework.integration.transformer.PayloadTypeConvertingTransformer#transformPayload(java.lang.Object)}
|
||||
* .
|
||||
*/
|
||||
@Test
|
||||
public void testTransformPayloadObject() throws Exception {
|
||||
PayloadTypeConvertingTransformer<String, String> tx = new PayloadTypeConvertingTransformer<String, String>();
|
||||
tx.setConverter(new Converter<String, String> () {
|
||||
|
||||
@Override
|
||||
public String convert(String source) {
|
||||
return source.toUpperCase();
|
||||
}}
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
String in = "abcd";
|
||||
String out = tx.transformPayload(in);
|
||||
assertEquals("ABCD", out);
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
|
||||
package org.springframework.integration.transformer;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -32,7 +34,7 @@ import org.junit.Test;
|
||||
*/
|
||||
public class SysLogTransformerTests {
|
||||
|
||||
private SyslogToMapTransformer sut = new SyslogToMapTransformer();
|
||||
private final SyslogToMapTransformer sut = new SyslogToMapTransformer();
|
||||
|
||||
@Test
|
||||
public void testMap() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user