|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packageorg.springframework.test.context.transaction
as colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
{@code TransactionConfiguration} defines class-level metadata for configuring transactional tests. @author Sam Brannen @since 2.5 @seeContextConfigurationTransactionalTestExecutionListener @seeTransactionalTestExecutionListenerorg.springframework.test.context.ContextConfiguration
Class TransactionalTestExecutionListener, void afterTestMethod(TestContext){@code TestExecutionListener} that provides support forexecutingexecutingteststests within transactions byusinghonoring the @Transactional and @NotTransactional annotations.Expectsa PlatformTransactionManager bean to be defined in the Spring ApplicationContext for the test. Changes to the database during a test that is run with@{@code @Transactional} willbebe run within a transaction that will, by default, be automatically rolled back after completion of the test; whereas, changes to the database during a test that is run with@{@code @NotTransactional}willwill notbe run within a transaction. Test methods that arenotnot annotated witheither{@code@@Transactional} (at the class or method level)or @NotTransactionalwillnotnot be run within a transaction.
Transactional commit and rollback behavior can be configured via the class-level@@TransactionConfiguration and method-level@@Rollback annotations.@TransactionConfigurationIn case
alsothereprovidesare multipleconfigurationinstances of {@code PlatformTransactionManager} within the test's {@code ApplicationContext}, {@code @TransactionConfiguration} supports configuring the bean name of thePlatformTransactionManager{@codethatPlatformTransactionManager}is tothat should be used to drive transactions.Alternatively, TransactionManagementConfigurer can be implemented in an @Configuration class. When executing transactional tests, it is sometimes useful to be ableto executeto execute certain set up or tear down code outside of a transaction. {@code TransactionalTestExecutionListener} provides such support for methods annotated with@@BeforeTransaction and@@AfterTransaction.@author Sam Brannen @author Juergen Hoeller @since 2.5 @see TransactionConfiguration @see TransactionManagementConfigurer @see org.springframework.transaction.annotation.Transactional @see org.springframework.test.annotation.NotTransactional @see org.springframework.test.annotation.Rollback @see BeforeTransaction @see AfterTransaction
If a transaction is currently active for the test method of the supplied test context, this method will end the transaction and run @AfterTransaction methods.Class TransactionalTestExecutionListener, void beforeTestMethod(TestContext)
@{@code @AfterTransaction} methods are guaranteed to be invoked even if an error occurs while ending the transaction.
If the test method of the supplied test context is configured to run within a transaction, this method will run @BeforeTransaction methods and start a new transaction.Class TransactionalTestExecutionListener, PlatformTransactionManager getTransactionManager(TestContext)Note that if a
@{@code @BeforeTransaction} method fails,remainingany@remaining {@code @BeforeTransaction} methods willnotnot be invoked, and atransactiontransaction will not be started. @see org.springframework.transaction.annotation.Transactional @see org.springframework.test.annotation.NotTransactionalNotTransactional @see #getTransactionManager(TestContext, String)
Get the transaction manager to use for the supplied test context. @param testContext the test context for which the transaction manager should be retrieved @return the transaction manager to use, ornull
if not found @throws BeansException if an error occurs while retrieving the transactionmanagermanager @see #getTransactionManager(TestContext, String)