Removing usage of the Subscription object, and resolved issue with 'auto-create' channels for SourceEndpoints (INT-235).
This commit is contained in:
@@ -33,7 +33,6 @@ import org.springframework.integration.handler.MessageHandler;
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.message.MessagingException;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
import org.springframework.integration.scheduling.Subscription;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -57,9 +56,10 @@ public class DirectChannelSubscriptionTests {
|
||||
@Test
|
||||
public void testSendAndReceiveForRegisteredEndpoint() {
|
||||
HandlerEndpoint endpoint = new HandlerEndpoint(new TestHandler());
|
||||
endpoint.setSubscription(new Subscription("sourceChannel"));
|
||||
endpoint.setInputChannelName("sourceChannel");
|
||||
endpoint.setOutputChannelName("targetChannel");
|
||||
bus.registerEndpoint("testEndpoint", endpoint);
|
||||
endpoint.setName("testEndpoint");
|
||||
bus.registerEndpoint(endpoint);
|
||||
bus.start();
|
||||
this.sourceChannel.send(new StringMessage("foo"));
|
||||
Message<?> response = this.targetChannel.receive();
|
||||
@@ -89,9 +89,10 @@ public class DirectChannelSubscriptionTests {
|
||||
throw new RuntimeException("intentional test failure");
|
||||
}
|
||||
});
|
||||
endpoint.setSubscription(new Subscription("sourceChannel"));
|
||||
endpoint.setInputChannelName("sourceChannel");
|
||||
endpoint.setOutputChannelName("targetChannel");
|
||||
bus.registerEndpoint("testEndpoint", endpoint);
|
||||
endpoint.setName("testEndpoint");
|
||||
bus.registerEndpoint(endpoint);
|
||||
bus.start();
|
||||
this.sourceChannel.send(new StringMessage("foo"));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.channel.DispatcherPolicy;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.channel.PublishSubscribeChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
@@ -169,9 +168,11 @@ public class MessageBusTests {
|
||||
public void testErrorChannelWithFailedDispatch() throws InterruptedException {
|
||||
MessageBus bus = new MessageBus();
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
SourceEndpoint sourceEndpoint = new SourceEndpoint(new FailingSource(latch), new QueueChannel());
|
||||
SourceEndpoint sourceEndpoint = new SourceEndpoint(new FailingSource(latch));
|
||||
sourceEndpoint.setOutputChannel(new QueueChannel());
|
||||
sourceEndpoint.setSchedule(new PollingSchedule(1000));
|
||||
bus.registerEndpoint("testEndpoint", sourceEndpoint);
|
||||
sourceEndpoint.setName("testEndpoint");
|
||||
bus.registerEndpoint(sourceEndpoint);
|
||||
bus.start();
|
||||
latch.await(2000, TimeUnit.MILLISECONDS);
|
||||
Message<?> message = bus.getErrorChannel().receive(100);
|
||||
|
||||
@@ -12,11 +12,7 @@
|
||||
|
||||
<bean id="endpoint" class="org.springframework.integration.endpoint.HandlerEndpoint">
|
||||
<constructor-arg ref="handler"/>
|
||||
<property name="subscription">
|
||||
<bean class="org.springframework.integration.scheduling.Subscription">
|
||||
<constructor-arg ref="sourceChannel"/>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="inputChannel" ref="sourceChannel"/>
|
||||
<property name="outputChannelName" value="targetChannel"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ public class MessagingAnnotationPostProcessorTests {
|
||||
AnnotatedEndpointWithPolledAnnotation endpoint = new AnnotatedEndpointWithPolledAnnotation();
|
||||
postProcessor.postProcessAfterInitialization(endpoint, "testBean");
|
||||
HandlerEndpoint processedEndpoint = (HandlerEndpoint) messageBus.lookupEndpoint("testBean.MessageHandler.endpoint");
|
||||
Schedule schedule = processedEndpoint.getSubscription().getSchedule();
|
||||
Schedule schedule = processedEndpoint.getSchedule();
|
||||
assertEquals(PollingSchedule.class, schedule.getClass());
|
||||
PollingSchedule pollingSchedule = (PollingSchedule) schedule;
|
||||
assertEquals(1234, pollingSchedule.getPeriod());
|
||||
|
||||
@@ -40,7 +40,8 @@ public class SourceEndpointTests {
|
||||
public void testPolledSourceSendsToChannel() {
|
||||
TestSource source = new TestSource("testing", 1);
|
||||
QueueChannel channel = new QueueChannel();
|
||||
SourceEndpoint endpoint = new SourceEndpoint(source, channel);
|
||||
SourceEndpoint endpoint = new SourceEndpoint(source);
|
||||
endpoint.setOutputChannel(channel);
|
||||
endpoint.afterPropertiesSet();
|
||||
endpoint.send(new CommandMessage(new PollCommand()));
|
||||
Message<?> message = channel.receive(1000);
|
||||
@@ -52,7 +53,8 @@ public class SourceEndpointTests {
|
||||
public void testAutoStartupDisabled() {
|
||||
TestSource source = new TestSource("testing", 1);
|
||||
QueueChannel channel = new QueueChannel();
|
||||
SourceEndpoint endpoint = new SourceEndpoint(source, channel);
|
||||
SourceEndpoint endpoint = new SourceEndpoint(source);
|
||||
endpoint.setOutputChannel(channel);
|
||||
endpoint.setAutoStartup(false);
|
||||
endpoint.afterPropertiesSet();
|
||||
endpoint.send(new CommandMessage(new PollCommand()));
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<property name="methodName" value="foo"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg ref="channel"/>
|
||||
<property name="outputChannel" ref="channel"/>
|
||||
<property name="schedule">
|
||||
<bean class="org.springframework.integration.scheduling.PollingSchedule">
|
||||
<constructor-arg value="1000"/>
|
||||
@@ -34,11 +34,7 @@
|
||||
|
||||
<bean id="targetEndpoint" class="org.springframework.integration.endpoint.TargetEndpoint">
|
||||
<constructor-arg ref="target"/>
|
||||
<property name="subscription">
|
||||
<bean class="org.springframework.integration.scheduling.Subscription">
|
||||
<constructor-arg ref="channel"/>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="inputChannel" ref="channel"/>
|
||||
</bean>
|
||||
|
||||
<bean id="sink" class="org.springframework.integration.handler.TestSink"/>
|
||||
|
||||
Reference in New Issue
Block a user