mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved mysql exception sorter.
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
package com.alibaba.druid.bvt.pool.vendor;
|
||||
|
||||
import com.alibaba.druid.pool.vendor.MySqlExceptionSorter;
|
||||
import com.mysql.jdbc.CommunicationsException;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Created by wenshao on 18/07/2017.
|
||||
*/
|
||||
public class MySqlExceptionSorterTest_1 extends TestCase {
|
||||
public void test_0() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
|
||||
SQLException rootException = new SQLException(
|
||||
new SQLException("Could not retrieve transation read-only status server",
|
||||
new CommunicationsException(null, 0, 0, null)
|
||||
)
|
||||
);
|
||||
|
||||
assertTrue(sorter.isExceptionFatal(rootException));
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.alibaba.druid.bvt.pool.vendor;
|
||||
|
||||
import com.alibaba.druid.pool.vendor.MySqlExceptionSorter;
|
||||
import com.mysql.jdbc.CommunicationsException;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Created by wenshao on 18/07/2017.
|
||||
*/
|
||||
public class MySqlExceptionSorterTest_2 extends TestCase {
|
||||
public void test_0() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
|
||||
SQLException rootException = new SQLException(
|
||||
new SQLException("Could not retrieve transation read-only status server",
|
||||
new SocketTimeoutException()
|
||||
)
|
||||
);
|
||||
|
||||
assertTrue(sorter.isExceptionFatal(rootException));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user