From 731b338c84d7b869faabad692e5d604c25440faf Mon Sep 17 00:00:00 2001 From: Gunnar Hillert Date: Fri, 8 Feb 2013 00:30:01 -0500 Subject: [PATCH] INT-2728 Stored Proc Fix Missing Schema Attribute INT-2728 - Stored Proc - Add 'return-value-required' attribute * For Stored Procedure Inbound Channel Adapter: Add 'return-value-required' attribute * Add tests For reference: https://jira.springsource.org/browse/INT-2728 INT-2878 Polishing Add a default false assertion to the parser tests. --- .../jdbc/config/spring-integration-jdbc-3.0.xsd | 11 +++++++++++ .../StoredProcOutboundGatewayParserTests.java | 14 +++++++++++++- ...oredProcPollingChannelAdapterParserTests.java | 15 +++++++++++++++ .../storedProcOutboundGatewayParserTest.xml | 2 +- ...storedProcPollingChannelAdapterParserTest.xml | 1 + src/reference/docbook/jdbc.xml | 16 ++++++++-------- 6 files changed, 49 insertions(+), 10 deletions(-) diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-3.0.xsd b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-3.0.xsd index e3d73fd48e..8bb7f26567 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-3.0.xsd +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-3.0.xsd @@ -1101,6 +1101,17 @@ + + + + Indicates the procedure's return value should be included + in the results returned. + + + + + + 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 cfe9a4dfa0..d66346cbdc 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 @@ -89,7 +89,6 @@ public class StoredProcOutboundGatewayParserTests { } - @Test public void testSkipUndeclaredResultsAttributeSet() throws Exception { setUp("storedProcOutboundGatewayParserTest.xml", getClass()); @@ -103,6 +102,19 @@ public class StoredProcOutboundGatewayParserTests { assertFalse(skipUndeclaredResults); } + @Test + public void testReturnValueRequiredAttributeSet() 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 returnValueRequired = (Boolean) accessor.getPropertyValue("returnValueRequired"); + assertTrue(returnValueRequired); + } + @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 9bff31f868..575cd3524a 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 @@ -14,6 +14,7 @@ package org.springframework.integration.jdbc.config; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; @@ -118,6 +119,19 @@ public class StoredProcPollingChannelAdapterParserTests { assertTrue("skipUndeclaredResults was not set and should default to 'true'", skipUndeclaredResults); } + @Test + public void testReturnValueRequiredAttributeSet() 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 returnValueRequired = (Boolean) accessor.getPropertyValue("returnValueRequired"); + assertTrue(returnValueRequired); + } + @SuppressWarnings("unchecked") @Test public void testProcedurepParametersAreSet() throws Exception { @@ -235,6 +249,7 @@ public class StoredProcPollingChannelAdapterParserTests { MessageChannel autoChannel = context.getBean("autoChannel", MessageChannel.class); SourcePollingChannelAdapter autoChannelAdapter = context.getBean("autoChannel.adapter", SourcePollingChannelAdapter.class); assertSame(autoChannel, TestUtils.getPropertyValue(autoChannelAdapter, "outputChannel")); + assertFalse(TestUtils.getPropertyValue(autoChannelAdapter, "source.executor.returnValueRequired", Boolean.class)); } @After diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcOutboundGatewayParserTest.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcOutboundGatewayParserTest.xml index 812244a4d6..2592380e0e 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcOutboundGatewayParserTest.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/storedProcOutboundGatewayParserTest.xml @@ -18,7 +18,7 @@ data-source="datasource" auto-startup="true" id="storedProcedureOutboundGateway" ignore-column-meta-data="false" is-function="false" skip-undeclared-results="false" order="2" reply-channel="replyChannel" - reply-timeout="555" return-value-required="false"> + reply-timeout="555" return-value-required="true"> 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 b7fffe2f6e..bf727a3817 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 @@ -15,6 +15,7 @@ diff --git a/src/reference/docbook/jdbc.xml b/src/reference/docbook/jdbc.xml index fa397663e2..c01c492db5 100644 --- a/src/reference/docbook/jdbc.xml +++ b/src/reference/docbook/jdbc.xml @@ -906,6 +906,7 @@ is-function="false" max-rows-per-poll="" ]]> Optional. + + + Indicates whether this procedure's return value + should be included. Since Spring Integration 3.0. + Optional. + + When you declare a Poller, you may notice the Poller's @@ -972,7 +980,6 @@ id="" ignore-column-meta-data="false" order="" ]]> @@ -999,13 +1006,6 @@ Optional. - - - Indicates whether this procedure's return value - should be included. - Optional. - -