Search in sources :

Example 41 with SQLNonTransientException

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

the class SQLNonTransientExceptionTests method test1.

/**
     * Create SQLNonTransientException with no-arg constructor
     */
@Test
public void test1() {
    SQLNonTransientException ex = new SQLNonTransientException();
    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)

Example 42 with SQLNonTransientException

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

the class SQLSyntaxErrorExceptionTests method test13.

/**
     * Create SQLSyntaxErrorException and validate it is an instance of
     * SQLNonTransientException
     */
@Test
public void test13() {
    Exception ex = new SQLSyntaxErrorException();
    assertTrue(ex instanceof SQLNonTransientException);
}
Also used : SQLNonTransientException(java.sql.SQLNonTransientException) SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) SQLException(java.sql.SQLException) SQLNonTransientException(java.sql.SQLNonTransientException) SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 43 with SQLNonTransientException

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

the class SQLNonTransientExceptionTests method test10.

/**
     * Serialize a SQLNonTransientException and make sure you can read it back properly
     */
@Test
public void test10() throws Exception {
    SQLNonTransientException e = new SQLNonTransientException(reason, state, errorCode, t);
    SQLNonTransientException ex1 = createSerializedException(e);
    assertTrue(reason.equals(ex1.getMessage()) && ex1.getSQLState().equals(state) && cause.equals(ex1.getCause().toString()) && ex1.getErrorCode() == errorCode);
}
Also used : SQLNonTransientException(java.sql.SQLNonTransientException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 44 with SQLNonTransientException

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

the class SQLNonTransientExceptionTests method test4.

/**
     * Create SQLNonTransientException with message, SQLState, and error code
     */
@Test
public void test4() {
    ;
    SQLNonTransientException ex = new SQLNonTransientException(reason, state, errorCode);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == errorCode);
}
Also used : SQLNonTransientException(java.sql.SQLNonTransientException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 45 with SQLNonTransientException

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

the class SQLNonTransientExceptionTests method test6.

/**
     * Create SQLNonTransientException with message, SQLState, and Throwable
     */
@Test
public void test6() {
    SQLNonTransientException ex = new SQLNonTransientException(reason, state, t);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && cause.equals(ex.getCause().toString()) && 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