diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/StoredProcPollingChannelAdapterParser.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/StoredProcPollingChannelAdapterParser.java index 715d33ef07..acabc93b57 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/StoredProcPollingChannelAdapterParser.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/StoredProcPollingChannelAdapterParser.java @@ -48,7 +48,7 @@ public class StoredProcPollingChannelAdapterParser extends AbstractPollingInboun final BeanDefinitionBuilder storedProcExecutorBuilder = StoredProcParserUtils.getStoredProcExecutorBuilder(element, parserContext); IntegrationNamespaceUtils.setValueIfAttributeDefined(storedProcExecutorBuilder, element, "return-value-required"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(storedProcExecutorBuilder, element, "function"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(storedProcExecutorBuilder, element, "is-function"); IntegrationNamespaceUtils.setValueIfAttributeDefined(storedProcExecutorBuilder, element, "skip-undeclared-results"); final ManagedMap returningResultsetMap = StoredProcParserUtils.getReturningResultsetBeanDefinitions(element, parserContext); diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcOutboundGatewayParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcOutboundGatewayParserTests.java index d66346cbdc..83077d8a2b 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcOutboundGatewayParserTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcOutboundGatewayParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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 @@ -115,6 +115,54 @@ public class StoredProcOutboundGatewayParserTests { assertTrue(returnValueRequired); } + @Test + public void testIsFunctionAttributeSet() throws Exception { + setUp("storedProcOutboundGatewayParserFunctionTest.xml", getClass()); + DirectFieldAccessor accessor = new DirectFieldAccessor(this.outboundGateway); + Object source = accessor.getPropertyValue("handler"); + accessor = new DirectFieldAccessor(source); + source = accessor.getPropertyValue("executor"); + accessor = new DirectFieldAccessor(source); + boolean isFunction = (Boolean) accessor.getPropertyValue("isFunction"); + assertTrue(isFunction); + } + + @Test + public void testIsFunctionAttributeSetToFalse() throws Exception { + setUp("storedProcOutboundGatewayParserTest.xml", getClass()); + DirectFieldAccessor accessor = new DirectFieldAccessor(this.outboundGateway); + Object source = accessor.getPropertyValue("handler"); + accessor = new DirectFieldAccessor(source); + source = accessor.getPropertyValue("executor"); + accessor = new DirectFieldAccessor(source); + boolean isFunction = (Boolean) accessor.getPropertyValue("isFunction"); + assertFalse(isFunction); + } + + @Test + public void testIsIgnoreColumnMetaDataSetToFalse() throws Exception { + setUp("storedProcOutboundGatewayParserTest.xml", getClass()); + DirectFieldAccessor accessor = new DirectFieldAccessor(this.outboundGateway); + Object source = accessor.getPropertyValue("handler"); + accessor = new DirectFieldAccessor(source); + source = accessor.getPropertyValue("executor"); + accessor = new DirectFieldAccessor(source); + boolean ignoreColumnMetaData = (Boolean) accessor.getPropertyValue("ignoreColumnMetaData"); + assertFalse(ignoreColumnMetaData); + } + + @Test + public void testIsIgnoreColumnMetaDataSet() throws Exception { + setUp("storedProcOutboundGatewayParserFunctionTest.xml", getClass()); + DirectFieldAccessor accessor = new DirectFieldAccessor(this.outboundGateway); + Object source = accessor.getPropertyValue("handler"); + accessor = new DirectFieldAccessor(source); + source = accessor.getPropertyValue("executor"); + accessor = new DirectFieldAccessor(source); + boolean ignoreColumnMetaData = (Boolean) accessor.getPropertyValue("ignoreColumnMetaData"); + assertTrue(ignoreColumnMetaData); + } + @SuppressWarnings("unchecked") @Test public void testProcedurepParametersAreSet() throws Exception { diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcPollingChannelAdapterParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcPollingChannelAdapterParserTests.java index 575cd3524a..4f460500a9 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcPollingChannelAdapterParserTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/StoredProcPollingChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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 @@ -132,6 +132,18 @@ public class StoredProcPollingChannelAdapterParserTests { assertTrue(returnValueRequired); } + @Test + public void testIsFunctionAttributeSet() throws Exception { + setUp("storedProcPollingChannelAdapterParserTest.xml", getClass()); + DirectFieldAccessor accessor = new DirectFieldAccessor(this.pollingAdapter); + Object source = accessor.getPropertyValue("source"); + accessor = new DirectFieldAccessor(source); + source = accessor.getPropertyValue("executor"); + accessor = new DirectFieldAccessor(source); + boolean isFunction = (Boolean) accessor.getPropertyValue("isFunction"); + assertTrue(isFunction); + } + @SuppressWarnings("unchecked") @Test public void testProcedurepParametersAreSet() throws Exception { @@ -250,6 +262,7 @@ public class StoredProcPollingChannelAdapterParserTests { SourcePollingChannelAdapter autoChannelAdapter = context.getBean("autoChannel.adapter", SourcePollingChannelAdapter.class); assertSame(autoChannel, TestUtils.getPropertyValue(autoChannelAdapter, "outputChannel")); assertFalse(TestUtils.getPropertyValue(autoChannelAdapter, "source.executor.returnValueRequired", Boolean.class)); + assertFalse(TestUtils.getPropertyValue(autoChannelAdapter, "source.executor.isFunction", Boolean.class)); } @After diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcOutboundGatewayParserFunctionTest.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcOutboundGatewayParserFunctionTest.xml new file mode 100644 index 0000000000..44f4c5465a --- /dev/null +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcOutboundGatewayParserFunctionTest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcPollingChannelAdapterParserTest.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcPollingChannelAdapterParserTest.xml index bf727a3817..77413ec3c4 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcPollingChannelAdapterParserTest.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcPollingChannelAdapterParserTest.xml @@ -16,7 +16,7 @@ data-source="dataSource" channel="target" stored-procedure-name="GET_PRIME_NUMBERS" return-value-required="true" - is-function="false"> + is-function="true">