Projekt von de.halbekunst.juplo nach de.juplo verschoben und aufgeräumt
[percentcodec] / test / src / main / java / de / halbekunst / juplo / test / WebContextTestExecutionListener.java
diff --git a/test/src/main/java/de/halbekunst/juplo/test/WebContextTestExecutionListener.java b/test/src/main/java/de/halbekunst/juplo/test/WebContextTestExecutionListener.java
deleted file mode 100644 (file)
index 68985c2..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-package de.halbekunst.juplo.test;
-
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.config.Scope;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.context.support.SimpleThreadScope;
-import org.springframework.test.context.TestContext;
-import org.springframework.test.context.support.AbstractTestExecutionListener;
-
-/**
- * Diese Klasse ermöglicht es, Beans mit dem Scope REQUEST in JUnit-Testfällen
- * zu verwenden.
- * <p>
- * Source: http://stackoverflow.com/questions/2411343/request-scoped-beans-in-spring-testing
- * <p>
- * Anwendung:
- * <code>
- * @RunWith(SpringJUnit4ClassRunner.class)
- * @ContextConfiguration(locations = "classpath:spring/TestScopedBeans-context.xml")
- * @TestExecutionListeners({
- *      WebContextTestExecutionListener.class,
- *      DependencyInjectionTestExecutionListener.class,
- *      DirtiesContextTestExecutionListener.class })
- * public class TestScopedBeans {
- * ...
- * </code>
- */
-public class WebContextTestExecutionListener extends AbstractTestExecutionListener {
-    @Override
-    public void prepareTestInstance(TestContext testContext) throws Exception {
-
-        if (testContext.getApplicationContext() instanceof GenericApplicationContext) {
-            GenericApplicationContext context = (GenericApplicationContext) testContext.getApplicationContext();
-            ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
-            Scope requestScope = new SimpleThreadScope();
-            beanFactory.registerScope("request", requestScope);
-            Scope sessionScope = new SimpleThreadScope();
-            beanFactory.registerScope("session", sessionScope);
-        }
-    }
-}