use of cn.hutool.db.ds.c3p0.C3p0DSFactory in project hutool by looly.
the class DsTest method c3p0DsTest.
@Test
public void c3p0DsTest() throws SQLException {
DSFactory.setCurrentDSFactory(new C3p0DSFactory());
DataSource ds = DSFactory.get();
SqlRunner runner = SqlRunner.create(ds);
List<Entity> all = runner.findAll("user");
Assert.assertTrue(CollUtil.isNotEmpty(all));
}
use of cn.hutool.db.ds.c3p0.C3p0DSFactory in project hutool by looly.
the class DsTest method c3p0DsUserAndPassTest.
@Test
public void c3p0DsUserAndPassTest() {
// https://gitee.com/dromara/hutool/issues/I4T7XZ
DSFactory.setCurrentDSFactory(new C3p0DSFactory());
ComboPooledDataSource ds = (ComboPooledDataSource) ((DataSourceWrapper) DSFactory.get("mysql")).getRaw();
Assert.assertEquals("root", ds.getUser());
Assert.assertEquals("123456", ds.getPassword());
}
use of cn.hutool.db.ds.c3p0.C3p0DSFactory in project hutool by looly.
the class DsTest method c3p0DsTest.
@Test
public void c3p0DsTest() throws SQLException {
DSFactory.setCurrentDSFactory(new C3p0DSFactory());
DataSource ds = DSFactory.get("test");
Db db = Db.use(ds);
List<Entity> all = db.findAll("user");
Assert.assertTrue(CollUtil.isNotEmpty(all));
}
Aggregations