mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 00:55:16 +00:00
Re-enabled additional tests
This commit is contained in:
parent
32ee43cfe7
commit
8ed1ed5159
@ -23,8 +23,6 @@
|
|||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.jdbc.SQLStatementInspector;
|
import org.hibernate.testing.jdbc.SQLStatementInspector;
|
||||||
import org.hibernate.testing.orm.junit.DomainModel;
|
import org.hibernate.testing.orm.junit.DomainModel;
|
||||||
import org.hibernate.testing.orm.junit.FailureExpected;
|
|
||||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
|
||||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
@ -206,7 +204,6 @@ public void testBasicMultiLoadWithManagedAndChecking(SessionFactoryScope scope)
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue(jiraKey = "HHH-12944")
|
@TestForIssue(jiraKey = "HHH-12944")
|
||||||
@NotImplementedYet(strict = false, reason = "Caching/CacheMode supported not yet implemented")
|
|
||||||
public void testMultiLoadFrom2ndLevelCache(SessionFactoryScope scope) {
|
public void testMultiLoadFrom2ndLevelCache(SessionFactoryScope scope) {
|
||||||
final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector();
|
final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector();
|
||||||
statementInspector.clear();
|
statementInspector.clear();
|
||||||
@ -261,7 +258,6 @@ public void testMultiLoadFrom2ndLevelCache(SessionFactoryScope scope) {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue(jiraKey = "HHH-12944")
|
@TestForIssue(jiraKey = "HHH-12944")
|
||||||
@NotImplementedYet(strict = false, reason = "Caching/CacheMode supported not yet implemented")
|
|
||||||
public void testUnorderedMultiLoadFrom2ndLevelCache(SessionFactoryScope scope) {
|
public void testUnorderedMultiLoadFrom2ndLevelCache(SessionFactoryScope scope) {
|
||||||
final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector();
|
final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector();
|
||||||
statementInspector.clear();
|
statementInspector.clear();
|
||||||
@ -450,25 +446,19 @@ public void testUnorderedMultiLoadFrom2ndLevelCachePendingDeleteReturnRemoved(Se
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@NotImplementedYet(strict = false, reason = "CacheMode not yet implemented")
|
|
||||||
public void testMultiLoadWithCacheModeIgnore(SessionFactoryScope scope) {
|
public void testMultiLoadWithCacheModeIgnore(SessionFactoryScope scope) {
|
||||||
// do the multi-load, telling Hibernate to IGNORE the L2 cache -
|
// do the multi-load, telling Hibernate to IGNORE the L2 cache -
|
||||||
// the end result should be that the cache is (still) empty afterwards
|
// the end result should be that the cache is (still) empty afterwards
|
||||||
scope.inTransaction(
|
List<SimpleEntity> list = scope.fromTransaction(
|
||||||
session -> {
|
session ->
|
||||||
session.getTransaction().begin();
|
session.byMultipleIds( SimpleEntity.class )
|
||||||
List<SimpleEntity> list = session.byMultipleIds( SimpleEntity.class )
|
.with( CacheMode.IGNORE )
|
||||||
.with( CacheMode.IGNORE )
|
.multiLoad( ids( 56 ) )
|
||||||
.multiLoad( ids( 56 ) );
|
|
||||||
session.getTransaction().commit();
|
|
||||||
session.close();
|
|
||||||
|
|
||||||
assertEquals( 56, list.size() );
|
|
||||||
for ( SimpleEntity entity : list ) {
|
|
||||||
assertFalse( scope.getSessionFactory().getCache().containsEntity( SimpleEntity.class, entity.getId() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
assertEquals( 56, list.size() );
|
||||||
|
for ( SimpleEntity entity : list ) {
|
||||||
|
assertFalse( scope.getSessionFactory().getCache().containsEntity( SimpleEntity.class, entity.getId() ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import org.hibernate.boot.model.TypeContributor;
|
import org.hibernate.boot.model.TypeContributor;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||||
import org.hibernate.boot.spi.MetadataImplementor;
|
import org.hibernate.boot.spi.MetadataImplementor;
|
||||||
import org.hibernate.mapping.BasicValue;
|
import org.hibernate.cache.spi.access.AccessType;
|
||||||
import org.hibernate.mapping.Collection;
|
import org.hibernate.mapping.Collection;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.mapping.Property;
|
import org.hibernate.mapping.Property;
|
||||||
@ -32,6 +32,8 @@
|
|||||||
import org.junit.jupiter.api.extension.TestInstancePostProcessor;
|
import org.junit.jupiter.api.extension.TestInstancePostProcessor;
|
||||||
import org.junit.platform.commons.support.AnnotationSupport;
|
import org.junit.platform.commons.support.AnnotationSupport;
|
||||||
|
|
||||||
|
import jakarta.persistence.SharedCacheMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hibernate-testing implementation of a few JUnit5 contracts to support SessionFactory-based testing,
|
* hibernate-testing implementation of a few JUnit5 contracts to support SessionFactory-based testing,
|
||||||
* including argument injection (or see {@link DomainModelScopeAware})
|
* including argument injection (or see {@link DomainModelScopeAware})
|
||||||
@ -133,6 +135,11 @@ public static DomainModelScope findDomainModelScope(Object testInstance, Extensi
|
|||||||
contributor.contribute( metadataBuilder, serviceRegistry );
|
contributor.contribute( metadataBuilder, serviceRegistry );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final SharedCacheMode sharedCacheMode = domainModelAnnotation.sharedCacheMode();
|
||||||
|
final AccessType accessType = domainModelAnnotation.accessType();
|
||||||
|
metadataBuilder.applySharedCacheMode( sharedCacheMode );
|
||||||
|
metadataBuilder.applyAccessType( accessType );
|
||||||
|
|
||||||
MetadataImplementor metadataImplementor = metadataBuilder.build();
|
MetadataImplementor metadataImplementor = metadataBuilder.build();
|
||||||
applyCacheSettings(
|
applyCacheSettings(
|
||||||
metadataImplementor,
|
metadataImplementor,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user