INT-1076 added support for the 'ignore-channel-name-resolution-failures' attribute on <xpath-router/> elements.

This commit is contained in:
Mark Fisher
2010-05-04 14:31:20 +00:00
parent 2da44cf041
commit 85c3263e1e
4 changed files with 59 additions and 36 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2010 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.xml.config;
public class TestXmlApplicationContextHelper {
@@ -34,11 +35,11 @@ public class TestXmlApplicationContextHelper {
+ "'http://www.springframework.org/schema/beans "
+ "http://www.springframework.org/schema/beans/spring-beans.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.xsd "
+ "http://www.springframework.org/schema/integration/xml "
+ "http://www.springframework.org/schema/integration/xml/spring-integration-xml-1.0.xsd "
+ "http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd "
+ "http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd " +
"http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd' >" +
"http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd' >" +
"<context:annotation-config/>";
private final static String footer = "</beans>";

View File

@@ -36,6 +36,7 @@ import org.w3c.dom.Document;
/**
* @author Jonas Partner
* @author Mark Fisher
*/
@ContextConfiguration
public class XPathRouterParserTests {
@@ -155,7 +156,32 @@ 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>");