org.hibernate.testing.ServiceRegistryBuilder Maven / Gradle / Ivy
                 Go to download
                
        
                    Show more of this group  Show more artifacts with this name
Show all versions of hibernate-testing Show documentation
                Show all versions of hibernate-testing Show documentation
Support for testing Hibernate ORM functionality
                
             The newest version!
        
        /*
 * SPDX-License-Identifier: Apache-2.0
 * Copyright Red Hat Inc. and Hibernate Authors
 */
package org.hibernate.testing;
import java.util.Map;
import java.util.Properties;
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
import org.hibernate.cfg.Environment;
import org.hibernate.internal.util.PropertiesHelper;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.testing.util.ServiceRegistryUtil;
/**
 * @author Steve Ebersole
 */
public final class ServiceRegistryBuilder {
	private ServiceRegistryBuilder() {
	}
	public static StandardServiceRegistryImpl buildServiceRegistry() {
		return buildServiceRegistry( PropertiesHelper.map( Environment.getProperties() ) );
	}
	public static StandardServiceRegistryImpl buildServiceRegistry(Map serviceRegistryConfig) {
		return (StandardServiceRegistryImpl) ServiceRegistryUtil.serviceRegistryBuilder()
				.applySettings( serviceRegistryConfig )
				.build();
	}
	public static StandardServiceRegistryImpl buildServiceRegistry(Properties serviceRegistryConfig) {
		return (StandardServiceRegistryImpl) ServiceRegistryUtil.serviceRegistryBuilder()
				.applySettings( serviceRegistryConfig )
				.build();
	}
	public static void destroy(ServiceRegistry serviceRegistry) {
		( (StandardServiceRegistryImpl) serviceRegistry ).destroy();
	}
}
     © 2015 - 2025 Weber Informatics LLC | Privacy Policy