testcase refactor.

This commit is contained in:
wenshao
2017-11-20 15:00:26 +08:00
parent d3e429757a
commit 7f3f4a6dd6
61 changed files with 280 additions and 122 deletions
@@ -0,0 +1,26 @@
package com.alibaba.druid;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
import junit.framework.TestCase;
import org.junit.Assert;
import javax.management.openmbean.CompositeData;
public class PoolTestCase extends TestCase {
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
}
protected void tearDown() throws Exception {
int size = DruidDataSourceStatManager.getInstance().getDataSourceList().size();
String errorInfo = null;
if (size > 0) {
CompositeData compositeData = (CompositeData) DruidDataSourceStatManager.getInstance().getDataSourceList().values().iterator().next();
String name = (String) compositeData.get("Name");
String url = (String) compositeData.get("URL");
errorInfo = "Name " + name + ", URL " + url;
}
Assert.assertEquals(errorInfo, 0, size);
}
}
@@ -1,12 +1,15 @@
package com.alibaba.druid.bvt.pool;
import com.alibaba.druid.PoolTestCase;
import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
public class AsyncInitTest extends TestCase {
public class AsyncInitTest extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setAsyncInit(true);
dataSource.setUrl("jdbc:mock:xxx");
@@ -16,6 +19,8 @@ public class AsyncInitTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_async_init() throws Exception {
@@ -18,6 +18,8 @@ package com.alibaba.druid.bvt.pool;
import java.sql.Connection;
import java.sql.PreparedStatement;
import com.alibaba.druid.PoolTestCase;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -27,11 +29,13 @@ import com.alibaba.druid.mock.MockConnectionClosedException;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class Bug_for_dupCloseStmtError extends TestCase {
public class Bug_for_dupCloseStmtError extends PoolTestCase {
protected DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:");
dataSource.setPoolPreparedStatements(false);
@@ -41,8 +45,10 @@ public class Bug_for_dupCloseStmtError extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
for (DruidDataSource dataSource : DruidDataSourceStatManager.getDruidDataSourceInstances()) {
dataSource.close();
JdbcUtils.close(dataSource);
}
super.tearDown();
}
public void test_2() throws Exception {
@@ -20,6 +20,7 @@ import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -29,11 +30,13 @@ import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.mock.MockResultSet;
import com.alibaba.druid.pool.DruidDataSource;
public class CallableStatmentTest extends TestCase {
public class CallableStatmentTest extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
@@ -51,6 +54,8 @@ public class CallableStatmentTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_connect() throws Exception {
@@ -20,6 +20,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -27,15 +28,7 @@ import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class Case0 extends TestCase {
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
}
protected void tearDown() throws Exception {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
}
public class Case0 extends PoolTestCase {
public void test_0() throws Exception {
@@ -19,6 +19,7 @@ import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -27,15 +28,7 @@ import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class Case1 extends TestCase {
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
}
protected void tearDown() throws Exception {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
}
public class Case1 extends PoolTestCase {
public void test_f() throws Exception {
final DruidDataSource dataSource = new DruidDataSource();
@@ -18,6 +18,7 @@ package com.alibaba.druid.bvt.pool;
import java.sql.Connection;
import java.util.Properties;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -31,15 +32,7 @@ import com.alibaba.druid.util.JMXUtils;
*
* @author admin 2011-5-4 下午02:45:21
*/
public class Case2 extends TestCase {
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
}
protected void tearDown() throws Exception {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
}
public class Case2 extends PoolTestCase {
public void test_singleThread() throws Exception {
@@ -21,13 +21,14 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class Case3 extends TestCase {
public class Case3 extends PoolTestCase {
// public void test_0() throws Exception {
// DruidDataSource dataSource = new DruidDataSource();
@@ -55,13 +56,6 @@ public class Case3 extends TestCase {
//
// dataSource.close();
// }
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
}
protected void tearDown() throws Exception {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
}
public void test_2() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
@@ -17,13 +17,14 @@ package com.alibaba.druid.bvt.pool;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DataSourceClosedException;
import com.alibaba.druid.pool.DruidDataSource;
public class ClosedTest extends TestCase {
public class ClosedTest extends PoolTestCase {
public void test_close() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
@@ -18,17 +18,20 @@ package com.alibaba.druid.bvt.pool;
import java.lang.reflect.Field;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.logging.Log;
public class ConfigErrorTest extends TestCase {
public class ConfigErrorTest extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(true);
@@ -36,6 +39,8 @@ public class ConfigErrorTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_connect() throws Exception {
@@ -18,17 +18,20 @@ package com.alibaba.druid.bvt.pool;
import java.lang.reflect.Field;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.logging.Log;
public class ConfigErrorTest2 extends TestCase {
public class ConfigErrorTest2 extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:wrap-jdbc:jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
@@ -38,6 +41,8 @@ public class ConfigErrorTest2 extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_connect() throws Exception {
@@ -17,6 +17,7 @@ package com.alibaba.druid.bvt.pool;
import java.lang.reflect.Field;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -24,11 +25,13 @@ import org.junit.Assert;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.logging.Log;
public class ConfigErrorTest3 extends TestCase {
public class ConfigErrorTest3 extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mysql:xxx");
dataSource.setTestOnBorrow(false);
@@ -40,6 +43,8 @@ public class ConfigErrorTest3 extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_connect() throws Exception {
@@ -17,17 +17,19 @@ package com.alibaba.druid.bvt.pool;
import java.lang.reflect.Field;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.logging.Log;
public class ConfigErrorTestMysql extends TestCase {
public class ConfigErrorTestMysql extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mysql:xxx");
dataSource.setTestOnBorrow(false);
@@ -36,6 +38,7 @@ public class ConfigErrorTestMysql extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_success() throws Exception {
@@ -4,18 +4,21 @@ import java.sql.Connection;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.pool.DruidDataSource;
public class CreateSchedulerTest extends TestCase {
public class CreateSchedulerTest extends PoolTestCase {
private DruidDataSource dataSource;
private ScheduledExecutorService createScheduler;
protected void setUp() throws Exception {
super.setUp();
createScheduler = Executors.newScheduledThreadPool(1);
dataSource = new DruidDataSource();
@@ -28,6 +31,8 @@ public class CreateSchedulerTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
createScheduler.shutdown();
super.tearDown();
}
public void test_connectAndClose() throws Exception {
@@ -1,11 +1,12 @@
package com.alibaba.druid.bvt.pool;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DataSourceDisableException;
public class DataSourceDisableExceptionTest extends TestCase {
public class DataSourceDisableExceptionTest extends PoolTestCase {
public void test_0() throws Exception {
DataSourceDisableException ex = new DataSourceDisableException();
Assert.assertEquals(null, ex.getMessage());
@@ -4,18 +4,21 @@ import java.sql.Connection;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.pool.DruidDataSource;
public class DestorySchedulerTest extends TestCase {
public class DestorySchedulerTest extends PoolTestCase {
private DruidDataSource dataSource;
private ScheduledExecutorService destroyScheduler;
protected void setUp() throws Exception {
super.setUp();
destroyScheduler = Executors.newScheduledThreadPool(1);
dataSource = new DruidDataSource();
@@ -28,6 +31,8 @@ public class DestorySchedulerTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
destroyScheduler.shutdown();
super.tearDown();
}
public void test_connectAndClose() throws Exception {
@@ -1,5 +1,6 @@
package com.alibaba.druid.bvt.pool;
import com.alibaba.druid.PoolTestCase;
import com.alibaba.druid.filter.FilterAdapter;
import com.alibaba.druid.filter.FilterChain;
import com.alibaba.druid.pool.DruidDataSource;
@@ -9,7 +10,7 @@ import junit.framework.TestCase;
import java.sql.SQLException;
public class DruidConnectionHolderTest extends TestCase {
public class DruidConnectionHolderTest extends PoolTestCase {
Driver driver;
private DruidDataSource dataSource;
@@ -17,6 +18,8 @@ public class DruidConnectionHolderTest extends TestCase {
private Class exceptionClass;
protected void setUp() throws Exception {
super.setUp();
driver = new Driver();
if (driver.getMajorVersion() == 5) {
@@ -48,6 +51,8 @@ public class DruidConnectionHolderTest extends TestCase {
if (dataSource != null) {
dataSource.close();
}
super.tearDown();
}
public void test_mysqlSyntaxError() throws Exception {
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool;
import java.sql.SQLException;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -11,11 +12,13 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.GetConnectionTimeoutException;
import com.alibaba.druid.proxy.jdbc.ConnectionProxy;
public class DruidConnectionHolderTest2 extends TestCase {
public class DruidConnectionHolderTest2 extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
@@ -32,6 +35,8 @@ public class DruidConnectionHolderTest2 extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_mysqlSyntaxError() throws Exception {
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool;
import java.sql.SQLException;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -11,11 +12,13 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.GetConnectionTimeoutException;
import com.alibaba.druid.proxy.jdbc.ConnectionProxy;
public class DruidConnectionHolderTest3 extends TestCase {
public class DruidConnectionHolderTest3 extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
@@ -32,6 +35,8 @@ public class DruidConnectionHolderTest3 extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_mysqlSyntaxError() throws Exception {
@@ -3,6 +3,7 @@ package com.alibaba.druid.bvt.pool;
import java.lang.reflect.Field;
import java.sql.PreparedStatement;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -11,11 +12,13 @@ import com.alibaba.druid.pool.DruidConnectionHolder;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
public class DruidConnectionHolderTest4 extends TestCase {
public class DruidConnectionHolderTest4 extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
@@ -25,6 +28,8 @@ public class DruidConnectionHolderTest4 extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_toString() throws Exception {
@@ -19,6 +19,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -27,10 +28,12 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
public class TestClone extends TestCase {
public class TestClone extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUsername("xxx1");
@@ -107,5 +110,6 @@ public class TestClone extends TestCase {
protected void tearDown() throws Exception {
JdbcUtils.close(dataSource);
super.tearDown();
}
}
@@ -19,21 +19,14 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class TestClose_0 extends TestCase {
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
}
protected void tearDown() throws Exception {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
}
public class TestClose_0 extends PoolTestCase {
public void test_close() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
@@ -19,6 +19,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -26,15 +27,7 @@ import com.alibaba.druid.mock.MockStatement;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class TestClose_1 extends TestCase {
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
}
protected void tearDown() throws Exception {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
}
public class TestClose_1 extends PoolTestCase {
public void test_close() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
@@ -19,6 +19,7 @@ import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -26,16 +27,7 @@ import com.alibaba.druid.mock.MockStatement;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class TestClose_2 extends TestCase {
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
}
protected void tearDown() throws Exception {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
}
public class TestClose_2 extends PoolTestCase {
public void test_close() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setPoolPreparedStatements(true);
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -12,11 +13,12 @@ import com.alibaba.druid.filter.stat.MergeStatFilter;
import com.alibaba.druid.filter.stat.StatFilter;
import com.alibaba.druid.pool.DruidDataSource;
public class UnwrapTest_filter extends TestCase {
public class UnwrapTest_filter extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
@@ -31,6 +33,8 @@ public class UnwrapTest_filter extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_unwrap() throws Exception {
@@ -3,6 +3,7 @@ package com.alibaba.druid.bvt.pool;
import java.lang.reflect.Field;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -11,11 +12,13 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.logging.Log;
import com.alibaba.druid.util.JdbcConstants;
public class ValidationQueryLogDB2Test extends TestCase {
public class ValidationQueryLogDB2Test extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setDbType(JdbcConstants.DB2);
@@ -29,6 +32,8 @@ public class ValidationQueryLogDB2Test extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_oracle() throws Exception {
@@ -3,6 +3,7 @@ package com.alibaba.druid.bvt.pool;
import java.lang.reflect.Field;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -11,11 +12,13 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.logging.Log;
import com.alibaba.druid.util.JdbcConstants;
public class ValidationQueryLogTest extends TestCase {
public class ValidationQueryLogTest extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setDbType(JdbcConstants.ORACLE);
@@ -29,6 +32,8 @@ public class ValidationQueryLogTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_oracle() throws Exception {
@@ -17,6 +17,7 @@ package com.alibaba.druid.bvt.pool.adapter;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -24,12 +25,14 @@ import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSourceC3P0Adapter;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class DruidDataSourceC3P0AdapterTest extends TestCase {
public class DruidDataSourceC3P0AdapterTest extends PoolTestCase {
private MockDriver driver;
private DruidDataSourceC3P0Adapter dataSource;
protected void setUp() throws Exception {
super.setUp();
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
driver = new MockDriver();
@@ -49,7 +52,8 @@ public class DruidDataSourceC3P0AdapterTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
super.tearDown();
}
public void test_basic() throws Exception {
@@ -17,6 +17,7 @@ package com.alibaba.druid.bvt.pool.adapter;
import javax.sql.DataSource;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -24,7 +25,7 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceC3P0Adapter;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class DruidDataSourceC3P0AdapterTest2 extends TestCase {
public class DruidDataSourceC3P0AdapterTest2 extends PoolTestCase {
public void test_0() throws Exception {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
@@ -86,5 +87,7 @@ public class DruidDataSourceC3P0AdapterTest2 extends TestCase {
for (DruidDataSource dataSource : DruidDataSourceStatManager.getDruidDataSourceInstances()) {
dataSource.close();
}
super.tearDown();
}
}
@@ -20,6 +20,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -27,13 +28,13 @@ import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class ConnectionTest extends TestCase {
public class ConnectionTest extends PoolTestCase {
private MockDriver driver;
private DruidDataSource dataSource;
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
super.setUp();
driver = new MockDriver();
@@ -54,7 +55,7 @@ public class ConnectionTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
super.tearDown();
}
public void test_prepare() throws Exception {
@@ -20,6 +20,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -27,7 +28,7 @@ import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class ConnectionTest2 extends TestCase {
public class ConnectionTest2 extends PoolTestCase {
private MockDriver driver;
private DruidDataSource dataSource;
@@ -58,6 +59,8 @@ public class ConnectionTest2 extends TestCase {
Assert.assertEquals(0, dataSource.getCreateCount());
dataSource.close();
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
super.tearDown();
}
public void test_prepare() throws Exception {
@@ -20,6 +20,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -30,7 +31,7 @@ import com.alibaba.druid.stat.DruidDataSourceStatManager;
import com.alibaba.druid.stat.JdbcStatContext;
import com.alibaba.druid.stat.JdbcStatManager;
public class ConnectionTest3 extends TestCase {
public class ConnectionTest3 extends PoolTestCase {
private MockDriver driver;
private DruidDataSource dataSource;
@@ -64,6 +65,8 @@ public class ConnectionTest3 extends TestCase {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
JdbcStatManager.getInstance().setStatContext(null);
super.tearDown();
}
public void test_basic() throws Exception {
@@ -22,6 +22,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -35,7 +36,7 @@ import com.alibaba.druid.stat.DruidDataSourceStatManager;
import com.alibaba.druid.stat.JdbcStatContext;
import com.alibaba.druid.stat.JdbcStatManager;
public class ConnectionTest4 extends TestCase {
public class ConnectionTest4 extends PoolTestCase {
private MockDriver driver;
private DruidDataSource dataSource;
@@ -70,6 +71,7 @@ public class ConnectionTest4 extends TestCase {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
JdbcStatManager.getInstance().setStatContext(null);
super.tearDown();
}
public void test_basic() throws Exception {
@@ -21,6 +21,7 @@ import java.util.Properties;
import javax.sql.ConnectionEvent;
import javax.sql.ConnectionEventListener;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -31,7 +32,7 @@ import com.alibaba.druid.stat.DruidDataSourceStatManager;
import com.alibaba.druid.stat.JdbcStatContext;
import com.alibaba.druid.stat.JdbcStatManager;
public class ConnectionTest5 extends TestCase {
public class ConnectionTest5 extends PoolTestCase {
private MockDriver driver;
private DruidDataSource dataSource;
@@ -66,6 +67,8 @@ public class ConnectionTest5 extends TestCase {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
JdbcStatManager.getInstance().setStatContext(null);
super.tearDown();
}
public void test_basic() throws Exception {
@@ -21,6 +21,7 @@ import java.util.Properties;
import javax.security.auth.callback.PasswordCallback;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -34,7 +35,7 @@ import com.alibaba.druid.stat.DruidDataSourceStatManager;
import com.alibaba.druid.stat.JdbcStatContext;
import com.alibaba.druid.stat.JdbcStatManager;
public class DataSourceTest3 extends TestCase {
public class DataSourceTest3 extends PoolTestCase {
private MockDriver driver;
private DruidDataSource dataSource;
@@ -68,6 +69,8 @@ public class DataSourceTest3 extends TestCase {
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
JdbcStatManager.getInstance().setStatContext(null);
super.tearDown();
}
public void test_prepareStatement_error() throws Exception {
@@ -21,6 +21,7 @@ import java.sql.Statement;
import javax.sql.DataSource;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -30,13 +31,13 @@ import com.alibaba.druid.pool.DruidPooledConnection;
import com.alibaba.druid.pool.vendor.NullExceptionSorter;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class TestDataSourceBasic extends TestCase {
public class TestDataSourceBasic extends PoolTestCase {
private MockDriver driver;
private DruidDataSource dataSource;
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
super.setUp();
driver = new MockDriver();
@@ -67,6 +68,8 @@ public class TestDataSourceBasic extends TestCase {
}
dataSource.close();
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
super.tearDown();
}
public void test_toCompositeData() throws Exception {
@@ -18,6 +18,7 @@ package com.alibaba.druid.bvt.pool.basic;
import java.util.Arrays;
import java.util.Properties;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -26,7 +27,7 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.ExceptionSorter;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
public class TestDataSourceBasic2 extends TestCase {
public class TestDataSourceBasic2 extends PoolTestCase {
public void test_0() throws Exception {
DruidDataSourceStatManager.clear();
@@ -126,6 +127,8 @@ public class TestDataSourceBasic2 extends TestCase {
for (DruidDataSource dataSource : DruidDataSourceStatManager.getDruidDataSourceInstances()) {
dataSource.close();
}
super.tearDown();
}
}
@@ -18,6 +18,7 @@ package com.alibaba.druid.bvt.pool.dynamic;
import java.lang.reflect.Field;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -26,13 +27,15 @@ import com.alibaba.druid.filter.stat.StatFilter;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.logging.Log;
public class ConnectPropertiesChangeTest extends TestCase {
public class ConnectPropertiesChangeTest extends PoolTestCase {
private DruidDataSource dataSource;
private Log dataSourceLog;
protected void setUp() throws Exception {
super.setUp();
Field logField = DruidDataSource.class.getDeclaredField("LOG");
logField.setAccessible(true);
dataSourceLog = (Log) logField.get(null);
@@ -51,6 +54,8 @@ public class ConnectPropertiesChangeTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_connectPropertiesChange() throws Exception {
@@ -18,6 +18,7 @@ package com.alibaba.druid.bvt.pool.dynamic;
import java.lang.reflect.Field;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -26,13 +27,15 @@ import com.alibaba.druid.filter.stat.StatFilter;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.logging.Log;
public class ConnectPropertiesChangeTest1 extends TestCase {
public class ConnectPropertiesChangeTest1 extends PoolTestCase {
private DruidDataSource dataSource;
private Log dataSourceLog;
protected void setUp() throws Exception {
super.setUp();
Field logField = DruidDataSource.class.getDeclaredField("LOG");
logField.setAccessible(true);
dataSourceLog = (Log) logField.get(null);
@@ -50,6 +53,8 @@ public class ConnectPropertiesChangeTest1 extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_connectPropertiesChange() throws Exception {
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool.dynamic;
import java.lang.reflect.Field;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -11,13 +12,15 @@ import com.alibaba.druid.pool.DruidDataSourceStatLogger;
import com.alibaba.druid.pool.DruidDataSourceStatLoggerImpl;
import com.alibaba.druid.support.logging.Log;
public class DruidDataSourceStatLoggerImplTest extends TestCase {
public class DruidDataSourceStatLoggerImplTest extends PoolTestCase {
private DruidDataSource dataSource;
private Log statLog;
protected void setUp() throws Exception {
super.setUp();
Field logField = DruidDataSourceStatLoggerImpl.class.getDeclaredField("LOG");
logField.setAccessible(true);
statLog = (Log) logField.get(null);
@@ -35,6 +38,8 @@ public class DruidDataSourceStatLoggerImplTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_connectPropertiesChange() throws Exception {
@@ -17,6 +17,7 @@ package com.alibaba.druid.bvt.pool.dynamic;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -24,11 +25,13 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.GetConnectionTimeoutException;
import com.alibaba.druid.util.JdbcUtils;
public class MaxActiveChangeTest extends TestCase {
public class MaxActiveChangeTest extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
@@ -41,6 +44,8 @@ public class MaxActiveChangeTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_maxActive() throws Exception {
@@ -20,19 +20,22 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.logging.Log;
public class PoolPreparedStatementsChangeTest extends TestCase {
public class PoolPreparedStatementsChangeTest extends PoolTestCase {
private DruidDataSource dataSource;
private Log dataSourceLog;
protected void setUp() throws Exception {
super.setUp();
Field logField = DruidDataSource.class.getDeclaredField("LOG");
logField.setAccessible(true);
dataSourceLog = (Log) logField.get(null);
@@ -49,6 +52,8 @@ public class PoolPreparedStatementsChangeTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_connectPropertiesChange() throws Exception {
@@ -4,6 +4,7 @@ import java.lang.reflect.Field;
import java.sql.Connection;
import java.sql.PreparedStatement;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -12,13 +13,15 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceStatValue;
import com.alibaba.druid.support.logging.Log;
public class SqlSkipCountTest extends TestCase {
public class SqlSkipCountTest extends PoolTestCase {
private DruidDataSource dataSource;
private Log dataSourceLog;
protected void setUp() throws Exception {
super.setUp();
Field logField = DruidDataSource.class.getDeclaredField("LOG");
logField.setAccessible(true);
dataSourceLog = (Log) logField.get(null);
@@ -36,6 +39,8 @@ public class SqlSkipCountTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void test_connectPropertiesChange() throws Exception {
@@ -4,6 +4,7 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -17,11 +18,13 @@ import com.alibaba.druid.stat.JdbcStatManager;
import com.alibaba.druid.test.util.OracleMockDriver;
import com.alibaba.druid.util.JdbcUtils;
public class OracleExceptionSorterTest_stmt_setQueryTimeout extends TestCase {
public class OracleExceptionSorterTest_stmt_setQueryTimeout extends PoolTestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
Assert.assertEquals(0, JdbcStatManager.getInstance().getSqlList().size());
dataSource = new DruidDataSource();
@@ -37,7 +40,8 @@ public class OracleExceptionSorterTest_stmt_setQueryTimeout extends TestCase {
@Override
protected void tearDown() throws Exception {
JdbcUtils.close(dataSource);
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
super.tearDown();
}
public void test_connect() throws Exception {
@@ -2,20 +2,25 @@ package com.alibaba.druid.bvt.pool.exception;
import java.sql.SQLException;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.pool.vendor.OracleExceptionSorter;
public class OracleExceptionSorter_userDefined extends TestCase {
public class OracleExceptionSorter_userDefined extends PoolTestCase {
protected void setUp() throws Exception {
super.setUp();
System.setProperty("druid.oracle.fatalErrorCodes", "1,2,3,a,");
}
protected void tearDown() throws Exception {
System.clearProperty("druid.oracle.fatalErrorCodes");
super.tearDown();
}
public void test_userDefinedErrorCodes() throws Exception {
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool.exception;
import java.sql.SQLException;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -12,7 +13,7 @@ import com.alibaba.druid.stat.JdbcStatManager;
import com.alibaba.druid.test.util.OracleMockDriver;
import com.alibaba.druid.util.JdbcUtils;
public class OracleExceptionSorter_userDefined_1 extends TestCase {
public class OracleExceptionSorter_userDefined_1 extends PoolTestCase {
private DruidDataSource dataSource;
@@ -32,6 +33,8 @@ public class OracleExceptionSorter_userDefined_1 extends TestCase {
@Override
protected void tearDown() throws Exception {
JdbcUtils.close(dataSource);
super.tearDown();
}
public void test_userDefinedErrorCodes() throws Exception {
@@ -6,6 +6,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import com.alibaba.druid.pool.DataSourceNotAvailableException;
@@ -13,7 +14,7 @@ import com.alibaba.druid.pool.DruidDataSource;
import junit.framework.TestCase;
public class FailFastTest extends TestCase {
public class FailFastTest extends PoolTestCase {
private DruidDataSource dataSource;
@@ -21,6 +22,8 @@ public class FailFastTest extends TestCase {
@SuppressWarnings("serial")
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource() {
public PhysicalConnectionInfo createPhysicalConnection() throws SQLException {
try {
@@ -45,6 +48,8 @@ public class FailFastTest extends TestCase {
protected void tearDown() throws Exception {
dataSource.close();
super.tearDown();
}
public void testDefault() throws Exception {
@@ -1,5 +1,6 @@
package com.alibaba.druid.bvt.pool.property;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -8,7 +9,7 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
public class PropertyTest_filters extends TestCase {
public class PropertyTest_filters extends PoolTestCase {
private DruidDataSource dataSource;
public void test_stat() {
@@ -29,5 +30,7 @@ public class PropertyTest_filters extends TestCase {
protected void tearDown() throws Exception {
System.clearProperty("druid.filters");
JdbcUtils.close(dataSource);
super.tearDown();
}
}
@@ -1,5 +1,6 @@
package com.alibaba.druid.bvt.pool.property;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -8,7 +9,7 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
public class PropertyTest_validationQuery extends TestCase {
public class PropertyTest_validationQuery extends PoolTestCase {
private DruidDataSource dataSource;
public void test_validationQuery() {
@@ -20,5 +21,7 @@ public class PropertyTest_validationQuery extends TestCase {
protected void tearDown() throws Exception {
System.clearProperty("druid.validationQuery");
JdbcUtils.close(dataSource);
super.tearDown();
}
}
@@ -2,13 +2,14 @@ package com.alibaba.druid.bvt.pool.vendor;
import java.sql.SQLException;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.pool.vendor.InformixExceptionSorter;
public class InformixExceptionSorterTest extends TestCase {
public class InformixExceptionSorterTest extends PoolTestCase {
public void test_informix() throws Exception {
InformixExceptionSorter sorter = new InformixExceptionSorter();
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool.vendor;
import java.sql.SQLException;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -9,7 +10,7 @@ import org.junit.Assert;
import com.alibaba.druid.mock.MockConnection;
import com.alibaba.druid.pool.vendor.MSSQLValidConnectionChecker;
public class MSSQLValidConnectionCheckerTest extends TestCase {
public class MSSQLValidConnectionCheckerTest extends PoolTestCase {
public void test_0() throws Exception {
MSSQLValidConnectionChecker checker = new MSSQLValidConnectionChecker();
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool.vendor;
import java.sql.Connection;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -9,7 +10,7 @@ import org.junit.Assert;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.vendor.MySqlValidConnectionChecker;
public class MySQLValidConnectionCheckerTest extends TestCase {
public class MySQLValidConnectionCheckerTest extends PoolTestCase {
private DruidDataSource dataSource;
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool.vendor;
import java.sql.SQLException;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -9,7 +10,7 @@ import org.junit.Assert;
import com.alibaba.druid.pool.vendor.MySqlExceptionSorter;
public class MySqlExceptionSorterTest extends TestCase {
public class MySqlExceptionSorterTest extends PoolTestCase {
public void test_true() throws Exception {
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("", "", 1040)));
@@ -1,5 +1,6 @@
package com.alibaba.druid.bvt.pool.vendor;
import com.alibaba.druid.PoolTestCase;
import com.alibaba.druid.pool.vendor.MySqlExceptionSorter;
import com.mysql.jdbc.CommunicationsException;
import junit.framework.TestCase;
@@ -9,7 +10,7 @@ import java.sql.SQLException;
/**
* Created by wenshao on 18/07/2017.
*/
public class MySqlExceptionSorterTest_1 extends TestCase {
public class MySqlExceptionSorterTest_1 extends PoolTestCase {
public void test_0() throws Exception {
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
@@ -1,5 +1,6 @@
package com.alibaba.druid.bvt.pool.vendor;
import com.alibaba.druid.PoolTestCase;
import com.alibaba.druid.pool.vendor.MySqlExceptionSorter;
import com.mysql.jdbc.CommunicationsException;
import junit.framework.TestCase;
@@ -10,7 +11,7 @@ import java.sql.SQLException;
/**
* Created by wenshao on 18/07/2017.
*/
public class MySqlExceptionSorterTest_2 extends TestCase {
public class MySqlExceptionSorterTest_2 extends PoolTestCase {
public void test_0() throws Exception {
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool.vendor;
import java.sql.SQLException;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -9,7 +10,7 @@ import org.junit.Assert;
import com.alibaba.druid.pool.vendor.MySqlExceptionSorter;
public class MySqlExceptionSorterTest_oceanbase extends TestCase {
public class MySqlExceptionSorterTest_oceanbase extends PoolTestCase {
public void test_true() throws Exception {
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
SQLException exception = new SQLException("", "", -9000);
@@ -1,5 +1,6 @@
package com.alibaba.druid.bvt.pool.vendor;
import com.alibaba.druid.PoolTestCase;
import org.junit.Assert;
import org.postgresql.util.GT;
import org.postgresql.util.PSQLException;
@@ -9,7 +10,7 @@ import junit.framework.TestCase;
import com.alibaba.druid.pool.vendor.PGExceptionSorter;
public class PGExceptionSorterTest extends TestCase {
public class PGExceptionSorterTest extends PoolTestCase {
public void test_pg() throws Exception {
PGExceptionSorter exSorter = new PGExceptionSorter();
@@ -2,13 +2,14 @@ package com.alibaba.druid.bvt.pool.vendor;
import java.sql.SQLException;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.pool.vendor.SybaseExceptionSorter;
public class SybaseExceptionSorterTest extends TestCase {
public class SybaseExceptionSorterTest extends PoolTestCase {
public void test_false() throws Exception {
SybaseExceptionSorter sorter = new SybaseExceptionSorter();
@@ -1,5 +1,6 @@
package com.alibaba.druid.bvt.pool.vendor;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import org.junit.Assert;
@@ -7,7 +8,7 @@ import org.junit.Assert;
import com.alibaba.druid.pool.ValidConnectionCheckerAdapter;
public class ValidConnectionCheckerAdapterTest extends TestCase {
public class ValidConnectionCheckerAdapterTest extends PoolTestCase {
public void test_adapter() throws Exception {
ValidConnectionCheckerAdapter adapter = new ValidConnectionCheckerAdapter();
adapter.configFromProperties(System.getProperties());
@@ -17,16 +17,19 @@ package com.alibaba.druid.bvt.pool.xa;
import javax.sql.XAConnection;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import com.alibaba.druid.pool.xa.DruidXADataSource;
import com.alibaba.druid.util.JdbcUtils;
public class H2XATest extends TestCase {
public class H2XATest extends PoolTestCase {
private DruidXADataSource dataSource;
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidXADataSource();
dataSource.setMinIdle(1);
dataSource.setUrl("jdbc:h2:mem:test;");
@@ -39,6 +42,8 @@ public class H2XATest extends TestCase {
protected void tearDown() throws Exception {
JdbcUtils.execute(dataSource, "DROP TABLE user");
JdbcUtils.close(dataSource);
super.tearDown();
}
public void test_0() throws Exception {
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool.xa;
import java.lang.reflect.Constructor;
import com.alibaba.druid.PoolTestCase;
import junit.framework.TestCase;
import net.sourceforge.jtds.jdbc.JtdsConnection;
@@ -10,7 +11,7 @@ import org.junit.Assert;
import com.alibaba.druid.pool.xa.JtdsXAConnection;
import com.alibaba.druid.pool.xa.JtdsXAResource;
public class JtdsXAConnectionTest extends TestCase {
public class JtdsXAConnectionTest extends PoolTestCase {
public void test_jtds() throws Exception {
Constructor<JtdsConnection> constrcutor = JtdsConnection.class.getDeclaredConstructor();