Search in sources :

Example 16 with SQLNonTransientException

use of java.sql.SQLNonTransientException in project jdk8u_jdk by JetBrains.

the class SQLNonTransientExceptionTests method test.

/**
     * Create SQLNonTransientException and setting all objects to null
     */
@Test
public void test() {
    SQLNonTransientException e = new SQLNonTransientException(null, null, errorCode, null);
    assertTrue(e.getMessage() == null && e.getSQLState() == null && e.getCause() == null && e.getErrorCode() == errorCode);
}
Also used : SQLNonTransientException(java.sql.SQLNonTransientException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 17 with SQLNonTransientException

use of java.sql.SQLNonTransientException in project jdk8u_jdk by JetBrains.

the class SQLNonTransientExceptionTests method test12.

/**
     * Validate that the ordering of the returned Exceptions is correct
     * using traditional while loop
     */
@Test
public void test12() {
    SQLNonTransientException ex = new SQLNonTransientException("Exception 1", t1);
    SQLNonTransientException ex1 = new SQLNonTransientException("Exception 2");
    SQLNonTransientException ex2 = new SQLNonTransientException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
Also used : SQLNonTransientException(java.sql.SQLNonTransientException) SQLException(java.sql.SQLException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 18 with SQLNonTransientException

use of java.sql.SQLNonTransientException in project jdk8u_jdk by JetBrains.

the class SQLNonTransientExceptionTests method test2.

/**
     * Create SQLNonTransientException with message
     */
@Test
public void test2() {
    SQLNonTransientException ex = new SQLNonTransientException(reason);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Also used : SQLNonTransientException(java.sql.SQLNonTransientException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 19 with SQLNonTransientException

use of java.sql.SQLNonTransientException in project jdk8u_jdk by JetBrains.

the class SQLNonTransientExceptionTests method test11.

/**
     * Validate that the ordering of the returned Exceptions is correct
     * using for-each loop
     */
@Test
public void test11() {
    SQLNonTransientException ex = new SQLNonTransientException("Exception 1", t1);
    SQLNonTransientException ex1 = new SQLNonTransientException("Exception 2");
    SQLNonTransientException ex2 = new SQLNonTransientException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
Also used : SQLNonTransientException(java.sql.SQLNonTransientException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 20 with SQLNonTransientException

use of java.sql.SQLNonTransientException in project jdk8u_jdk by JetBrains.

the class SQLNonTransientExceptionTests method test8.

/**
     * Create SQLNonTransientException with null Throwable
     */
@Test
public void test8() {
    SQLNonTransientException ex = new SQLNonTransientException((Throwable) null);
    assertTrue(ex.getMessage() == null && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Also used : SQLNonTransientException(java.sql.SQLNonTransientException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

SQLNonTransientException (java.sql.SQLNonTransientException)49 Test (org.testng.annotations.Test)19 BaseTest (util.BaseTest)19 TableConfig (io.mycat.config.model.TableConfig)12 RouteResultset (io.mycat.route.RouteResultset)8 SQLException (java.sql.SQLException)8 RouteResultsetNode (io.mycat.route.RouteResultsetNode)7 ColumnRoutePair (io.mycat.sqlengine.mpp.ColumnRoutePair)6 SlotFunction (io.mycat.route.function.SlotFunction)5 MySqlStatementParser (com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser)4 AbstractPartitionAlgorithm (io.mycat.route.function.AbstractPartitionAlgorithm)4 RouteCalculateUnit (io.mycat.route.parser.druid.RouteCalculateUnit)4 SQLExpr (com.alibaba.druid.sql.ast.SQLExpr)3 SQLStatement (com.alibaba.druid.sql.ast.SQLStatement)3 MySqlInsertStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlInsertStatement)3 SchemaConfig (io.mycat.config.model.SchemaConfig)3 SQLSyntaxErrorException (java.sql.SQLSyntaxErrorException)3 SchemaConfig (com.alibaba.cobar.config.model.SchemaConfig)2 SQLCharExpr (com.alibaba.druid.sql.ast.expr.SQLCharExpr)2 MySqlUpdateStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlUpdateStatement)2