Search in sources :

Example 11 with SQLRecoverableException

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

the class SQLRecoverableExceptionTests method test12.

/**
     * Validate that the ordering of the returned Exceptions is correct
     * using traditional while loop
     */
@Test
public void test12() {
    SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1);
    SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2");
    SQLRecoverableException ex2 = new SQLRecoverableException("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 : SQLRecoverableException(java.sql.SQLRecoverableException) SQLException(java.sql.SQLException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 12 with SQLRecoverableException

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

the class SQLRecoverableExceptionTests method test.

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

Example 13 with SQLRecoverableException

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

the class SQLRecoverableExceptionTests method test2.

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

Example 14 with SQLRecoverableException

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

the class SQLRecoverableExceptionTests method test3.

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

Aggregations

SQLRecoverableException (java.sql.SQLRecoverableException)14 Test (org.testng.annotations.Test)13 BaseTest (util.BaseTest)13 SQLException (java.sql.SQLException)2 IOException (java.io.IOException)1 SQLDataException (java.sql.SQLDataException)1 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)1 SQLNonTransientConnectionException (java.sql.SQLNonTransientConnectionException)1 ParseException (java.text.ParseException)1 DateTime (org.joda.time.DateTime)1 SQLCommand (org.xbib.elasticsearch.common.util.SQLCommand)1