Search in sources :

Example 1 with DataSourceListener

use of io.bootique.jdbc.DataSourceListener in project bootique-jdbc by bootique.

the class TomcatInstrumentedJdbcModuleIT method testMetricsListener_Injected.

@Test
public void testMetricsListener_Injected() {
    BQRuntime runtime = TEST_FACTORY.app("-c", "classpath:io/bootique/jdbc/instrumented/dummy-ds.yml").autoLoadModules().createRuntime();
    TypeLiteral<Set<DataSourceListener>> typeLiteral = new TypeLiteral<Set<io.bootique.jdbc.DataSourceListener>>() {
    };
    Set<DataSourceListener> set = runtime.getInstance(Key.get(typeLiteral));
    assertEquals(set.size(), 1);
    assertTrue(set.iterator().next() instanceof TomcatMetricsInitializer);
}
Also used : Set(java.util.Set) TypeLiteral(com.google.inject.TypeLiteral) BQRuntime(io.bootique.BQRuntime) DataSourceListener(io.bootique.jdbc.DataSourceListener) Test(org.junit.Test)

Aggregations

TypeLiteral (com.google.inject.TypeLiteral)1 BQRuntime (io.bootique.BQRuntime)1 DataSourceListener (io.bootique.jdbc.DataSourceListener)1 Set (java.util.Set)1 Test (org.junit.Test)1