mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
support dynamic setUserOracleImplicitCache
This commit is contained in:
@@ -21,7 +21,7 @@ import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.PoolableConnection;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
|
||||
public class TestDruidDataSource extends TestCase {
|
||||
@@ -51,7 +51,7 @@ public class TestDruidDataSource extends TestCase {
|
||||
|
||||
Connection conn = dataSource.getConnection();
|
||||
|
||||
Assert.assertTrue(conn instanceof PoolableConnection);
|
||||
Assert.assertTrue(conn instanceof DruidPooledConnection);
|
||||
|
||||
Assert.assertEquals(1, dataSource.getConnectCount());
|
||||
Assert.assertEquals(0, dataSource.getConnectErrorCount());
|
||||
|
||||
@@ -9,7 +9,7 @@ import junit.framework.TestCase;
|
||||
import com.alibaba.druid.filter.stat.StatFilter;
|
||||
import com.alibaba.druid.mock.MockDriver;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.PoolableConnection;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
|
||||
public class TestPoolPreparedStatement2 extends TestCase {
|
||||
@@ -80,7 +80,7 @@ public class TestPoolPreparedStatement2 extends TestCase {
|
||||
}
|
||||
|
||||
Connection conn = dataSource.getConnection();
|
||||
PoolableConnection poolableConn = conn.unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection poolableConn = conn.unwrap(DruidPooledConnection.class);
|
||||
Assert.assertNotNull(poolableConn);
|
||||
|
||||
Assert.assertEquals(dataSource.getMaxPoolPreparedStatementPerConnectionSize(),
|
||||
|
||||
@@ -9,7 +9,7 @@ import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.mock.MockDriver;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.PoolableConnection;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
import com.alibaba.druid.stat.JdbcStatContext;
|
||||
import com.alibaba.druid.stat.JdbcStatManager;
|
||||
@@ -51,7 +51,7 @@ public class ConnectionTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_basic() throws Exception {
|
||||
PoolableConnection conn = (PoolableConnection) dataSource.getConnection();
|
||||
DruidPooledConnection conn = (DruidPooledConnection) dataSource.getConnection();
|
||||
|
||||
conn.getTransactionInfo();
|
||||
conn.getMetaData();
|
||||
|
||||
@@ -13,7 +13,7 @@ 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.pool.PoolableConnection;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
import com.alibaba.druid.stat.JdbcStatContext;
|
||||
import com.alibaba.druid.stat.JdbcStatManager;
|
||||
@@ -56,14 +56,14 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_basic() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
Assert.assertEquals(null, conn.unwrap(Date.class));
|
||||
Assert.assertEquals(null, conn.unwrap(null));
|
||||
Assert.assertEquals(conn, conn.unwrap(Connection.class));
|
||||
|
||||
Assert.assertEquals(false, conn.isWrapperFor(null));
|
||||
Assert.assertEquals(true, conn.isWrapperFor(PoolableConnection.class));
|
||||
Assert.assertEquals(true, conn.isWrapperFor(DruidPooledConnection.class));
|
||||
Assert.assertEquals(true, conn.isWrapperFor(Connection.class));
|
||||
|
||||
Assert.assertEquals("SELECT 1", conn.nativeSQL("SELECT 1"));
|
||||
@@ -75,7 +75,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_error() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_error2() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_error3() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
|
||||
@@ -130,7 +130,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_error4() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -147,7 +147,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_error5() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -163,7 +163,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_error6() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -180,7 +180,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_error7() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -197,7 +197,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_error8() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -214,7 +214,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
MockPreparedStatement raw = null;
|
||||
{
|
||||
@@ -234,7 +234,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_1() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
MockPreparedStatement raw = null;
|
||||
{
|
||||
@@ -256,7 +256,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_2() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
MockPreparedStatement raw = null;
|
||||
{
|
||||
@@ -274,7 +274,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_3() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
MockPreparedStatement raw = null;
|
||||
{
|
||||
@@ -292,7 +292,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_4() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
MockPreparedStatement raw = null;
|
||||
{
|
||||
@@ -310,7 +310,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_preCall_error() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -328,7 +328,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_preCall_error_1() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -345,7 +345,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_preCall_error_2() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -362,7 +362,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepCall() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
MockPreparedStatement raw = null;
|
||||
{
|
||||
@@ -382,7 +382,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepCall_1() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
MockPreparedStatement raw = null;
|
||||
{
|
||||
@@ -408,7 +408,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_create() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -425,7 +425,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_create_1() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -443,7 +443,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_create_2() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -460,7 +460,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_setAutoCommit() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getAutoCommit();
|
||||
conn.setAutoCommit(true);
|
||||
@@ -479,7 +479,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_commit() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -496,7 +496,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_rollback() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.setAutoCommit(false);
|
||||
Statement stmt = conn.createStatement();
|
||||
@@ -517,7 +517,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_rollback_1() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -534,7 +534,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_releaseSavepoint_1() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
{
|
||||
@@ -551,7 +551,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_addListenerError() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
{
|
||||
@@ -566,7 +566,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_addListenerError2() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
{
|
||||
@@ -581,7 +581,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_removeConnectionEventListener() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
{
|
||||
@@ -596,7 +596,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_removeStatementEventListener() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
{
|
||||
@@ -611,7 +611,7 @@ public class ConnectionTest4 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_checkOpen_error() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.mock.MockDriver;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.PoolableConnection;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
import com.alibaba.druid.stat.JdbcStatContext;
|
||||
import com.alibaba.druid.stat.JdbcStatManager;
|
||||
@@ -54,7 +54,7 @@ public class ConnectionTest5 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_basic() throws Exception {
|
||||
PoolableConnection conn = (PoolableConnection) dataSource.getConnection();
|
||||
DruidPooledConnection conn = (DruidPooledConnection) dataSource.getConnection();
|
||||
conn.close();
|
||||
|
||||
Assert.assertEquals(true, dataSource.isResetStatEnable());
|
||||
@@ -71,7 +71,7 @@ public class ConnectionTest5 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_handleException() throws Exception {
|
||||
PoolableConnection conn = (PoolableConnection) dataSource.getConnection();
|
||||
DruidPooledConnection conn = (DruidPooledConnection) dataSource.getConnection();
|
||||
conn.close();
|
||||
|
||||
SQLException error = new SQLException();
|
||||
@@ -83,7 +83,7 @@ public class ConnectionTest5 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_handleException_2() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
conn.getConnection().close();
|
||||
|
||||
{
|
||||
@@ -100,7 +100,7 @@ public class ConnectionTest5 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_handleException_3() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
conn.getConnection().close();
|
||||
|
||||
{
|
||||
@@ -117,7 +117,7 @@ public class ConnectionTest5 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_handleException_4() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
conn.getConnection().close();
|
||||
|
||||
{
|
||||
@@ -134,7 +134,7 @@ public class ConnectionTest5 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_handleException_5() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
conn.addConnectionEventListener(new ConnectionEventListener() {
|
||||
|
||||
@Override
|
||||
@@ -163,7 +163,7 @@ public class ConnectionTest5 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_setClientInfo() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
conn.close();
|
||||
|
||||
{
|
||||
@@ -179,7 +179,7 @@ public class ConnectionTest5 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_setClientInfo_1() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
conn.close();
|
||||
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.mock.MockDriver;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.PoolableConnection;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.alibaba.druid.pool.vendor.MySqlValidConnectionChecker;
|
||||
import com.alibaba.druid.pool.vendor.NullExceptionSorter;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
@@ -56,7 +56,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_prepareStatement_error() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_1() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -80,7 +80,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_2() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -96,7 +96,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_3() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -112,7 +112,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_4() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -128,7 +128,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_5() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -144,7 +144,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_6() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -160,7 +160,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_7() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -176,7 +176,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_8() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -192,7 +192,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_9() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -208,7 +208,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_getValidConnectionCheckerClassName() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -216,7 +216,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_setConnectionInitSqls() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -228,14 +228,14 @@ public class DataSourceTest3 extends TestCase {
|
||||
dataSource.setLogWriter(null);
|
||||
dataSource.getLogWriter();
|
||||
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
}
|
||||
|
||||
public void test_error_10() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -251,7 +251,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_11() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -303,7 +303,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_12() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -329,7 +329,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_validateConnection() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.close();
|
||||
|
||||
@@ -345,7 +345,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_error_validateConnection_2() throws Exception {
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
conn.getConnection().close();
|
||||
|
||||
@@ -363,7 +363,7 @@ public class DataSourceTest3 extends TestCase {
|
||||
public void test_error_validateConnection_3() throws Exception {
|
||||
dataSource.setValidationQuery(null);
|
||||
dataSource.setValidConnectionChecker(new MySqlValidConnectionChecker());
|
||||
PoolableConnection conn = dataSource.getConnection().unwrap(PoolableConnection.class);
|
||||
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
|
||||
|
||||
dataSource.validateConnection(conn);
|
||||
}
|
||||
|
||||
@@ -17,18 +17,18 @@ import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.mock.MockCallableStatement;
|
||||
import com.alibaba.druid.pool.PoolableCallableStatement;
|
||||
import com.alibaba.druid.pool.PoolablePreparedStatement.PreparedStatementKey;
|
||||
import com.alibaba.druid.pool.DruidPooledCallableStatement;
|
||||
import com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey;
|
||||
import com.alibaba.druid.pool.PreparedStatementHolder;
|
||||
|
||||
public class PoolableCallableStatementTest extends TestCase {
|
||||
|
||||
protected MockCallableStatement raw;
|
||||
protected PoolableCallableStatement stmt;
|
||||
protected DruidPooledCallableStatement stmt;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
raw = new MockCallableStatement(null, null);
|
||||
stmt = new PoolableCallableStatement(null,
|
||||
stmt = new DruidPooledCallableStatement(null,
|
||||
new PreparedStatementHolder(new PreparedStatementKey("", null, null, 0, 0, 0), raw)) {
|
||||
|
||||
protected SQLException checkException(Throwable error) throws SQLException {
|
||||
|
||||
@@ -13,18 +13,18 @@ import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.mock.MockPreparedStatement;
|
||||
import com.alibaba.druid.pool.PoolablePreparedStatement;
|
||||
import com.alibaba.druid.pool.DruidPooledPreparedStatement;
|
||||
import com.alibaba.druid.pool.PreparedStatementHolder;
|
||||
import com.alibaba.druid.pool.PoolablePreparedStatement.PreparedStatementKey;
|
||||
import com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey;
|
||||
|
||||
public class PoolablePreparedStatementTest extends TestCase {
|
||||
|
||||
protected MockPreparedStatement raw;
|
||||
protected PoolablePreparedStatement stmt;
|
||||
protected DruidPooledPreparedStatement stmt;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
raw = new MockPreparedStatement(null, null);
|
||||
stmt = new PoolablePreparedStatement(null,
|
||||
stmt = new DruidPooledPreparedStatement(null,
|
||||
new PreparedStatementHolder(new PreparedStatementKey("", null, null, 0, 0, 0), raw)) {
|
||||
|
||||
protected SQLException checkException(Throwable error) throws SQLException {
|
||||
|
||||
@@ -9,16 +9,16 @@ import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.mock.MockStatement;
|
||||
import com.alibaba.druid.pool.PoolableStatement;
|
||||
import com.alibaba.druid.pool.DruidPooledStatement;
|
||||
|
||||
public class PoolableStatementTest extends TestCase {
|
||||
|
||||
protected Statement raw;
|
||||
protected PoolableStatement stmt;
|
||||
protected DruidPooledStatement stmt;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
raw = new MockStatement(null);
|
||||
stmt = new PoolableStatement(null, raw) {
|
||||
stmt = new DruidPooledStatement(null, raw) {
|
||||
|
||||
protected SQLException checkException(Throwable error) throws SQLException {
|
||||
if (error instanceof SQLException) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.mock.MockDriver;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.PoolableStatement;
|
||||
import com.alibaba.druid.pool.DruidPooledStatement;
|
||||
import com.alibaba.druid.pool.vendor.NullExceptionSorter;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
import com.alibaba.druid.stat.JdbcStatContext;
|
||||
@@ -80,7 +80,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -100,7 +100,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -120,7 +120,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -141,7 +141,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.setEscapeProcessing(true);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -164,7 +164,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
stmt.setMaxFieldSize(23);
|
||||
Assert.assertEquals(23, stmt.getMaxFieldSize());
|
||||
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -197,7 +197,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
stmt.setQueryTimeout(33);
|
||||
Assert.assertEquals(33, stmt.getQueryTimeout());
|
||||
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -230,7 +230,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
stmt.setMaxRows(44);
|
||||
Assert.assertEquals(44, stmt.getMaxRows());
|
||||
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -263,7 +263,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
stmt.setFetchDirection(144);
|
||||
Assert.assertEquals(144, stmt.getFetchDirection());
|
||||
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -296,7 +296,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
stmt.setFetchSize(144);
|
||||
Assert.assertEquals(144, stmt.getFetchSize());
|
||||
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -327,7 +327,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.cancel();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -348,7 +348,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.getWarnings();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -369,7 +369,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.clearWarnings();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -390,7 +390,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.setCursorName("c_name");
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -411,7 +411,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.getResultSet();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -432,7 +432,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.getUpdateCount();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -453,7 +453,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.getMoreResults();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -474,7 +474,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.getResultSetConcurrency();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -495,7 +495,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.getResultSetType();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -516,7 +516,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.addBatch("select 1");
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -537,7 +537,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.clearBatch();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -558,7 +558,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.executeBatch();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -579,7 +579,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.getMoreResults(1);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -600,7 +600,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.getGeneratedKeys();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -621,7 +621,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.getResultSetHoldability();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -642,7 +642,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.execute("SELECT 1", new String[0]);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -663,7 +663,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.execute("SELECT 1", new int[0]);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -684,7 +684,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.execute("SELECT 1", Statement.NO_GENERATED_KEYS);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -705,7 +705,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.executeUpdate("SELECT 1", new String[0]);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -726,7 +726,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.executeUpdate("SELECT 1", new int[0]);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -747,7 +747,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.executeUpdate("SELECT 1", Statement.NO_GENERATED_KEYS);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -768,7 +768,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
PreparedStatement stmt = conn.prepareStatement("SELELCT 1");
|
||||
|
||||
stmt.getMetaData();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -789,7 +789,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
PreparedStatement stmt = conn.prepareStatement("SELELCT 1");
|
||||
|
||||
stmt.getParameterMetaData();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -810,7 +810,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
CallableStatement stmt = conn.prepareCall("SELELCT 1");
|
||||
|
||||
stmt.wasNull();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -831,7 +831,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
PreparedStatement stmt = conn.prepareStatement("SELELCT 1");
|
||||
|
||||
stmt.executeQuery();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -852,7 +852,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
PreparedStatement stmt = conn.prepareStatement("SELELCT 1");
|
||||
|
||||
stmt.executeQuery();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -873,7 +873,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
PreparedStatement stmt = conn.prepareStatement("SELELCT 1");
|
||||
|
||||
stmt.execute();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -894,7 +894,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
PreparedStatement stmt = conn.prepareStatement("SELELCT 1");
|
||||
|
||||
stmt.clearParameters();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -915,7 +915,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
PreparedStatement stmt = conn.prepareStatement("SELELCT 1");
|
||||
|
||||
stmt.addBatch();
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -936,7 +936,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.executeUpdate("SET 1", Statement.RETURN_GENERATED_KEYS);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -957,7 +957,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.executeUpdate("SET 1", new String[0]);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
@@ -978,7 +978,7 @@ public class PoolableStatementTest2 extends TestCase {
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
stmt.executeUpdate("SET 1", new int[0]);
|
||||
((PoolableStatement) stmt).getStatement().close();
|
||||
((DruidPooledStatement) stmt).getStatement().close();
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.sql.SQLException;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.mock.MockResultSet;
|
||||
import com.alibaba.druid.pool.PoolableStatement;
|
||||
import com.alibaba.druid.pool.DruidPooledStatement;
|
||||
|
||||
public class PoolableStatementTest3 extends TestCase {
|
||||
|
||||
@@ -17,7 +17,7 @@ public class PoolableStatementTest3 extends TestCase {
|
||||
}
|
||||
};
|
||||
|
||||
PoolableStatement stmt = new PoolableStatement(null, null) {
|
||||
DruidPooledStatement stmt = new DruidPooledStatement(null, null) {
|
||||
|
||||
public void close() throws SQLException {
|
||||
resultSetTrace.add(rs);
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.alibaba.druid.mock.MockConnection;
|
||||
import com.alibaba.druid.mock.MockPreparedStatement;
|
||||
import com.alibaba.druid.pool.ConnectionHolder;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.PoolablePreparedStatement.PreparedStatementKey;
|
||||
import com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey;
|
||||
import com.alibaba.druid.pool.PreparedStatementHolder;
|
||||
import com.alibaba.druid.pool.PreparedStatementPool;
|
||||
import com.alibaba.druid.pool.PreparedStatementPool.MethodType;
|
||||
|
||||
@@ -15,17 +15,17 @@ import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.mock.MockResultSet;
|
||||
import com.alibaba.druid.pool.PoolableResultSet;
|
||||
import com.alibaba.druid.pool.PoolableStatement;
|
||||
import com.alibaba.druid.pool.DruidPooledResultSet;
|
||||
import com.alibaba.druid.pool.DruidPooledStatement;
|
||||
|
||||
public class ResultSetTest extends TestCase {
|
||||
|
||||
private PoolableStatement stmt;
|
||||
private DruidPooledStatement stmt;
|
||||
private MockResultSet raw;
|
||||
private PoolableResultSet resultSet;
|
||||
private DruidPooledResultSet resultSet;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
stmt = new PoolableStatement(null, null) {
|
||||
stmt = new DruidPooledStatement(null, null) {
|
||||
|
||||
protected SQLException checkException(Throwable error) throws SQLException {
|
||||
if (error instanceof SQLException) {
|
||||
@@ -38,7 +38,7 @@ public class ResultSetTest extends TestCase {
|
||||
|
||||
raw = new MockResultSet(null);
|
||||
raw.getRows().add(new Object[] { null });
|
||||
resultSet = new PoolableResultSet(stmt, raw);
|
||||
resultSet = new DruidPooledResultSet(stmt, raw);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
@@ -8,17 +8,17 @@ import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.mock.MockResultSet;
|
||||
import com.alibaba.druid.pool.PoolableResultSet;
|
||||
import com.alibaba.druid.pool.PoolableStatement;
|
||||
import com.alibaba.druid.pool.DruidPooledResultSet;
|
||||
import com.alibaba.druid.pool.DruidPooledStatement;
|
||||
|
||||
public class ResultSetTest2 extends TestCase {
|
||||
|
||||
private PoolableStatement stmt;
|
||||
private DruidPooledStatement stmt;
|
||||
private MockResultSet raw;
|
||||
private PoolableResultSet resultSet;
|
||||
private DruidPooledResultSet resultSet;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
stmt = new PoolableStatement(null, null) {
|
||||
stmt = new DruidPooledStatement(null, null) {
|
||||
|
||||
protected SQLException checkException(Throwable error) throws SQLException {
|
||||
if (error instanceof SQLException) {
|
||||
@@ -31,7 +31,7 @@ public class ResultSetTest2 extends TestCase {
|
||||
|
||||
raw = new MockResultSet(null);
|
||||
raw.getRows().add(new Object[] { null });
|
||||
resultSet = new PoolableResultSet(stmt, raw);
|
||||
resultSet = new DruidPooledResultSet(stmt, raw);
|
||||
}
|
||||
|
||||
public void test_rowDeleted() throws Exception {
|
||||
@@ -615,7 +615,7 @@ public class ResultSetTest2 extends TestCase {
|
||||
}
|
||||
};
|
||||
|
||||
PoolableResultSet rs = new PoolableResultSet(stmt, mock);
|
||||
DruidPooledResultSet rs = new DruidPooledResultSet(stmt, mock);
|
||||
|
||||
SQLException error = null;
|
||||
try {
|
||||
|
||||
@@ -8,7 +8,7 @@ import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.mock.MockDriver;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.PoolableConnection;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.alibaba.druid.pool.vendor.NullExceptionSorter;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
|
||||
@@ -48,8 +48,8 @@ public class TestCommit extends TestCase {
|
||||
Connection conn = dataSource.getConnection();
|
||||
|
||||
{
|
||||
PoolableConnection wrap = conn.unwrap(PoolableConnection.class);
|
||||
Assert.assertTrue(conn.isWrapperFor(PoolableConnection.class));
|
||||
DruidPooledConnection wrap = conn.unwrap(DruidPooledConnection.class);
|
||||
Assert.assertTrue(conn.isWrapperFor(DruidPooledConnection.class));
|
||||
Assert.assertNotNull(wrap);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.mock.MockDriver;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.PoolableConnection;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.alibaba.druid.pool.vendor.NullExceptionSorter;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
|
||||
@@ -64,8 +64,8 @@ public class TestDataSourceBasic extends TestCase {
|
||||
Connection conn = dataSource.getConnection();
|
||||
|
||||
{
|
||||
PoolableConnection wrap = conn.unwrap(PoolableConnection.class);
|
||||
Assert.assertTrue(conn.isWrapperFor(PoolableConnection.class));
|
||||
DruidPooledConnection wrap = conn.unwrap(DruidPooledConnection.class);
|
||||
Assert.assertTrue(conn.isWrapperFor(DruidPooledConnection.class));
|
||||
Assert.assertNotNull(wrap);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Oracle_Case4 extends TestCase {
|
||||
private String validationQuery = "SELECT 1 FROM DUAL";
|
||||
private int threadCount = 1;
|
||||
private int loopCount = 3;
|
||||
final int LOOP_COUNT = 1000 * 10;
|
||||
final int LOOP_COUNT = 1000 * 1000;
|
||||
private boolean testOnBorrow = false;
|
||||
private boolean preparedStatementCache = true;
|
||||
private int preparedStatementCacheSize = 50;
|
||||
@@ -68,6 +68,7 @@ public class Oracle_Case4 extends TestCase {
|
||||
dataSource.setValidationQuery(validationQuery);
|
||||
dataSource.setTestOnBorrow(testOnBorrow);
|
||||
dataSource.setConnectionProperties(properties);
|
||||
dataSource.setUseOracleImplicitCache(false);
|
||||
|
||||
// printAV_INFO(dataSource);
|
||||
// printTables(dataSource);
|
||||
@@ -154,7 +155,7 @@ public class Oracle_Case4 extends TestCase {
|
||||
|
||||
int mod = i % 500;
|
||||
|
||||
String sql = SQL;// + " AND ROWNUM <= " + (mod + 1);
|
||||
String sql = SQL; // + " AND ROWNUM <= " + (mod + 1);
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
stmt.setInt(1, 61);
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
|
||||
Reference in New Issue
Block a user