HHH-16963 Avoid H2's capability to register a JVM shutdown hook: causes classloader leaks during tests
This commit is contained in:
parent
9e249452a9
commit
3b05c27a56
|
@ -18,7 +18,7 @@ ext {
|
|||
'jdbc.driver': 'org.h2.Driver',
|
||||
'jdbc.user' : 'sa',
|
||||
'jdbc.pass' : '',
|
||||
'jdbc.url' : 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000',
|
||||
'jdbc.url' : 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE',
|
||||
'connection.init_sql' : '',
|
||||
'hibernate.dialect.native_param_markers' : 'true'
|
||||
],
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<property name="hibernate.connection.username">sa</property>
|
||||
<property name="hibernate.connection.password"></property>
|
||||
<property name="hibernate.connection.init_sql"></property>
|
||||
<property name="hibernate.connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1</property>
|
||||
<property name="hibernate.connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE</property>
|
||||
<property name="hibernate.cache.use_query_cache">true</property>
|
||||
<property name="hibernate.cache.region_prefix">hibernate.test</property>
|
||||
<property name="hibernate.jdbc.batch_size">0</property>
|
||||
|
|
|
@ -50,7 +50,7 @@ public class RefreshUpdatedDataTest extends BaseCoreFunctionalTestCase {
|
|||
super.configure( cfg );
|
||||
Properties properties = Environment.getProperties();
|
||||
if ( H2Dialect.class.getName().equals( properties.get( Environment.DIALECT ) ) ) {
|
||||
cfg.setProperty( Environment.URL, "jdbc:h2:mem:db-mvcc" );
|
||||
cfg.setProperty( Environment.URL, "jdbc:h2:mem:db-mvcc;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE" );
|
||||
}
|
||||
cfg.setProperty( Environment.CACHE_REGION_PREFIX, "" );
|
||||
cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.sql.Driver;
|
|||
import java.util.Collections;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hibernate.boot.registry.StandardServiceInitiator;
|
||||
import org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl;
|
||||
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
|
||||
import org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator;
|
||||
|
@ -19,7 +18,6 @@ import org.hibernate.engine.jdbc.internal.JdbcServicesImpl;
|
|||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.exception.JDBCConnectionException;
|
||||
import org.hibernate.service.Service;
|
||||
import org.hibernate.service.internal.ProvidedService;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
|
@ -53,7 +51,7 @@ public class ConnectionCreatorTest extends BaseUnitTestCase {
|
|||
return super.getService( serviceRole );
|
||||
}
|
||||
},
|
||||
"jdbc:h2:mem:test-bad-urls;nosuchparam=saywhat",
|
||||
"jdbc:h2:mem:test-bad-urls;nosuchparam=saywhat;DB_CLOSE_ON_EXIT=FALSE",
|
||||
new Properties(),
|
||||
false,
|
||||
null,
|
||||
|
|
|
@ -150,7 +150,7 @@ public class JpaSchemaGeneratorTest extends EntityManagerFactoryBasedFunctionalT
|
|||
// We want a fresh db after emf close
|
||||
// Unfortunately we have to use this dirty hack because the db seems not to be closed otherwise
|
||||
settings.put( "hibernate.connection.url", "jdbc:h2:mem:db-schemagen" + schemagenNumber++
|
||||
+ ";LOCK_TIMEOUT=10000" );
|
||||
+ ";DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE" );
|
||||
EntityManagerFactoryBuilder emfb = Bootstrap.getEntityManagerFactoryBuilder(
|
||||
buildPersistenceUnitDescriptor(),
|
||||
settings
|
||||
|
|
|
@ -24,7 +24,7 @@ public class DatabaseConnectionInfo {
|
|||
public static final DatabaseConnectionInfo INSTANCE = new DatabaseConnectionInfo();
|
||||
|
||||
public static final String DRIVER = "org.h2.Driver";
|
||||
public static final String URL = "jdbc:h2:mem:hibernate-core";
|
||||
public static final String URL = "jdbc:h2:mem:hibernate-core;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE";
|
||||
public static final String USER = "hibernate";
|
||||
public static final String PASS = "hibernate";
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ConnectionsReleaseTest extends BaseUnitTestCase {
|
|||
public static Properties getConnectionProviderProperties() {
|
||||
Properties props = new Properties();
|
||||
props.put( Environment.DRIVER, "org.h2.Driver" );
|
||||
props.put( Environment.URL, String.format( "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1", "db1" ) );
|
||||
props.put( Environment.URL, String.format( "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE", "db1" ) );
|
||||
props.put( Environment.USER, "sa" );
|
||||
props.put( Environment.PASS, "" );
|
||||
return props;
|
||||
|
|
|
@ -42,7 +42,7 @@ public class H2DialectDataBaseToUpperTest extends BaseUnitTestCase {
|
|||
ssr = new StandardServiceRegistryBuilder()
|
||||
.applySetting(
|
||||
AvailableSettings.URL,
|
||||
"jdbc:h2:mem:databaseToUpper;DATABASE_TO_UPPER=" + databaseToUpper
|
||||
"jdbc:h2:mem:databaseToUpper;DATABASE_TO_UPPER=" + databaseToUpper + ";DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
|
||||
)
|
||||
.build();
|
||||
final MetadataSources metadataSources = new MetadataSources( ssr );
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<exclude-unlisted-classes />
|
||||
<properties>
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
|
||||
<property name="hibernate.connection.url" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1"/>
|
||||
<property name="hibernate.connection.url" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"/>
|
||||
<property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
|
||||
<property name="hibernate.connection.username" value="sa"/>
|
||||
<property name="hibernate.connection.password" value=""/>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<property name="format_sql">false</property>
|
||||
|
||||
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
|
||||
<property name="connection.url">jdbc:h2:mem:envers</property>
|
||||
<property name="connection.url">jdbc:h2:mem:envers;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE</property>
|
||||
<property name="connection.driver_class">org.h2.Driver</property>
|
||||
<property name="connection.username">sa</property>
|
||||
<property name="connection.password"></property>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<properties>
|
||||
<property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
|
||||
<property name="hibernate.connection.url" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1"/>
|
||||
<property name="hibernate.connection.url" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"/>
|
||||
<property name="hibernate.connection.username" value="sa"/>
|
||||
<property name="hibernate.connection.password" value=""/>
|
||||
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
|
||||
|
|
|
@ -58,7 +58,7 @@ public class RefreshUpdatedDataTest {
|
|||
.configure( "hibernate-config/hibernate.cfg.xml" );
|
||||
|
||||
if ( H2Dialect.class.equals( DialectContext.getDialect().getClass() ) ) {
|
||||
ssrb.applySetting( AvailableSettings.URL, "jdbc:h2:mem:db-mvcc" );
|
||||
ssrb.applySetting( AvailableSettings.URL, "jdbc:h2:mem:db-mvcc;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE" );
|
||||
}
|
||||
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ public class TestHelper {
|
|||
.applySetting( AvailableSettings.HBM2DDL_AUTO, "create-drop" );
|
||||
|
||||
if ( H2Dialect.class.equals( DialectContext.getDialect().getClass() ) ) {
|
||||
ssrb.applySetting( AvailableSettings.URL, "jdbc:h2:mem:db-mvcc" );
|
||||
ssrb.applySetting( AvailableSettings.URL, "jdbc:h2:mem:db-mvcc;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE" );
|
||||
}
|
||||
return ssrb;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
#
|
||||
jdbc-0.proxool.alias=pool-one
|
||||
jdbc-0.proxool.driver-url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1
|
||||
jdbc-0.proxool.driver-url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
|
||||
jdbc-0.proxool.driver-class=org.h2.Driver
|
||||
jdbc-0.user=sa
|
||||
jdbc-0.password=
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
#
|
||||
jdbc-0.proxool.alias=pool-two
|
||||
jdbc-0.proxool.driver-url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1
|
||||
jdbc-0.proxool.driver-url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
|
||||
jdbc-0.proxool.driver-class=org.h2.Driver
|
||||
jdbc-0.user=sa
|
||||
jdbc-0.password=
|
||||
|
|
|
@ -34,7 +34,7 @@ public class ConnectionProviderBuilder implements DialectCheck {
|
|||
public static final String DRIVER = "org.h2.Driver";
|
||||
public static final String DATA_SOURCE = "org.h2.jdbcx.JdbcDataSource";
|
||||
// public static final String URL = "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1";
|
||||
public static final String URL_FORMAT = "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1";
|
||||
public static final String URL_FORMAT = "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE";
|
||||
public static final String URL = URL_FORMAT;
|
||||
public static final String USER = "sa";
|
||||
public static final String PASS = "";
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.hibernate.dialect.H2Dialect;
|
|||
*/
|
||||
public final class TestingDatabaseInfo {
|
||||
public static volatile String DRIVER = "org.h2.Driver";
|
||||
public static volatile String URL = "jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1";
|
||||
public static volatile String URL = "jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE";
|
||||
public static volatile String USER = "sa";
|
||||
public static volatile String PASS = "";
|
||||
|
||||
|
|
Loading…
Reference in New Issue