This commit is contained in:
Mark Fisher
2008-12-15 22:12:35 +00:00
parent 36ef3d32cb
commit 8e5dfbe3a4
3 changed files with 10 additions and 6 deletions

View File

@@ -26,7 +26,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.channel.SubscribableChannel;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.file.CompositeFileListFilter;
import org.springframework.integration.file.FileReadingMessageSource;
import org.springframework.test.context.ContextConfiguration;
@@ -40,7 +41,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
public class FileInboundChannelAdapterParserTests {
@Autowired(required=true)
SubscribableChannel channel;
ApplicationContext context;
@Autowired(required=true)
FileReadingMessageSource source;
@@ -53,6 +54,7 @@ public class FileInboundChannelAdapterParserTests {
@Test
public void channelName() throws Exception {
MessageChannel channel = (MessageChannel) context.getBean("inputDirPoller");
assertEquals("Channel should be available under specified id","inputDirPoller", channel.getName());
}

View File

@@ -30,7 +30,8 @@ import org.junit.runner.RunWith;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.channel.SubscribableChannel;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.file.AcceptOnceFileListFilter;
import org.springframework.integration.file.CompositeFileListFilter;
@@ -48,7 +49,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
public class FileInboundChannelAdapterWithPatternParserTests {
@Autowired(required=true)
private SubscribableChannel channel;
private ApplicationContext context;
@Autowired(required=true)
private AbstractEndpoint endpoint;
@@ -63,6 +64,7 @@ public class FileInboundChannelAdapterWithPatternParserTests {
@Test
public void channelName() {
MessageChannel channel = (MessageChannel) context.getBean("adapterWithPattern");
assertEquals("adapterWithPattern", channel.getName());
}

View File

@@ -30,7 +30,7 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.core.task.TaskExecutor;
import org.springframework.integration.channel.MessagePublishingErrorHandler;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.channel.PublishSubscribeChannel;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.scheduling.SimpleTaskScheduler;
@@ -70,7 +70,7 @@ public class IntegrationNamespaceHandler implements NamespaceHandler {
*/
private static void registerTaskSchedulerIfNecessary(BeanDefinitionRegistry registry) {
if (!registry.containsBeanDefinition(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)) {
RootBeanDefinition errorChannelDef = new RootBeanDefinition(QueueChannel.class);
RootBeanDefinition errorChannelDef = new RootBeanDefinition(PublishSubscribeChannel.class);
BeanDefinitionHolder errorChannelHolder = new BeanDefinitionHolder(
errorChannelDef, IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME);
BeanDefinitionReaderUtils.registerBeanDefinition(errorChannelHolder, registry);