use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class HikariCPModuleIT method testDataSource_DriverAutoDetected.
@Test
public void testDataSource_DriverAutoDetected() throws SQLException {
BQRuntime runtime = testFactory.app("-c", "classpath:HikariCPModuleIT_nodriver.yml").autoLoadModules().createRuntime();
DataSource ds = runtime.getInstance(DataSourceFactory.class).forName("derby2");
assertNotNull(ds);
assertTrue(ds instanceof HikariDataSource);
try (Connection c = ds.getConnection()) {
assertTrue(c.getMetaData().getDriverName().toLowerCase().contains("derby"));
}
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class HikariCPModuleIT method testDataSource.
@Test
public void testDataSource() {
BQRuntime runtime = testFactory.app("-c", "classpath:HikariCPModuleIT_ds.yml").autoLoadModules().createRuntime();
DataSource ds = runtime.getInstance(DataSourceFactory.class).forName("derby1");
assertNotNull(ds);
assertTrue(ds instanceof HikariDataSource);
HikariDataSource hikariDS = (HikariDataSource) ds;
assertEquals("jdbc:derby:target/derby1;create=true", hikariDS.getJdbcUrl());
assertEquals("sa", hikariDS.getUsername());
assertEquals(1, hikariDS.getMinimumIdle());
assertEquals(3, hikariDS.getMaximumPoolSize());
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class HikariCPModuleProviderIT method testModuleDeclaresDependencies.
@Test
public void testModuleDeclaresDependencies() {
final BQRuntime bqRuntime = testFactory.app().module(new HikariCPModuleProvider()).createRuntime();
BQRuntimeChecker.testModulesLoaded(bqRuntime, JdbcModule.class);
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class CsvDataSetBuilderIT method setupDB.
@BeforeClass
public static void setupDB() {
BQRuntime runtime = TEST_FACTORY.app("--config=classpath:io/bootique/jdbc/test/dataset/CsvDataSetBuilderIT.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)");
channel.execStatement().exec("CREATE TABLE \"t4\" (\"c1\" INT, \"c2\" BOOLEAN)");
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();
T4 = channel.newTable("t4").columnNames("c1", "c2").initColumnTypesFromDBMetadata().build();
}
use of io.bootique.BQRuntime in project bootique-jdbc by bootique.
the class DerbyDatabaseIT method before.
@Before
public void before() {
this.derbyDir = new File("target/derby/DerbyDatabaseIT");
BQRuntime runtime = testFactory.app("--config=classpath:io/bootique/jdbc/test/DerbyDatabaseIT.yml").autoLoadModules().createRuntime();
this.channel = DatabaseChannel.get(runtime);
assertNotNull(this.channel);
}
Aggregations