Browse Source

Fix outdated Javadoc in the TestContext framework

Fixed outdated Javadoc regarding support for 'annotated classes' in
the TestContext Framework.
pull/97/merge
Sam Brannen 14 years ago
parent
commit
726655af50
  1. 28
      spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java
  2. 23
      spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java
  3. 28
      spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java
  4. 19
      spring-test/src/main/java/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java
  5. 7
      spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java

28
spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java

@ -18,7 +18,9 @@ package org.springframework.test.context.junit4; @@ -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 @@ -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 &#064;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 &#064;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 &#064;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
* &#064;ContextConfiguration}, {@link TestExecutionListeners
* &#064;TestExecutionListeners}, etc.
* </p>
*
* @author Sam Brannen
* @since 2.5

23
spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java

@ -32,33 +32,28 @@ import org.springframework.transaction.PlatformTransactionManager; @@ -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
* &#064;ContextConfiguration}, {@link TestExecutionListeners
* &#064;TestExecutionListeners}, {@link Transactional &#064;Transactional},
* etc.
* </p>
*
* @author Sam Brannen
* @author Juergen Hoeller
@ -76,9 +71,9 @@ import org.springframework.transaction.annotation.Transactional; @@ -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 {
/**

28
spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java

@ -21,6 +21,7 @@ import java.lang.reflect.Method; @@ -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; @@ -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; @@ -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
* &#064;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 &#064;ContextConfiguration} declaration
* and to configure the appropriate
* &#064;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 &#064;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

19
spring-test/src/main/java/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java

@ -31,24 +31,20 @@ import org.springframework.transaction.PlatformTransactionManager; @@ -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; @@ -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 @@ -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);

7
spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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.
@ -32,7 +32,6 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager; @@ -32,7 +32,6 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.test.annotation.NotTransactional;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
import org.springframework.test.context.transaction.AfterTransaction;
import org.springframework.test.context.transaction.BeforeTransaction;
import org.springframework.transaction.PlatformTransactionManager;
@ -48,13 +47,13 @@ import org.testng.annotations.Test; @@ -48,13 +47,13 @@ import org.testng.annotations.Test;
* classes with TestNG-based tests.
*
* <p>Configuration will be loaded from
* {@link AnnotationConfigTransactionalTestNGSpringContextTestsConfig}.
* {@link AnnotationConfigTransactionalTestNGSpringContextTests.ContextConfiguration}.
*
* @author Sam Brannen
* @since 3.1
*/
@SuppressWarnings("deprecation")
@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
@ContextConfiguration
public class AnnotationConfigTransactionalTestNGSpringContextTests extends
AbstractTransactionalTestNGSpringContextTests {

Loading…
Cancel
Save