mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
testcase refactor
This commit is contained in:
@@ -49,14 +49,14 @@ public class Case0 extends TestCase {
|
||||
public final int COUNT = 1000 * 1000 * 1;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
// jdbcUrl = "jdbc:fake:dragoon_v25masterdb";
|
||||
// user = "dragoon25";
|
||||
// password = "dragoon25";
|
||||
// driverClass = "com.alibaba.druid.mock.MockDriver";
|
||||
jdbcUrl = "jdbc:fake:dragoon_v25masterdb";
|
||||
user = "dragoon25";
|
||||
password = "dragoon25";
|
||||
driverClass = "com.alibaba.druid.mock.MockDriver";
|
||||
|
||||
jdbcUrl = "jdbc:mysql://10.20.159.104:3306/masterdb";
|
||||
user = "dragoon";
|
||||
password = "dragoon";
|
||||
// jdbcUrl = "jdbc:mysql://10.20.159.104:3306/masterdb";
|
||||
// user = "dragoon";
|
||||
// password = "dragoon";
|
||||
}
|
||||
|
||||
public void test_0() throws Exception {
|
||||
@@ -135,8 +135,8 @@ public class Case0 extends TestCase {
|
||||
for (int i = 0; i < COUNT; ++i) {
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
// ResultSet rs = stmt.executeQuery("SELECT 1");
|
||||
// rs.close();
|
||||
ResultSet rs = stmt.executeQuery("SELECT 1");
|
||||
rs.close();
|
||||
stmt.close();
|
||||
conn.close();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.DruidDataSourceFactory;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
import com.alibaba.druid.util.JMXUtils;
|
||||
|
||||
@@ -51,7 +52,7 @@ public class Case2 extends TestCase {
|
||||
properties.put("url", "jdbc:mock:");
|
||||
properties.put("filters", "stat");
|
||||
properties.put("validationQuery", "SELECT 1");
|
||||
final DruidDataSource dataSource = (DruidDataSource) com.alibaba.druid.pool.DruidDataSourceFactory.createDataSource(properties);
|
||||
DruidDataSource dataSource = (DruidDataSource) DruidDataSourceFactory.createDataSource(properties);
|
||||
JMXUtils.register("com.alibaba.druid:type=DruidDataSource", dataSource);
|
||||
|
||||
final int COUNT = 10;
|
||||
|
||||
Reference in New Issue
Block a user