mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve oracle exception sorter error code
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
package com.alibaba.druid.bvt.pool.exception;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.pool.vendor.OracleExceptionSorter;
|
||||
|
||||
public class OracleExceptionSorter_userDefined extends TestCase {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
System.setProperty("druid.oracle.fatalErrorCodes", "1,2,3,a,");
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
System.clearProperty("druid.oracle.fatalErrorCodes");
|
||||
}
|
||||
|
||||
public void test_userDefinedErrorCodes() throws Exception {
|
||||
OracleExceptionSorter sorter = new OracleExceptionSorter();
|
||||
Assert.assertEquals(3, sorter.getFatalErrorCodes().size());
|
||||
Assert.assertTrue(sorter.getFatalErrorCodes().contains(1));
|
||||
Assert.assertTrue(sorter.getFatalErrorCodes().contains(2));
|
||||
Assert.assertTrue(sorter.getFatalErrorCodes().contains(3));
|
||||
|
||||
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("xx", "xx", 1)));
|
||||
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("xx", "xx", 2)));
|
||||
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("xx", "xx", 3)));
|
||||
Assert.assertFalse(sorter.isExceptionFatal(new SQLException("xx", "xx", 4)));
|
||||
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("xx", "xx", 28)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user