Package com.taobao.tddl.client.jdbc.sorter

Examples of com.taobao.tddl.client.jdbc.sorter.MySQLExceptionSorter


*/
public class MySQLExceptionSorterUnitTest {

  @Test
  public void all() {
    MySQLExceptionSorter s = new MySQLExceptionSorter();
    int[] errors = new int[] { 1040, 1042, 1043, 1047, 1081, 1129, 1130, 1045, 1004, 1005, 1021, 1041, 1037, 1038 };

    SQLException e = new SQLException("reason", "08S01");

    Assert.assertTrue(s.isExceptionFatal(e));

    for (int err : errors) {
      e = new SQLException("reason", "01XXX", err);
      Assert.assertTrue(s.isExceptionFatal(e));
    }
   
    e = new SQLException("no datasource!", "01XXX");
    Assert.assertTrue(s.isExceptionFatal(e));
    e = new SQLException("no alive datasource", "01XXX");
    Assert.assertTrue(s.isExceptionFatal(e));
   
    e = new SQLException("msg", "01XXX",-1);
    Assert.assertFalse(s.isExceptionFatal(e));
  }
View Full Code Here

TOP

Related Classes of com.taobao.tddl.client.jdbc.sorter.MySQLExceptionSorter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.