mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix c3p0 bug
This commit is contained in:
@@ -2,6 +2,7 @@ package cn.hutool.db;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.db.ds.DSFactory;
|
||||
import cn.hutool.db.ds.DataSourceWrapper;
|
||||
import cn.hutool.db.ds.bee.BeeDSFactory;
|
||||
import cn.hutool.db.ds.c3p0.C3p0DSFactory;
|
||||
import cn.hutool.db.ds.dbcp.DbcpDSFactory;
|
||||
@@ -9,6 +10,7 @@ import cn.hutool.db.ds.druid.DruidDSFactory;
|
||||
import cn.hutool.db.ds.hikari.HikariDSFactory;
|
||||
import cn.hutool.db.ds.pooled.PooledDSFactory;
|
||||
import cn.hutool.db.ds.tomcat.TomcatDSFactory;
|
||||
import com.mchange.v2.c3p0.ComboPooledDataSource;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -87,6 +89,15 @@ public class DsTest {
|
||||
Assert.assertTrue(CollUtil.isNotEmpty(all));
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hutoolPoolTest() throws SQLException {
|
||||
DSFactory.setCurrentDSFactory(new PooledDSFactory());
|
||||
|
Reference in New Issue
Block a user