@groovy.util.logging.Slf4j @groovy.transform.CompileStatic class DatabaseCleanupContext extends java.lang.Object
Context that holds the discovered DatabaseCleaner implementations and provides access to the application's data sources for cleanup operations.
Multiple cleaners can be registered (one per database type). When performing cleanup, the context matches each datasource to an appropriate cleaner using either an explicit database type from the DatasourceCleanupMapping or auto-discovery via DatabaseCleaner.supports. If a datasource is marked for cleanup but no matching cleaner is found, an error is thrown.
| Type | Name and description |
|---|---|
ApplicationContext |
applicationContext |
| Constructor and description |
|---|
DatabaseCleanupContext(java.util.List<DatabaseCleaner> cleaners) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
ApplicationContext |
getApplicationContext()
|
|
java.util.List<DatabaseCleanupStats> |
performCleanup(DatasourceCleanupMapping mapping)Performs cleanup on data sources found in the application context using the provided mapping from the DatabaseCleanup annotation. |
|
void |
setApplicationContext(ApplicationContext applicationContext)Sets the application context. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Performs cleanup on data sources found in the application context using the provided mapping from the DatabaseCleanup annotation.
If the mapping specifies explicit database types for data sources, those types are used to look up the cleaner directly. Otherwise, auto-discovery via DatabaseCleaner.supports is used.
mapping - the parsed annotation value describing which data sources to clean
and optionally which cleaner types to useSets the application context. Called by the interceptor when the test's Spring context becomes available.