完善测试

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@802 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-09-16 06:29:42 +00:00
parent 7f34535999
commit 6a1a477a14
2 changed files with 127 additions and 3 deletions
@@ -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();
}
}