Search in sources :

Example 6 with SQLTransientException

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

the class SQLTransientExceptionTests method test1.

/**
     * Create SQLTransientException with no-arg constructor
     */
@Test
public void test1() {
    SQLTransientException ex = new SQLTransientException();
    assertTrue(ex.getMessage() == null && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Also used : SQLTransientException(java.sql.SQLTransientException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 7 with SQLTransientException

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

the class SQLTransientExceptionTests method test8.

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

Example 8 with SQLTransientException

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

the class SQLTimeoutExceptionTests method test13.

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

Example 9 with SQLTransientException

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

the class SQLTransientExceptionTests method test2.

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

Example 10 with SQLTransientException

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

the class SQLTransientExceptionTests method test11.

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

Aggregations

SQLTransientException (java.sql.SQLTransientException)17 Test (org.testng.annotations.Test)16 BaseTest (util.BaseTest)16 SQLException (java.sql.SQLException)5 SQLTimeoutException (java.sql.SQLTimeoutException)1 SQLTransactionRollbackException (java.sql.SQLTransactionRollbackException)1 SQLTransientConnectionException (java.sql.SQLTransientConnectionException)1 Random (java.util.Random)1