Search in sources :

Example 6 with SQLNonTransientConnectionException

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

the class SQLNonTransientConnectionExceptionTests method test8.

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

Example 7 with SQLNonTransientConnectionException

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

the class SQLNonTransientConnectionExceptionTests method test6.

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

Example 8 with SQLNonTransientConnectionException

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

the class SQLNonTransientConnectionExceptionTests method test11.

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

Example 9 with SQLNonTransientConnectionException

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

the class SQLNonTransientConnectionExceptionTests method test12.

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

Example 10 with SQLNonTransientConnectionException

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

the class SQLNonTransientConnectionExceptionTests method test13.

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

Aggregations

SQLNonTransientConnectionException (java.sql.SQLNonTransientConnectionException)15 Test (org.testng.annotations.Test)14 BaseTest (util.BaseTest)14 SQLException (java.sql.SQLException)3 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)1 SQLNonTransientException (java.sql.SQLNonTransientException)1 Properties (java.util.Properties)1