diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/bus/DefaultChannelFactoryBean.java b/org.springframework.integration/src/main/java/org/springframework/integration/bus/DefaultChannelFactoryBean.java deleted file mode 100644 index 0d8951fc81..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/bus/DefaultChannelFactoryBean.java +++ /dev/null @@ -1,95 +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.bus; - -import java.util.List; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.FactoryBean; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.integration.channel.ChannelInterceptor; -import org.springframework.integration.channel.MessageChannel; -import org.springframework.integration.channel.factory.ChannelFactory; -import org.springframework.integration.channel.factory.QueueChannelFactory; - -/** - * Creates a channel by delegating to the "channelFactory" bean defined - * within the {@link ApplicationContext} or else the default implementation - * (QueueChannelFactory). - *

- * As a {@link FactoryBean}, this class is solely intended to be used within - * an ApplicationContext. - * - * @author Marius Bogoevici - * @author Mark Fisher - */ -public class DefaultChannelFactoryBean implements ApplicationContextAware, FactoryBean, BeanNameAware { - - public static final String CHANNEL_FACTORY_BEAN_NAME = "channelFactory"; - - private volatile String beanName; - - private volatile List interceptors; - - private volatile ApplicationContext applicationContext; - - private volatile MessageChannel channel; - - private final Object initializationMonitor = new Object(); - - - public void setApplicationContext(ApplicationContext applicationContext) { - this.applicationContext = applicationContext; - } - - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public void setInterceptors(List interceptors) { - this.interceptors = interceptors; - } - - public Object getObject() throws Exception { - synchronized (this.initializationMonitor) { - if (this.channel == null) { - ChannelFactory channelFactory = null; - if (this.applicationContext.containsBean(CHANNEL_FACTORY_BEAN_NAME)) { - channelFactory = (ChannelFactory) this.applicationContext.getBean(CHANNEL_FACTORY_BEAN_NAME); - } - else { - channelFactory = new QueueChannelFactory(); - } - this.channel = channelFactory.getChannel(this.beanName, this.interceptors); - } - } - return this.channel; - } - - public Class getObjectType() { - if (this.channel == null) { - return MessageChannel.class; - } - return this.channel.getClass(); - } - - public boolean isSingleton() { - return true; - } - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/AbstractChannelFactory.java b/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/AbstractChannelFactory.java deleted file mode 100644 index b14a2d12ca..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/AbstractChannelFactory.java +++ /dev/null @@ -1,54 +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.factory; - -import java.util.List; - -import org.springframework.integration.channel.AbstractMessageChannel; -import org.springframework.integration.channel.ChannelInterceptor; -import org.springframework.integration.channel.MessageChannel; - -/** - * Base class for {@link ChannelFactory} implementations. Subclasses should - * override {@literal createChannelInternal()}. - * - * @author Marius Bogoevici - */ -public abstract class AbstractChannelFactory implements ChannelFactory { - - public AbstractChannelFactory() { - super(); - } - - public final MessageChannel getChannel(String name, List interceptors) { - AbstractMessageChannel channel = createChannelInternal(); - if (null != interceptors) { - channel.setInterceptors(interceptors); - } - if (name != null && channel.getName() == null) { - channel.setBeanName(name); - } - return channel; - } - - /** - * Factory method to be overridden by subclasses. It assumes that subclasses will return - * subclasses of AbstractMessageChannel. - */ - protected abstract AbstractMessageChannel createChannelInternal(); - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/ChannelFactory.java b/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/ChannelFactory.java deleted file mode 100644 index 88a916b917..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/ChannelFactory.java +++ /dev/null @@ -1,36 +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.factory; - -import java.util.List; - -import org.springframework.integration.channel.ChannelInterceptor; -import org.springframework.integration.channel.MessageChannel; - -/** - * Interface for a channel factory. - * - * @author Marius Bogoevici - */ -public interface ChannelFactory { - - /** - * Creates a channel based on the provided name and interceptors. - */ - MessageChannel getChannel(String name, List interceptors); - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/DirectChannelFactory.java b/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/DirectChannelFactory.java deleted file mode 100644 index 71944c7c70..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/DirectChannelFactory.java +++ /dev/null @@ -1,34 +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.factory; - -import org.springframework.integration.channel.AbstractMessageChannel; -import org.springframework.integration.channel.DirectChannel; - -/** - * A {@link ChannelFactory} for creating {@link DirectChannel} instances. - * - * @author Marius Bogoevici - */ -public class DirectChannelFactory extends AbstractChannelFactory { - - @Override - protected AbstractMessageChannel createChannelInternal() { - return new DirectChannel(); - } - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/PriorityChannelFactory.java b/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/PriorityChannelFactory.java deleted file mode 100644 index 834e4219bd..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/PriorityChannelFactory.java +++ /dev/null @@ -1,52 +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.factory; - -import java.util.Comparator; - -import org.springframework.integration.channel.AbstractMessageChannel; -import org.springframework.integration.channel.PriorityChannel; -import org.springframework.integration.message.Message; -import org.springframework.util.Assert; - -/** - * A {@link ChannelFactory} for creating {@link PriorityChannel} instances. - * @author Marius Bogoevici - * - */ -public class PriorityChannelFactory extends AbstractChannelFactory { - - private int capacity = PriorityChannel.DEFAULT_CAPACITY; - - private Comparator> comparator; - - - public void setCapacity(int capacity) { - Assert.isTrue(capacity > 0, "capacity must be a positive value"); - this.capacity = capacity; - } - - public void setComparator(Comparator> comparator) { - this.comparator = comparator; - } - - @Override - protected AbstractMessageChannel createChannelInternal() { - return new PriorityChannel(this.capacity, this.comparator); - } - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/QueueChannelFactory.java b/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/QueueChannelFactory.java deleted file mode 100644 index be68f95e32..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/QueueChannelFactory.java +++ /dev/null @@ -1,51 +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.factory; - -import org.springframework.integration.channel.AbstractMessageChannel; -import org.springframework.integration.channel.QueueChannel; -import org.springframework.util.Assert; - -/** - * Default implementation of a {@link ChannelFactory}, which will create instances of a - * {@link QueueChannel}. - * - * @author Marius Bogoevici - */ -public class QueueChannelFactory extends AbstractChannelFactory{ - - int queueCapacity = QueueChannel.DEFAULT_CAPACITY; - - public int getQueueCapacity() { - return queueCapacity; - } - - /** - * Sets the queue capacity for the newly created channels. - * By default, the queue capacity is {@literal QueueChannel.DEFAULT_CAPACITY} - * @param queueCapacity - */ - public void setQueueCapacity(int queueCapacity) { - Assert.state(queueCapacity > 0, "Queue capacity must be greater than zero"); - this.queueCapacity = queueCapacity; - } - - protected AbstractMessageChannel createChannelInternal() { - return new QueueChannel(queueCapacity); - } - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/RendezvousChannelFactory.java b/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/RendezvousChannelFactory.java deleted file mode 100644 index 08f541b415..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/RendezvousChannelFactory.java +++ /dev/null @@ -1,34 +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.factory; - -import org.springframework.integration.channel.AbstractMessageChannel; -import org.springframework.integration.channel.RendezvousChannel; - -/** - * A {@link ChannelFactory} for creating {@link RendezvousChannel} instances. - * - * @author Marius Bogoevici - */ -public class RendezvousChannelFactory extends AbstractChannelFactory { - - @Override - protected AbstractMessageChannel createChannelInternal() { - return new RendezvousChannel(); - } - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/ThreadLocalChannelFactory.java b/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/ThreadLocalChannelFactory.java deleted file mode 100644 index 3f18c2c428..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/channel/factory/ThreadLocalChannelFactory.java +++ /dev/null @@ -1,34 +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.factory; - -import org.springframework.integration.channel.AbstractMessageChannel; -import org.springframework.integration.channel.ThreadLocalChannel; - -/** - * A {@link ChannelFactory} implementation for creating {@link ThreadLocalChannel} instances. - * - * @author Mark Fisher - */ -public class ThreadLocalChannelFactory extends AbstractChannelFactory { - - @Override - protected AbstractMessageChannel createChannelInternal() { - return new ThreadLocalChannel(); - } - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/DefaultChannelParser.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/DefaultChannelParser.java deleted file mode 100644 index 7fe965b871..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/config/DefaultChannelParser.java +++ /dev/null @@ -1,35 +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.config; - -import org.springframework.integration.bus.DefaultChannelFactoryBean; - -import org.w3c.dom.Element; - -/** - * Parser for the <channel> element. - * - * @author Marius Bogoevici - */ -public class DefaultChannelParser extends AbstractChannelParser { - - @Override - protected Class getBeanClass(Element element) { - return DefaultChannelFactoryBean.class; - } - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java index 04d4748fc3..7dda60e48a 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java @@ -49,7 +49,7 @@ public class IntegrationNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("message-bus", new MessageBusParser()); registerBeanDefinitionParser("annotation-driven", new AnnotationDrivenParser()); - registerBeanDefinitionParser("channel", new DefaultChannelParser()); + registerBeanDefinitionParser("channel", new QueueChannelParser()); registerBeanDefinitionParser("queue-channel", new QueueChannelParser()); registerBeanDefinitionParser("publish-subscribe-channel", new PublishSubscribeChannelParser()); registerBeanDefinitionParser("direct-channel", new DirectChannelParser()); diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/DefaultChannelParserTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/DefaultChannelParserTests.java deleted file mode 100644 index 34155b13b9..0000000000 --- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/DefaultChannelParserTests.java +++ /dev/null @@ -1,40 +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.config; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.integration.channel.MessageChannel; -import org.springframework.integration.channel.factory.StubChannel; - -/** - * @author Marius Bogoevici - */ -public class DefaultChannelParserTests { - - @Test - public void testDefaultChannel() { - ApplicationContext context = new ClassPathXmlApplicationContext("defaultChannelParserTests.xml", this.getClass()); - MessageChannel channel = (MessageChannel) context.getBean("defaultChannel"); - assertEquals(StubChannel.class, channel.getClass()); - } - -} diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/defaultChannelParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/defaultChannelParserTests.xml deleted file mode 100644 index 26a6ec7ef1..0000000000 --- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/config/defaultChannelParserTests.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/ChannelFactoryTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/ChannelFactoryTests.java deleted file mode 100644 index fce44629bb..0000000000 --- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/ChannelFactoryTests.java +++ /dev/null @@ -1,149 +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.factory; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Before; -import org.junit.Test; - -import org.springframework.beans.DirectFieldAccessor; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.context.support.StaticApplicationContext; -import org.springframework.integration.bus.DefaultChannelFactoryBean; -import org.springframework.integration.channel.AbstractMessageChannel; -import org.springframework.integration.channel.ChannelInterceptor; -import org.springframework.integration.channel.DirectChannel; -import org.springframework.integration.channel.MessageChannel; -import org.springframework.integration.channel.PriorityChannel; -import org.springframework.integration.channel.QueueChannel; -import org.springframework.integration.channel.RendezvousChannel; -import org.springframework.integration.channel.ThreadLocalChannel; -import org.springframework.integration.channel.interceptor.ChannelInterceptorAdapter; -import org.springframework.integration.message.Message; -import org.springframework.integration.message.MessageBuilder; - -/** - * @author Marius Bogoevici - * @author Mark Fisher - */ -public class ChannelFactoryTests { - - private final ArrayList interceptors = new ArrayList(); - - private final ArrayList appliedInterceptors = new ArrayList(); - - @Before - public void initInterceptorsList() { - interceptors.add(new TestChannelInterceptor()); - interceptors.add(new TestChannelInterceptor()); - } - - - @Test - public void testQueueChannelFactory() { - QueueChannelFactory channelFactory = new QueueChannelFactory(); - channelFactory.setQueueCapacity(99); - genericChannelFactoryTests(channelFactory, QueueChannel.class); - assertEquals(99, channelFactory.getQueueCapacity()); - } - - @Test - public void testDirectChannelFactory() { - DirectChannelFactory channelFactory = new DirectChannelFactory(); - assertNotNull(interceptors); - AbstractMessageChannel channel = (AbstractMessageChannel) - channelFactory.getChannel("testChannel", interceptors); - assertEquals(DirectChannel.class, channel.getClass()); - assertEquals("testChannel", channel.getName()); - assertInterceptors(channel); - } - - @Test - public void testRendezvousChannelFactory() { - RendezvousChannelFactory channelFactory = new RendezvousChannelFactory(); - genericChannelFactoryTests(channelFactory, RendezvousChannel.class); - } - - @Test - public void testPriorityChannelFactory() { - PriorityChannelFactory channelFactory = new PriorityChannelFactory(); - genericChannelFactoryTests(channelFactory, PriorityChannel.class); - } - - @Test - public void testThreadLocalChannelFactory() { - ThreadLocalChannelFactory channelFactory = new ThreadLocalChannelFactory(); - assertNotNull(interceptors); - AbstractMessageChannel channel = (AbstractMessageChannel) - channelFactory.getChannel("testChannel", interceptors); - assertEquals(ThreadLocalChannel.class, channel.getClass()); - assertEquals("testChannel", channel.getName()); - assertInterceptors(channel); - } - - @Test - public void testDefaultChannelFactoryBean() throws Exception{ - StaticApplicationContext applicationContext = new StaticApplicationContext(); - BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(StubChannelFactory.class); - applicationContext.registerBeanDefinition("channelFactory", builder.getBeanDefinition()); - DefaultChannelFactoryBean channelFactoryBean = new DefaultChannelFactoryBean(); - channelFactoryBean.setBeanName("testChannel"); - channelFactoryBean.setApplicationContext(applicationContext); - channelFactoryBean.setInterceptors(interceptors); - MessageChannel channel = (MessageChannel) channelFactoryBean.getObject(); - channel.getName(); - assertEquals(StubChannel.class, channel.getClass()); - assertEquals("testChannel", channel.getName()); - channel.send(MessageBuilder.fromPayload("").build()); - assertTrue(appliedInterceptors.get(0) == interceptors.get(0)); - assertTrue(appliedInterceptors.get(1) == interceptors.get(1)); - } - - private void genericChannelFactoryTests(ChannelFactory channelFactory, Class expectedChannelClass) { - assertNotNull(interceptors); - AbstractMessageChannel channel = (AbstractMessageChannel) channelFactory.getChannel("testChannel", interceptors); - assertEquals(expectedChannelClass, channel.getClass()); - assertEquals("testChannel", channel.getName()); - assertInterceptors(channel); - } - - @SuppressWarnings("unchecked") - private void assertInterceptors(AbstractMessageChannel channel) { - Object interceptorsWrapper = new DirectFieldAccessor(channel).getPropertyValue("interceptors"); - List interceptors = (List) - new DirectFieldAccessor(interceptorsWrapper).getPropertyValue("interceptors"); - assertTrue(interceptors.get(0) == this.interceptors.get(0)); - assertTrue(interceptors.get(1) == this.interceptors.get(1)); - } - - - private class TestChannelInterceptor extends ChannelInterceptorAdapter { - - public Message preSend(Message message, MessageChannel channel) { - appliedInterceptors.add(this); - return message; - } - - } - -} diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/StubChannel.java b/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/StubChannel.java deleted file mode 100644 index 14a205d760..0000000000 --- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/StubChannel.java +++ /dev/null @@ -1,48 +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.factory; - -import java.util.List; - -import org.springframework.integration.channel.AbstractPollableChannel; -import org.springframework.integration.message.Message; -import org.springframework.integration.message.selector.MessageSelector; - -/** - * @author Marius Bogoevici - */ -public class StubChannel extends AbstractPollableChannel { - - @Override - protected Message doReceive(long timeout) { - return null; - } - - @Override - protected boolean doSend(Message message, long timeout) { - return false; - } - - public List> clear() { - return null; - } - - public List> purge(MessageSelector selector) { - return null; - } - -} diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/StubChannelFactory.java b/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/StubChannelFactory.java deleted file mode 100644 index 976a795f54..0000000000 --- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/StubChannelFactory.java +++ /dev/null @@ -1,31 +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.factory; - -import org.springframework.integration.channel.AbstractMessageChannel; - -/** - * @author Marius Bogoevici - */ -public class StubChannelFactory extends AbstractChannelFactory { - - @Override - protected AbstractMessageChannel createChannelInternal() { - return new StubChannel(); - } - -} diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/defaultChannelFactoryBeanTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/defaultChannelFactoryBeanTests.xml deleted file mode 100644 index 46ab83003e..0000000000 --- a/org.springframework.integration/src/test/java/org/springframework/integration/channel/factory/defaultChannelFactoryBeanTests.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/MessageBusParserTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/config/MessageBusParserTests.java index ad2e833a48..1fb069513e 100644 --- a/org.springframework.integration/src/test/java/org/springframework/integration/config/MessageBusParserTests.java +++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/MessageBusParserTests.java @@ -37,9 +37,6 @@ import org.springframework.integration.bus.MessageBusInterceptorTests; import org.springframework.integration.bus.TestMessageBusAwareImpl; import org.springframework.integration.bus.TestMessageBusStartInterceptor; import org.springframework.integration.bus.TestMessageBusStopInterceptor; -import org.springframework.integration.channel.DirectChannel; -import org.springframework.integration.channel.MessageChannel; -import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.scheduling.TaskScheduler; import org.springframework.integration.scheduling.spi.ProviderTaskScheduler; @@ -115,15 +112,6 @@ public class MessageBusParserTests { assertTrue(messageBusAware.getMessageBus() == context.getBean(MessageBusParser.MESSAGE_BUS_BEAN_NAME)); } - @Test - public void testMessageBusWithChannelFactory() { - ApplicationContext context = new ClassPathXmlApplicationContext("messageBusWithChannelFactory.xml", - this.getClass()); - ((MessageChannel)context.getBean("defaultTypeChannel")).getName(); - assertEquals(DirectChannel.class, context.getBean("defaultTypeChannel").getClass()); - assertEquals(QueueChannel.class, context.getBean("specifiedTypeChannel").getClass()); - } - @Test public void testMulticasterIsSyncByDefault() { ApplicationContext context = new ClassPathXmlApplicationContext( diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/messageBusWithChannelFactory.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/messageBusWithChannelFactory.xml deleted file mode 100644 index ba147a89f6..0000000000 --- a/org.springframework.integration/src/test/java/org/springframework/integration/config/messageBusWithChannelFactory.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - -