Package org.opennms.core.test.db
Class TemporaryDatabaseExecutionListener
- java.lang.Object
-
- org.springframework.test.context.support.AbstractTestExecutionListener
-
- org.opennms.core.test.db.TemporaryDatabaseExecutionListener
-
- All Implemented Interfaces:
org.springframework.core.Ordered
,org.springframework.test.context.TestExecutionListener
public class TemporaryDatabaseExecutionListener extends org.springframework.test.context.support.AbstractTestExecutionListener
ThisTestExecutionListener
creates a temporary database and then registers it as the default datasource insideDataSourceFactory
by usingDataSourceFactory.setInstance(DataSource)
. To change the settings for the temporary database, use theJUnitTemporaryDatabase
annotation on the test class or method.- Author:
- Mathew Brozowski
-
-
Constructor Summary
Constructors Constructor Description TemporaryDatabaseExecutionListener()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterTestClass(org.springframework.test.context.TestContext testContext)
void
afterTestMethod(org.springframework.test.context.TestContext testContext)
void
beforeTestClass(org.springframework.test.context.TestContext testContext)
void
beforeTestMethod(org.springframework.test.context.TestContext testContext)
static java.util.List<java.lang.reflect.Method>
getOrderedTestMethods(java.lang.Class<?> testClass)
static void
getOrderedTestMethods(java.lang.Class<?> testClass, java.util.List<java.lang.reflect.Method> methods)
void
prepareTestInstance(org.springframework.test.context.TestContext testContext)
-
-
-
Method Detail
-
afterTestMethod
public void afterTestMethod(org.springframework.test.context.TestContext testContext) throws java.lang.Exception
- Specified by:
afterTestMethod
in interfaceorg.springframework.test.context.TestExecutionListener
- Overrides:
afterTestMethod
in classorg.springframework.test.context.support.AbstractTestExecutionListener
- Throws:
java.lang.Exception
-
afterTestClass
public void afterTestClass(org.springframework.test.context.TestContext testContext) throws java.lang.Exception
- Specified by:
afterTestClass
in interfaceorg.springframework.test.context.TestExecutionListener
- Overrides:
afterTestClass
in classorg.springframework.test.context.support.AbstractTestExecutionListener
- Throws:
java.lang.Exception
-
beforeTestMethod
public void beforeTestMethod(org.springframework.test.context.TestContext testContext) throws java.lang.Exception
- Specified by:
beforeTestMethod
in interfaceorg.springframework.test.context.TestExecutionListener
- Overrides:
beforeTestMethod
in classorg.springframework.test.context.support.AbstractTestExecutionListener
- Throws:
java.lang.Exception
-
getOrderedTestMethods
public static java.util.List<java.lang.reflect.Method> getOrderedTestMethods(java.lang.Class<?> testClass)
-
getOrderedTestMethods
public static void getOrderedTestMethods(java.lang.Class<?> testClass, java.util.List<java.lang.reflect.Method> methods)
-
beforeTestClass
public void beforeTestClass(org.springframework.test.context.TestContext testContext) throws java.lang.Exception
- Specified by:
beforeTestClass
in interfaceorg.springframework.test.context.TestExecutionListener
- Overrides:
beforeTestClass
in classorg.springframework.test.context.support.AbstractTestExecutionListener
- Throws:
java.lang.Exception
-
prepareTestInstance
public void prepareTestInstance(org.springframework.test.context.TestContext testContext) throws java.lang.Exception
- Specified by:
prepareTestInstance
in interfaceorg.springframework.test.context.TestExecutionListener
- Overrides:
prepareTestInstance
in classorg.springframework.test.context.support.AbstractTestExecutionListener
- Throws:
java.lang.Exception
-
-