Fix test transactionCoordinator.isActive() check

This commit is contained in:
Andrea Boriero 2016-04-29 12:13:48 +01:00 committed by Steve Ebersole
parent 7570baed15
commit 9e4b90e72a
3 changed files with 15 additions and 13 deletions

View File

@ -755,10 +755,10 @@ public final class SessionImpl
private void firePersist(PersistEvent event) {
checkOpen();
try {
checkTransactionSynchStatus();
checkNoUnresolvedActionsBeforeOperation();
try {
for ( PersistEventListener listener : listeners( EventType.PERSIST ) ) {
listener.onPersist( event );
}

View File

@ -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() );

View File

@ -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 );