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

    Constructors
    Constructor
    Description
    SpringTransactionTestExecutionListener(org.springframework.transaction.PlatformTransactionManager transactionManager, boolean rollback, io.micronaut.test.annotation.TransactionMode transactionMode)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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's PlatformTransactionManager
      rollback - true if the transaction should be rollback
      transactionMode - TransactionMode to use for each test
  • Method Details

    • 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) throws Exception
      Specified by:
      beforeCleanupTest in interface io.micronaut.test.context.TestExecutionListener
      Throws:
      Exception
    • afterCleanupTest

      public void afterCleanupTest(io.micronaut.test.context.TestContext testContext) throws Exception
      Specified by:
      afterCleanupTest in interface io.micronaut.test.context.TestExecutionListener
      Throws:
      Exception
    • 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