remove use of deprecated caching methods from tests

This commit is contained in:
Gavin 2022-01-11 14:02:15 +01:00 committed by Gavin King
parent abf3360b49
commit be4b751582
17 changed files with 50 additions and 52 deletions

View File

@ -286,7 +286,7 @@ public class BasicHibernateAnnotationsTest extends BaseCoreFunctionalTestCase {
s.close();
sessionFactory().getStatistics().clear();
sessionFactory().getStatistics().setStatisticsEnabled( true );
sessionFactory().getCache().evictEntityRegion( ZipCode.class );
sessionFactory().getCache().evictEntityData( ZipCode.class );
s = openSession();
tx = s.beginTransaction();
s.get( ZipCode.class, zc.code );

View File

@ -336,7 +336,7 @@ public class OrderByTest extends BaseCoreFunctionalTestCase {
s.flush();
s.clear();
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
forum = (Forum) s.get( Forum.class, forum.getId() );
@ -354,7 +354,7 @@ public class OrderByTest extends BaseCoreFunctionalTestCase {
s.flush();
s.clear();
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
forum = (Forum) s.get( Forum.class, forum.getId() );
@ -367,7 +367,7 @@ public class OrderByTest extends BaseCoreFunctionalTestCase {
s.flush();
s.clear();
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
forum = (Forum) s.get( Forum.class, forum.getId() );
@ -405,7 +405,7 @@ public class OrderByTest extends BaseCoreFunctionalTestCase {
s.flush();
s.clear();
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
employee = (Employee) s.get( Employee.class, employee.getId() );

View File

@ -652,7 +652,7 @@ public class QueryAndSQLTest {
session.persist( chaos );
session.flush();
session.clear();
session.getSessionFactory().getCache().evictEntityRegion( Chaos.class );
session.getSessionFactory().getCache().evictEntityData( Chaos.class );
Chaos resultChaos = session.load( Chaos.class, chaos.getId() );
assertEquals( upperName, resultChaos.getName() );
@ -686,7 +686,7 @@ public class QueryAndSQLTest {
chaos.getParticles().add( p );
session.flush();
session.clear();
session.getSessionFactory().getCache().evictEntityRegion( Chaos.class );
session.getSessionFactory().getCache().evictEntityData( Chaos.class );
Chaos resultChaos = session.load( Chaos.class, chaos.getId() );
assertEquals( 2, resultChaos.getParticles().size() );

View File

@ -74,8 +74,8 @@ public class BatchFetchTest {
}
);
scope.getSessionFactory().getCache().evictEntityRegion( Model.class );
scope.getSessionFactory().getCache().evictEntityRegion( ProductLine.class );
scope.getSessionFactory().getCache().evictEntityData( Model.class );
scope.getSessionFactory().getCache().evictEntityData( ProductLine.class );
scope.inTransaction(
session -> {

View File

@ -39,7 +39,7 @@ public class InsertedDataTest extends BaseCoreFunctionalTestCase {
@Test
public void testInsert() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
Session s = openSession();
@ -60,7 +60,7 @@ public class InsertedDataTest extends BaseCoreFunctionalTestCase {
@Test
public void testInsertWithRollback() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
Session s = openSession();
@ -76,7 +76,7 @@ public class InsertedDataTest extends BaseCoreFunctionalTestCase {
@Test
public void testInsertThenUpdate() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
Session s = openSession();
@ -100,7 +100,7 @@ public class InsertedDataTest extends BaseCoreFunctionalTestCase {
@Test
public void testInsertThenUpdateThenRollback() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
Session s = openSession();
@ -123,7 +123,7 @@ public class InsertedDataTest extends BaseCoreFunctionalTestCase {
@Test
public void testInsertWithRefresh() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
Session s = openSession();
@ -146,7 +146,7 @@ public class InsertedDataTest extends BaseCoreFunctionalTestCase {
@Test
public void testInsertWithRefreshThenRollback() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
Session s = openSession();
@ -173,7 +173,7 @@ public class InsertedDataTest extends BaseCoreFunctionalTestCase {
@Test
public void testInsertWithClear() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
Session s = openSession();
@ -196,7 +196,7 @@ public class InsertedDataTest extends BaseCoreFunctionalTestCase {
@Test
public void testInsertWithClearThenRollback() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
Session s = openSession();

View File

@ -16,9 +16,7 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.hibernate.cfg.AvailableSettings.DEFAULT_LIST_SEMANTICS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
/**
* @author Guenther Demetz
@ -117,7 +115,7 @@ public class LockModeTest extends BaseCoreFunctionalTestCase {
public void testDefaultLockModeOnEntityLoad() {
// first evict user
sessionFactory().getCache().evictEntity( User.class.getName(), 1 );
sessionFactory().getCache().evictEntityData( User.class.getName(), 1 );
Session s1 = openSession();
s1.beginTransaction();
@ -153,7 +151,7 @@ public class LockModeTest extends BaseCoreFunctionalTestCase {
public void testReadLockModeOnEntityLoad() {
// first evict user
sessionFactory().getCache().evictEntity( User.class.getName(), 1 );
sessionFactory().getCache().evictEntityData( User.class.getName(), 1 );
Session s1 = openSession();
s1.beginTransaction();

View File

@ -221,8 +221,8 @@ public class BackrefCompositeMapKeyTest {
SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
sessionFactory.getCache().evictEntityRegion( Product.class );
sessionFactory.getCache().evictEntityRegion( Part.class );
sessionFactory.getCache().evictEntityData( Product.class );
sessionFactory.getCache().evictEntityData( Part.class );
scope.inTransaction(
session -> {
@ -234,8 +234,8 @@ public class BackrefCompositeMapKeyTest {
);
sessionFactory.getCache().evictEntityRegion( Product.class );
sessionFactory.getCache().evictEntityRegion( Part.class );
sessionFactory.getCache().evictEntityData( Product.class );
sessionFactory.getCache().evictEntityData( Part.class );
scope.inTransaction(
session -> {

View File

@ -160,7 +160,7 @@ public class DiscriminatorMultiTenancyTest extends BaseUnitTestCase {
// make sure the same works from data store too
sessionFactory.getStatistics().clear();
sessionFactory.getCache().evictEntityRegions();
sessionFactory.getCache().evictEntityData();
// first jboss
doInHibernate( "jboss", session -> {

View File

@ -190,7 +190,7 @@ public abstract class AbstractSchemaBasedMultiTenancyTest<T extends MultiTenantC
// make sure the same works from datastore too
sessionFactory.getStatistics().clear();
sessionFactory.getCache().evictEntityRegions();
sessionFactory.getCache().evictEntityData();
// first jboss
doInHibernateSessionBuilder( this::jboss, session -> {
Customer customer = session.load( Customer.class, 1L );

View File

@ -504,7 +504,7 @@ public class MergeTest extends AbstractOperationTestCase {
assertUpdateCount( 1, scope );
clearCounts( scope );
scope.getSessionFactory().getCache().evictEntityRegion( NumberedNode.class );
scope.getSessionFactory().getCache().evictEntityData( NumberedNode.class );
NumberedNode child2 = new NumberedNode( "child2" );
NumberedNode grandchild3 = new NumberedNode( "grandchild3" );

View File

@ -60,9 +60,9 @@ public abstract class CustomSQLTestSupport extends BaseCoreFunctionalTestCase {
t.commit();
s.close();
sessionFactory().getCache().evictEntityRegion( Organization.class );
sessionFactory().getCache().evictEntityRegion( Person.class );
sessionFactory().getCache().evictEntityRegion( Employment.class );
sessionFactory().getCache().evictEntityData( Organization.class );
sessionFactory().getCache().evictEntityData( Person.class );
sessionFactory().getCache().evictEntityData( Employment.class );
s = openSession();
t = s.beginTransaction();

View File

@ -58,7 +58,7 @@ public class SubselectTest extends BaseCoreFunctionalTestCase {
assertNotNull( being.getSpecies() );
}
s.clear();
sessionFactory().getCache().evictEntityRegion( Being.class );
sessionFactory().getCache().evictEntityData( Being.class );
Being gav = s.get( Being.class, gavin.getId() );
assertEquals( gav.getLocation(), gavin.getAddress() );
assertEquals( gav.getSpecies(), "human" );

View File

@ -58,7 +58,7 @@ public class UnconstrainedTest {
public void testUnconstrainedNoCache(SessionFactoryScope scope) {
final CacheImplementor cache = scope.getSessionFactory().getCache();
cache.evictEntityRegion( Person.class );
cache.evictEntityData( Person.class );
scope.inTransaction(
session -> {
@ -68,7 +68,7 @@ public class UnconstrainedTest {
}
);
cache.evictEntityRegion( Person.class );
cache.evictEntityData( Person.class );
scope.inTransaction(
session -> {
@ -85,7 +85,7 @@ public class UnconstrainedTest {
final CacheImplementor cache = scope.getSessionFactory().getCache();
cache.evictEntityRegion( Person.class );
cache.evictEntityData( Person.class );
scope.inTransaction(
session -> {
@ -104,7 +104,7 @@ public class UnconstrainedTest {
}
);
cache.evictEntityRegion( Person.class );
cache.evictEntityData( Person.class );
scope.inTransaction(
session -> {

View File

@ -84,7 +84,7 @@ public class JoinFetchTest extends BaseCoreFunctionalTestCase {
}
);
sessionFactory().getCache().evictEntityRegion( Item.class );
sessionFactory().getCache().evictEntityData( Item.class );
inTransaction(
s -> {
@ -97,7 +97,7 @@ public class JoinFetchTest extends BaseCoreFunctionalTestCase {
);
sessionFactory().getCache().evictEntityRegion( Bid.class );
sessionFactory().getCache().evictEntityData( Bid.class );
inTransaction(
s -> {
@ -108,7 +108,7 @@ public class JoinFetchTest extends BaseCoreFunctionalTestCase {
}
);
sessionFactory().getCache().evictCollectionRegion( Item.class.getName() + ".bids" );
sessionFactory().getCache().evictCollectionData( Item.class.getName() + ".bids" );
inTransaction(
s -> {

View File

@ -63,8 +63,8 @@ public class PartialComponentPropertyRefTest extends BaseNonConfigCoreFunctional
s.clear();
sessionFactory().getCache().evictEntityRegion( Account.class );
sessionFactory().getCache().evictEntityRegion( Person.class );
sessionFactory().getCache().evictEntityData( Account.class );
sessionFactory().getCache().evictEntityData( Person.class );
a = (Account) s.get(Account.class, "123-12345-1236");
assertTrue( Hibernate.isInitialized( a.getOwner() ) );

View File

@ -84,7 +84,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase {
assertEquals(2, sessionFactory().getStatistics().getUpdateTimestampsCachePutCount()); // One preinvalidate & one invalidate
assertEquals(0, sessionFactory().getStatistics().getUpdateTimestampsCacheMissCount());
sessionFactory().getCache().evictEntityRegion( "Item" );
sessionFactory().getCache().evictEntityData( "Item" );
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
Session s1 = openSession();
@ -101,7 +101,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase {
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().resume( tx );
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit();
sessionFactory().getCache().evictEntityRegion( "Item" );
sessionFactory().getCache().evictEntityData( "Item" );
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
s1 = openSession();
@ -159,7 +159,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase {
sessionFactory().getStatistics().clear();
sessionFactory().getCache().evictEntityRegion( "Item" );
sessionFactory().getCache().evictEntityData( "Item" );
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
Session s4 = openSession();

View File

@ -71,7 +71,7 @@ public class InsertedDataTest {
@Test
public void testInsert() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
inTransaction(
@ -92,7 +92,7 @@ public class InsertedDataTest {
@Test
public void testInsertWithRollback() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
inTransaction(
@ -110,7 +110,7 @@ public class InsertedDataTest {
@Test
public void testInsertThenUpdate() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
inTransaction(
@ -133,7 +133,7 @@ public class InsertedDataTest {
@Test
public void testInsertThenUpdateThenRollback() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
inTransaction(
@ -152,7 +152,7 @@ public class InsertedDataTest {
@Test
public void testInsertWithRefresh() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
inTransaction(
@ -175,7 +175,7 @@ public class InsertedDataTest {
@Test
public void testInsertWithRefreshThenRollback() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
inTransaction(
@ -219,7 +219,7 @@ public class InsertedDataTest {
@Test
public void testInsertWithClear() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
inTransaction(
@ -242,7 +242,7 @@ public class InsertedDataTest {
@Test
public void testInsertWithClearThenRollback() {
sessionFactory().getCache().evictEntityRegions();
sessionFactory().getCache().evictEntityData();
sessionFactory().getStatistics().clear();
inTransaction(