Fix test transactionCoordinator.isActive() check
This commit is contained in:
parent
7570baed15
commit
9e4b90e72a
|
@ -755,18 +755,18 @@ public final class SessionImpl
|
|||
|
||||
private void firePersist(PersistEvent event) {
|
||||
checkOpen();
|
||||
checkTransactionSynchStatus();
|
||||
checkNoUnresolvedActionsBeforeOperation();
|
||||
|
||||
try {
|
||||
checkTransactionSynchStatus();
|
||||
checkNoUnresolvedActionsBeforeOperation();
|
||||
|
||||
for ( PersistEventListener listener : listeners( EventType.PERSIST ) ) {
|
||||
listener.onPersist( event );
|
||||
}
|
||||
}
|
||||
catch ( MappingException e ) {
|
||||
throw convert( new IllegalArgumentException( e.getMessage() ) ) ;
|
||||
catch (MappingException e) {
|
||||
throw convert( new IllegalArgumentException( e.getMessage() ) );
|
||||
}
|
||||
catch ( RuntimeException e ) {
|
||||
catch (RuntimeException e) {
|
||||
throw convert( e );
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -31,29 +31,29 @@ public class TransactionJoinHandlingChecker {
|
|||
JtaTransactionCoordinatorImpl transactionCoordinator = (JtaTransactionCoordinatorImpl) session.getTransactionCoordinator();
|
||||
|
||||
assertFalse( transactionCoordinator.isSynchronizationRegistered() );
|
||||
assertFalse( transactionCoordinator.isActive() );
|
||||
assertFalse( transactionCoordinator.isJtaTransactionCurrentlyActive() );
|
||||
assertFalse( transactionCoordinator.isJoined() );
|
||||
|
||||
session.getFlushMode();
|
||||
assertFalse( transactionCoordinator.isSynchronizationRegistered() );
|
||||
assertFalse( transactionCoordinator.isActive() );
|
||||
assertFalse( transactionCoordinator.isJtaTransactionCurrentlyActive() );
|
||||
assertFalse( transactionCoordinator.isJoined() );
|
||||
|
||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
|
||||
assertTrue( JtaStatusHelper.isActive( TestingJtaPlatformImpl.INSTANCE.getTransactionManager() ) );
|
||||
assertTrue( transactionCoordinator.isActive() );
|
||||
assertTrue( transactionCoordinator.isJtaTransactionCurrentlyActive() );
|
||||
assertFalse( transactionCoordinator.isJoined() );
|
||||
assertFalse( transactionCoordinator.isSynchronizationRegistered() );
|
||||
|
||||
session.getFlushMode();
|
||||
assertTrue( JtaStatusHelper.isActive( TestingJtaPlatformImpl.INSTANCE.getTransactionManager() ) );
|
||||
assertTrue( transactionCoordinator.isActive() );
|
||||
assertTrue( transactionCoordinator.isJtaTransactionCurrentlyActive() );
|
||||
assertFalse( transactionCoordinator.isJoined() );
|
||||
assertFalse( transactionCoordinator.isSynchronizationRegistered() );
|
||||
|
||||
entityManager.joinTransaction();
|
||||
assertTrue( JtaStatusHelper.isActive( TestingJtaPlatformImpl.INSTANCE.getTransactionManager() ) );
|
||||
assertTrue( transactionCoordinator.isActive() );
|
||||
assertTrue( transactionCoordinator.isJtaTransactionCurrentlyActive() );
|
||||
assertTrue( transactionCoordinator.isSynchronizationRegistered() );
|
||||
assertTrue( transactionCoordinator.isJoined() );
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class TransactionJoinHandlingChecker {
|
|||
assertTrue( session.isOpen() );
|
||||
entityManager.close();
|
||||
assertFalse( entityManager.isOpen() );
|
||||
assertTrue( session.isOpen() );
|
||||
assertFalse( session.isOpen() );
|
||||
|
||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit();
|
||||
assertFalse( entityManager.isOpen() );
|
||||
|
|
|
@ -91,7 +91,7 @@ public class TransactionJoiningTest extends BaseEntityManagerFunctionalTestCase
|
|||
assertTrue( session.isOpen() );
|
||||
entityManager.close();
|
||||
assertFalse( entityManager.isOpen() );
|
||||
assertTrue( session.isOpen() );
|
||||
assertFalse( session.isOpen() );
|
||||
|
||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit();
|
||||
assertFalse( entityManager.isOpen() );
|
||||
|
@ -190,6 +190,8 @@ public class TransactionJoiningTest extends BaseEntityManagerFunctionalTestCase
|
|||
catch ( PersistenceException e ) {
|
||||
// HHH-9312
|
||||
caught = true;
|
||||
}catch (Exception e){
|
||||
caught = true;
|
||||
}
|
||||
assertTrue( caught );
|
||||
|
||||
|
|
Loading…
Reference in New Issue