Refactor/Standardize Router XSD Schema Attributes

- Add more documentation for schema elements in spring-integration-xml-2.1.xsd
  - Simplify Handling of Channel Resolution (Failures) for Routers
  - Fix PayloadTypeRouterTests
  - Update reference docs, XSD Schemas
  - Rename 'channel-resolution-required' to 'resolution-required'
  - Updated all tests accordingly
This commit is contained in:
Gunnar Hillert
2011-09-06 14:39:38 -04:00
committed by Mark Fisher
parent b55520369d
commit 2c023f6fd1
16 changed files with 1399 additions and 614 deletions

View File

@@ -125,19 +125,6 @@ public class XPathRouterParserTests {
inputChannel.send(docMessage);
assertEquals("Wrong number of messages", 1, outputChannel.getQueueSize());
}
@Test
public void testSetChannelResolver() throws Exception {
StringBuffer contextBuffer = new StringBuffer("<si-xml:xpath-router id='router' channel-resolver='stubResolver' input-channel='test-input'><si-xml:xpath-expression expression='/name'/></si-xml:xpath-router>");
contextBuffer.append("<bean id='stubResolver' class='").append(StubChannelResolver.class.getName()).append("'/>");
EventDrivenConsumer consumer = buildContext(contextBuffer.toString());
DirectFieldAccessor accessor = new DirectFieldAccessor(consumer);
Object handler = accessor.getPropertyValue("handler");
accessor = new DirectFieldAccessor(handler);
Object resolver = accessor.getPropertyValue("channelResolver");
assertEquals("Wrong channel resolver ",StubChannelResolver.class, resolver.getClass());
}
@Test
public void testSetResolutionRequiredFalse() throws Exception {
@@ -163,32 +150,6 @@ public class XPathRouterParserTests {
assertEquals("Resolution required not set to true ", true, resolutionRequired);
}
@Test
public void testIgnoreChannelNameResolutionFailuresFalse() throws Exception {
StringBuffer contextBuffer = new StringBuffer(
"<si-xml:xpath-router id='router' ignore-channel-name-resolution-failures='false' input-channel='test-input'><si-xml:xpath-expression expression='/name'/></si-xml:xpath-router>");
EventDrivenConsumer consumer = buildContext(contextBuffer.toString());
DirectFieldAccessor accessor = new DirectFieldAccessor(consumer);
Object handler = accessor.getPropertyValue("handler");
accessor = new DirectFieldAccessor(handler);
Object ignoreChannelNameResolutionFailures = accessor.getPropertyValue("ignoreChannelNameResolutionFailures");
assertEquals("ignoreChannelNameResolutionFailures not set to false", false, ignoreChannelNameResolutionFailures);
}
@Test
public void testIgnoreChannelNameResolutionFailuresTrue() throws Exception {
StringBuffer contextBuffer = new StringBuffer(
"<si-xml:xpath-router id='router' ignore-channel-name-resolution-failures='true' input-channel='test-input'><si-xml:xpath-expression expression='/name'/></si-xml:xpath-router>");
EventDrivenConsumer consumer = buildContext(contextBuffer.toString());
DirectFieldAccessor accessor = new DirectFieldAccessor(consumer);
Object handler = accessor.getPropertyValue("handler");
accessor = new DirectFieldAccessor(handler);
Object ignoreChannelNameResolutionFailures = accessor.getPropertyValue("ignoreChannelNameResolutionFailures");
assertEquals("ignoreChannelNameResolutionFailures not set to true ", true, ignoreChannelNameResolutionFailures);
}
@Test
public void testSetDefaultOutputChannel() throws Exception {
StringBuffer contextBuffer = new StringBuffer("<si-xml:xpath-router id='router' default-output-channel='defaultOutput' input-channel='test-input'><si-xml:xpath-expression expression='/name'/></si-xml:xpath-router>");