Removed DefaultChannelRegistry, and add TestChannelRegistry (for tests only).

This commit is contained in:
Mark Fisher
2008-09-29 18:48:29 +00:00
parent 4954228395
commit a7dcd5f31f
11 changed files with 78 additions and 108 deletions

View File

@@ -25,8 +25,8 @@ import org.junit.Test;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.channel.TestChannelRegistry;
import org.springframework.integration.message.Message;
/**
@@ -38,7 +38,7 @@ public class PublisherAnnotationAdvisorTests {
public void testPublisherAnnotation() {
final QueueChannel channel = new QueueChannel();
channel.setBeanName("testChannel");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(channel);
PublisherAnnotationAdvisor advisor = new PublisherAnnotationAdvisor(channelRegistry);
TestService proxy = (TestService) this.createProxy(new TestServiceImpl("hello world"), advisor);
@@ -52,7 +52,7 @@ public class PublisherAnnotationAdvisorTests {
public void testNoPublisherAnnotation() {
final QueueChannel channel = new QueueChannel();
channel.setBeanName("testChannel");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(channel);
PublisherAnnotationAdvisor advisor = new PublisherAnnotationAdvisor(channelRegistry);
TestService proxy = (TestService) this.createProxy(new TestServiceImpl("hello world"), advisor);
@@ -65,7 +65,7 @@ public class PublisherAnnotationAdvisorTests {
public void testPublishArguments() {
final QueueChannel channel = new QueueChannel();
channel.setBeanName("testChannel");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(channel);
PublisherAnnotationAdvisor advisor = new PublisherAnnotationAdvisor(channelRegistry);
TestService proxy = (TestService) this.createProxy(new TestServiceImpl("hello world"), advisor);
@@ -83,7 +83,7 @@ public class PublisherAnnotationAdvisorTests {
public void testPublishException() {
final QueueChannel channel = new QueueChannel();
channel.setBeanName("testChannel");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(channel);
PublisherAnnotationAdvisor advisor = new PublisherAnnotationAdvisor(channelRegistry);
TestService proxy = (TestService) this.createProxy(new TestServiceImpl("hello world"), advisor);
@@ -106,7 +106,7 @@ public class PublisherAnnotationAdvisorTests {
public void testPublishReturnValue() {
final QueueChannel channel = new QueueChannel();
channel.setBeanName("testChannel");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(channel);
PublisherAnnotationAdvisor advisor = new PublisherAnnotationAdvisor(channelRegistry);
TestService proxy = (TestService) this.createProxy(new TestServiceImpl("hello world"), advisor);

View File

@@ -19,6 +19,7 @@ package org.springframework.integration.bus;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.util.concurrent.CountDownLatch;
@@ -30,6 +31,7 @@ import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.channel.PublishSubscribeChannel;
import org.springframework.integration.channel.QueueChannel;
@@ -49,7 +51,7 @@ import org.springframework.integration.scheduling.IntervalTrigger;
public class DefaultMessageBusTests {
@Test
public void testRegistrationWithInputChannelReference() {
public void endpointRegistrationWithInputChannelReference() {
GenericApplicationContext context = new GenericApplicationContext();
QueueChannel sourceChannel = new QueueChannel();
QueueChannel targetChannel = new QueueChannel();
@@ -78,7 +80,7 @@ public class DefaultMessageBusTests {
}
@Test
public void testChannelsWithoutHandlers() {
public void channelsWithoutHandlers() {
GenericApplicationContext context = new GenericApplicationContext();
DefaultMessageBus bus = new DefaultMessageBus();
bus.setApplicationContext(context);
@@ -96,7 +98,7 @@ public class DefaultMessageBusTests {
}
@Test
public void testAutodetectionWithApplicationContext() {
public void autodetectionWithApplicationContext() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("messageBusTests.xml", this.getClass());
context.start();
PollableChannel sourceChannel = (PollableChannel) context.getBean("sourceChannel");
@@ -109,7 +111,7 @@ public class DefaultMessageBusTests {
}
@Test
public void testExactlyOneHandlerReceivesPointToPointMessage() {
public void exactlyOneConsumerReceivesPointToPointMessage() {
GenericApplicationContext context = new GenericApplicationContext();
QueueChannel inputChannel = new QueueChannel();
QueueChannel outputChannel1 = new QueueChannel();
@@ -149,7 +151,7 @@ public class DefaultMessageBusTests {
}
@Test
public void testBothHandlersReceivePublishSubscribeMessage() throws InterruptedException {
public void bothConsumersReceivePublishSubscribeMessage() throws InterruptedException {
GenericApplicationContext context = new GenericApplicationContext();
PublishSubscribeChannel inputChannel = new PublishSubscribeChannel();
QueueChannel outputChannel1 = new QueueChannel();
@@ -197,7 +199,7 @@ public class DefaultMessageBusTests {
}
@Test
public void testErrorChannelWithFailedDispatch() throws InterruptedException {
public void errorChannelWithFailedDispatch() throws InterruptedException {
GenericApplicationContext context = new GenericApplicationContext();
QueueChannel errorChannel = new QueueChannel();
QueueChannel outputChannel = new QueueChannel();
@@ -224,12 +226,12 @@ public class DefaultMessageBusTests {
}
@Test(expected = BeanCreationException.class)
public void testMultipleMessageBusBeans() {
public void multipleMessageBusBeans() {
new ClassPathXmlApplicationContext("multipleMessageBusBeans.xml", this.getClass());
}
@Test
public void testErrorChannelRegistration() {
public void errorChannelRegistration() {
DefaultMessageBus bus = new DefaultMessageBus();
QueueChannel errorChannel = new QueueChannel();
errorChannel.setBeanName(ChannelRegistry.ERROR_CHANNEL_NAME);
@@ -238,7 +240,7 @@ public class DefaultMessageBusTests {
}
@Test
public void testHandlerSubscribedToErrorChannel() throws InterruptedException {
public void consumerSubscribedToErrorChannel() throws InterruptedException {
GenericApplicationContext context = new GenericApplicationContext();
QueueChannel errorChannel = new QueueChannel();
errorChannel.setBeanName(ChannelRegistry.ERROR_CHANNEL_NAME);
@@ -262,7 +264,25 @@ public class DefaultMessageBusTests {
}
@Test
public void testMessageBusAwareImpl() {
public void lookupRegisteredChannel() {
DefaultMessageBus messageBus = new DefaultMessageBus();
QueueChannel testChannel = new QueueChannel();
testChannel.setBeanName("testChannel");
messageBus.registerChannel(testChannel);
MessageChannel lookedUpChannel = messageBus.lookupChannel("testChannel");
assertNotNull(testChannel);
assertSame(testChannel, lookedUpChannel);
}
@Test
public void lookupNonRegisteredChannel() {
DefaultMessageBus messageBus = new DefaultMessageBus();
MessageChannel noSuchChannel = messageBus.lookupChannel("noSuchChannel");
assertNull(noSuchChannel);
}
@Test
public void messageBusAware() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("messageBusTests.xml", this.getClass());
TestMessageBusAwareImpl messageBusAwareBean = (TestMessageBusAwareImpl) context.getBean("messageBusAwareBean");
assertTrue(messageBusAwareBean.getMessageBus() == context.getBean("bus"));

View File

@@ -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;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import org.junit.Test;
/**
* @author Mark Fisher
*/
public class DefaultChannelRegistryTests {
@Test
public void testLookupRegisteredChannel() {
QueueChannel testChannel = new QueueChannel();
testChannel.setBeanName("testChannel");
DefaultChannelRegistry registry = new DefaultChannelRegistry();
registry.registerChannel(testChannel);
MessageChannel lookedUpChannel = registry.lookupChannel("testChannel");
assertNotNull(testChannel);
assertSame(testChannel, lookedUpChannel);
}
@Test
public void testLookupNonRegisteredChannel() {
DefaultChannelRegistry registry = new DefaultChannelRegistry();
MessageChannel noSuchChannel = registry.lookupChannel("noSuchChannel");
assertNull(noSuchChannel);
}
}

View File

@@ -0,0 +1,42 @@
/*
* 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;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.springframework.util.Assert;
/**
* @author Mark Fisher
*/
public class TestChannelRegistry implements ChannelRegistry {
private final Map<String, MessageChannel> channels = new ConcurrentHashMap<String, MessageChannel>();
public MessageChannel lookupChannel(String channelName) {
return this.channels.get(channelName);
}
public void registerChannel(MessageChannel channel) {
Assert.notNull(channel, "'channel' must not be null");
Assert.notNull(channel.getName(), "channel name must not be null");
this.channels.put(channel.getName(), channel);
}
}

View File

@@ -30,8 +30,8 @@ import org.junit.Test;
import org.springframework.integration.bus.DefaultMessageBus;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.channel.TestChannelRegistry;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.message.MessageHandlingException;
@@ -106,7 +106,7 @@ public class ServiceActivatorEndpointTests {
final QueueChannel replyChannel1 = new QueueChannel();
final QueueChannel replyChannel2 = new QueueChannel();
replyChannel2.setBeanName("replyChannel2");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(replyChannel2);
Object handler = new Object() {
@SuppressWarnings("unused")

View File

@@ -29,7 +29,7 @@ import org.junit.Test;
import org.springframework.integration.annotation.Header;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.ChannelRegistryAware;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.TestChannelRegistry;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.message.GenericMessage;
@@ -47,7 +47,7 @@ public class MethodInvokingRouterTests {
public void channelNameResolutionByPayloadConfiguredByMethodReference() throws Exception {
QueueChannel barChannel = new QueueChannel();
barChannel.setBeanName("bar-channel");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(barChannel);
SingleChannelNameRoutingTestBean testBean = new SingleChannelNameRoutingTestBean();
Method routingMethod = testBean.getClass().getMethod("routePayload", String.class);
@@ -65,7 +65,7 @@ public class MethodInvokingRouterTests {
public void channelNameResolutionByPayloadConfiguredByMethodName() {
QueueChannel barChannel = new QueueChannel();
barChannel.setBeanName("bar-channel");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(barChannel);
SingleChannelNameRoutingTestBean testBean = new SingleChannelNameRoutingTestBean();
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, "routePayload");
@@ -84,7 +84,7 @@ public class MethodInvokingRouterTests {
QueueChannel barChannel = new QueueChannel();
fooChannel.setBeanName("foo-channel");
barChannel.setBeanName("bar-channel");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(fooChannel);
channelRegistry.registerChannel(barChannel);
SingleChannelNameRoutingTestBean testBean = new SingleChannelNameRoutingTestBean();
@@ -133,7 +133,7 @@ public class MethodInvokingRouterTests {
QueueChannel barChannel = new QueueChannel();
fooChannel.setBeanName("foo-channel");
barChannel.setBeanName("bar-channel");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(fooChannel);
channelRegistry.registerChannel(barChannel);
endpoint.setChannelRegistry(channelRegistry);
@@ -153,7 +153,7 @@ public class MethodInvokingRouterTests {
@Test
public void channelInstanceResolutionByPayloadConfiguredByMethodReference() throws Exception {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
SingleChannelInstanceRoutingTestBean testBean = new SingleChannelInstanceRoutingTestBean(channelRegistry);
Method routingMethod = testBean.getClass().getMethod("routePayload", String.class);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, routingMethod);
@@ -163,7 +163,7 @@ public class MethodInvokingRouterTests {
@Test
public void channelInstanceResolutionByPayloadConfiguredByMethodName() {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
SingleChannelInstanceRoutingTestBean testBean = new SingleChannelInstanceRoutingTestBean(channelRegistry);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, "routePayload");
RouterEndpoint endpoint = new RouterEndpoint(resolver);
@@ -194,7 +194,7 @@ public class MethodInvokingRouterTests {
@Test
public void channelInstanceResolutionByMessageConfiguredByMethodReference() throws Exception {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
SingleChannelInstanceRoutingTestBean testBean = new SingleChannelInstanceRoutingTestBean(channelRegistry);
Method routingMethod = testBean.getClass().getMethod("routeMessage", Message.class);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, routingMethod);
@@ -204,7 +204,7 @@ public class MethodInvokingRouterTests {
@Test
public void channelInstanceResolutionByMessageConfiguredByMethodName() {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
SingleChannelInstanceRoutingTestBean testBean = new SingleChannelInstanceRoutingTestBean(channelRegistry);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, "routeMessage");
RouterEndpoint endpoint = new RouterEndpoint(resolver);
@@ -235,7 +235,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelNameResolutionByPayloadConfiguredByMethodReference() throws Exception {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelNameRoutingTestBean testBean = new MultiChannelNameRoutingTestBean();
Method routingMethod = testBean.getClass().getMethod("routePayload", String.class);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, routingMethod);
@@ -245,7 +245,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelNameResolutionByPayloadConfiguredByMethodName() {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelNameRoutingTestBean testBean = new MultiChannelNameRoutingTestBean();
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, "routePayload");
RouterEndpoint endpoint = new RouterEndpoint(resolver);
@@ -282,7 +282,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelNameResolutionByMessageConfiguredByMethodReference() throws Exception {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelNameRoutingTestBean testBean = new MultiChannelNameRoutingTestBean();
Method routingMethod = testBean.getClass().getMethod("routeMessage", Message.class);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, routingMethod);
@@ -292,7 +292,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelNameResolutionByMessageConfiguredByMethodName() throws Exception {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelNameRoutingTestBean testBean = new MultiChannelNameRoutingTestBean();
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, "routeMessage");
RouterEndpoint endpoint = new RouterEndpoint(resolver);
@@ -329,7 +329,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelNameArrayResolutionByMessageConfiguredByMethodReference() throws Exception {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelNameRoutingTestBean testBean = new MultiChannelNameRoutingTestBean();
Method routingMethod = testBean.getClass().getMethod("routeMessageToArray", Message.class);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, routingMethod);
@@ -339,7 +339,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelNameArrayResolutionByMessageConfiguredByMethodName() {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelNameRoutingTestBean testBean = new MultiChannelNameRoutingTestBean();
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, "routeMessageToArray");
RouterEndpoint endpoint = new RouterEndpoint(resolver);
@@ -376,7 +376,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelListResolutionByPayloadConfiguredByMethodReference() throws Exception {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelInstanceRoutingTestBean testBean = new MultiChannelInstanceRoutingTestBean(channelRegistry);
Method routingMethod = testBean.getClass().getMethod("routePayload", String.class);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, routingMethod);
@@ -386,7 +386,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelListResolutionByPayloadConfiguredByMethodName() {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelInstanceRoutingTestBean testBean = new MultiChannelInstanceRoutingTestBean(channelRegistry);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, "routePayload");
RouterEndpoint endpoint = new RouterEndpoint(resolver);
@@ -423,7 +423,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelListResolutionByMessageConfiguredByMethodReference() throws Exception {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelInstanceRoutingTestBean testBean = new MultiChannelInstanceRoutingTestBean(channelRegistry);
Method routingMethod = testBean.getClass().getMethod("routeMessage", Message.class);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, routingMethod);
@@ -433,7 +433,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelListResolutionByMessageConfiguredByMethodName() {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelInstanceRoutingTestBean testBean = new MultiChannelInstanceRoutingTestBean(channelRegistry);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, "routeMessage");
RouterEndpoint endpoint = new RouterEndpoint(resolver);
@@ -470,7 +470,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelArrayResolutionByMessageConfiguredByMethodReference() throws Exception {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelInstanceRoutingTestBean testBean = new MultiChannelInstanceRoutingTestBean(channelRegistry);
Method routingMethod = testBean.getClass().getMethod("routeMessageToArray", Message.class);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, routingMethod);
@@ -480,7 +480,7 @@ public class MethodInvokingRouterTests {
@Test
public void multiChannelArrayResolutionByMessageConfiguredByMethodName() {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
MultiChannelInstanceRoutingTestBean testBean = new MultiChannelInstanceRoutingTestBean(channelRegistry);
MethodInvokingChannelResolver resolver = new MethodInvokingChannelResolver(testBean, "routeMessageToArray");
RouterEndpoint endpoint = new RouterEndpoint(resolver);

View File

@@ -25,7 +25,7 @@ import java.util.List;
import org.junit.Test;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.TestChannelRegistry;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.message.Message;
@@ -71,7 +71,7 @@ public class MultiChannelRouterTests {
QueueChannel channel2 = new QueueChannel();
channel1.setBeanName("channel1");
channel2.setBeanName("channel2");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(channel1);
channelRegistry.registerChannel(channel2);
RouterEndpoint endpoint = new RouterEndpoint(channelNameResolver);
@@ -93,7 +93,7 @@ public class MultiChannelRouterTests {
return new String[] {"noSuchChannel"};
}
};
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
RouterEndpoint endpoint = new RouterEndpoint(channelNameResolver);
endpoint.setChannelRegistry(channelRegistry);
Message<String> message = new StringMessage("test");

View File

@@ -24,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.junit.Test;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.TestChannelRegistry;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.message.GenericMessage;
@@ -62,7 +62,7 @@ public class PayloadTypeRouterTests {
Map<Class<?>, MessageChannel> channelMappings = new ConcurrentHashMap<Class<?>, MessageChannel>();
channelMappings.put(String.class, stringChannel);
channelMappings.put(Integer.class, integerChannel);
DefaultChannelRegistry channelRegistry = new DefaultChannelRegistry();
TestChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(stringChannel);
channelRegistry.registerChannel(integerChannel);
PayloadTypeChannelResolver resolver = new PayloadTypeChannelResolver();
@@ -85,7 +85,7 @@ public class PayloadTypeRouterTests {
stringChannel.setBeanName("stringChannel");
QueueChannel defaultChannel = new QueueChannel();
defaultChannel.setBeanName("defaultChannel");
DefaultChannelRegistry channelRegistry = new DefaultChannelRegistry();
TestChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(stringChannel);
channelRegistry.registerChannel(defaultChannel);
Map<Class<?>, MessageChannel> channelMappings = new ConcurrentHashMap<Class<?>, MessageChannel>();

View File

@@ -29,7 +29,7 @@ import org.junit.Test;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.TestChannelRegistry;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.message.Message;
@@ -84,7 +84,7 @@ public class RecipientListRouterTests {
QueueChannel channel2 = new QueueChannel();
channel1.setBeanName("channel1");
channel2.setBeanName("channel2");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(channel1);
channelRegistry.registerChannel(channel2);
RecipientListChannelResolver resolver = new RecipientListChannelResolver();
@@ -108,7 +108,7 @@ public class RecipientListRouterTests {
QueueChannel channel2 = new QueueChannel();
channel1.setBeanName("channel1");
channel2.setBeanName("channel2");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(channel1);
channelRegistry.registerChannel(channel2);
RecipientListChannelResolver resolver = new RecipientListChannelResolver();
@@ -134,7 +134,7 @@ public class RecipientListRouterTests {
List<MessageChannel> channels = new ArrayList<MessageChannel>();
channels.add(channel1);
channels.add(channel2);
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(channel1);
channelRegistry.registerChannel(channel2);
RecipientListChannelResolver resolver = new RecipientListChannelResolver();

View File

@@ -22,7 +22,7 @@ import java.util.List;
import org.junit.Test;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.TestChannelRegistry;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageDeliveryException;
@@ -91,7 +91,7 @@ public class RouterEndpointTests {
return null;
}
};
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
RouterEndpoint endpoint = new RouterEndpoint(channelNameResolver);
endpoint.setChannelRegistry(channelRegistry);
Message<String> message = new StringMessage("test");
@@ -105,7 +105,7 @@ public class RouterEndpointTests {
return null;
}
};
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
RouterEndpoint endpoint = new RouterEndpoint(channelNameResolver);
endpoint.setChannelRegistry(channelRegistry);
endpoint.setResolutionRequired(true);
@@ -121,7 +121,7 @@ public class RouterEndpointTests {
return new String[] {};
}
};
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
RouterEndpoint endpoint = new RouterEndpoint(channelNameResolver);
endpoint.setChannelRegistry(channelRegistry);
Message<String> message = new StringMessage("test");
@@ -135,7 +135,7 @@ public class RouterEndpointTests {
return new String[] {};
}
};
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
RouterEndpoint endpoint = new RouterEndpoint(channelNameResolver);
endpoint.setChannelRegistry(channelRegistry);
endpoint.setResolutionRequired(true);

View File

@@ -22,7 +22,7 @@ import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.springframework.integration.channel.ChannelRegistry;
import org.springframework.integration.channel.DefaultChannelRegistry;
import org.springframework.integration.channel.TestChannelRegistry;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.message.Message;
@@ -59,7 +59,7 @@ public class SingleChannelRouterTests {
};
QueueChannel channel = new QueueChannel();
channel.setBeanName("testChannel");
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
channelRegistry.registerChannel(channel);
RouterEndpoint endpoint = new RouterEndpoint(channelNameResolver);
endpoint.setChannelRegistry(channelRegistry);
@@ -89,7 +89,7 @@ public class SingleChannelRouterTests {
return "noSuchChannel";
}
};
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
ChannelRegistry channelRegistry = new TestChannelRegistry();
RouterEndpoint endpoint = new RouterEndpoint(channelNameResolver);
endpoint.setChannelRegistry(channelRegistry);
Message<String> message = new StringMessage("test");