Fix outdated Javadoc in the TestContext framework
Fixed outdated Javadoc regarding support for 'annotated classes' in the TestContext Framework.
This commit is contained in:
@@ -18,7 +18,9 @@ package org.springframework.test.context.junit4;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -29,30 +31,26 @@ import org.springframework.test.context.support.DependencyInjectionTestExecution
|
||||
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Abstract base test class which integrates the <em>Spring TestContext
|
||||
* Framework</em> with explicit {@link ApplicationContext} testing support in a
|
||||
* <strong>JUnit 4.5+</strong> environment.
|
||||
* </p>
|
||||
* <p>
|
||||
* Concrete subclasses should typically declare a class-level
|
||||
*
|
||||
* <p>Concrete subclasses should typically declare a class-level
|
||||
* {@link ContextConfiguration @ContextConfiguration} annotation to
|
||||
* configure the {@link ApplicationContext application context}
|
||||
* {@link ContextConfiguration#locations() resource locations}.
|
||||
* <em>If your test does not need to load an application context, you may choose
|
||||
* to omit the {@link ContextConfiguration @ContextConfiguration} declaration
|
||||
* and to configure the appropriate
|
||||
* {@link org.springframework.test.context.TestExecutionListener TestExecutionListeners}
|
||||
* manually.</em>
|
||||
* </p>
|
||||
* <p>
|
||||
* Note: this class serves only as a convenience for extension. If you do not
|
||||
* configure the {@link ApplicationContext application context} {@link
|
||||
* ContextConfiguration#locations() resource locations} or {@link
|
||||
* ContextConfiguration#classes() annotated classes}. <em>If your test does not
|
||||
* need to load an application context, you may choose to omit the {@link
|
||||
* ContextConfiguration @ContextConfiguration} declaration and to configure
|
||||
* the appropriate {@link org.springframework.test.context.TestExecutionListener
|
||||
* TestExecutionListeners} manually.</em>
|
||||
*
|
||||
* <p>Note: this class serves only as a convenience for extension. If you do not
|
||||
* wish for your test classes to be tied to a Spring-specific class hierarchy,
|
||||
* you may configure your own custom test classes by using
|
||||
* {@link SpringJUnit4ClassRunner}, {@link ContextConfiguration
|
||||
* @ContextConfiguration}, {@link TestExecutionListeners
|
||||
* @TestExecutionListeners}, etc.
|
||||
* </p>
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 2.5
|
||||
|
||||
@@ -32,33 +32,28 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Abstract {@link Transactional transactional} extension of
|
||||
* {@link AbstractJUnit4SpringContextTests} which adds convenience functionality
|
||||
* for JDBC access. Expects a {@link DataSource} bean and a
|
||||
* {@link PlatformTransactionManager} bean to be defined in the Spring
|
||||
* {@link ApplicationContext application context}.
|
||||
* </p>
|
||||
* <p>
|
||||
* This class exposes a {@link SimpleJdbcTemplate} and provides an easy way to
|
||||
* {@link #countRowsInTable(String) count the number of rows in a table} ,
|
||||
* {@link #deleteFromTables(String...) delete from the database} , and
|
||||
*
|
||||
* <p>This class exposes a {@link SimpleJdbcTemplate} and provides an easy way
|
||||
* to {@link #countRowsInTable(String) count the number of rows in a table},
|
||||
* {@link #deleteFromTables(String...) delete from tables}, and
|
||||
* {@link #executeSqlScript(String, boolean) execute SQL scripts} within a
|
||||
* transaction.
|
||||
* </p>
|
||||
* <p>
|
||||
* Concrete subclasses must fulfill the same requirements outlined in
|
||||
*
|
||||
* <p>Concrete subclasses must fulfill the same requirements outlined in
|
||||
* {@link AbstractJUnit4SpringContextTests}.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note: this class serves only as a convenience for extension. If you do not
|
||||
*
|
||||
* <p>Note: this class serves only as a convenience for extension. If you do not
|
||||
* wish for your test classes to be tied to a Spring-specific class hierarchy,
|
||||
* you may configure your own custom test classes by using
|
||||
* {@link SpringJUnit4ClassRunner}, {@link ContextConfiguration
|
||||
* @ContextConfiguration}, {@link TestExecutionListeners
|
||||
* @TestExecutionListeners}, {@link Transactional @Transactional},
|
||||
* etc.
|
||||
* </p>
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @author Juergen Hoeller
|
||||
@@ -76,9 +71,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @see org.springframework.test.jdbc.SimpleJdbcTestUtils
|
||||
* @see org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@TestExecutionListeners(TransactionalTestExecutionListener.class)
|
||||
@Transactional
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class AbstractTransactionalJUnit4SpringContextTests extends AbstractJUnit4SpringContextTests {
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -29,6 +30,7 @@ import org.springframework.test.context.TestContextManager;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
|
||||
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
|
||||
|
||||
import org.testng.IHookCallBack;
|
||||
import org.testng.IHookable;
|
||||
import org.testng.ITestResult;
|
||||
@@ -38,27 +40,23 @@ import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Abstract base test class which integrates the
|
||||
* <em>Spring TestContext Framework</em> with explicit
|
||||
* {@link ApplicationContext} testing support in a <strong>TestNG</strong>
|
||||
* Abstract base test class which integrates the <em>Spring TestContext Framework</em>
|
||||
* with explicit {@link ApplicationContext} testing support in a <strong>TestNG</strong>
|
||||
* environment.
|
||||
* </p>
|
||||
* <p>
|
||||
* Concrete subclasses:
|
||||
* </p>
|
||||
*
|
||||
* <p>Concrete subclasses:
|
||||
* <ul>
|
||||
* <li>Typically declare a class-level {@link ContextConfiguration
|
||||
* @ContextConfiguration} annotation to configure the
|
||||
* {@link ApplicationContext application context}
|
||||
* {@link ContextConfiguration#locations() resource locations}.
|
||||
* <em>If your test does not need to load an application context, you may choose
|
||||
* to omit the {@link ContextConfiguration @ContextConfiguration} declaration
|
||||
* and to configure the appropriate
|
||||
* @ContextConfiguration} annotation to configure the {@link ApplicationContext
|
||||
* application context} {@link ContextConfiguration#locations() resource locations}
|
||||
* or {@link ContextConfiguration#classes() annotated classes}. <em>If your test
|
||||
* does not need to load an application context, you may choose to omit the
|
||||
* {@link ContextConfiguration @ContextConfiguration} declaration and to
|
||||
* configure the appropriate
|
||||
* {@link org.springframework.test.context.TestExecutionListener TestExecutionListeners}
|
||||
* manually.</em></li>
|
||||
* <li>Must have constructors which either implicitly or explicitly delegate to
|
||||
* <code>super();</code>.</li>
|
||||
* {@code super();}.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Sam Brannen
|
||||
|
||||
@@ -31,24 +31,20 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Abstract {@link Transactional transactional} extension of
|
||||
* {@link AbstractTestNGSpringContextTests} which adds convenience functionality
|
||||
* for JDBC access. Expects a {@link DataSource} bean and a
|
||||
* {@link PlatformTransactionManager} bean to be defined in the Spring
|
||||
* {@link ApplicationContext application context}.
|
||||
* </p>
|
||||
* <p>
|
||||
* This class exposes a {@link SimpleJdbcTemplate} and provides an easy way to
|
||||
* {@link #countRowsInTable(String) count the number of rows in a table} ,
|
||||
* {@link #deleteFromTables(String...) delete from the database} , and
|
||||
*
|
||||
* <p>This class exposes a {@link SimpleJdbcTemplate} and provides an easy way
|
||||
* to {@link #countRowsInTable(String) count the number of rows in a table},
|
||||
* {@link #deleteFromTables(String...) delete from tables}, and
|
||||
* {@link #executeSqlScript(String, boolean) execute SQL scripts} within a
|
||||
* transaction.
|
||||
* </p>
|
||||
* <p>
|
||||
* Concrete subclasses must fulfill the same requirements outlined in
|
||||
*
|
||||
* <p>Concrete subclasses must fulfill the same requirements outlined in
|
||||
* {@link AbstractTestNGSpringContextTests}.
|
||||
* </p>
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @author Juergen Hoeller
|
||||
@@ -64,9 +60,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @see org.springframework.test.jdbc.SimpleJdbcTestUtils
|
||||
* @see org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@TestExecutionListeners(TransactionalTestExecutionListener.class)
|
||||
@Transactional
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class AbstractTransactionalTestNGSpringContextTests extends AbstractTestNGSpringContextTests {
|
||||
|
||||
/**
|
||||
@@ -125,7 +121,6 @@ public abstract class AbstractTransactionalTestNGSpringContextTests extends Abst
|
||||
* and continueOnError was <code>false</code>
|
||||
*/
|
||||
protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {
|
||||
|
||||
Resource resource = this.applicationContext.getResource(sqlResourcePath);
|
||||
SimpleJdbcTestUtils.executeSqlScript(this.simpleJdbcTemplate, new EncodedResource(resource,
|
||||
this.sqlScriptEncoding), continueOnError);
|
||||
|
||||
Reference in New Issue
Block a user