diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpChannelFactoryBean.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpChannelFactoryBean.java index 934afde5ad..eac098b520 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpChannelFactoryBean.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AmqpChannelFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -20,6 +20,7 @@ import java.util.List; import java.util.concurrent.Executor; import org.aopalliance.aop.Advice; + import org.springframework.amqp.core.AcknowledgeMode; import org.springframework.amqp.core.AmqpAdmin; import org.springframework.amqp.core.AmqpTemplate; @@ -39,7 +40,7 @@ import org.springframework.integration.amqp.channel.AbstractAmqpChannel; import org.springframework.integration.amqp.channel.PointToPointSubscribableAmqpChannel; import org.springframework.integration.amqp.channel.PollableAmqpChannel; import org.springframework.integration.amqp.channel.PublishSubscribeAmqpChannel; -import org.springframework.integration.channel.ChannelInterceptor; +import org.springframework.messaging.support.ChannelInterceptor; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.interceptor.TransactionAttribute; import org.springframework.util.Assert; @@ -133,6 +134,7 @@ public class AmqpChannelFactoryBean extends AbstractFactoryBeantrue if the message is sent successfully or * false if the sending thread is interrupted. */ + @Override public final boolean send(Message message) { return this.send(message, -1); } @@ -163,6 +167,7 @@ public abstract class AbstractMessageChannel extends IntegrationObjectSupport im * false if the message cannot be sent within the allotted * time or the sending thread is interrupted. */ + @Override public final boolean send(Message message, long timeout) { Assert.notNull(message, "message must not be null"); Assert.notNull(message.getPayload(), "message payload must not be null"); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelInterceptor.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelInterceptor.java deleted file mode 100644 index 31c6d86364..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelInterceptor.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2002-2010 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.channel; - -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; - -/** - * Interface for interceptors that are able to view and/or modify the - * {@link Message Messages} being sent-to and/or received-from a - * {@link MessageChannel}. - * - * @author Mark Fisher - */ -public interface ChannelInterceptor { - - /** - * Invoked before the Message is actually sent to the channel. - * This allows for modification of the Message if necessary. - * If this method returns null, then the actual - * send invocation will not occur. - */ - Message preSend(Message message, MessageChannel channel); - - /** - * Invoked immediately after the send invocation. The boolean - * value argument represents the return value of that invocation. - */ - void postSend(Message message, MessageChannel channel, boolean sent); - - /** - * Invoked as soon as receive is called and before a Message is - * actually retrieved. If the return value is 'false', then no - * Message will be retrieved. This only applies to PollableChannels. - */ - boolean preReceive(MessageChannel channel); - - /** - * Invoked immediately after a Message has been retrieved but before - * it is returned to the caller. The Message may be modified if - * necessary. This only applies to PollableChannels. - */ - Message postReceive(Message message, MessageChannel channel); - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/ChannelInterceptorAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/ChannelInterceptorAdapter.java deleted file mode 100644 index 619782ffb8..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/ChannelInterceptorAdapter.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2002-2008 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.channel.interceptor; - -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; -import org.springframework.integration.channel.ChannelInterceptor; - -/** - * A {@link ChannelInterceptor} with no-op method implementations so that - * subclasses do not have to implement all of the interface's methods. - * - * @author Mark Fisher - */ -public class ChannelInterceptorAdapter implements ChannelInterceptor { - - public Message preSend(Message message, MessageChannel channel) { - return message; - } - - public void postSend(Message message, MessageChannel channel, boolean sent) { - } - - public boolean preReceive(MessageChannel channel) { - return true; - } - - public Message postReceive(Message message, MessageChannel channel) { - return message; - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java index c36849e58f..b9f0184d62 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2013 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. @@ -34,13 +34,13 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.core.OrderComparator; import org.springframework.messaging.MessageChannel; -import org.springframework.integration.channel.ChannelInterceptor; +import org.springframework.messaging.support.ChannelInterceptor; import org.springframework.util.PatternMatchUtils; import org.springframework.util.StringUtils; /** - * Will apply global interceptors to channels (<channel-interceptor>). - * + * Will apply global interceptors to channels (<channel-interceptor>). + * * @author Oleg Zhurakousky * @author Mark Fisher * @since 2.0 @@ -64,33 +64,36 @@ final class GlobalChannelInterceptorBeanPostProcessor implements BeanPostProcess } + @Override public void afterPropertiesSet() throws Exception { for (GlobalChannelInterceptorWrapper channelInterceptor : this.channelInterceptors) { if (channelInterceptor.getOrder() >= 0) { this.positiveOrderInterceptors.add(channelInterceptor); - } + } else { this.negativeOrderInterceptors.add(channelInterceptor); } } } + @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { return bean; } + @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof MessageChannel) { if (logger.isDebugEnabled()) { logger.debug("Applying global interceptors on channel '" + beanName + "'"); } this.addMatchingInterceptors((MessageChannel) bean, beanName); - } + } return bean; } /** - * Adds any interceptor whose pattern matches against the channel's name. + * Adds any interceptor whose pattern matches against the channel's name. */ private void addMatchingInterceptors(MessageChannel channel, String beanName) { List interceptors = this.getExistingInterceptors(channel); @@ -128,7 +131,7 @@ final class GlobalChannelInterceptorBeanPostProcessor implements BeanPostProcess } @SuppressWarnings("unchecked") - private List getExistingInterceptors(MessageChannel channel) { + private List getExistingInterceptors(MessageChannel channel) { try { MessageChannel targetChannel = channel; if (AopUtils.isAopProxy(channel)) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java index 2f34935cc7..5f98a006f9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2013 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. @@ -17,7 +17,7 @@ package org.springframework.integration.channel.interceptor; import org.springframework.core.Ordered; -import org.springframework.integration.channel.ChannelInterceptor; +import org.springframework.messaging.support.ChannelInterceptor; import org.springframework.util.Assert; /** @@ -53,6 +53,7 @@ public class GlobalChannelInterceptorWrapper implements Ordered { this.order = order; } + @Override public int getOrder() { return this.order; } @@ -65,6 +66,7 @@ public class GlobalChannelInterceptorWrapper implements Ordered { return this.patterns; } + @Override public String toString() { return this.channelInterceptor.toString(); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/MessageSelectingInterceptor.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/MessageSelectingInterceptor.java index 78c6835200..bf84c01a8c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/MessageSelectingInterceptor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/MessageSelectingInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2013 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,9 +23,10 @@ import org.springframework.integration.core.MessageSelector; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageDeliveryException; +import org.springframework.messaging.support.ChannelInterceptorAdapter; /** - * A {@link org.springframework.integration.channel.ChannelInterceptor} that + * A {@link org.springframework.messaging.support.ChannelInterceptor ChannelInterceptor} that * delegates to a list of {@link MessageSelector MessageSelectors} to decide * whether a {@link Message} should be accepted on the {@link MessageChannel}. * diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/WireTap.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/WireTap.java index d991bfc212..4f5b6dd899 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/WireTap.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/WireTap.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2013 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. @@ -18,20 +18,22 @@ package org.springframework.integration.channel.interceptor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.context.Lifecycle; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; -import org.springframework.integration.channel.ChannelInterceptor; import org.springframework.integration.core.MessageSelector; import org.springframework.jmx.export.annotation.ManagedAttribute; import org.springframework.jmx.export.annotation.ManagedOperation; import org.springframework.jmx.export.annotation.ManagedResource; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageChannel; +import org.springframework.messaging.support.ChannelInterceptor; +import org.springframework.messaging.support.ChannelInterceptorAdapter; import org.springframework.util.Assert; /** * A {@link ChannelInterceptor} that publishes a copy of the intercepted message * to a secondary target while still sending the original message to the main channel. - * + * * @author Mark Fisher */ @ManagedResource @@ -50,7 +52,7 @@ public class WireTap extends ChannelInterceptorAdapter implements Lifecycle { /** * Create a new wire tap with no {@link MessageSelector}. - * + * * @param channel the MessageChannel to which intercepted messages will be sent */ public WireTap(MessageChannel channel) { @@ -59,7 +61,7 @@ public class WireTap extends ChannelInterceptorAdapter implements Lifecycle { /** * Create a new wire tap with the provided {@link MessageSelector}. - * + * * @param channel the channel to which intercepted messages will be sent * @param selector the selector that must accept a message for it to be * sent to the intercepting channel @@ -73,7 +75,7 @@ public class WireTap extends ChannelInterceptorAdapter implements Lifecycle { /** * Specify the timeout value for sending to the intercepting target. - * + * * @param timeout the timeout in milliseconds */ public void setTimeout(long timeout) { @@ -83,6 +85,7 @@ public class WireTap extends ChannelInterceptorAdapter implements Lifecycle { /** * Check whether the wire tap is currently running. */ + @Override @ManagedAttribute public boolean isRunning() { return this.running; @@ -91,6 +94,7 @@ public class WireTap extends ChannelInterceptorAdapter implements Lifecycle { /** * Restart the wire tap if it has been stopped. It is running by default. */ + @Override @ManagedOperation public void start() { this.running = true; @@ -99,6 +103,7 @@ public class WireTap extends ChannelInterceptorAdapter implements Lifecycle { /** * Stop the wire tap. To restart, invoke {@link #start()}. */ + @Override @ManagedOperation public void stop() { this.running = false; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformingChannelInterceptor.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformingChannelInterceptor.java index 0fabff997e..ad727e644f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformingChannelInterceptor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformingChannelInterceptor.java @@ -18,8 +18,8 @@ package org.springframework.integration.transformer; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; -import org.springframework.integration.channel.ChannelInterceptor; -import org.springframework.integration.channel.interceptor.ChannelInterceptorAdapter; +import org.springframework.messaging.support.ChannelInterceptor; +import org.springframework.messaging.support.ChannelInterceptorAdapter; /** * A {@link ChannelInterceptor} which invokes a {@link Transformer} diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java index d6f3f71555..b946c0cf91 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java @@ -37,17 +37,17 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.PublishSubscribeChannel; import org.springframework.integration.channel.QueueChannel; -import org.springframework.integration.channel.interceptor.ChannelInterceptorAdapter; import org.springframework.integration.config.TestChannelInterceptor; import org.springframework.integration.dispatcher.RoundRobinLoadBalancingStrategy; import org.springframework.integration.dispatcher.UnicastingDispatcher; -import org.springframework.messaging.support.GenericMessage; import org.springframework.integration.support.MessageBuilder; import org.springframework.integration.util.ErrorHandlingTaskExecutor; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageDeliveryException; import org.springframework.messaging.PollableChannel; +import org.springframework.messaging.support.ChannelInterceptorAdapter; +import org.springframework.messaging.support.GenericMessage; /** * @author Mark Fisher diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java index 5a4df802d3..1d24425e5f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2013 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. @@ -31,12 +31,13 @@ import org.junit.Test; import org.springframework.beans.DirectFieldAccessor; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; import org.springframework.integration.channel.AbstractMessageChannel; import org.springframework.integration.channel.QueueChannel; -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.ChannelInterceptorAdapter; +import org.springframework.messaging.support.GenericMessage; import org.springframework.util.StringUtils; /** @@ -120,7 +121,7 @@ public class ChannelInterceptorTests { channel.send(message); Message result = channel.receive(0); assertEquals(1, PreReceiveReturnsTrueInterceptor.counter.get()); - assertNotNull(result); + assertNotNull(result); } @Test @@ -130,7 +131,7 @@ public class ChannelInterceptorTests { channel.send(message); Message result = channel.receive(0); assertEquals(1, PreReceiveReturnsFalseInterceptor.counter.get()); - assertNull(result); + assertNull(result); } @Test @@ -154,7 +155,7 @@ public class ChannelInterceptorTests { assertEquals(0, messageCount.get()); channel.send(new GenericMessage("test")); Message result = channel.receive(0); - assertNotNull(result); + assertNotNull(result); assertEquals(2, invokedCount.get()); assertEquals(1, messageCount.get()); } @@ -174,7 +175,7 @@ public class ChannelInterceptorTests { } - public static class PreSendReturnsMessageInterceptor extends ChannelInterceptorAdapter { + public static class PreSendReturnsMessageInterceptor extends ChannelInterceptorAdapter { private String foo; private static AtomicInteger counter = new AtomicInteger(); @@ -196,7 +197,7 @@ public class ChannelInterceptorTests { } - private static class PreSendReturnsNullInterceptor extends ChannelInterceptorAdapter { + private static class PreSendReturnsNullInterceptor extends ChannelInterceptorAdapter { private static AtomicInteger counter = new AtomicInteger(); @@ -213,7 +214,7 @@ public class ChannelInterceptorTests { } - private static class PreReceiveReturnsTrueInterceptor extends ChannelInterceptorAdapter { + private static class PreReceiveReturnsTrueInterceptor extends ChannelInterceptorAdapter { private static AtomicInteger counter = new AtomicInteger(); @@ -225,7 +226,7 @@ public class ChannelInterceptorTests { } - private static class PreReceiveReturnsFalseInterceptor extends ChannelInterceptorAdapter { + private static class PreReceiveReturnsFalseInterceptor extends ChannelInterceptorAdapter { private static AtomicInteger counter = new AtomicInteger(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java index a4fb094da4..c4ce8ab18f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java @@ -25,16 +25,17 @@ import org.aopalliance.intercept.MethodInvocation; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.ApplicationContext; import org.springframework.core.Ordered; +import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; -import org.springframework.integration.channel.ChannelInterceptor; -import org.springframework.integration.test.util.TestUtils; +import org.springframework.messaging.support.ChannelInterceptor; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -48,7 +49,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; public class GlobalChannelInterceptorTests { @Autowired ApplicationContext applicationContext; - + @Test public void validateGlobalInterceptor() throws Exception{ Map channels = applicationContext.getBeansOfType(MessageChannel.class); @@ -61,7 +62,7 @@ public class GlobalChannelInterceptorTests { channel = (MessageChannel) ((Advised)channel).getTargetSource().getTarget(); } List interceptorList = TestUtils.getPropertyValue(channel, "interceptors.interceptors", List.class); - ChannelInterceptor[] interceptors = interceptorList.toArray(new ChannelInterceptor[] {}); + ChannelInterceptor[] interceptors = interceptorList.toArray(new ChannelInterceptor[] {}); if (channelName.equals("inputA")){ // 328741 Assert.assertTrue(interceptors.length ==10); Assert.assertEquals("interceptor-three", interceptors[0].toString()); @@ -74,7 +75,7 @@ public class GlobalChannelInterceptorTests { Assert.assertEquals("interceptor-eleven", interceptors[7].toString()); Assert.assertEquals("interceptor-four", interceptors[8].toString()); Assert.assertEquals("interceptor-one", interceptors[9].toString()); - } + } else if (channelName.equals("inputB")) { Assert.assertTrue(interceptors.length == 6); Assert.assertEquals("interceptor-three", interceptors[0].toString()); @@ -83,7 +84,7 @@ public class GlobalChannelInterceptorTests { Assert.assertEquals("interceptor-eleven", interceptors[3].toString()); Assert.assertEquals("interceptor-four", interceptors[4].toString()); Assert.assertEquals("interceptor-one", interceptors[5].toString()); - } + } else if (channelName.equals("foo")) { Assert.assertTrue(interceptors.length == 6); Assert.assertEquals("interceptor-two", interceptors[0].toString()); @@ -111,13 +112,13 @@ public class GlobalChannelInterceptorTests { } } - + @Autowired @Qualifier("inpuC") MessageChannel inpuCchannel; @Test public void testWildCardPatternMatch() { - + List interceptorList = TestUtils.getPropertyValue(inpuCchannel, "interceptors.interceptors", List.class); List interceptorNames = new ArrayList(); for (Object interceptor : interceptorList) { @@ -127,7 +128,7 @@ public class GlobalChannelInterceptorTests { Assert.assertTrue(interceptorNames.contains("interceptor-eleven")); } - + public static class SampleInterceptor implements ChannelInterceptor { private String testIdentifier; @@ -153,10 +154,11 @@ public class GlobalChannelInterceptorTests { public Message preSend(Message message, MessageChannel channel) { return null; - } + } + @Override public String toString() { - return "interceptor-" + testIdentifier; + return "interceptor-" + testIdentifier; } } @@ -165,21 +167,23 @@ public class GlobalChannelInterceptorTests { private int order; + @Override public int getOrder() { return order; - } + } public void setOrder(int order) { this.order = order; } } - + public static class TestInterceptor implements MethodInterceptor{ + @Override public Object invoke(MethodInvocation invocation) throws Throwable { return invocation.proceed(); } - + } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/TestChannelInterceptor.java b/spring-integration-core/src/test/java/org/springframework/integration/config/TestChannelInterceptor.java index 1e1fb411e1..99d45d958b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/TestChannelInterceptor.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/TestChannelInterceptor.java @@ -20,7 +20,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; -import org.springframework.integration.channel.interceptor.ChannelInterceptorAdapter; +import org.springframework.messaging.support.ChannelInterceptorAdapter; /** * @author Mark Fisher diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/TestChannelInterceptor.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/TestChannelInterceptor.java index f4e68b2909..d013aec42e 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/TestChannelInterceptor.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/TestChannelInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2013 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. @@ -20,7 +20,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; -import org.springframework.integration.channel.interceptor.ChannelInterceptorAdapter; +import org.springframework.messaging.support.ChannelInterceptorAdapter; /** * @author Mark Fisher diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java index 059501a02b..503e05387f 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -28,7 +28,6 @@ import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.config.AbstractFactoryBean; import org.springframework.context.SmartLifecycle; -import org.springframework.integration.channel.ChannelInterceptor; import org.springframework.integration.jms.AbstractJmsChannel; import org.springframework.integration.jms.DynamicJmsTemplate; import org.springframework.integration.jms.PollableJmsChannel; @@ -39,6 +38,7 @@ import org.springframework.jms.listener.DefaultMessageListenerContainer; import org.springframework.jms.listener.SimpleMessageListenerContainer; import org.springframework.jms.support.converter.MessageConverter; import org.springframework.jms.support.destination.DestinationResolver; +import org.springframework.messaging.support.ChannelInterceptor; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; @@ -320,6 +320,7 @@ public class JmsChannelFactoryBean extends AbstractFactoryBean message = new AtomicReference(); final CountDownLatch latch1 = new CountDownLatch(1); Executors.newSingleThreadExecutor().execute(new Runnable() { + @Override public void run() { message.set(receiver.receive(queue)); latch1.countDown(); @@ -196,6 +198,7 @@ public class PollableJmsChannelTests { boolean sent2 = channel.send(MessageBuilder.withPayload("foo").setPriority(6).build()); assertTrue(sent2); Executors.newSingleThreadExecutor().execute(new Runnable() { + @Override public void run() { message.set(receiver.receive(queue)); latch2.countDown(); @@ -231,6 +234,7 @@ public class PollableJmsChannelTests { jmsTemplate.setDefaultDestinationName("pollableJmsChannelSelectorTestQueue"); jmsTemplate.send(new MessageCreator() { + @Override public javax.jms.Message createMessage(Session session) throws JMSException { TextMessage message = session.createTextMessage("bar"); message.setStringProperty("baz", "qux"); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests.java index 882e2f7d23..b4e62ddc4c 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests.java @@ -27,8 +27,8 @@ import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.channel.AbstractMessageChannel; -import org.springframework.integration.channel.interceptor.ChannelInterceptorAdapter; import org.springframework.integration.test.util.TestUtils; +import org.springframework.messaging.support.ChannelInterceptorAdapter; /** * @author Oleg Zhurakousky diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelParserTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelParserTests.java index adb9f62298..e7d39d30ea 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelParserTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -30,12 +30,10 @@ import javax.jms.Topic; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.messaging.MessageChannel; -import org.springframework.integration.channel.ChannelInterceptor; -import org.springframework.integration.channel.interceptor.ChannelInterceptorAdapter; import org.springframework.integration.jms.PollableJmsChannel; import org.springframework.integration.jms.SubscribableJmsChannel; import org.springframework.integration.test.util.TestUtils; @@ -44,6 +42,9 @@ import org.springframework.jms.listener.AbstractMessageListenerContainer; import org.springframework.jms.listener.DefaultMessageListenerContainer; import org.springframework.jms.listener.SimpleMessageListenerContainer; import org.springframework.jms.support.destination.DestinationResolver; +import org.springframework.messaging.MessageChannel; +import org.springframework.messaging.support.ChannelInterceptor; +import org.springframework.messaging.support.ChannelInterceptorAdapter; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -307,6 +308,7 @@ public class JmsChannelParserTests { @Autowired private Topic topic; + @Override public Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain) throws JMSException { if (!"foo".equals(destinationName)) { diff --git a/spring-integration-security/src/test/java/org/springframework/integration/security/config/SecuredChannelsParserTests.java b/spring-integration-security/src/test/java/org/springframework/integration/security/config/SecuredChannelsParserTests.java index e35debe10c..5cac7c605b 100644 --- a/spring-integration-security/src/test/java/org/springframework/integration/security/config/SecuredChannelsParserTests.java +++ b/spring-integration-security/src/test/java/org/springframework/integration/security/config/SecuredChannelsParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2013 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,6 +16,10 @@ package org.springframework.integration.security.config; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -26,25 +30,22 @@ import java.util.regex.Pattern; import org.junit.Before; import org.junit.Test; + import org.springframework.aop.Advisor; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; import org.springframework.beans.DirectFieldAccessor; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; import org.springframework.integration.channel.AbstractPollableChannel; -import org.springframework.integration.channel.ChannelInterceptor; import org.springframework.integration.core.MessageSelector; import org.springframework.integration.security.channel.ChannelAccessPolicy; import org.springframework.integration.security.channel.ChannelSecurityInterceptor; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageChannel; +import org.springframework.messaging.support.ChannelInterceptor; import org.springframework.security.access.ConfigAttribute; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - /** * @author Jonas Partner * @author Mark Fisher