IN PROGRESS - issue INT-633: BridgeHandler should not require an output channel

http://jira.springframework.org/browse/INT-633

And the xsd part...
This commit is contained in:
Iwein Fuld
2009-06-07 12:43:07 +00:00
parent 7e4e31afdf
commit f0db35873b
3 changed files with 47 additions and 19 deletions

View File

@@ -1,32 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<!-- pollable to subscribable -->
<channel id="pollableChannel">
<queue/>
</channel>
<channel id="output1">
<queue/>
</channel>
<channel id="subscribableChannel"/>
<channel id="output2">
<queue/>
<queue />
</channel>
<bridge input-channel="pollableChannel" output-channel="output1">
<poller max-messages-per-poll="2">
<interval-trigger interval="3000"/>
<interval-trigger interval="3000" />
</poller>
</bridge>
<bridge input-channel="subscribableChannel" output-channel="output2"/>
<channel id="output1">
<queue />
</channel>
<!-- subscribable to pollable -->
<channel id="subscribableChannel" />
<bridge input-channel="subscribableChannel" output-channel="output2" />
<channel id="output2">
<queue />
</channel>
<!-- stopper (uses reply channel header) -->
<channel id="stopperChannel" />
<bridge input-channel="stopperChannel" />
</beans:beans>

View File

@@ -23,14 +23,18 @@ import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.core.MessagingException;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.message.StringMessage;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
/**
* @author Mark Fisher
* @author Iwein Fuld
*/
@ContextConfiguration
public class BridgeParserTests extends AbstractJUnit4SpringContextTests {
@@ -43,6 +47,10 @@ public class BridgeParserTests extends AbstractJUnit4SpringContextTests {
@Qualifier("subscribableChannel")
private MessageChannel subscribableChannel;
@Autowired
@Qualifier("stopperChannel")
private MessageChannel stopperChannel;
@Autowired
@Qualifier("output1")
private PollableChannel output1;
@@ -51,7 +59,6 @@ public class BridgeParserTests extends AbstractJUnit4SpringContextTests {
@Qualifier("output2")
private PollableChannel output2;
@Test
public void pollableChannel() {
Message<?> message = new StringMessage("test1");
@@ -68,4 +75,19 @@ public class BridgeParserTests extends AbstractJUnit4SpringContextTests {
assertEquals(message, reply);
}
@Test
public void stopperWithReplyHeader() {
PollableChannel replyChannel = new QueueChannel();
Message<?> message = MessageBuilder.withPayload("test3").setReplyChannel(replyChannel).build();
this.stopperChannel.send(message);
Message<?> reply = replyChannel.receive(0);
assertEquals(message, reply);
}
@Test(expected = MessagingException.class)
public void stopperWithoutReplyHeader() {
Message<?> message = MessageBuilder.withPayload("test3").build();
this.stopperChannel.send(message);
}
}