use of com.alibaba.druid.pool.vendor.MySqlExceptionSorter in project druid by alibaba.
the class DiscardTest method setUp.
protected void setUp() throws Exception {
driver = new MockDriver() {
public ResultSet executeQuery(MockStatementBase stmt, String sql) throws SQLException {
if (failed) {
throw new SQLException("", "", 1040);
}
return super.executeQuery(stmt, sql);
}
public Connection connect(String url, Properties info) throws SQLException {
while (failed) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
throw new SQLException(e.getMessage(), e);
}
}
return super.connect(url, info);
}
};
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setDriver(driver);
dataSource.setDbType("mysql");
dataSource.setMinIdle(1);
dataSource.setMaxActive(1);
dataSource.setFilters("log4j");
dataSource.setExceptionSorter(new MySqlExceptionSorter());
}
use of com.alibaba.druid.pool.vendor.MySqlExceptionSorter in project druid by alibaba.
the class MySqlExceptionSorterTest_oceanbase method test_true_1.
public void test_true_1() throws Exception {
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
Assert.assertFalse(sorter.isExceptionFatal(new SQLException("", "", -10000)));
}
use of com.alibaba.druid.pool.vendor.MySqlExceptionSorter in project druid by alibaba.
the class MySqlExceptionSorterTest method test_false_1.
public void test_false_1() throws Exception {
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("", "", -8000)));
Assert.assertFalse(sorter.isExceptionFatal(new SQLException("", "", -9100)));
}
use of com.alibaba.druid.pool.vendor.MySqlExceptionSorter in project druid by alibaba.
the class MySqlExceptionSorterTest method test_false_2.
public void test_false_2() throws Exception {
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
Assert.assertFalse(sorter.isExceptionFatal(new SQLException("", null, 0)));
}
use of com.alibaba.druid.pool.vendor.MySqlExceptionSorter in project druid by alibaba.
the class MySqlExceptionSorterTest method test_true_1.
public void test_true_1() throws Exception {
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("", "", 1042)));
}
Aggregations