use of io.bootique.BQRuntime 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);
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class TomcatInstrumentedJdbcModuleProviderTest method testModuleDeclaresDependencies.
@Test
public void testModuleDeclaresDependencies() {
final BQRuntime bqRuntime = testFactory.app().module(new TomcatInstrumentedJdbcModuleProvider()).createRuntime();
BQRuntimeChecker.testModulesLoaded(bqRuntime, JdbcModule.class, TomcatJdbcModule.class, InstrumentedJdbcModule.class, MetricsModule.class);
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class DefaultDatabaseChannelIT method loadChannel.
private DefaultDatabaseChannel loadChannel(String configResource) {
BQRuntime runtime = TEST_FACTORY.app("-c", configResource).autoLoadModules().createRuntime();
DatabaseChannel channel = DatabaseChannel.get(runtime);
assertTrue(channel instanceof DefaultDatabaseChannel);
return (DefaultDatabaseChannel) channel;
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class DataSourceFactoryIT method testForName_NoImpl.
@Test
public void testForName_NoImpl() {
BQRuntime runtime = testFactory.app("-c", "classpath:io/bootique/jdbc/DataSourceFactoryIT_notype.yml").autoLoadModules().createRuntime();
try {
runtime.getInstance(DataSourceFactory.class).forName("ds1");
fail("Exception expected");
} catch (ProvisionException e) {
assertTrue(e.getCause() instanceof BootiqueException);
}
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class DataSourceFactoryIT method testForName_SingleImpl.
@Test
public void testForName_SingleImpl() {
BQRuntime runtime = testFactory.app("-c", "classpath:io/bootique/jdbc/DataSourceFactoryIT_notype.yml").autoLoadModules().module(b -> JdbcModule.extend(b).addFactoryType(Factory1.class)).createRuntime();
DataSource ds = runtime.getInstance(DataSourceFactory.class).forName("ds1");
assertNotNull(ds);
}
Aggregations