Skip to content

Commit d6ae8be

Browse files
committed
Reorder beans in JdbcPollingChAParserTests cofigs
https://build.spring.io/browse/INT-AT42SIO-820/ The test configs use `fixed-rate="100"`. This way when Inbound Channel Adapter is declared earlier in the config than `<jdbc:embedded-database>`, there is a chance that we start to poll DB before it is really initialized. * Reorder config so embedded DB is initialized before an Inbound Channel Adapter **Cherry-pick to 5.0.x, 4.3.x and 4.2.x** (cherry picked from commit da6f47c)
1 parent 2b6cafd commit d6ae8be

9 files changed

+49
-56
lines changed

spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/pollingForMapJdbcInboundChannelAdapterTest.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
http://www.springframework.org/schema/integration/spring-integration.xsd
1010
http://www.springframework.org/schema/integration/jdbc
1111
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
12-
12+
13+
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
14+
1315
<si:message-history/>
14-
15-
<inbound-channel-adapter id="jdbcAdapter" query="select * from item where status=2" channel="target"
16+
17+
<inbound-channel-adapter id="jdbcAdapter" query="select * from item where status=2" channel="target"
1618
data-source="dataSource" />
17-
18-
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
19+
1920

2021
</beans:beans>
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans:beans xmlns="http://www.springframework.org/schema/integration/jdbc"
33
xmlns:beans="http://www.springframework.org/schema/beans"
4-
xmlns:si="http://www.springframework.org/schema/integration"
54
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
65
xsi:schemaLocation="http://www.springframework.org/schema/beans
76
http://www.springframework.org/schema/beans/spring-beans.xsd
8-
http://www.springframework.org/schema/integration
9-
http://www.springframework.org/schema/integration/spring-integration.xsd
107
http://www.springframework.org/schema/integration/jdbc
118
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
129

10+
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
11+
1312
<inbound-channel-adapter channel="target" data-source="dataSource">
1413
<query>select * from item where status=2</query>
1514
<update>update item set status=10 where id in (:id)</update>
1615
</inbound-channel-adapter>
1716

18-
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
1917

2018
</beans:beans>
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans:beans xmlns="http://www.springframework.org/schema/integration/jdbc"
33
xmlns:beans="http://www.springframework.org/schema/beans"
4-
xmlns:si="http://www.springframework.org/schema/integration"
54
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
65
xsi:schemaLocation="http://www.springframework.org/schema/beans
76
http://www.springframework.org/schema/beans/spring-beans.xsd
8-
http://www.springframework.org/schema/integration
9-
http://www.springframework.org/schema/integration/spring-integration.xsd
107
http://www.springframework.org/schema/integration/jdbc
118
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
129

13-
<inbound-channel-adapter query="select * from item where status=2" channel="target"
14-
data-source="dataSource" update="update item set status=10 where id in (:id)" />
15-
1610
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
1711

12+
<inbound-channel-adapter query="select * from item where status=2" channel="target"
13+
data-source="dataSource" update="update item set status=10 where id in (:id)" />
14+
1815
</beans:beans>

spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/pollingNoAutoStartupJdbcInboundChannelAdapterTest.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
http://www.springframework.org/schema/beans/spring-beans.xsd
77
http://www.springframework.org/schema/integration/jdbc
88
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
9-
10-
<inbound-channel-adapter id="jdbcAdapter" query="select * from item where status=2" channel="target"
11-
data-source="dataSource" auto-startup="#{systemProperties['autostart']?:false}"/>
12-
9+
1310
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
1411

12+
<inbound-channel-adapter id="jdbcAdapter" query="select * from item where status=2" channel="target"
13+
data-source="dataSource" auto-startup="#{systemProperties['autostart']?:false}"/>
14+
15+
1516
</beans:beans>
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans:beans xmlns="http://www.springframework.org/schema/integration/jdbc"
3-
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:si="http://www.springframework.org/schema/integration"
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
5-
xsi:schemaLocation="http://www.springframework.org/schema/beans
3+
xmlns:beans="http://www.springframework.org/schema/beans"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.springframework.org/schema/beans
66
http://www.springframework.org/schema/beans/spring-beans.xsd
7-
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
8-
http://www.springframework.org/schema/integration
9-
http://www.springframework.org/schema/integration/spring-integration.xsd
107
http://www.springframework.org/schema/integration/jdbc
118
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
129

10+
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml"/>
11+
1312
<inbound-channel-adapter query="select * from item where status=2"
14-
channel="target" jdbc-operations="jdbcTemplate" />
13+
channel="target" jdbc-operations="jdbcTemplate"/>
1514

16-
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
1715

1816
</beans:beans>
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans:beans xmlns="http://www.springframework.org/schema/integration/jdbc"
3-
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:si="http://www.springframework.org/schema/integration"
3+
xmlns:beans="http://www.springframework.org/schema/beans"
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://www.springframework.org/schema/beans
66
http://www.springframework.org/schema/beans/spring-beans.xsd
7-
http://www.springframework.org/schema/integration
8-
http://www.springframework.org/schema/integration/spring-integration.xsd
97
http://www.springframework.org/schema/integration/jdbc
108
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
119

10+
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
11+
1212
<inbound-channel-adapter query="select * from item where status=2"
1313
channel="target" data-source="dataSource" max-rows-per-poll="2"
1414
update="update item set status=10 where id in (:id)" />
1515

16-
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
1716

1817
</beans:beans>
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<beans:beans xmlns="http://www.springframework.org/schema/integration/jdbc" xmlns:beans="http://www.springframework.org/schema/beans"
3-
xmlns:si="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
5-
xsi:schemaLocation="http://www.springframework.org/schema/beans
2+
<beans:beans xmlns="http://www.springframework.org/schema/integration/jdbc"
3+
xmlns:beans="http://www.springframework.org/schema/beans"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.springframework.org/schema/beans
66
http://www.springframework.org/schema/beans/spring-beans.xsd
7-
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
8-
http://www.springframework.org/schema/integration
9-
http://www.springframework.org/schema/integration/spring-integration.xsd
107
http://www.springframework.org/schema/integration/jdbc
118
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
129

13-
<inbound-channel-adapter query="select * from item where status=2" channel="target"
14-
update="update item set status=1, name=:name where id in (:id)" jdbc-operations="jdbcTemplate"
15-
update-sql-parameter-source-factory="sqlParameterSourceFactory" />
16-
17-
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
10+
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml"/>
1811

19-
<beans:bean id="sqlParameterSourceFactory" class="org.springframework.integration.jdbc.ExpressionEvaluatingSqlParameterSourceFactory">
12+
<beans:bean id="sqlParameterSourceFactory"
13+
class="org.springframework.integration.jdbc.ExpressionEvaluatingSqlParameterSourceFactory">
2014
<beans:property name="parameterExpressions">
2115
<beans:map>
22-
<beans:entry key="name" value="'bar'.toUpperCase()" />
16+
<beans:entry key="name" value="'bar'.toUpperCase()"/>
2317
</beans:map>
2418
</beans:property>
2519
<beans:property name="staticParameters">
2620
<beans:map>
27-
<beans:entry key="foo" value="bar" />
21+
<beans:entry key="foo" value="bar"/>
2822
</beans:map>
2923
</beans:property>
3024
</beans:bean>
3125

26+
<inbound-channel-adapter query="select * from item where status=2" channel="target"
27+
update="update item set status=1, name=:name where id in (:id)"
28+
jdbc-operations="jdbcTemplate"
29+
update-sql-parameter-source-factory="sqlParameterSourceFactory"/>
30+
3231
</beans:beans>
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans:beans xmlns="http://www.springframework.org/schema/integration/jdbc"
33
xmlns:beans="http://www.springframework.org/schema/beans"
4-
xmlns:si="http://www.springframework.org/schema/integration"
54
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
65
xsi:schemaLocation="http://www.springframework.org/schema/beans
76
http://www.springframework.org/schema/beans/spring-beans.xsd
8-
http://www.springframework.org/schema/integration
9-
http://www.springframework.org/schema/integration/spring-integration.xsd
107
http://www.springframework.org/schema/integration/jdbc
118
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
12-
13-
<inbound-channel-adapter query="select * from item where status=:status" channel="target"
14-
data-source="dataSource" select-sql-parameter-source="parameterSource"/>
15-
9+
1610
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml" />
17-
18-
<beans:bean id="parameterSource" class="org.springframework.integration.jdbc.config.JdbcPollingChannelAdapterParserTests$TestSqlParameterSource"/>
11+
12+
<beans:bean id="parameterSource"
13+
class="org.springframework.integration.jdbc.config.JdbcPollingChannelAdapterParserTests$TestSqlParameterSource"/>
14+
15+
<inbound-channel-adapter query="select * from item where status=:status" channel="target"
16+
data-source="dataSource" select-sql-parameter-source="parameterSource"/>
17+
1918

2019
</beans:beans>

spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/pollingWithSelectParameterSourceJdbcInboundChannelAdapterTest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
http://www.springframework.org/schema/integration/jdbc
88
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
99

10+
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml"/>
11+
1012
<inbound-channel-adapter query="select * from item where status=:status" channel="target"
1113
data-source="dataSource" select-sql-parameter-source="parameterSource"
1214
update="delete from item"/>
1315

14-
<beans:import resource="jdbcInboundChannelAdapterCommonConfig.xml"/>
1516

1617
<beans:bean id="parameterSource" factory-bean="parameterSourceFactory"
1718
factory-method="createParameterSourceNoCache">

0 commit comments

Comments
 (0)