fix test fallout from rebase

update test to jakarta package name
and refix moved tests
This commit is contained in:
Gavin King 2021-12-07 21:31:14 +01:00 committed by Steve Ebersole
parent 8f7e0c4c2f
commit 6d43d62a5a
5 changed files with 12 additions and 19 deletions

View File

@ -6,7 +6,6 @@
*/ */
package org.hibernate.orm.test.multitenancy; package org.hibernate.orm.test.multitenancy;
import org.hibernate.MultiTenancyStrategy;
import org.hibernate.boot.MetadataSources; import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
@ -31,7 +30,6 @@ public class ConfigurationValidationTest extends BaseUnitTestCase {
ServiceRegistryImplementor serviceRegistry = null; ServiceRegistryImplementor serviceRegistry = null;
try { try {
serviceRegistry = (ServiceRegistryImplementor) new StandardServiceRegistryBuilder() serviceRegistry = (ServiceRegistryImplementor) new StandardServiceRegistryBuilder()
.applySetting( Environment.MULTI_TENANT, MultiTenancyStrategy.SCHEMA )
.applySetting( Environment.MULTI_TENANT_CONNECTION_PROVIDER, "class.not.present.in.classpath" ) .applySetting( Environment.MULTI_TENANT_CONNECTION_PROVIDER, "class.not.present.in.classpath" )
.build(); .build();
@ -53,7 +51,6 @@ public class ConfigurationValidationTest extends BaseUnitTestCase {
ServiceRegistryImplementor serviceRegistry = null; ServiceRegistryImplementor serviceRegistry = null;
try { try {
serviceRegistry = (ServiceRegistryImplementor) new StandardServiceRegistryBuilder() serviceRegistry = (ServiceRegistryImplementor) new StandardServiceRegistryBuilder()
.applySetting( Environment.MULTI_TENANT, MultiTenancyStrategy.SCHEMA )
.applySetting( Environment.CONNECTION_HANDLING, PhysicalConnectionHandlingMode.DELAYED_ACQUISITION_AND_RELEASE_AFTER_STATEMENT.name() ) .applySetting( Environment.CONNECTION_HANDLING, PhysicalConnectionHandlingMode.DELAYED_ACQUISITION_AND_RELEASE_AFTER_STATEMENT.name() )
.addService( .addService(
MultiTenantConnectionProvider.class, MultiTenantConnectionProvider.class,

View File

@ -12,7 +12,6 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer; import java.util.function.Consumer;
import org.hibernate.MultiTenancyStrategy;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.boot.Metadata; import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources; import org.hibernate.boot.MetadataSources;
@ -59,7 +58,6 @@ public class DiscriminatorMultiTenancyTest extends BaseUnitTestCase {
@Before @Before
public void setUp() { public void setUp() {
Map settings = new HashMap(); Map settings = new HashMap();
settings.put(Environment.MULTI_TENANT, MultiTenancyStrategy.DISCRIMINATOR);
settings.put(Environment.MULTI_TENANT_IDENTIFIER_RESOLVER, currentTenantResolver); settings.put(Environment.MULTI_TENANT_IDENTIFIER_RESOLVER, currentTenantResolver);
settings.put(Environment.CACHE_REGION_FACTORY, CachingRegionFactory.class.getName()); settings.put(Environment.CACHE_REGION_FACTORY, CachingRegionFactory.class.getName());
settings.put(Environment.GENERATE_STATISTICS, "true"); settings.put(Environment.GENERATE_STATISTICS, "true");

View File

@ -9,7 +9,6 @@ package org.hibernate.orm.test.multitenancy.schema;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.hibernate.MultiTenancyStrategy;
import org.hibernate.SessionBuilder; import org.hibernate.SessionBuilder;
import org.hibernate.boot.Metadata; import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources; import org.hibernate.boot.MetadataSources;
@ -61,7 +60,6 @@ public abstract class AbstractSchemaBasedMultiTenancyTest<T extends MultiTenantC
T multiTenantConnectionProvider = buildMultiTenantConnectionProvider(); T multiTenantConnectionProvider = buildMultiTenantConnectionProvider();
Map settings = new HashMap(); Map settings = new HashMap();
settings.put( Environment.MULTI_TENANT, MultiTenancyStrategy.SCHEMA );
settings.put( Environment.CACHE_REGION_FACTORY, CachingRegionFactory.class.getName() ); settings.put( Environment.CACHE_REGION_FACTORY, CachingRegionFactory.class.getName() );
settings.put( Environment.GENERATE_STATISTICS, "true" ); settings.put( Environment.GENERATE_STATISTICS, "true" );
@ -178,7 +176,7 @@ public abstract class AbstractSchemaBasedMultiTenancyTest<T extends MultiTenantC
// make sure we get the correct people back, from cache // make sure we get the correct people back, from cache
// first, jboss // first, jboss
doInHibernateSessionBuilder( this::jboss, session -> { doInHibernateSessionBuilder( this::jboss, session -> {
Customer customer = (Customer) session.load( Customer.class, 1L ); Customer customer = session.load( Customer.class, 1L );
Assert.assertEquals( "steve", customer.getName() ); Assert.assertEquals( "steve", customer.getName() );
// also, make sure this came from second level // also, make sure this came from second level
Assert.assertEquals( 1, sessionFactory.getStatistics().getSecondLevelCacheHitCount() ); Assert.assertEquals( 1, sessionFactory.getStatistics().getSecondLevelCacheHitCount() );
@ -187,7 +185,7 @@ public abstract class AbstractSchemaBasedMultiTenancyTest<T extends MultiTenantC
sessionFactory.getStatistics().clear(); sessionFactory.getStatistics().clear();
// then, acme // then, acme
doInHibernateSessionBuilder( this::acme, session -> { doInHibernateSessionBuilder( this::acme, session -> {
Customer customer = (Customer) session.load( Customer.class, 1L ); Customer customer = session.load( Customer.class, 1L );
Assert.assertEquals( "john", customer.getName() ); Assert.assertEquals( "john", customer.getName() );
// also, make sure this came from second level // also, make sure this came from second level
Assert.assertEquals( 1, sessionFactory.getStatistics().getSecondLevelCacheHitCount() ); Assert.assertEquals( 1, sessionFactory.getStatistics().getSecondLevelCacheHitCount() );
@ -198,7 +196,7 @@ public abstract class AbstractSchemaBasedMultiTenancyTest<T extends MultiTenantC
sessionFactory.getCache().evictEntityRegions(); sessionFactory.getCache().evictEntityRegions();
// first jboss // first jboss
doInHibernateSessionBuilder( this::jboss, session -> { doInHibernateSessionBuilder( this::jboss, session -> {
Customer customer = (Customer) session.load( Customer.class, 1L ); Customer customer = session.load( Customer.class, 1L );
Assert.assertEquals( "steve", customer.getName() ); Assert.assertEquals( "steve", customer.getName() );
// also, make sure this came from second level // also, make sure this came from second level
Assert.assertEquals( 0, sessionFactory.getStatistics().getSecondLevelCacheHitCount() ); Assert.assertEquals( 0, sessionFactory.getStatistics().getSecondLevelCacheHitCount() );
@ -207,7 +205,7 @@ public abstract class AbstractSchemaBasedMultiTenancyTest<T extends MultiTenantC
sessionFactory.getStatistics().clear(); sessionFactory.getStatistics().clear();
// then, acme // then, acme
doInHibernateSessionBuilder( this::acme, session -> { doInHibernateSessionBuilder( this::acme, session -> {
Customer customer = (Customer) session.load( Customer.class, 1L ); Customer customer = session.load( Customer.class, 1L );
Assert.assertEquals( "john", customer.getName() ); Assert.assertEquals( "john", customer.getName() );
// also, make sure this came from second level // also, make sure this came from second level
Assert.assertEquals( 0, sessionFactory.getStatistics().getSecondLevelCacheHitCount() ); Assert.assertEquals( 0, sessionFactory.getStatistics().getSecondLevelCacheHitCount() );

View File

@ -8,10 +8,10 @@ package org.hibernate.test.tenantid;
import org.hibernate.annotations.TenantId; import org.hibernate.annotations.TenantId;
import javax.persistence.Entity; import jakarta.persistence.Entity;
import javax.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;
import javax.persistence.Id; import jakarta.persistence.Id;
import javax.persistence.ManyToOne; import jakarta.persistence.ManyToOne;
@Entity @Entity
public class Account { public class Account {

View File

@ -8,10 +8,10 @@ package org.hibernate.test.tenantid;
import org.hibernate.annotations.TenantId; import org.hibernate.annotations.TenantId;
import javax.persistence.Entity; import jakarta.persistence.Entity;
import javax.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;
import javax.persistence.Id; import jakarta.persistence.Id;
import javax.persistence.OneToMany; import jakarta.persistence.OneToMany;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;