Class DefaultTestTransactionExecutionListener

java.lang.Object
io.micronaut.transaction.test.DefaultTestTransactionExecutionListener
All Implemented Interfaces:
io.micronaut.test.context.TestExecutionListener, io.micronaut.test.context.TestMethodInterceptor<Object>

@EachBean(TransactionOperations.class) @Requires(classes=io.micronaut.test.context.TestExecutionListener.class) @Requires(property="micronaut.test.transactional",value="true",defaultValue="true") @Replaces(io.micronaut.spring.tx.test.SpringTransactionTestExecutionListener.class) @Internal public class DefaultTestTransactionExecutionListener extends Object implements io.micronaut.test.context.TestExecutionListener, io.micronaut.test.context.TestMethodInterceptor<Object>
Adds support for MicronautTest transactional handling.
Since:
1.0.0
Author:
graemerocher
  • Constructor Details

    • DefaultTestTransactionExecutionListener

      protected DefaultTestTransactionExecutionListener(TransactionOperations<Object> 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 - The transaction manager
      rollback - true if the transaction should be rollback
      transactionMode - The transaction mode
  • Method Details

    • interceptTest

      public Object interceptTest(io.micronaut.test.context.TestMethodInvocationContext<Object> methodInvocationContext) throws Throwable
      Specified by:
      interceptTest in interface io.micronaut.test.context.TestMethodInterceptor<Object>
      Throws:
      Throwable
    • interceptBeforeEach

      public Object interceptBeforeEach(io.micronaut.test.context.TestMethodInvocationContext<Object> methodInvocationContext) throws Throwable
      Specified by:
      interceptBeforeEach in interface io.micronaut.test.context.TestMethodInterceptor<Object>
      Throws:
      Throwable
    • interceptAfterEach

      public Object interceptAfterEach(io.micronaut.test.context.TestMethodInvocationContext<Object> methodInvocationContext) throws Throwable
      Specified by:
      interceptAfterEach in interface io.micronaut.test.context.TestMethodInterceptor<Object>
      Throws:
      Throwable
    • beforeSetupTest

      public void beforeSetupTest(io.micronaut.test.context.TestContext testContext)
      Specified by:
      beforeSetupTest in interface io.micronaut.test.context.TestExecutionListener
    • afterSetupTest

      public void afterSetupTest(io.micronaut.test.context.TestContext testContext)
      Specified by:
      afterSetupTest in interface io.micronaut.test.context.TestExecutionListener
    • beforeCleanupTest

      public void beforeCleanupTest(io.micronaut.test.context.TestContext testContext)
      Specified by:
      beforeCleanupTest in interface io.micronaut.test.context.TestExecutionListener
    • afterCleanupTest

      public void afterCleanupTest(io.micronaut.test.context.TestContext testContext)
      Specified by:
      afterCleanupTest in interface io.micronaut.test.context.TestExecutionListener
    • afterTestExecution

      public void afterTestExecution(io.micronaut.test.context.TestContext testContext)
      Specified by:
      afterTestExecution in interface io.micronaut.test.context.TestExecutionListener
    • beforeTestExecution

      public void beforeTestExecution(io.micronaut.test.context.TestContext testContext)
      Specified by:
      beforeTestExecution in interface io.micronaut.test.context.TestExecutionListener