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);
}
Aggregations