use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class JdbcTestModuleIT method testListenersClasses_Injected.
@Test
public void testListenersClasses_Injected() {
BQRuntime runtime = TEST_FACTORY.app("-c", "classpath:io/bootique/jdbc/test/dummy-ds.yml").autoLoadModules().module(binder -> {
JdbcModule.extend(binder).addDataSourceListener(new TestDataSourceListener1()).addDataSourceListener(new TestDataSourceListener2());
}).createRuntime();
TypeLiteral<Set<io.bootique.jdbc.DataSourceListener>> typeLiteral = new TypeLiteral<Set<io.bootique.jdbc.DataSourceListener>>() {
};
Set<io.bootique.jdbc.DataSourceListener> set = runtime.getInstance(Key.get(typeLiteral));
assertEquals(set.size(), 3);
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class JdbcTestModuleIT method testListeners_Injected.
@Test
public void testListeners_Injected() {
BQRuntime runtime = TEST_FACTORY.app("-c", "classpath:io/bootique/jdbc/test/dummy-ds.yml").autoLoadModules().module(new Module() {
@Override
public void configure(Binder binder) {
JdbcModule.extend(binder).addDataSourceListener(TestDataSourceListener3.class).addDataSourceListener(TestDataSourceListener4.class);
}
@Singleton
@Provides
TestDataSourceListener3 provideListener3(BootLogger bootLogger) {
return new TestDataSourceListener3();
}
@Singleton
@Provides
TestDataSourceListener4 provideListener4(BootLogger bootLogger) {
return new TestDataSourceListener4();
}
}).createRuntime();
TypeLiteral<Set<io.bootique.jdbc.DataSourceListener>> typeLiteral = new TypeLiteral<Set<io.bootique.jdbc.DataSourceListener>>() {
};
Set<io.bootique.jdbc.DataSourceListener> set = runtime.getInstance(Key.get(typeLiteral));
assertEquals(set.size(), 3);
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class JdbcTestModuleProviderTest method testModuleDeclaresDependencies.
@Test
public void testModuleDeclaresDependencies() {
final BQRuntime bqRuntime = testFactory.app().module(new JdbcTestModuleProvider()).createRuntime();
BQRuntimeChecker.testModulesLoaded(bqRuntime, JdbcModule.class);
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class TableIT method setupDB.
@BeforeClass
public static void setupDB() {
BQRuntime runtime = TEST_FACTORY.app("--config=classpath:io/bootique/jdbc/test/TableIT.yml").autoLoadModules().createRuntime();
DatabaseChannel channel = DatabaseChannel.get(runtime);
channel.execStatement().exec("CREATE TABLE \"t1\" (\"c1\" INT, \"c2\" VARCHAR(10), \"c3\" VARCHAR(10))");
channel.execStatement().exec("CREATE TABLE \"t2\" (\"c1\" INT, \"c2\" INT, \"c3\" DATE, \"c4\" TIMESTAMP)");
channel.execStatement().exec("CREATE TABLE \"t3\" (\"c1\" INT, \"c2\" VARCHAR (10) FOR BIT DATA)");
T1 = channel.newTable("t1").columnNames("c1", "c2", "c3").initColumnTypesFromDBMetadata().build();
T2 = channel.newTable("t2").columnNames("c1", "c2", "c3", "c4").initColumnTypesFromDBMetadata().build();
T3 = channel.newTable("t3").columnNames("c1", "c2").initColumnTypesFromDBMetadata().build();
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class TestDataManagerIT method setupDB.
@BeforeClass
public static void setupDB() {
BQRuntime testRuntime = TEST_FACTORY.app("--config=classpath:io/bootique/jdbc/test/TestDataManagerIT.yml").autoLoadModules().createRuntime();
DatabaseChannel channel = DatabaseChannel.get(testRuntime);
channel.execStatement().exec("CREATE TABLE \"t1\" (\"id\" INT NOT NULL PRIMARY KEY, \"name\" VARCHAR(10))");
channel.execStatement().exec("CREATE TABLE \"t2\" (\"id\" INT NOT NULL PRIMARY KEY, \"name\" VARCHAR(10), \"t1_id\" INT)");
T1 = channel.newTable("t1").columnNames("id", "name").build();
T2 = channel.newTable("t2").columnNames("id", "name", "t1_id").build();
}
Aggregations