Checkstyle 2509 (#6525)

* fix test checkstyle

* fix testcase

* fix testcase

* fix checkstyle
This commit is contained in:
Shaojin Wen 2025-09-14 02:27:49 +08:00 committed by GitHub
parent 8917bb77ed
commit 81ebdebf67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3176 changed files with 7794 additions and 16606 deletions

View File

@ -38,7 +38,7 @@ public class MySqlMockExecuteHandlerImpl implements MockExecuteHandler {
@Override
public ResultSet executeQuery(MockStatementBase statement, String sql) throws SQLException {
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList(); //
List<SQLStatement> stmtList = parser.parseStatementList();
if (stmtList.size() > 1) {
throw new SQLException("not support multi-statment. " + sql);

View File

@ -2868,7 +2868,7 @@ public class DruidDataSource extends DruidAbstractDataSource
if (timeBetweenEvictionRunsMillis > 0) {
Thread.sleep(timeBetweenEvictionRunsMillis);
} else {
Thread.sleep(1000); //
Thread.sleep(1000);
}
if (Thread.interrupted()) {

View File

@ -444,7 +444,7 @@ public class TableStat {
private boolean having;
private boolean join;
private boolean primaryKey; // for ddl
private boolean unique; //
private boolean unique;
private boolean update;
private Map<String, Object> attributes = new HashMap<String, Object>();
private transient String fullName;
@ -631,7 +631,7 @@ public class TableStat {
DropIndex(256), //
CreateIndex(512), //
Replace(1024),
DESC(2048); //
DESC(2048);
public final int mark;

View File

@ -813,7 +813,7 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
public List<MonitorApp> listApp(String domain) throws SQLException {
List<MonitorApp> list = new ArrayList<MonitorApp>();
String sql = "select id, domain, app from druid_app " //
String sql = "select id, domain, app from druid_app "
+ " where domain = ?";
Connection conn = null;
PreparedStatement stmt = null;
@ -838,7 +838,7 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
}
public MonitorApp findApp(String domain, String app) throws SQLException {
String sql = "select id, domain, app from druid_app " //
String sql = "select id, domain, app from druid_app "
+ " where domain = ? and app = ?";
Connection conn = null;
PreparedStatement stmt = null;
@ -876,7 +876,7 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
public List<MonitorCluster> listCluster(String domain, String app) throws SQLException {
List<MonitorCluster> list = new ArrayList<MonitorCluster>();
String sql = "select id, domain, app, cluster from druid_cluster " //
String sql = "select id, domain, app, cluster from druid_cluster "
+ " where domain = ?";
if (app != null) {
@ -919,7 +919,7 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
}
public MonitorCluster findCluster(String domain, String app, String cluster) throws SQLException {
String sql = "select id, domain, app, cluster from druid_cluster " //
String sql = "select id, domain, app, cluster from druid_cluster "
+ " where domain = ? and app = ? and cluster = ?";
Connection conn = null;
PreparedStatement stmt = null;
@ -960,19 +960,19 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
Date startTime, long pid) throws SQLException {
MonitorInstance monitorInst = findInst(domain, app, cluster, host);
if (monitorInst == null) {
String sql = "insert into druid_inst (domain, app, cluster, host, ip, lastActiveTime, lastPID) " //
String sql = "insert into druid_inst (domain, app, cluster, host, ip, lastActiveTime, lastPID) "
+ " values (?, ?, ?, ?, ?, ?, ?)";
JdbcUtils.execute(dataSource, sql, domain, app, cluster, host, ip, startTime, pid);
} else {
String sql = "update druid_inst set ip = ?, lastActiveTime = ?, lastPID = ? " //
String sql = "update druid_inst set ip = ?, lastActiveTime = ?, lastPID = ? "
+ " where domain = ? and app = ? and cluster = ? and host = ? ";
JdbcUtils.execute(dataSource, sql, ip, startTime, pid, domain, app, cluster, host);
}
}
public MonitorInstance findInst(String domain, String app, String cluster, String host) throws SQLException {
String sql = "select id, domain, app, cluster, host, ip, lastActiveTime, lastPID from druid_inst " //
+ " where domain = ? and app = ? and cluster = ? and host = ? " //
String sql = "select id, domain, app, cluster, host, ip, lastActiveTime, lastPID from druid_inst "
+ " where domain = ? and app = ? and cluster = ? and host = ? "
+ " limit 1";
Connection conn = null;
PreparedStatement stmt = null;
@ -1002,7 +1002,7 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
public List<MonitorInstance> listInst(String domain, String app, String cluster) throws SQLException {
List<MonitorInstance> list = new ArrayList<MonitorInstance>();
String sql = "select id, domain, app, cluster, host, ip, lastActiveTime, lastPID from druid_inst " //
String sql = "select id, domain, app, cluster, host, ip, lastActiveTime, lastPID from druid_inst "
+ "where domain = ?";
if (app != null) {

View File

@ -880,7 +880,7 @@ public final class JdbcUtils implements JdbcConstants {
StringBuilder sql = new StringBuilder() //
.append("insert into ") //
.append(tableName) //
.append("("); //
.append("(");
int nameCount = 0;
for (String name : names) {

View File

@ -15,10 +15,8 @@
*/
package com.alibaba.druid;
import junit.framework.TestCase;
import com.alibaba.druid.support.json.JSONUtils;
import junit.framework.TestCase;
public class Bug_for_alibank extends TestCase {
public void test_bug() throws Exception {

View File

@ -15,14 +15,12 @@
*/
package com.alibaba.druid;
import java.sql.Connection;
import java.util.concurrent.CountDownLatch;
import com.alibaba.druid.mock.MockDriver;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import com.alibaba.druid.mock.MockDriver;
import java.sql.Connection;
import java.util.concurrent.CountDownLatch;
public class DBCPTest extends TestCase {
public void test_max() throws Exception {

View File

@ -15,6 +15,8 @@
*/
package com.alibaba.druid;
import junit.framework.TestCase;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
@ -23,8 +25,6 @@ import java.net.URL;
import java.util.Enumeration;
import java.util.Properties;
import junit.framework.TestCase;
public class DragoonMetaInfTest extends TestCase {
public void test_0() throws Exception {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

View File

@ -15,11 +15,11 @@
*/
package com.alibaba.druid;
import junit.framework.TestCase;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import junit.framework.TestCase;
public class LockTest extends TestCase {
public void test_0() throws Exception {
Lock lock = new ReentrantLock();

View File

@ -18,7 +18,6 @@ package com.alibaba.druid;
import java.util.HashMap;
import java.util.Map;
public class TestForZY {
public void foo() throws Exception {
Map<String, Map.Entry<String, Boolean>> m = new HashMap<String, Map.Entry<String, Boolean>>();

View File

@ -7,5 +7,4 @@ import junit.framework.TestCase;
* date 2012-11-26 下午11:35
*/
public class TestHibernateCRUDWithTransactional extends TestCase {
}

View File

@ -15,17 +15,16 @@
*/
package com.alibaba.druid;
import java.lang.management.ManagementFactory;
import java.sql.Connection;
import java.util.concurrent.CountDownLatch;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
import org.junit.Assert;
import javax.management.ObjectName;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import java.lang.management.ManagementFactory;
import java.sql.Connection;
import java.util.concurrent.CountDownLatch;
public class TestIdel3 extends TestCase {
public void test_idle2() throws Exception {
@ -113,7 +112,6 @@ public class TestIdel3 extends TestCase {
Thread.sleep(1000 * 100);
dataSource.close();
}
private void concurrent(final DruidDataSource dataSource, int threadCount, final int loopCount)

View File

@ -15,10 +15,10 @@
*/
package com.alibaba.druid;
import java.util.LinkedHashMap;
import junit.framework.TestCase;
import java.util.LinkedHashMap;
public class TestLRU extends TestCase {
public void test_lru() throws Exception {
LinkedHashMap<Integer, Object> cache = new LinkedHashMap<Integer, Object>(100, 0.75f, true);
@ -33,6 +33,5 @@ public class TestLRU extends TestCase {
System.out.println(cache);
cache.get(3);
System.out.println(cache);
}
}

View File

@ -15,13 +15,13 @@
*/
package com.alibaba.druid;
import junit.framework.TestCase;
import org.junit.Assert;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.junit.Assert;
import junit.framework.TestCase;
public class TestLockCount extends TestCase {
public void test_current() throws Exception {
DataSource dataSource = new DataSource();

View File

@ -15,15 +15,14 @@
*/
package com.alibaba.druid;
import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
import org.junit.Assert;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
public class TestOracle extends TestCase {
private String jdbcUrl;
private String user;

View File

@ -15,14 +15,14 @@
*/
package com.alibaba.druid;
import junit.framework.TestCase;
import oracle.jdbc.OracleConnection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import junit.framework.TestCase;
import oracle.jdbc.OracleConnection;
public class TestOraclePing extends TestCase {
private String jdbcUrl;
private String user;

View File

@ -15,18 +15,10 @@
*/
package com.alibaba.druid;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import com.alibaba.druid.util.Utils;
import junit.framework.TestCase;
import com.alibaba.druid.util.Utils;
import java.io.*;
public class TestReplaceLicense extends TestCase {
private String license;
@ -46,7 +38,6 @@ public class TestReplaceLicense extends TestCase {
public void test_0() throws Exception {
File file = new File("/usr/alibaba/workspace/druid");
listFile(file);
}
public void listFile(File file) throws Exception {
@ -79,7 +70,6 @@ public class TestReplaceLicense extends TestCase {
Writer writer = new OutputStreamWriter(out, "utf-8");
writer.write(newContent);
writer.close();
} else {
}
}
}

View File

@ -121,5 +121,4 @@ public class TestRollBack {
// abc插了进去,没有回滚
Assert.assertNotNull(dao_druid.fetch("msg", Cnd.where("message", "=", "abc")));
}
}

View File

@ -15,11 +15,10 @@
*/
package com.alibaba.druid;
import java.sql.Connection;
import java.sql.DriverManager;
import junit.framework.TestCase;
import java.sql.Connection;
import java.sql.DriverManager;
public class TestSqlServer extends TestCase {
private String jdbcUrl;

View File

@ -15,15 +15,14 @@
*/
package com.alibaba.druid;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.JdbcTraceManager;
import com.alibaba.druid.util.JMXUtils;
import junit.framework.TestCase;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
@SuppressWarnings("deprecation")
public class TestTraceFilter extends TestCase {

View File

@ -15,18 +15,16 @@
*/
package com.alibaba.druid;
import com.alibaba.druid.util.JdbcUtils;
import com.alibaba.druid.util.Utils;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.management.ManagementFactory;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.management.ManagementFactory;
public class TestUtil {
public static long getYoungGC() {
try {

View File

@ -3,6 +3,7 @@ package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.pool.DruidDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -31,6 +32,7 @@ public class AsyncClose {
ResultSet rs = ps.executeQuery();
while (rs.next()) {
// Intentionally empty loop
}
rs.close();

View File

@ -15,21 +15,19 @@
*/
package com.alibaba.druid.benckmark.pool;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.NumberFormat;
import javax.sql.DataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.jolbox.bonecp.BoneCPDataSource;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.NumberFormat;
public class Case0 extends TestCase {
private String jdbcUrl;
@ -41,7 +39,7 @@ public class Case0 extends TestCase {
private int maxIdle = 8;
private int maxActive = 8;
private String validationQuery = "SELECT 1";
private boolean testOnBorrow = false;
private boolean testOnBorrow;
private long minEvictableIdleTimeMillis = 3000;
public final int LOOP_COUNT = 5;

View File

@ -15,6 +15,16 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import com.jolbox.bonecp.BoneCPDataSource;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import javax.sql.DataSource;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.sql.Connection;
@ -25,18 +35,6 @@ import java.util.Properties;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicLong;
import javax.sql.DataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import com.jolbox.bonecp.BoneCPDataSource;
import com.mchange.v2.c3p0.ComboPooledDataSource;
/**
* TestOnBo 类Case1.java的实现描述TODO 类实现描述
*
@ -261,6 +259,5 @@ public class Case1 extends TestCase {
+ NumberFormat.getInstance().format(blockedCount) //
+ " waited " + NumberFormat.getInstance().format(waitedCount) + " physicalConn "
+ physicalConnStat.get());
}
}

View File

@ -15,6 +15,14 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.jolbox.bonecp.BoneCPDataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import javax.sql.DataSource;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.sql.Connection;
@ -22,16 +30,6 @@ import java.text.NumberFormat;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicLong;
import javax.sql.DataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.jolbox.bonecp.BoneCPDataSource;
/**
* TestOnBo 类Case1.java的实现描述TODO 类实现描述
*

View File

@ -15,6 +15,15 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.jolbox.bonecp.BoneCPDataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import org.junit.Assert;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
@ -23,17 +32,6 @@ import java.util.Properties;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import javax.sql.DataSource;
import org.junit.Assert;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.jolbox.bonecp.BoneCPDataSource;
public class Case3 extends TestCase {
private String jdbcUrl;
private String user;
@ -48,7 +46,7 @@ public class Case3 extends TestCase {
private int threadCount = 10;
private int TEST_COUNT = 3;
final int LOOP_COUNT = 1000 * 100;
private boolean testOnBorrow = false;
private boolean testOnBorrow;
private String connectionProperties = ""; // "bigStringTryClob=true;clientEncoding=GBK;defaultRowPrefetch=50;serverEncoding=ISO-8859-1";
private String sql = "SELECT 1";
private long timeBetweenEvictionRunsMillis = 60000;

View File

@ -15,21 +15,19 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.NumberFormat;
import java.util.concurrent.CountDownLatch;
import javax.sql.DataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
public class CaseKylin_Oracle extends TestCase {
private String jdbcUrl;
private String user;
@ -40,20 +38,20 @@ public class CaseKylin_Oracle extends TestCase {
private int maxIdle = 14;
private int maxActive = 14;
private int maxWait = 60000;
private String validationQuery = null; // "SELECT 1";
private String validationQuery; // "SELECT 1";
private int threadCount = 15;
private int TEST_COUNT = 3;
final int LOOP_COUNT = 1000 * 100;
private boolean testWhileIdle = true;
private boolean testOnBorrow = true;
private boolean testOnReturn = false;
private boolean testOnReturn;
private boolean removeAbandoned = true;
private int removeAbandonedTimeout = 180;
private long timeBetweenEvictionRunsMillis = 60000;
private long minEvictableIdleTimeMillis = 1800000;
private int numTestsPerEvictionRun = 20;
private String validateQuery = null;
private String validateQuery;
private String oracleDriverClass = "com.alibaba.china.jdbc.SimpleDriver";

View File

@ -15,21 +15,19 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.NumberFormat;
import java.util.concurrent.CountDownLatch;
import javax.sql.DataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
public class CaseKylin_mysql extends TestCase {
private String jdbcUrl;
private String user;
@ -40,13 +38,13 @@ public class CaseKylin_mysql extends TestCase {
private int maxIdle = 20;
private int maxActive = 20;
private int maxWait = 60000;
private String validationQuery = null; // "SELECT 1";
private String validationQuery; // "SELECT 1";
private int threadCount = 15;
private int TEST_COUNT = 3;
final int LOOP_COUNT = 1000 * 100;
private boolean testWhileIdle = true;
private boolean testOnBorrow = false;
private boolean testOnReturn = false;
private boolean testOnBorrow;
private boolean testOnReturn;
private boolean removeAbandoned = true;
private int removeAbandonedTimeout = 180;

View File

@ -15,19 +15,18 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.NumberFormat;
import java.util.concurrent.CountDownLatch;
import javax.sql.DataSource;
import junit.framework.TestCase;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
public class CaseKylin_mysql_idle_1 extends TestCase {
private String jdbcUrl;
private String user;
@ -38,13 +37,13 @@ public class CaseKylin_mysql_idle_1 extends TestCase {
private int maxIdle = 20;
private int maxActive = 20;
private int maxWait = 60000;
private String validationQuery = null; // "SELECT 1";
private String validationQuery; // "SELECT 1";
private int threadCount = 15;
private int TEST_COUNT = 3;
final int LOOP_COUNT = 1000 * 10;
private boolean testWhileIdle = true;
private boolean testOnBorrow = false;
private boolean testOnReturn = false;
private boolean testOnBorrow;
private boolean testOnReturn;
private boolean removeAbandoned = true;
private int removeAbandonedTimeout = 180;
@ -71,7 +70,6 @@ public class CaseKylin_mysql_idle_1 extends TestCase {
public void test_perf() throws Exception {
druid();
}
public void druid() throws Exception {

View File

@ -15,20 +15,19 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.NumberFormat;
import java.util.concurrent.CountDownLatch;
import javax.sql.DataSource;
import junit.framework.TestCase;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
public class CaseKylin_mysql_idle_2 extends TestCase {
private String jdbcUrl;
private String user;
@ -39,13 +38,13 @@ public class CaseKylin_mysql_idle_2 extends TestCase {
private int maxIdle = 20;
private int maxActive = 20;
private int maxWait = 60000;
private String validationQuery = null; // "SELECT 1";
private String validationQuery; // "SELECT 1";
private int threadCount = 15;
private int TEST_COUNT = 3;
final int LOOP_COUNT = 10 * 1;
private boolean testWhileIdle = true;
private boolean testOnBorrow = false;
private boolean testOnReturn = false;
private boolean testOnBorrow;
private boolean testOnReturn;
private boolean removeAbandoned = true;
private int removeAbandonedTimeout = 180;
@ -74,7 +73,6 @@ public class CaseKylin_mysql_idle_2 extends TestCase {
public void test_perf() throws Exception {
druid();
}
public void druid() throws Exception {

View File

@ -15,32 +15,30 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.NumberFormat;
import java.util.concurrent.CountDownLatch;
import javax.sql.DataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
public class Case_Concurrent_50 extends TestCase {
private String jdbcUrl;
private String user;
private String password;
private String driverClass;
private int initialSize = 0;
private int initialSize;
private int minIdle = 3;
private int maxIdle = 5;
private int maxActive = 10;
private String validationQuery = "SELECT 1";
private boolean testOnBorrow = false;
private boolean testOnBorrow;
private long minEvictableIdleTimeMillis = 3000;
public final int LOOP_COUNT = 5;

View File

@ -15,22 +15,20 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.jolbox.bonecp.BoneCPDataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.NumberFormat;
import javax.sql.DataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.jolbox.bonecp.BoneCPDataSource;
public class Oracle_Case0 extends TestCase {
private String jdbcUrl;
private String user;

View File

@ -15,22 +15,20 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.util.Assert;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.NumberFormat;
import java.util.concurrent.CountDownLatch;
import javax.sql.DataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.util.Assert;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
public class Oracle_Case3 extends TestCase {
private String jdbcUrl;
private String user;

View File

@ -15,6 +15,15 @@
*/
package com.alibaba.druid.benckmark.pool;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.util.Assert;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -23,17 +32,6 @@ import java.sql.Statement;
import java.text.NumberFormat;
import java.util.concurrent.CountDownLatch;
import javax.sql.DataSource;
import junit.framework.TestCase;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.util.Assert;
import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
public class Oracle_Case4 extends TestCase {
private String jdbcUrl;
private String user;
@ -46,7 +44,7 @@ public class Oracle_Case4 extends TestCase {
private int threadCount = 1;
private int loopCount = 5;
final int LOOP_COUNT = 1000 * 1;
private boolean testOnBorrow = false;
private boolean testOnBorrow;
private boolean preparedStatementCache = true;
private int preparedStatementCacheSize = 50;
private String properties = "defaultRowPrefetch=50";

View File

@ -15,14 +15,12 @@
*/
package com.alibaba.druid.benckmark.pool.druid;
import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
public class DruidCase0 extends TestCase {
private DruidDataSource dataSource;
@ -72,5 +70,4 @@ public class DruidCase0 extends TestCase {
conn.close();
}
}
}

View File

@ -1,12 +1,12 @@
package com.alibaba.druid.benckmark.pool.model;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;
public class TableOperator {
private DataSource dataSource;

View File

@ -15,6 +15,9 @@
*/
package com.alibaba.druid.benckmark.proxy;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import java.lang.management.ManagementFactory;
import java.text.NumberFormat;
import java.util.ArrayList;
@ -22,9 +25,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.management.MBeanServer;
import javax.management.ObjectName;
public class BenchmarkExecutor {
private int loopCount = 1000;
private int executeCount = 10;

View File

@ -64,5 +64,4 @@ public class DirectSQLExecutor extends SQLExecutor {
public Connection getConnection() throws SQLException {
return DriverManager.getConnection(jdbcUrl, user, password);
}
}

View File

@ -15,9 +15,8 @@
*/
package com.alibaba.druid.benckmark.proxy;
import junit.framework.TestCase;
import com.alibaba.druid.benckmark.proxy.sqlcase.SelectNow;
import junit.framework.TestCase;
public class DruidBenchmarkTest extends TestCase {
public void test_druid_benchmark() throws Exception {

View File

@ -15,10 +15,10 @@
*/
package com.alibaba.druid.benckmark.proxy;
import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.TestCase;
import java.util.concurrent.atomic.AtomicInteger;
public class TestAtomicPerformance extends TestCase {
public void test_0() throws Exception {
AtomicInteger count = new AtomicInteger();

View File

@ -15,15 +15,14 @@
*/
package com.alibaba.druid.benckmark.proxy.sqlcase;
import com.alibaba.druid.benckmark.proxy.BenchmarkCase;
import com.alibaba.druid.benckmark.proxy.SQLExecutor;
import org.junit.Assert;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import org.junit.Assert;
import com.alibaba.druid.benckmark.proxy.BenchmarkCase;
import com.alibaba.druid.benckmark.proxy.SQLExecutor;
public class Select1 extends BenchmarkCase {
private String sql;
private Connection conn;
@ -60,5 +59,4 @@ public class Select1 extends BenchmarkCase {
conn.close();
conn = null;
}
}

View File

@ -15,15 +15,14 @@
*/
package com.alibaba.druid.benckmark.proxy.sqlcase;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import org.junit.Assert;
import com.alibaba.druid.benckmark.proxy.BenchmarkCase;
import com.alibaba.druid.benckmark.proxy.SQLExecutor;
import com.alibaba.druid.util.JdbcUtils;
import org.junit.Assert;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
public class SelectEmptyTable extends BenchmarkCase {
private String sql;
@ -86,5 +85,4 @@ public class SelectEmptyTable extends BenchmarkCase {
conn.close();
conn = null;
}
}

View File

@ -15,16 +15,15 @@
*/
package com.alibaba.druid.benckmark.proxy.sqlcase;
import com.alibaba.druid.benckmark.proxy.BenchmarkCase;
import com.alibaba.druid.benckmark.proxy.SQLExecutor;
import org.junit.Assert;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Date;
import org.junit.Assert;
import com.alibaba.druid.benckmark.proxy.BenchmarkCase;
import com.alibaba.druid.benckmark.proxy.SQLExecutor;
public class SelectNow extends BenchmarkCase {
private String sql;
private Connection conn;
@ -61,5 +60,4 @@ public class SelectNow extends BenchmarkCase {
conn.close();
conn = null;
}
}

View File

@ -15,15 +15,14 @@
*/
package com.alibaba.druid.benckmark.proxy.sqlcase;
import com.alibaba.druid.benckmark.proxy.BenchmarkCase;
import com.alibaba.druid.benckmark.proxy.SQLExecutor;
import org.junit.Assert;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import org.junit.Assert;
import com.alibaba.druid.benckmark.proxy.BenchmarkCase;
import com.alibaba.druid.benckmark.proxy.SQLExecutor;
public class SelectSysUser extends BenchmarkCase {
private String sql;
private Connection conn;
@ -60,5 +59,4 @@ public class SelectSysUser extends BenchmarkCase {
conn.close();
conn = null;
}
}

View File

@ -4,7 +4,6 @@ import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.util.JdbcConstants;
import junit.framework.TestCase;
import org.apache.ibatis.jdbc.SQL;
import java.util.List;
@ -14,7 +13,6 @@ public class MySqlInsertBenchmark extends TestCase {
protected void setUp() throws Exception {
stmtList = SQLUtils.parseStatements(sql, JdbcConstants.MYSQL);
}
public void test_perf() throws Exception {
@ -42,6 +40,4 @@ public class MySqlInsertBenchmark extends TestCase {
long millis = System.currentTimeMillis() - startMillis;
System.out.println("millis : " + millis);
}
}

View File

@ -37,7 +37,6 @@ public class MySqlInsertBenchmark_2 extends TestCase {
public void perf() {
long startMillis = System.currentTimeMillis();
for (int i = 0; i < 1000 * 1000; ++i) {
List<SQLStatement> stmt = SQLUtils.parseStatements(sql, JdbcConstants.MYSQL);
// stmt.toString();
}

View File

@ -15,15 +15,15 @@
*/
package com.alibaba.druid.benckmark.sql;
import java.lang.management.ManagementFactory;
import java.util.List;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor;
import com.alibaba.druid.sql.test.TestUtils;
import com.alibaba.druid.util.Utils;
import java.lang.management.ManagementFactory;
import java.util.List;
public class MySqlPerfMain {
public static void main(String[] args) throws Exception {
System.out.println(System.getProperty("java.vm.name") + " " + System.getProperty("java.runtime.version"));

View File

@ -17,12 +17,9 @@ package com.alibaba.druid.benckmark.sql;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor;
import com.alibaba.druid.sql.test.TestUtils;
import com.alibaba.druid.sql.visitor.SchemaStatVisitor;
import com.alibaba.druid.util.JdbcConstants;
import com.alibaba.druid.util.Utils;
import java.lang.management.ManagementFactory;
import java.util.List;

View File

@ -15,14 +15,13 @@
*/
package com.alibaba.druid.benckmark.sql;
import java.lang.management.ManagementFactory;
import java.util.List;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitorAdapter;
import com.alibaba.druid.sql.test.TestUtils;
import java.lang.management.ManagementFactory;
import java.util.List;
public class MySqlPerfMain_select {
public static void main(String[] args) throws Exception {
System.out.println(System.getProperty("java.vm.name") + " " + System.getProperty("java.runtime.version"));
@ -30,10 +29,10 @@ public class MySqlPerfMain_select {
System.out.println(arguments);
String sql = "SELECT ID, NAME, AGE FROM USER WHERE ID = ?";
// String sql = "SELECT student_name, " //
// + "GROUP_CONCAT(DISTINCT test_score " //
// + " ORDER BY test_score DESC SEPARATOR ' ') " //
// + "FROM student " //
// String sql = "SELECT student_name, "
// + "GROUP_CONCAT(DISTINCT test_score "
// + " ORDER BY test_score DESC SEPARATOR ' ') "
// + "FROM student "
// + "GROUP BY student_name";
for (int i = 0; i < 10; ++i) {

View File

@ -15,15 +15,15 @@
*/
package com.alibaba.druid.benckmark.sql;
import java.lang.management.ManagementFactory;
import java.util.List;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor;
import com.alibaba.druid.sql.test.TestUtils;
import java.lang.management.ManagementFactory;
import java.util.List;
public class MySqlPerfMain_visitor {
public static void main(String[] args) throws Exception {
System.out.println(System.getProperty("java.vm.name") + " " + System.getProperty("java.runtime.version"));

View File

@ -15,15 +15,13 @@
*/
package com.alibaba.druid.benckmark.sql;
import java.util.List;
import junit.framework.TestCase;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor;
import com.alibaba.druid.sql.test.TestUtils;
import com.alibaba.druid.util.Utils;
import junit.framework.TestCase;
import java.util.List;
public class MySqlPerfTest extends TestCase {
private String sql;

View File

@ -2,28 +2,27 @@ package com.alibaba.druid.benckmark.sql;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLObject;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr;
import com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr;
import com.alibaba.druid.sql.ast.statement.SQLSelect;
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlSelectParser;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor;
import com.alibaba.druid.sql.parser.*;
import com.alibaba.druid.sql.parser.ParserException;
import com.alibaba.druid.sql.parser.SQLParserFeature;
import com.alibaba.druid.sql.parser.SQLSelectListCache;
import com.alibaba.druid.sql.visitor.SQLASTOutputVisitor;
import com.alibaba.druid.sql.visitor.SchemaStatVisitor;
import com.alibaba.druid.stat.TableStat;
import com.alibaba.druid.util.JdbcConstants;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONWriter;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by kaiwang.ckw on 15/05/2017.
@ -122,9 +121,9 @@ public class SqlHolder {
if (isParam) {
features = new SQLParserFeature[]{SQLParserFeature.EnableSQLBinaryOpExprGroup, SQLParserFeature.OptimizedForParameterized};
} else {
features = new SQLParserFeature[]{SQLParserFeature.EnableSQLBinaryOpExprGroup
, SQLParserFeature.OptimizedForParameterized
, SQLParserFeature.UseInsertColumnsCache
features = new SQLParserFeature[]{SQLParserFeature.EnableSQLBinaryOpExprGroup,
SQLParserFeature.OptimizedForParameterized,
SQLParserFeature.UseInsertColumnsCache
};
}
@ -179,7 +178,6 @@ public class SqlHolder {
return Templates.parameterize(ast, physicalNames, params);
}
public String getParams() {
ensureParsed();
StringBuilder out = new StringBuilder();
@ -214,8 +212,9 @@ public class SqlHolder {
}
} catch (Exception ex) {
}
if (itemMap.isEmpty())
if (itemMap.isEmpty()) {
return null;
}
StringBuilder resSb = new StringBuilder();
for (Map.Entry<String, LinkedHashSet<String>> entry : itemMap.entrySet()) {
resSb.append(StringUtils.join(entry.getValue(), ",")).append(",");

View File

@ -45,5 +45,4 @@ public class Templates {
String sqlTemplate = out.toString();
return sqlTemplate;
}
}

View File

@ -15,10 +15,9 @@
*/
package com.alibaba.druid.benckmark.wall;
import junit.framework.TestCase;
import com.alibaba.druid.wall.WallProvider;
import com.alibaba.druid.wall.spi.OracleWallProvider;
import junit.framework.TestCase;
public class WallBenchmarkTest extends TestCase {
WallProvider provider = new OracleWallProvider();
@ -26,8 +25,8 @@ public class WallBenchmarkTest extends TestCase {
public static final int COUNT = 1000 * 1000;
public void test_0() throws Exception {
String sql = "SELECT t1.department_id, t2.*\n" + //
"FROM hr_info t1, TABLE(t1.people) t2\n" + //
String sql = "SELECT t1.department_id, t2.*\n" +
"FROM hr_info t1, TABLE(t1.people) t2\n" +
"WHERE t2.department_id = t1.department_id;";
for (int i = 0; i < 10; ++i) {
provider.clearCache();

View File

@ -15,12 +15,11 @@
*/
package com.alibaba.druid.benckmark.wall;
import java.util.Random;
import junit.framework.TestCase;
import com.alibaba.druid.wall.WallProvider;
import com.alibaba.druid.wall.spi.MySqlWallProvider;
import junit.framework.TestCase;
import java.util.Random;
public class WallBenchmarkTest1 extends TestCase {
static Random r = new Random();
@ -29,8 +28,8 @@ public class WallBenchmarkTest1 extends TestCase {
public static final int COUNT = 1000 * 1000;
public void test_0() throws Exception {
String sql = "SELECT t1.department_id, t2.*\n" + //
"FROM hr_info t1, x2 t2\n" + //
String sql = "SELECT t1.department_id, t2.*\n" +
"FROM hr_info t1, x2 t2\n" +
"WHERE t2.department_id = t1.department_id";
for (int i = 0; i < 10; ++i) {
provider.clearCache();
@ -63,6 +62,4 @@ public class WallBenchmarkTest1 extends TestCase {
sb.append(" from sqlinject");
return sb.toString();
}
}

View File

@ -15,10 +15,9 @@
*/
package com.alibaba.druid.benckmark.wall;
import junit.framework.TestCase;
import com.alibaba.druid.wall.WallProvider;
import com.alibaba.druid.wall.spi.MySqlWallProvider;
import junit.framework.TestCase;
public class WallBenchmarkTest_mysql extends TestCase {
WallProvider provider = new MySqlWallProvider();
@ -26,8 +25,8 @@ public class WallBenchmarkTest_mysql extends TestCase {
public static final int COUNT = 1000 * 1000;
public void test_0() throws Exception {
String sql = "SELECT t1.department_id, t2.*\n" + //
"FROM hr_info t1, x2 t2\n" + //
String sql = "SELECT t1.department_id, t2.*\n" +
"FROM hr_info t1, x2 t2\n" +
"WHERE t2.department_id = t1.department_id";
for (int i = 0; i < 10; ++i) {
provider.clearCache();

View File

@ -15,12 +15,11 @@
*/
package com.alibaba.druid.benckmark.wall;
import java.util.concurrent.CountDownLatch;
import junit.framework.TestCase;
import com.alibaba.druid.wall.WallProvider;
import com.alibaba.druid.wall.spi.MySqlWallProvider;
import junit.framework.TestCase;
import java.util.concurrent.CountDownLatch;
public class WallBenchmarkTest_mysql_concurrent extends TestCase {
WallProvider provider = new MySqlWallProvider();
@ -28,8 +27,8 @@ public class WallBenchmarkTest_mysql_concurrent extends TestCase {
public static final int COUNT = 1000 * 10;
public void test_0() throws Exception {
String sql = "SELECT t1.department_id, t2.*\n" + //
"FROM hr_info t1, x2 t2\n" + //
String sql = "SELECT t1.department_id, t2.*\n" +
"FROM hr_info t1, x2 t2\n" +
"WHERE t2.department_id = t1.department_id";
for (int i = 0; i < 10; ++i) {
provider.clearCache();

View File

@ -45,5 +45,4 @@ public class AlipayUseCaseTest {
public void test() {
// TODO
}
}

View File

@ -1,17 +1,15 @@
package com.alibaba.druid.bvt;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import junit.framework.TestCase;
import java.util.List;
import com.alibaba.druid.DbType;
import junit.framework.TestCase;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
public class OrTest extends TestCase {
public void test_xx() throws Exception {
String sql = "select * from t where not match('', '') or (c > 0 and d >0)";
String sql = "select * from t where not match('', '') or (c > 0 and d > 0)";
List<SQLStatement> stmtList = SQLUtils.parseStatements(sql, (DbType) null);
SQLStatement stmt = stmtList.get(0);

View File

@ -1,7 +1,5 @@
package com.alibaba.druid.bvt.bug;
import java.util.List;
import java.util.regex.Pattern;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser;
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleExportParameterVisitor;
@ -11,6 +9,9 @@ import com.alibaba.druid.sql.visitor.ExportParameterVisitor;
import com.alibaba.fastjson2.JSON;
import junit.framework.TestCase;
import java.util.List;
import java.util.regex.Pattern;
/**
* 此测试类用于检测试sql中where拼错导致SQL无效 但经SQLStatementParser解析却丢失where的严复问题.
*
@ -19,11 +20,11 @@ import junit.framework.TestCase;
public class BugSqlParserIllegalWhere extends TestCase {
public void test4deleteWhere() throws Exception {
Object[][] samples = {
{ "update test_tab1 set b= 1 swhere a=1", false },
{ "select * from test_tab1 swhere a=1", false },
{ "delete from test_tab1 \n swhere a=1", false },
{ "delete from test_tab1 where a=1", true },
{ "delete from test_tab1 \n where a=1 \n", true }
{"update test_tab1 set b= 1 swhere a=1", false},
{"select * from test_tab1 swhere a=1", false},
{"delete from test_tab1 \n swhere a=1", false},
{"delete from test_tab1 where a=1", true},
{"delete from test_tab1 \n where a=1 \n", true}
};
for (final Object[] arr : samples) {

View File

@ -15,25 +15,21 @@
*/
package com.alibaba.druid.bvt.bug;
import static org.junit.Assert.assertEquals;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.mock.MockPreparedStatement;
import com.alibaba.druid.mock.MockStatement;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
public class Bug_for_happyday517 extends PoolTestCase {
private DruidDataSource dataSource;
private MockDriver driver;
private int originalDataSourceCount = 0;
private int originalDataSourceCount;
protected void setUp() throws Exception {
super.setUp();
@ -44,7 +40,6 @@ public class Bug_for_happyday517 extends PoolTestCase {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat,trace,log4j,encoding");
}
protected void tearDown() throws Exception {

View File

@ -15,8 +15,12 @@
*/
package com.alibaba.druid.bvt.bug;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.alibaba.druid.mock.MockConnection;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.mock.MockPreparedStatement;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
import junit.framework.TestCase;
import java.sql.Connection;
import java.sql.DataTruncation;
@ -24,21 +28,13 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Properties;
import junit.framework.TestCase;
import com.alibaba.druid.mock.MockConnection;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.mock.MockPreparedStatement;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class Bug_for_happyday517_2 extends TestCase {
private DruidDataSource dataSource;
private MockDriver driver;
final DataTruncation exception = new java.sql.DataTruncation(0, true, true, 0, 0);
private int originalDataSourceCount = 0;
private int originalDataSourceCount;
protected void setUp() throws Exception {
originalDataSourceCount = DruidDataSourceStatManager.getInstance().getDataSourceList().size();
@ -63,7 +59,6 @@ public class Bug_for_happyday517_2 extends TestCase {
dataSource.setDriver(driver);
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat,trace,log4j,encoding");
}
protected void tearDown() throws Exception {

View File

@ -15,21 +15,18 @@
*/
package com.alibaba.druid.bvt.bug;
import static org.junit.Assert.assertEquals;
import java.sql.Connection;
import junit.framework.TestCase;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
import junit.framework.TestCase;
import java.sql.Connection;
public class Bug_for_happyday517_3 extends TestCase {
private DruidDataSource dataSource;
private MockDriver driver;
private int originalDataSourceCount = 0;
private int originalDataSourceCount;
protected void setUp() throws Exception {
originalDataSourceCount = DruidDataSourceStatManager.getInstance().getDataSourceList().size();

View File

@ -15,8 +15,6 @@
*/
package com.alibaba.druid.bvt.bug;
import static org.junit.Assert.assertEquals;
import com.alibaba.druid.sql.SQLUtils;
import junit.framework.TestCase;

View File

@ -1,15 +1,11 @@
package com.alibaba.druid.bvt.bug;
import static org.junit.Assert.assertEquals;
import java.util.List;
import junit.framework.TestCase;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.odps.parser.OdpsStatementParser;
import com.alibaba.druid.sql.dialect.odps.visitor.OdpsOutputVisitor;
import junit.framework.TestCase;
import java.util.List;
public class Bug_for_qianbi extends TestCase {
public void test_for_issue() throws Exception {

View File

@ -1,14 +1,11 @@
package com.alibaba.druid.bvt.bug;
import static org.junit.Assert.assertEquals;
import java.util.List;
import junit.framework.TestCase;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor;
import junit.framework.TestCase;
import java.util.List;
public class Bug_for_ruiyi extends TestCase {
public void test_for_issue() throws Exception {

View File

@ -1,11 +1,10 @@
package com.alibaba.druid.bvt.bug;
import java.sql.Connection;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.Connection;
public class Bug_for_wdw1206 extends TestCase {
private ClassLoader ctxClassLoader;

View File

@ -15,18 +15,9 @@
*/
package com.alibaba.druid.bvt.bug;
import static org.junit.Assert.assertEquals;
import java.util.List;
import com.alibaba.druid.sql.SQLUtils;
import junit.framework.TestCase;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor;
public class Bug_for_weizhi extends TestCase {
public void test_for_issue() throws Exception {
String sql = "insert into aaa values(1,2,'这是个反斜杠\\\\');";

View File

@ -15,18 +15,15 @@
*/
package com.alibaba.druid.bvt.bug;
import static org.junit.Assert.assertNull;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import junit.framework.TestCase;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.mock.MockPreparedStatement;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class Bug_for_xuershan extends TestCase {
private DruidDataSource dataSource;

View File

@ -1,7 +1,6 @@
package com.alibaba.druid.bvt.bug;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.parser.SQLParserUtils;
import com.alibaba.druid.sql.parser.SQLStatementParser;
import com.alibaba.druid.util.JdbcConstants;

View File

@ -14,7 +14,7 @@ public class Issue1759 extends TestCase {
String sql = "COMMENT ON COLUMN \"TB_CRM_MATERIAL\".\"INVALID_TIME\" IS '生效时间'";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLStatement statement = parser.parseStatement();// 分号之后多语句忽略
SQLStatement statement = parser.parseStatement(); // 分号之后多语句忽略
OracleWallProvider provider = new OracleWallProvider();
WallCheckResult result1 = provider.check(sql);

View File

@ -4,7 +4,6 @@ import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.visitor.SchemaStatVisitor;
import com.alibaba.druid.util.JdbcConstants;
import junit.framework.TestCase;
import java.util.List;

View File

@ -1,8 +1,6 @@
package com.alibaba.druid.bvt.bug;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement;
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
@ -13,8 +11,6 @@ import com.alibaba.druid.sql.parser.SQLStatementParser;
import com.alibaba.druid.util.JdbcConstants;
import junit.framework.TestCase;
import java.util.List;
public class Issue1865 extends TestCase {
public void test_for_select() throws Exception {
final DbType dbType = JdbcConstants.MYSQL;

View File

@ -1,7 +1,6 @@
package com.alibaba.druid.bvt.bug;
import junit.framework.TestCase;
import org.junit.Test;
/**
* Created by wenshao on 14/08/2017.

View File

@ -4,13 +4,11 @@ import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
import com.alibaba.druid.sql.parser.SQLStatementParser;
import com.alibaba.druid.sql.visitor.SQLASTOutputVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitorAdapter;
import junit.framework.TestCase;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Issue1912 extends TestCase {

View File

@ -3,7 +3,6 @@ package com.alibaba.druid.bvt.bug;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.statement.SQLCreateViewStatement;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor;
import com.alibaba.druid.stat.TableStat;
import com.alibaba.druid.util.JdbcConstants;
@ -45,6 +44,7 @@ public class Issue1935 extends TestCase {
Collection<TableStat.Column> cc = visitor.getColumns();
//column 存储了表名列名以及列是出现的位置whereselectgroupby order
for (TableStat.Column column : cc) {
// Intentionally left empty
}
System.out.println("conditions : " + visitor.getConditions());
List<TableStat.Condition> conditions = visitor.getConditions();

View File

@ -5,8 +5,6 @@ import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.statement.SQLSelectItem;
import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleInsertStatement;
import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelectQueryBlock;
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
import com.alibaba.druid.sql.repository.SchemaRepository;
import com.alibaba.druid.sql.visitor.SchemaStatVisitor;
import com.alibaba.druid.util.JdbcConstants;
import junit.framework.TestCase;

View File

@ -5,10 +5,7 @@ import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.statement.SQLJoinTableSource;
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser;
import com.alibaba.druid.util.JdbcConstants;
import com.alibaba.druid.wall.WallCheckResult;
import com.alibaba.druid.wall.spi.OracleWallProvider;
import junit.framework.TestCase;
import java.util.List;

View File

@ -2,14 +2,8 @@ package com.alibaba.druid.bvt.bug;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.statement.SQLJoinTableSource;
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
import com.alibaba.druid.util.JdbcConstants;
import junit.framework.TestCase;
import java.util.List;
public class Issue3952 extends TestCase {
public void test_0() throws Exception {
String sql = "select\n" +

View File

@ -1,7 +1,5 @@
package com.alibaba.druid.bvt.bug;
import java.util.List;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
@ -9,6 +7,8 @@ import com.alibaba.druid.sql.visitor.SchemaStatVisitor;
import com.alibaba.druid.stat.TableStat;
import junit.framework.TestCase;
import java.util.List;
public class Issue4067 extends TestCase {
public void test_for_issue() throws Exception {
List<SQLStatement> stmtList = SQLUtils.parseStatements("desc bi.aaa", DbType.hive);

View File

@ -1,12 +1,7 @@
package com.alibaba.druid.bvt.bug;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.parser.SQLParserUtils;
import com.alibaba.druid.sql.parser.SQLStatementParser;
import com.alibaba.druid.util.JdbcConstants;
import junit.framework.TestCase;
/**
@ -14,7 +9,6 @@ import junit.framework.TestCase;
* @see <a href="https://github.com/alibaba/druid/issues/5763">...</a>
*/
public class Issue5763 extends TestCase {
public void test_for_clone() throws Exception {
String sql = "select user.col from user use index(a)";
SQLStatement origin = SQLUtils.parseSingleMysqlStatement(sql);

View File

@ -1,18 +1,16 @@
package com.alibaba.druid.bvt.bug;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class Issue5845 extends TestCase {
public void test_for_issue() throws Exception {
String sql = "delete from table01 t where t.id=1";
List<DbType> dbTypes = new ArrayList<>();
@ -41,7 +39,7 @@ public class Issue5845 extends TestCase {
DbType.greenplum,
DbType.gaussdb,
DbType.tidb,
DbType.goldendb,}) {
DbType.goldendb, }) {
String mergeSql = ParameterizedOutputVisitorUtils.parameterize(sql, dbType);
System.out.println(dbType + "==" + mergeSql);
dbTypes.add(dbType);

View File

@ -1,30 +1,25 @@
package com.alibaba.druid.bvt.bug;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr;
import com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils;
import junit.framework.TestCase;
import java.util.List;
/**
*
*/
public class Issue5847 extends TestCase {
public void test_for_issue() throws Exception {
String sql = "-- 执行SQLUtils.format(sql, DbType.dm)结果外层括号被剔除该sql在dm库执行失败\n"
+ "SELECT *\n"
+ "FROM tb_test\n"
+ "LIMIT 10 OFFSET ( (2 - 1) * 1 *( 3 + 5) )";
sql="select a.*, (a.swanav-lead(a.swanav,1,null::numeric) over w)/lead(a.swanav,1,null::numeric) over w as roe_lag\n";
sql="select a.*, ((a.swanav-lead(a.swanav,1,null::numeric) over w)/lead(a.swanav,1,null::numeric) over w) as roe_lag\n";
sql="select * from aaa "
sql = "select a.*, (a.swanav-lead(a.swanav,1,null::numeric) over w)/lead(a.swanav,1,null::numeric) over w as roe_lag\n";
sql = "select a.*, ((a.swanav-lead(a.swanav,1,null::numeric) over w)/lead(a.swanav,1,null::numeric) over w) as roe_lag\n";
sql = "select * from aaa "
+ "group by to_char((CreateDate || ' ' || cast(HourArgment as VARCHAR) || ':00:00')::TIMESTAMP, 'YYYY-MM-DD HH24')";
@ -44,7 +39,6 @@ public class Issue5847 extends TestCase {
// DbType.tidb,
// DbType.goldendb,
//DbType.dm,
}) {
try {
// String mergeSql = SQLUtils.format(sql, dbType);

View File

@ -17,9 +17,6 @@ package com.alibaba.druid.bvt.bug;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.wall.WallConfig;
import com.alibaba.druid.wall.WallUtils;
import junit.framework.TestCase;
/**

View File

@ -1,12 +1,10 @@
package com.alibaba.druid.bvt.bug;
import org.junit.Test;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import junit.framework.TestCase;
import org.junit.Test;
public class Issue_4190 extends TestCase {
@Test

View File

@ -1,9 +1,8 @@
package com.alibaba.druid.bvt.bug;
import junit.framework.TestCase;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser;
import junit.framework.TestCase;
public class Issue_685 extends TestCase {
public void test_for_issue() throws Exception {

View File

@ -1,16 +1,8 @@
package com.alibaba.druid.bvt.bug;
import static org.junit.Assert.assertEquals;
import java.util.List;
import com.alibaba.druid.sql.SQLUtils;
import junit.framework.TestCase;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor;
public class Issue_697 extends TestCase {
public void test_for_issue() throws Exception {
String sql = "insert into tag_rule_detail(id, gmt_create, gmt_modified, group_id, priority, rule_condition, rule_action) values(1010102, now(), now(), 10101, 0, 'flow=''trustLogin''', 'be:login,dev:pc, env:web, type:trust_login, from:$loginfrom, result:true') ;\n"

View File

@ -15,13 +15,9 @@
*/
package com.alibaba.druid.bvt.bug;
import static org.junit.Assert.assertFalse;
import junit.framework.TestCase;
import com.alibaba.druid.wall.WallConfig;
import com.alibaba.druid.wall.WallUtils;
import junit.framework.TestCase;
public class Issue_728 extends TestCase {
public void test1() throws Exception {

View File

@ -1,18 +1,10 @@
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import com.alibaba.druid.filter.encoding.EncodingConvertFilter;
import com.alibaba.druid.filter.stat.StatFilter;
import com.alibaba.druid.pool.DruidDataSource;
public class ClearFilterTest extends PoolTestCase {
public void test_filters() throws Exception {
DruidDataSource dataSource = new DruidDataSource();

View File

@ -15,17 +15,6 @@
*/
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import junit.framework.TestCase;
import com.alibaba.druid.filter.encoding.EncodingConvertFilter;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.mock.MockPreparedStatement;
@ -35,6 +24,12 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.alibaba.druid.proxy.jdbc.ConnectionProxy;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class EncodingConvertFilterTest extends TestCase {
private DruidDataSource dataSource;
@ -101,7 +96,6 @@ public class EncodingConvertFilterTest extends TestCase {
stmt.close();
conn.close();
}
public static class MyResultSet extends MockResultSet {

View File

@ -15,23 +15,6 @@
*/
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.Reader;
import java.io.StringReader;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.Collections;
import junit.framework.TestCase;
import com.alibaba.druid.filter.encoding.EncodingConvertFilter;
import com.alibaba.druid.mock.MockCallableStatement;
import com.alibaba.druid.mock.MockDriver;
@ -42,9 +25,20 @@ import com.alibaba.druid.mock.MockStatementBase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.alibaba.druid.proxy.jdbc.ConnectionProxy;
import com.alibaba.druid.util.Utils;
import com.alibaba.druid.util.JdbcUtils;
import com.alibaba.druid.util.Utils;
import com.alibaba.druid.util.jdbc.ResultSetMetaDataBase.ColumnMetaData;
import junit.framework.TestCase;
import java.io.Reader;
import java.io.StringReader;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.Collections;
public class EncodingConvertFilterTest2 extends TestCase {
private DruidDataSource dataSource;
@ -143,7 +137,6 @@ public class EncodingConvertFilterTest2 extends TestCase {
raw.getOutParameters().add(param1);
raw.getOutParameters().add(param1);
assertEquals(C_TEXT, stmt.getString(4));
assertEquals(C_TEXT, stmt.getString("4"));
assertEquals(C_TEXT, stmt.getObject(4));
@ -239,7 +232,6 @@ public class EncodingConvertFilterTest2 extends TestCase {
stmt.close();
conn.close();
}
public static class MyResultSet extends MockResultSet {

View File

@ -1,21 +1,5 @@
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.Types;
import com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl;
import junit.framework.TestCase;
import com.alibaba.druid.filter.FilterAdapter;
import com.alibaba.druid.filter.FilterChainImpl;
import com.alibaba.druid.mock.MockNClob;
@ -23,6 +7,14 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.proxy.jdbc.ConnectionProxy;
import com.alibaba.druid.proxy.jdbc.StatementProxy;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Types;
public class FilterChainImplTest extends TestCase {
private DruidDataSource dataSource;
@ -91,7 +83,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getUnicodeStream_1() throws Exception {
@ -106,7 +97,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getRef() throws Exception {
@ -121,7 +111,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getRef_1() throws Exception {
@ -136,7 +125,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getArray() throws Exception {
@ -151,7 +139,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getArray_1() throws Exception {
@ -166,7 +153,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getURL() throws Exception {
@ -181,7 +167,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getURL_1() throws Exception {
@ -196,7 +181,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getRowId() throws Exception {
@ -211,7 +195,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getRowId_1() throws Exception {
@ -226,7 +209,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getNClob() throws Exception {
@ -241,7 +223,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getNClob_1() throws Exception {
@ -256,7 +237,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getSQLXML() throws Exception {
@ -271,7 +251,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getSQLXML_1() throws Exception {
@ -286,7 +265,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getNString() throws Exception {
@ -301,7 +279,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getNString_1() throws Exception {
@ -316,7 +293,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getNCharacterStream() throws Exception {
@ -331,7 +307,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getNCharacterStream_1() throws Exception {
@ -346,7 +321,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getObject() throws Exception {
@ -361,7 +335,6 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
public void test_getObject_1() throws Exception {
@ -376,6 +349,5 @@ public class FilterChainImplTest extends TestCase {
rs.close();
stmt.close();
conn.close();
}
}

View File

@ -1,21 +1,15 @@
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import com.alibaba.druid.filter.FilterAdapter;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;
import java.util.Collections;
import junit.framework.TestCase;
import com.alibaba.druid.filter.FilterAdapter;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
public class FilterChainImplTest2 extends TestCase {
private DruidDataSource dataSource;
@ -101,7 +95,6 @@ public class FilterChainImplTest2 extends TestCase {
conn.close();
}
public void test_getByte() throws Exception {
Connection conn = dataSource.getConnection();
CallableStatement stmt = conn.prepareCall("select ?");
@ -234,7 +227,6 @@ public class FilterChainImplTest2 extends TestCase {
conn.close();
}
public void test_getBytes() throws Exception {
Connection conn = dataSource.getConnection();
CallableStatement stmt = conn.prepareCall("select ?");
@ -257,7 +249,6 @@ public class FilterChainImplTest2 extends TestCase {
conn.close();
}
public void test_getDate() throws Exception {
Connection conn = dataSource.getConnection();
CallableStatement stmt = conn.prepareCall("select ?");

View File

@ -1,16 +1,5 @@
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertNull;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import junit.framework.TestCase;
import com.alibaba.druid.filter.FilterAdapter;
import com.alibaba.druid.mock.MockConnection;
import com.alibaba.druid.mock.MockDriver;
@ -18,6 +7,14 @@ import com.alibaba.druid.mock.MockStatement;
import com.alibaba.druid.mock.MockStatementBase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
public class FilterChainImplTest3 extends TestCase {
private DruidDataSource dataSource;

View File

@ -15,9 +15,6 @@
*/
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.alibaba.druid.filter.FilterChainImpl;
import com.alibaba.druid.mock.MockClob;
import com.alibaba.druid.mock.MockResultSet;
@ -40,7 +37,7 @@ public class FilterChainTest_Clob extends TestCase {
private StatementProxy statement;
private MockResultSet mockResultSet;
private int invokeCount = 0;
private int invokeCount;
protected void setUp() throws Exception {
dataSource = new DruidDataSource();

View File

@ -15,16 +15,6 @@
*/
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.sql.Clob;
import java.sql.SQLException;
import java.util.Collections;
import junit.framework.TestCase;
import com.alibaba.druid.filter.FilterChainImpl;
import com.alibaba.druid.mock.MockCallableStatement;
import com.alibaba.druid.mock.MockClob;
@ -34,12 +24,17 @@ import com.alibaba.druid.proxy.jdbc.CallableStatementProxyImpl;
import com.alibaba.druid.proxy.jdbc.ClobProxy;
import com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.Clob;
import java.sql.SQLException;
import java.util.Collections;
public class FilterChainTest_Clob_2 extends TestCase {
private DruidDataSource dataSource;
private CallableStatementProxy statement;
private int invokeCount = 0;
private int invokeCount;
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
@ -53,7 +48,6 @@ public class FilterChainTest_Clob_2 extends TestCase {
};
statement = new CallableStatementProxyImpl(new ConnectionProxyImpl(null, null, null, 0), mockStmt, "", 1);
}
protected void tearDown() throws Exception {

View File

@ -15,17 +15,6 @@
*/
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.sql.Clob;
import java.sql.SQLException;
import java.util.Collections;
import java.util.Properties;
import junit.framework.TestCase;
import com.alibaba.druid.filter.FilterChainImpl;
import com.alibaba.druid.mock.MockNClob;
import com.alibaba.druid.mock.MockResultSet;
@ -36,13 +25,19 @@ import com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl;
import com.alibaba.druid.proxy.jdbc.StatementProxy;
import com.alibaba.druid.proxy.jdbc.StatementProxyImpl;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.Clob;
import java.sql.SQLException;
import java.util.Collections;
import java.util.Properties;
public class FilterChainTest_NClob extends TestCase {
private DruidDataSource dataSource;
private StatementProxy statement;
private MockResultSet mockResultSet;
private int invokeCount = 0;
private int invokeCount;
protected void setUp() throws Exception {
dataSource = new DruidDataSource();

View File

@ -15,16 +15,6 @@
*/
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.sql.Clob;
import java.sql.SQLException;
import java.util.Collections;
import junit.framework.TestCase;
import com.alibaba.druid.filter.FilterChainImpl;
import com.alibaba.druid.mock.MockCallableStatement;
import com.alibaba.druid.mock.MockNClob;
@ -34,12 +24,17 @@ import com.alibaba.druid.proxy.jdbc.CallableStatementProxyImpl;
import com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl;
import com.alibaba.druid.proxy.jdbc.NClobProxy;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.Clob;
import java.sql.SQLException;
import java.util.Collections;
public class FilterChainTest_NClob_2 extends TestCase {
private DruidDataSource dataSource;
private CallableStatementProxy statement;
private int invokeCount = 0;
private int invokeCount;
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
@ -53,7 +48,6 @@ public class FilterChainTest_NClob_2 extends TestCase {
};
statement = new CallableStatementProxyImpl(new ConnectionProxyImpl(null, null, null, 0), mockStmt, "", 1);
}
protected void tearDown() throws Exception {
@ -80,7 +74,6 @@ public class FilterChainTest_NClob_2 extends TestCase {
assertEquals(1, invokeCount);
}
public void test_getObject() throws Exception {
FilterChainImpl chain = new FilterChainImpl(dataSource);

View File

@ -15,16 +15,6 @@
*/
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
import junit.framework.TestCase;
import com.alibaba.druid.filter.FilterChainImpl;
import com.alibaba.druid.mock.MockResultSet;
import com.alibaba.druid.pool.DruidDataSource;
@ -33,13 +23,18 @@ import com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl;
import com.alibaba.druid.proxy.jdbc.StatementProxy;
import com.alibaba.druid.proxy.jdbc.StatementProxyImpl;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
public class FilterChainTest_ResultSet extends TestCase {
private DruidDataSource dataSource;
private StatementProxy statement;
private MockResultSet mockResultSet;
private int invokeCount = 0;
private int invokeCount;
protected void setUp() throws Exception {
dataSource = new DruidDataSource();

View File

@ -15,17 +15,6 @@
*/
package com.alibaba.druid.bvt.filter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
import java.util.Properties;
import junit.framework.TestCase;
import com.alibaba.druid.filter.FilterChainImpl;
import com.alibaba.druid.mock.MockCallableStatement;
import com.alibaba.druid.mock.MockResultSet;
@ -35,12 +24,18 @@ import com.alibaba.druid.proxy.jdbc.CallableStatementProxyImpl;
import com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl;
import com.alibaba.druid.proxy.jdbc.ResultSetProxy;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
import java.util.Properties;
public class FilterChainTest_ResultSet_2 extends TestCase {
private DruidDataSource dataSource;
private CallableStatementProxy statement;
private int invokeCount = 0;
private int invokeCount;
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
@ -54,7 +49,6 @@ public class FilterChainTest_ResultSet_2 extends TestCase {
};
statement = new CallableStatementProxyImpl(conn, mockStmt, "", 1);
}
protected void tearDown() throws Exception {

Some files were not shown because too many files have changed in this diff Show More