Package io.micronaut.spring.tx.test
Class SpringTransactionTestExecutionListener
java.lang.Object
io.micronaut.spring.tx.test.SpringTransactionTestExecutionListener
- All Implemented Interfaces:
io.micronaut.test.context.TestExecutionListener
@Requires(classes={org.springframework.transaction.PlatformTransactionManager.class,io.micronaut.test.extensions.AbstractMicronautExtension.class}) @Requires(property="micronaut.test.transactional",value="true",defaultValue="true")
@EachBean(org.springframework.transaction.PlatformTransactionManager.class)
public class SpringTransactionTestExecutionListener
extends Object
implements io.micronaut.test.context.TestExecutionListener
Integrates Spring's transaction management if it is available.
- Since:
- 1.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorDescriptionSpringTransactionTestExecutionListener
(org.springframework.transaction.PlatformTransactionManager transactionManager, boolean rollback, io.micronaut.test.annotation.TransactionMode transactionMode) -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterCleanupTest
(io.micronaut.test.context.TestContext testContext) void
afterSetupTest
(io.micronaut.test.context.TestContext testContext) void
afterTestExecution
(io.micronaut.test.context.TestContext testContext) void
beforeCleanupTest
(io.micronaut.test.context.TestContext testContext) void
beforeSetupTest
(io.micronaut.test.context.TestContext testContext) void
beforeTestExecution
(io.micronaut.test.context.TestContext testContext) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.test.context.TestExecutionListener
afterTestClass, afterTestMethod, beforeTestClass, beforeTestMethod
-
Constructor Details
-
SpringTransactionTestExecutionListener
public SpringTransactionTestExecutionListener(org.springframework.transaction.PlatformTransactionManager transactionManager, @Property(name="micronaut.test.rollback",defaultValue="true") boolean rollback, @Property(name="micronaut.test.transaction-mode",defaultValue="SEPARATE_TRANSACTIONS") io.micronaut.test.annotation.TransactionMode transactionMode) - Parameters:
transactionManager
- Spring'sPlatformTransactionManager
rollback
-true
if the transaction should be rollbacktransactionMode
-TransactionMode
to use for each test
-
-
Method Details
-
beforeSetupTest
public void beforeSetupTest(io.micronaut.test.context.TestContext testContext) - Specified by:
beforeSetupTest
in interfaceio.micronaut.test.context.TestExecutionListener
-
afterSetupTest
public void afterSetupTest(io.micronaut.test.context.TestContext testContext) - Specified by:
afterSetupTest
in interfaceio.micronaut.test.context.TestExecutionListener
-
beforeCleanupTest
- Specified by:
beforeCleanupTest
in interfaceio.micronaut.test.context.TestExecutionListener
- Throws:
Exception
-
afterCleanupTest
- Specified by:
afterCleanupTest
in interfaceio.micronaut.test.context.TestExecutionListener
- Throws:
Exception
-
afterTestExecution
public void afterTestExecution(io.micronaut.test.context.TestContext testContext) - Specified by:
afterTestExecution
in interfaceio.micronaut.test.context.TestExecutionListener
-
beforeTestExecution
public void beforeTestExecution(io.micronaut.test.context.TestContext testContext) - Specified by:
beforeTestExecution
in interfaceio.micronaut.test.context.TestExecutionListener
-