HHH-8923 corrected test case
This commit is contained in:
parent
ee44d9be7f
commit
2464d2e214
|
@ -27,9 +27,11 @@ import static org.junit.Assert.assertFalse;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.metamodel.MetadataSources;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.service.BootstrapServiceRegistry;
|
||||
import org.hibernate.service.BootstrapServiceRegistryBuilder;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.service.ServiceRegistryBuilder;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -37,12 +39,14 @@ import org.junit.Test;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class ServiceRegistryClosingCascadeTest extends BaseUnitTestCase {
|
||||
|
||||
@Test
|
||||
public void testSessionFactoryClosing() {
|
||||
BootstrapServiceRegistry bsr = new BootstrapServiceRegistryBuilder().build();
|
||||
ServiceRegistry sr = new ServiceRegistryBuilder(bsr).buildServiceRegistry();
|
||||
assertTrue( ( (BootstrapServiceRegistryImpl) bsr ).isActive() );
|
||||
MetadataSources metadataSources = new MetadataSources( bsr );
|
||||
SessionFactory sf = metadataSources.buildMetadata().buildSessionFactory();
|
||||
Configuration config = new Configuration();
|
||||
SessionFactory sf = config.buildSessionFactory( sr );
|
||||
|
||||
sf.close();
|
||||
assertFalse( ( (BootstrapServiceRegistryImpl) bsr ).isActive() );
|
||||
|
|
Loading…
Reference in New Issue