Provide JdbcTemplate in tx base classes in the TCF

Since Spring 2.5, the abstract transactional base classes in the
TestContext framework have defined and delegated to a protected
SimpleJdbcTemplate instance variable; however, SimpleJdbcTemplate has
deprecated since Spring 3.1. Consequently, subclasses of
AbstractTransactionalJUnit4SpringContextTests and
AbstractTransactionalTestNGSpringContextTests that use this instance
variable suffer from seemingly unnecessary deprecation warnings.

This commit addresses this issue by introducing a protected JdbcTemplate
instance variable in abstract transactional base classes to replace the
use of the existing SimpleJdbcTemplate. Furthermore, the existing
simpleJdbcTemplate instance variable has been deprecated, and utility
methods in the affected base classes now delegate to JdbcTestUtils
instead of the now deprecated SimpleJdbcTestUtils.

Issue: SPR-8990
This commit is contained in:
Sam Brannen
2012-08-03 21:55:06 +02:00
parent a7d43773e8
commit 8d9637ada6
4 changed files with 52 additions and 28 deletions

View File

@@ -396,7 +396,7 @@
</listitem>
<listitem>
<para>A <classname>SimpleJdbcTemplate</classname>, for executing
<para>A <classname>JdbcTemplate</classname>, for executing
SQL statements to query the database. Such queries can be used to
confirm database state both <emphasis>prior to</emphasis> and
<emphasis>after</emphasis> execution of database-related
@@ -422,7 +422,7 @@
<title>JDBC Testing Support</title>
<para>The <literal>org.springframework.test.jdbc</literal> package
contains <classname>SimpleJdbcTestUtils</classname>, which is a
contains <classname>JdbcTestUtils</classname>, which is a
collection of JDBC related utility functions intended to simplify
standard database testing scenarios. <emphasis>Note that <link
linkend="testcontext-support-classes-junit4">
@@ -430,7 +430,7 @@
</link> and <link linkend="testcontext-support-classes-testng">
<classname>AbstractTransactionalTestNGSpringContextTests</classname>
</link> provide convenience methods which delegate to
<classname>SimpleJdbcTestUtils</classname> internally.</emphasis></para>
<classname>JdbcTestUtils</classname> internally.</emphasis></para>
<para>The <literal>spring-jdbc</literal> module provides support for
configuring and launching an embedded database which can be used in
@@ -2157,7 +2157,7 @@ public void updateWithSessionFlush() {
</listitem>
<listitem>
<para><literal>simpleJdbcTemplate</literal>: Use this
<para><literal>jdbcTemplate</literal>: Use this
variable to execute SQL statements to query the database.
Such queries can be used to confirm database state both
<emphasis>prior to</emphasis> and <emphasis>after</emphasis>
@@ -2266,7 +2266,7 @@ public class SimpleTest {
</listitem>
<listitem>
<para><literal>simpleJdbcTemplate</literal>: Use this
<para><literal>jdbcTemplate</literal>: Use this
variable to execute SQL statements to query the database.
Such queries can be used to confirm database state both
<emphasis>prior to</emphasis> and <emphasis>after</emphasis>