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 9db4cce9fb..bd6ab8db4c 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 @@ -73,6 +73,10 @@ final class GlobalChannelInterceptorBeanPostProcessor implements BeanPostProcess } public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + return bean; + } + + public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof MessageChannel) { if (logger.isDebugEnabled()) { logger.debug("Applying global interceptors on channel '" + beanName + "'"); @@ -82,10 +86,6 @@ final class GlobalChannelInterceptorBeanPostProcessor implements BeanPostProcess return bean; } - public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { - return bean; - } - /** * Adds any interceptor whose pattern matches against the channel's name. */ diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests-context.xml index afb75a3f33..5628c1bc7a 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests-context.xml @@ -13,7 +13,6 @@ - @@ -23,8 +22,9 @@ - + + 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 7143e5dd6e..3a9c732f13 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 @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.integration.jms.config; import static junit.framework.Assert.assertEquals; @@ -21,54 +22,36 @@ import static junit.framework.Assert.assertTrue; import java.util.List; -import org.junit.Ignore; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.integration.Message; -import org.springframework.integration.MessageChannel; import org.springframework.integration.channel.AbstractMessageChannel; -import org.springframework.integration.channel.ChannelInterceptor; +import org.springframework.integration.channel.interceptor.ChannelInterceptorAdapter; import org.springframework.integration.test.util.TestUtils; /** * @author Oleg Zhurakousky - * + * @author Mark Fisher + * @since 2.0.1 */ public class GlobalChannelInterceptorTests { - @SuppressWarnings("rawtypes") @Test - @Ignore - public void testJmsChannel(){ + public void testJmsChannel() { ActiveMqTestUtils.prepare(); - ApplicationContext context = new ClassPathXmlApplicationContext("GlobalChannelInterceptorTests-context.xml", - GlobalChannelInterceptorTests.class); + ApplicationContext context = new ClassPathXmlApplicationContext( + "GlobalChannelInterceptorTests-context.xml", GlobalChannelInterceptorTests.class); AbstractMessageChannel jmsChannel = context.getBean("jmsChannel", AbstractMessageChannel.class); Object interceptors = TestUtils.getPropertyValue((TestUtils.getPropertyValue(jmsChannel, "interceptors")), "interceptors"); assertNotNull(interceptors); assertTrue(interceptors instanceof List); - assertEquals(1, ((List)interceptors).size()); - assertTrue(((List)interceptors).get(0) instanceof SampleInterceptor); + assertEquals(1, ((List) interceptors).size()); + assertTrue(((List) interceptors).get(0) instanceof SampleInterceptor); } - - public static class SampleInterceptor 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; - } - + public static class SampleInterceptor extends ChannelInterceptorAdapter { } + }