Search in sources :

Example 1 with UnknownUnwrapTypeException

use of org.hibernate.service.UnknownUnwrapTypeException 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);
    Assert.assertNotNull(provider.unwrap(HikariConnectionProvider.class));
    Assert.assertFalse(provider.supportsAggressiveRelease());
    try {
        provider.unwrap(TestHibernate.class);
        Assert.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