diff --git a/spring-integration-core/.springBeans b/spring-integration-core/.springBeans index 9087afb06f..af61d5c04c 100644 --- a/spring-integration-core/.springBeans +++ b/spring-integration-core/.springBeans @@ -1,13 +1,14 @@ 1 - + src/test/java/org/springframework/integration/gateway/GatewayInterfaceTest-context.xml + src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests-context.xml diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/GatewayParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/GatewayParser.java index 81d03145ff..ad62582ba0 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/GatewayParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/GatewayParser.java @@ -45,7 +45,7 @@ public class GatewayParser extends AbstractSimpleBeanDefinitionParser { }; private static String[] innerAttributes = new String[] { - "request-channel", "reply-channel", "request-timeout", "reply-timeout" + "request-channel", "reply-channel", "request-timeout", "reply-timeout", "error-channel" }; @@ -75,7 +75,8 @@ public class GatewayParser extends AbstractSimpleBeanDefinitionParser { IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "request-channel", "defaultRequestChannel"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel", "defaultReplyChannel"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "request-timeout", "defaultRequestTimeout"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout", "defaultReplyTimeout"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout", "defaultReplyTimeout"); + IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel"); } private void postProcessGateway(BeanDefinitionBuilder builder, Element element) { diff --git a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd index 148882ad92..e4c27eae83 100644 --- a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd +++ b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd @@ -660,6 +660,15 @@ + + + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests-context.xml new file mode 100644 index 0000000000..cc584d1c1d --- /dev/null +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests-context.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests.java new file mode 100644 index 0000000000..90bedf5efa --- /dev/null +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/InnerGatewayWithChainTests.java @@ -0,0 +1,53 @@ +/* + * Copyright 2002-2011 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.gateway; + +import static junit.framework.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Oleg Zhurakousky + * + */ +@ContextConfiguration +@RunWith(SpringJUnit4ClassRunner.class) +public class InnerGatewayWithChainTests { + + @Autowired + private TestGateway testGateway; + + @Test + public void testExceptionHandledByMainGateway(){ + String reply = testGateway.echo(5); + assertEquals("ERROR from errorChannelA", reply); + } + + @Test + public void testExceptionHandledByInnerGateway(){ + String reply = testGateway.echo(0); + assertEquals("ERROR from errorChannelB", reply); + } + + public static interface TestGateway{ + public String echo(int value); + } +}