mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
@@ -26,7 +26,7 @@ import java.io.Writer;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
import com.alibaba.druid.util.IOUtils;
|
||||
|
||||
public class TestReplaceLicense extends TestCase {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class TestReplaceLicense extends TestCase {
|
||||
protected void setUp() throws Exception {
|
||||
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("License.txt");
|
||||
Reader reader = new InputStreamReader(is);
|
||||
license = JdbcUtils.read(reader);
|
||||
license = IOUtils.read(reader);
|
||||
reader.close();
|
||||
System.out.println(license);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class TestReplaceLicense extends TestCase {
|
||||
public void listJavaFile(File file) throws Exception {
|
||||
FileInputStream in = new FileInputStream(file);
|
||||
InputStreamReader reader = new InputStreamReader(in, "utf-8");
|
||||
String content = JdbcUtils.read(reader);
|
||||
String content = IOUtils.read(reader);
|
||||
reader.close();
|
||||
|
||||
if (!content.startsWith(license)) {
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.alibaba.druid.mock.MockConnection;
|
||||
import com.alibaba.druid.mock.MockResultSet;
|
||||
import com.alibaba.druid.mock.MockResultSetMetaData;
|
||||
import com.alibaba.druid.mock.MockStatement;
|
||||
import com.alibaba.druid.util.IOUtils;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
public class JdbcUtilsTest extends TestCase {
|
||||
@@ -185,7 +186,7 @@ public class JdbcUtilsTest extends TestCase {
|
||||
{
|
||||
Exception error = null;
|
||||
try {
|
||||
JdbcUtils.read(new Reader() {
|
||||
IOUtils.read(new Reader() {
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
@@ -206,7 +207,7 @@ public class JdbcUtilsTest extends TestCase {
|
||||
{
|
||||
Exception error = null;
|
||||
try {
|
||||
JdbcUtils.read(new Reader() {
|
||||
IOUtils.read(new Reader() {
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
@@ -226,7 +227,7 @@ public class JdbcUtilsTest extends TestCase {
|
||||
}
|
||||
|
||||
{
|
||||
String text = JdbcUtils.read(new Reader() {
|
||||
String text = IOUtils.read(new Reader() {
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
@@ -242,7 +243,7 @@ public class JdbcUtilsTest extends TestCase {
|
||||
Assert.assertEquals("", text);
|
||||
}
|
||||
{
|
||||
String text = JdbcUtils.read(new Reader() {
|
||||
String text = IOUtils.read(new Reader() {
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
@@ -275,7 +276,7 @@ public class JdbcUtilsTest extends TestCase {
|
||||
}
|
||||
|
||||
};
|
||||
String text = JdbcUtils.read(reader, 2);
|
||||
String text = IOUtils.read(reader, 2);
|
||||
Assert.assertEquals("AA", text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ 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.dialect.mysql.visitor.MySqlParameterizedOutputVisitor;
|
||||
import com.alibaba.druid.util.IOUtils;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
public class MySqlParserResourceTest extends TestCase {
|
||||
@@ -39,7 +40,7 @@ public class MySqlParserResourceTest extends TestCase {
|
||||
|
||||
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
|
||||
Reader reader = new InputStreamReader(is, "UTF-8");
|
||||
String input = JdbcUtils.read(reader);
|
||||
String input = IOUtils.read(reader);
|
||||
JdbcUtils.close(reader);
|
||||
String[] items = input.split("---------------------------");
|
||||
String sql = items[0].trim();
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlParameterizedOutputVisitor;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor;
|
||||
import com.alibaba.druid.util.IOUtils;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
public class MySqlResourceTest extends TestCase {
|
||||
@@ -37,7 +38,7 @@ public class MySqlResourceTest extends TestCase {
|
||||
|
||||
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
|
||||
Reader reader = new InputStreamReader(is, "UTF-8");
|
||||
String input = JdbcUtils.read(reader);
|
||||
String input = IOUtils.read(reader);
|
||||
JdbcUtils.close(reader);
|
||||
String[] items = input.split("---------------------------");
|
||||
String sql = items[0].trim();
|
||||
|
||||
@@ -11,6 +11,7 @@ import junit.framework.TestCase;
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser;
|
||||
import com.alibaba.druid.sql.test.TestUtils;
|
||||
import com.alibaba.druid.util.IOUtils;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
public class OracleSQLParserResourceTest extends TestCase {
|
||||
@@ -29,7 +30,7 @@ public class OracleSQLParserResourceTest extends TestCase {
|
||||
|
||||
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
|
||||
Reader reader = new InputStreamReader(is, "UTF-8");
|
||||
String input = JdbcUtils.read(reader);
|
||||
String input = IOUtils.read(reader);
|
||||
JdbcUtils.close(reader);
|
||||
String[] items = input.split("---------------------------");
|
||||
String sql = items[0].trim();
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlParameterizedOutputVisitor;
|
||||
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleSchemaStatVisitor;
|
||||
import com.alibaba.druid.util.IOUtils;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
public class OracleResourceTest extends OracleTest {
|
||||
@@ -31,7 +32,7 @@ public class OracleResourceTest extends OracleTest {
|
||||
|
||||
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
|
||||
Reader reader = new InputStreamReader(is, "UTF-8");
|
||||
String input = JdbcUtils.read(reader);
|
||||
String input = IOUtils.read(reader);
|
||||
JdbcUtils.close(reader);
|
||||
String[] items = input.split("---------------------------");
|
||||
String sql = items[0].trim();
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.visitor.PGOutputVisitor;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.visitor.PGSchemaStatVisitor;
|
||||
import com.alibaba.druid.util.IOUtils;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
public class PostgresqlResourceTest extends PGTest {
|
||||
@@ -30,7 +31,7 @@ public class PostgresqlResourceTest extends PGTest {
|
||||
|
||||
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
|
||||
Reader reader = new InputStreamReader(is, "UTF-8");
|
||||
String input = JdbcUtils.read(reader);
|
||||
String input = IOUtils.read(reader);
|
||||
JdbcUtils.close(reader);
|
||||
String[] items = input.split("---------------------------");
|
||||
String sql = items[0].trim();
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor;
|
||||
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleOutputVisitor;
|
||||
import com.alibaba.druid.util.IOUtils;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
public class PerfTest extends TestCase {
|
||||
@@ -28,7 +29,7 @@ public class PerfTest extends TestCase {
|
||||
String loadSql(String resource) throws Exception {
|
||||
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
|
||||
Reader reader = new InputStreamReader(is, "UTF-8");
|
||||
String input = JdbcUtils.read(reader);
|
||||
String input = IOUtils.read(reader);
|
||||
JdbcUtils.close(reader);
|
||||
String[] items = input.split("---------------------------");
|
||||
String sql = items[1].trim();
|
||||
|
||||
Reference in New Issue
Block a user