mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
完善测试
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@802 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.alibaba.druid.bvt.pool.basic;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
@@ -40,7 +41,5 @@ public class PoolableStatementTest extends TestCase {
|
||||
stmt.toString();
|
||||
}
|
||||
|
||||
public void test_MaxRows() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -607,4 +607,129 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
conn.close();
|
||||
}
|
||||
|
||||
public void test_getResultSetHoldability() throws Exception {
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.getResultSetHoldability();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
stmt.getResultSetHoldability();
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
stmt.close();
|
||||
conn.close();
|
||||
}
|
||||
|
||||
public void test_execute() throws Exception {
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.execute("SELECT 1", new String[0]);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
stmt.execute("SELECT 1", new String[0]);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
stmt.close();
|
||||
conn.close();
|
||||
}
|
||||
|
||||
public void test_execute_1() throws Exception {
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.execute("SELECT 1", new int[0]);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
stmt.execute("SELECT 1", new int[0]);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
stmt.close();
|
||||
conn.close();
|
||||
}
|
||||
|
||||
public void test_execute_2() throws Exception {
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.execute("SELECT 1", Statement.NO_GENERATED_KEYS);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
stmt.execute("SELECT 1", Statement.NO_GENERATED_KEYS);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
stmt.close();
|
||||
conn.close();
|
||||
}
|
||||
|
||||
public void test_executeUpdate_1() throws Exception {
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.executeUpdate("SELECT 1", new String[0]);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
stmt.execute("SELECT 1", new String[0]);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
stmt.close();
|
||||
conn.close();
|
||||
}
|
||||
|
||||
public void test_executeUpdate_2() throws Exception {
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.executeUpdate("SELECT 1", new int[0]);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
stmt.execute("SELECT 1", new int[0]);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
stmt.close();
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user