skip org.hibernate.test.legacy.MasterDetailTest#testCachedCollectionRefresh when connection is enforcing (at least) serializable isolation

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@13933 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2007-08-17 18:46:02 +00:00
parent d06348743f
commit 7955c1a75d
2 changed files with 31 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.sql.Connection;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Mappings;
@ -279,6 +280,29 @@ public abstract class FunctionalTestCase extends UnitTestCase implements Executi
/**
* Do connections enforce SERIALIZABLE isolation...
*
* @return
* @throws Exception
*/
protected boolean isSerializableIsolationEnforced() throws Exception {
Connection conn = null;
try {
conn = sfi().getConnectionProvider().getConnection();
return conn.getTransactionIsolation() >= Connection.TRANSACTION_SERIALIZABLE;
}
finally {
if ( conn != null ) {
try {
sfi().getConnectionProvider().closeConnection( conn );
}
catch ( Throwable ignore ) {
// ignore...
}
}
}
}
/**
* Is connection at least read committed?

View File

@ -835,6 +835,10 @@ public class MasterDetailTest extends LegacyTestCase {
}
public void testCachedCollectionRefresh() throws Exception {
if ( isSerializableIsolationEnforced() ) {
reportSkip( "SERIALIZABLE isolation", "cached collection refreshing" );
return;
}
Session s = openSession();
Category c = new Category();
List list = new ArrayList();
@ -853,7 +857,9 @@ public class MasterDetailTest extends LegacyTestCase {
s.close();
s = openSession();
if ( (getDialect() instanceof MySQLDialect) ) s.connection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
if ( (getDialect() instanceof MySQLDialect) ) {
s.connection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
}
c = (Category) s.load(Category.class, id);
c.getSubcategories().size(); //force load