HHH-6015 - Investigate hibernate-infinispan test failures

Some tests were relying on empty caches at the start, so
make sure these are clear.
This commit is contained in:
Galder Zamarreño 2011-03-16 18:32:08 +01:00
parent 29a90c3aa8
commit 5c8e4f195d
3 changed files with 5 additions and 2 deletions

View File

@ -121,7 +121,7 @@ public class BasicJdbcTransactionalTestCase extends SingleNodeTestCase {
@Test @Test
public void testEmptySecondLevelCacheEntry() throws Exception { public void testEmptySecondLevelCacheEntry() throws Exception {
sessionFactory().getCache().evictEntityRegion( Item.class.getName() ); sessionFactory().getCache().evictCollectionRegion( Item.class.getName() + ".items" );
Statistics stats = sessionFactory().getStatistics(); Statistics stats = sessionFactory().getStatistics();
stats.clear(); stats.clear();
SecondLevelCacheStatistics statistics = stats.getSecondLevelCacheStatistics( Item.class.getName() + ".items" ); SecondLevelCacheStatistics statistics = stats.getSecondLevelCacheStatistics( Item.class.getName() + ".items" );

View File

@ -433,7 +433,7 @@ public class BasicTransactionalTestCase extends SingleNodeTestCase {
@Test @Test
public void testEmptySecondLevelCacheEntry() throws Exception { public void testEmptySecondLevelCacheEntry() throws Exception {
sessionFactory().getCache().evictEntityRegion( Item.class.getName() ); sessionFactory().getCache().evictCollectionRegion( Item.class.getName() + ".items" );
Statistics stats = sessionFactory().getStatistics(); Statistics stats = sessionFactory().getStatistics();
stats.clear(); stats.clear();
SecondLevelCacheStatistics statistics = stats.getSecondLevelCacheStatistics( Item.class.getName() + ".items" ); SecondLevelCacheStatistics statistics = stats.getSecondLevelCacheStatistics( Item.class.getName() + ".items" );

View File

@ -25,6 +25,7 @@ package org.hibernate.test.cache.infinispan.functional.classloader;
import javax.transaction.TransactionManager; import javax.transaction.TransactionManager;
import org.hibernate.test.cache.infinispan.functional.Item;
import org.infinispan.Cache; import org.infinispan.Cache;
import org.infinispan.manager.CacheContainer; import org.infinispan.manager.CacheContainer;
import org.infinispan.manager.EmbeddedCacheManager; import org.infinispan.manager.EmbeddedCacheManager;
@ -116,6 +117,8 @@ public class IsolatedClassLoaderTest extends DualNodeTestCase {
@Override @Override
protected void cleanupTest() throws Exception { protected void cleanupTest() throws Exception {
try { try {
// Clear the local account cache
sessionFactory().getCache().evictEntityRegion(Account.class.getName());
if ( localQueryCache != null && localQueryListener != null ) { if ( localQueryCache != null && localQueryListener != null ) {
localQueryCache.removeListener( localQueryListener ); localQueryCache.removeListener( localQueryListener );
} }