Skip to content

Commit

Permalink
HHH-7347 fail test if it runs longer than 30 minutes to prevent hangs
Browse files Browse the repository at this point in the history
  • Loading branch information
stliu committed May 23, 2012
1 parent 7ed323a commit 4b74517
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@


import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.junit.After; import org.junit.After;
import org.junit.Rule;
import org.junit.rules.TestRule;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;


import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper; import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper;
Expand All @@ -41,6 +44,8 @@
public abstract class BaseUnitTestCase { public abstract class BaseUnitTestCase {
private static final Logger log = Logger.getLogger( BaseUnitTestCase.class ); private static final Logger log = Logger.getLogger( BaseUnitTestCase.class );


@Rule
public TestRule globalTimeout= new Timeout(30 * 60 * 1000); // no test should run longer than 30 minutes
@After @After
public void releaseTransactions() { public void releaseTransactions() {
if ( JtaStatusHelper.isActive( TestingJtaPlatformImpl.INSTANCE.getTransactionManager() ) ) { if ( JtaStatusHelper.isActive( TestingJtaPlatformImpl.INSTANCE.getTransactionManager() ) ) {
Expand Down

0 comments on commit 4b74517

Please sign in to comment.