Search in sources :

Example 1 with HikariConnectionProvider

use of com.zaxxer.hikari.hibernate.HikariConnectionProvider in project HikariCP by brettwooldridge.

the class TestHibernate method testConnectionProvider.

@Test
public void testConnectionProvider() throws Exception {
    HikariConnectionProvider provider = new HikariConnectionProvider();
    Properties props = new Properties();
    props.load(getClass().getResourceAsStream("/hibernate.properties"));
    provider.configure(props);
    Connection connection = provider.getConnection();
    provider.closeConnection(connection);
    assertNotNull(provider.unwrap(HikariConnectionProvider.class));
    assertFalse(provider.supportsAggressiveRelease());
    try {
        provider.unwrap(TestHibernate.class);
        fail("Expected exception");
    } catch (UnknownUnwrapTypeException e) {
    }
    provider.stop();
}
Also used : Connection(java.sql.Connection) HikariConnectionProvider(com.zaxxer.hikari.hibernate.HikariConnectionProvider) Properties(java.util.Properties) UnknownUnwrapTypeException(org.hibernate.service.UnknownUnwrapTypeException) Test(org.junit.Test)

Aggregations

HikariConnectionProvider (com.zaxxer.hikari.hibernate.HikariConnectionProvider)1 Connection (java.sql.Connection)1 Properties (java.util.Properties)1 UnknownUnwrapTypeException (org.hibernate.service.UnknownUnwrapTypeException)1 Test (org.junit.Test)1