HHH-8923 corrected test case

This commit is contained in:
Brett Meyer 2014-03-25 17:51:32 -04:00
parent daf120b063
commit 2c88c3998b
1 changed files with 9 additions and 7 deletions

View File

@ -23,18 +23,19 @@
*/
package org.hibernate.service.internal;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.BootstrapServiceRegistry;
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl;
import org.hibernate.metamodel.MetadataSources;
import org.hibernate.cfg.Configuration;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* @author Steve Ebersole
*/
@ -42,9 +43,10 @@ public class ServiceRegistryClosingCascadeTest extends BaseUnitTestCase {
@Test
public void testSessionFactoryClosing() {
BootstrapServiceRegistry bsr = new BootstrapServiceRegistryBuilder().build();
StandardServiceRegistry sr = new StandardServiceRegistryBuilder(bsr).build();
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() );