diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java b/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java
index f8ce39e0fa..01f368c011 100644
--- a/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java
+++ b/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java
@@ -57,7 +57,7 @@ abstract class ContextLoaderUtils {
private static final Log logger = LogFactory.getLog(ContextLoaderUtils.class);
private static final String DEFAULT_CONTEXT_LOADER_CLASS_NAME = "org.springframework.test.context.support.DelegatingSmartContextLoader";
- private static final String DEFAULT_WEB_CONTEXT_LOADER_CLASS_NAME = "org.springframework.test.context.support.WebDelegatingSmartContextLoader";
+ private static final String DEFAULT_WEB_CONTEXT_LOADER_CLASS_NAME = "org.springframework.test.context.web.WebDelegatingSmartContextLoader";
private static final String WEB_APP_CONFIGURATION_CLASS_NAME = "org.springframework.test.context.web.WebAppConfiguration";
private static final String WEB_MERGED_CONTEXT_CONFIGURATION_CLASS_NAME = "org.springframework.test.context.web.WebMergedContextConfiguration";
diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AbstractDelegatingSmartContextLoader.java b/spring-test/src/main/java/org/springframework/test/context/support/AbstractDelegatingSmartContextLoader.java
index 5a05a24c4e..d8116c000d 100644
--- a/spring-test/src/main/java/org/springframework/test/context/support/AbstractDelegatingSmartContextLoader.java
+++ b/spring-test/src/main/java/org/springframework/test/context/support/AbstractDelegatingSmartContextLoader.java
@@ -63,7 +63,7 @@ import org.springframework.util.ObjectUtils;
* @since 3.2
* @see SmartContextLoader
*/
-abstract class AbstractDelegatingSmartContextLoader implements SmartContextLoader {
+public abstract class AbstractDelegatingSmartContextLoader implements SmartContextLoader {
private static final Log logger = LogFactory.getLog(AbstractDelegatingSmartContextLoader.class);
diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoaderUtils.java b/spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoaderUtils.java
index f539869ab8..78c60e9bf5 100644
--- a/spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoaderUtils.java
+++ b/spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoaderUtils.java
@@ -31,7 +31,7 @@ import org.springframework.util.Assert;
* @author Sam Brannen
* @since 3.2
*/
-abstract class AnnotationConfigContextLoaderUtils {
+public abstract class AnnotationConfigContextLoaderUtils {
private static final Log logger = LogFactory.getLog(AnnotationConfigContextLoaderUtils.class);
@@ -86,7 +86,7 @@ abstract class AnnotationConfigContextLoaderUtils {
* @return an array of default configuration classes, potentially empty but
* never null
*/
- static Class>[] detectDefaultConfigurationClasses(Class> declaringClass) {
+ public static Class>[] detectDefaultConfigurationClasses(Class> declaringClass) {
Assert.notNull(declaringClass, "Declaring class must not be null");
List> configClasses = new ArrayList>();
diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AbstractGenericWebContextLoader.java b/spring-test/src/main/java/org/springframework/test/context/web/AbstractGenericWebContextLoader.java
similarity index 97%
rename from spring-test/src/main/java/org/springframework/test/context/support/AbstractGenericWebContextLoader.java
rename to spring-test/src/main/java/org/springframework/test/context/web/AbstractGenericWebContextLoader.java
index 5b34d7aa6b..42bdc7ee46 100644
--- a/spring-test/src/main/java/org/springframework/test/context/support/AbstractGenericWebContextLoader.java
+++ b/spring-test/src/main/java/org/springframework/test/context/web/AbstractGenericWebContextLoader.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.test.context.support;
+package org.springframework.test.context.web;
import javax.servlet.ServletContext;
@@ -29,7 +29,7 @@ import org.springframework.core.io.FileSystemResourceLoader;
import org.springframework.core.io.ResourceLoader;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.context.MergedContextConfiguration;
-import org.springframework.test.context.web.WebMergedContextConfiguration;
+import org.springframework.test.context.support.AbstractContextLoader;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.GenericWebApplicationContext;
diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigWebContextLoader.java b/spring-test/src/main/java/org/springframework/test/context/web/AnnotationConfigWebContextLoader.java
similarity index 96%
rename from spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigWebContextLoader.java
rename to spring-test/src/main/java/org/springframework/test/context/web/AnnotationConfigWebContextLoader.java
index ecb69c8841..71621b1ea8 100644
--- a/spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigWebContextLoader.java
+++ b/spring-test/src/main/java/org/springframework/test/context/web/AnnotationConfigWebContextLoader.java
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-package org.springframework.test.context.support;
+package org.springframework.test.context.web;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.annotation.AnnotatedBeanDefinitionReader;
import org.springframework.test.context.ContextConfigurationAttributes;
-import org.springframework.test.context.web.WebMergedContextConfiguration;
+import org.springframework.test.context.support.AbstractContextLoader;
+import org.springframework.test.context.support.AnnotationConfigContextLoaderUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.support.GenericWebApplicationContext;
diff --git a/spring-test/src/main/java/org/springframework/test/context/support/XmlWebContextLoader.java b/spring-test/src/main/java/org/springframework/test/context/web/GenericXmlWebContextLoader.java
similarity index 72%
rename from spring-test/src/main/java/org/springframework/test/context/support/XmlWebContextLoader.java
rename to spring-test/src/main/java/org/springframework/test/context/web/GenericXmlWebContextLoader.java
index 154ecd485a..23146df624 100644
--- a/spring-test/src/main/java/org/springframework/test/context/support/XmlWebContextLoader.java
+++ b/spring-test/src/main/java/org/springframework/test/context/web/GenericXmlWebContextLoader.java
@@ -14,19 +14,29 @@
* limitations under the License.
*/
-package org.springframework.test.context.support;
+package org.springframework.test.context.web;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.test.context.web.WebMergedContextConfiguration;
import org.springframework.web.context.support.GenericWebApplicationContext;
/**
- * TODO [SPR-9864] Document XmlWebContextLoader.
+ * TODO [SPR-9864] Document GenericXmlWebContextLoader.
*
* @author Sam Brannen
* @since 3.2
*/
-public class XmlWebContextLoader extends AbstractGenericWebContextLoader {
+public class GenericXmlWebContextLoader extends AbstractGenericWebContextLoader {
+
+ /**
+ * TODO [SPR-9864] Document overridden loadBeanDefinitions().
+ *
+ * @see org.springframework.test.context.web.AbstractGenericWebContextLoader#loadBeanDefinitions(org.springframework.web.context.support.GenericWebApplicationContext, org.springframework.test.context.web.WebMergedContextConfiguration)
+ */
+ @Override
+ protected void loadBeanDefinitions(GenericWebApplicationContext context,
+ WebMergedContextConfiguration webMergedConfig) {
+ new XmlBeanDefinitionReader(context).loadBeanDefinitions(webMergedConfig.getLocations());
+ }
/**
* Returns "-context.xml".
@@ -35,15 +45,4 @@ public class XmlWebContextLoader extends AbstractGenericWebContextLoader {
return "-context.xml";
}
- /**
- * TODO [SPR-9864] Document overridden loadBeanDefinitions().
- *
- * @see org.springframework.test.context.support.AbstractGenericWebContextLoader#loadBeanDefinitions(org.springframework.web.context.support.GenericWebApplicationContext, org.springframework.test.context.web.WebMergedContextConfiguration)
- */
- @Override
- protected void loadBeanDefinitions(GenericWebApplicationContext context,
- WebMergedContextConfiguration webMergedConfig) {
- new XmlBeanDefinitionReader(context).loadBeanDefinitions(webMergedConfig.getLocations());
- }
-
}
diff --git a/spring-test/src/main/java/org/springframework/test/context/web/ServletTestExecutionListener.java b/spring-test/src/main/java/org/springframework/test/context/web/ServletTestExecutionListener.java
index a22b465915..b5f7549e8f 100644
--- a/spring-test/src/main/java/org/springframework/test/context/web/ServletTestExecutionListener.java
+++ b/spring-test/src/main/java/org/springframework/test/context/web/ServletTestExecutionListener.java
@@ -20,7 +20,6 @@ import javax.servlet.ServletContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
@@ -29,6 +28,7 @@ import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.context.TestContext;
import org.springframework.test.context.TestExecutionListener;
+import org.springframework.test.context.support.AbstractTestExecutionListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletWebRequest;
@@ -39,21 +39,11 @@ import org.springframework.web.context.request.ServletWebRequest;
* @author Sam Brannen
* @since 3.2
*/
-public class ServletTestExecutionListener implements TestExecutionListener {
+public class ServletTestExecutionListener extends AbstractTestExecutionListener {
private static final Log logger = LogFactory.getLog(ServletTestExecutionListener.class);
- /**
- * The default implementation is empty. Can be overridden by
- * subclasses as necessary.
- *
- * @see TestExecutionListener#beforeTestClass(TestContext)
- */
- public void beforeTestClass(TestContext testContext) throws Exception {
- /* no-op */
- }
-
/**
* TODO [SPR-9864] Document overridden prepareTestInstance().
*
@@ -84,21 +74,10 @@ public class ServletTestExecutionListener implements TestExecutionListener {
RequestContextHolder.resetRequestAttributes();
}
- /**
- * The default implementation is empty. Can be overridden by
- * subclasses as necessary.
- *
- * @see TestExecutionListener#afterTestClass(TestContext)
- */
- public void afterTestClass(TestContext testContext) throws Exception {
- /* no-op */
- }
-
/**
* TODO [SPR-9864] Document setUpRequestContext().
*
* @param testContext
- * @param servletContext
*/
private void setUpRequestContextIfNecessary(TestContext testContext) {
diff --git a/spring-test/src/main/java/org/springframework/test/context/support/WebDelegatingSmartContextLoader.java b/spring-test/src/main/java/org/springframework/test/context/web/WebDelegatingSmartContextLoader.java
similarity index 80%
rename from spring-test/src/main/java/org/springframework/test/context/support/WebDelegatingSmartContextLoader.java
rename to spring-test/src/main/java/org/springframework/test/context/web/WebDelegatingSmartContextLoader.java
index 71f126fdbf..6e0be682e8 100644
--- a/spring-test/src/main/java/org/springframework/test/context/support/WebDelegatingSmartContextLoader.java
+++ b/spring-test/src/main/java/org/springframework/test/context/web/WebDelegatingSmartContextLoader.java
@@ -14,25 +14,26 @@
* limitations under the License.
*/
-package org.springframework.test.context.support;
+package org.springframework.test.context.web;
import org.springframework.test.context.SmartContextLoader;
+import org.springframework.test.context.support.AbstractDelegatingSmartContextLoader;
/**
* {@code WebDelegatingSmartContextLoader} is a concrete implementation of
- * {@link AbstractDelegatingSmartContextLoader} that delegates to an
- * {@link XmlWebContextLoader} and an {@link AnnotationConfigWebContextLoader}.
+ * {@link AbstractDelegatingSmartContextLoader} that delegates to a
+ * {@link GenericXmlWebContextLoader} and an {@link AnnotationConfigWebContextLoader}.
*
* @author Sam Brannen
* @since 3.2
* @see SmartContextLoader
* @see AbstractDelegatingSmartContextLoader
- * @see XmlWebContextLoader
+ * @see GenericXmlWebContextLoader
* @see AnnotationConfigWebContextLoader
*/
public class WebDelegatingSmartContextLoader extends AbstractDelegatingSmartContextLoader {
- private final SmartContextLoader xmlLoader = new XmlWebContextLoader();
+ private final SmartContextLoader xmlLoader = new GenericXmlWebContextLoader();
private final SmartContextLoader annotationConfigLoader = new AnnotationConfigWebContextLoader();
diff --git a/spring-test/src/main/java/org/springframework/test/context/web/package-info.java b/spring-test/src/main/java/org/springframework/test/context/web/package-info.java
new file mode 100644
index 0000000000..ebf0020303
--- /dev/null
+++ b/spring-test/src/main/java/org/springframework/test/context/web/package-info.java
@@ -0,0 +1,6 @@
+/**
+ * Web support classes for the Spring TestContext Framework.
+ */
+
+package org.springframework.test.context.web;
+