Search in sources :

Example 1 with SQLTransientConnectionException

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

the class SQLTransientConnectionExceptionTests method test.

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

Example 2 with SQLTransientConnectionException

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

the class SQLTransientConnectionExceptionTests method test2.

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

Example 3 with SQLTransientConnectionException

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

the class SQLTransientConnectionExceptionTests method test4.

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

Example 4 with SQLTransientConnectionException

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

the class SQLTransientConnectionExceptionTests method test7.

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

Example 5 with SQLTransientConnectionException

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

the class SQLTransientConnectionExceptionTests method test11.

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

Aggregations

SQLTransientConnectionException (java.sql.SQLTransientConnectionException)18 Test (org.testng.annotations.Test)14 BaseTest (util.BaseTest)14 SQLException (java.sql.SQLException)4 Connection (java.sql.Connection)3 Test (org.junit.Test)2 HikariConfig (com.zaxxer.hikari.HikariConfig)1 HikariDataSource (com.zaxxer.hikari.HikariDataSource)1 PoolInitializationException (com.zaxxer.hikari.pool.HikariPool.PoolInitializationException)1 ProxyConnection (com.zaxxer.hikari.pool.ProxyConnection)1 TestElf.newHikariConfig (com.zaxxer.hikari.pool.TestElf.newHikariConfig)1 ClockSource.elapsedDisplayString (com.zaxxer.hikari.util.ClockSource.elapsedDisplayString)1 SQLTransientException (java.sql.SQLTransientException)1 NamingException (javax.naming.NamingException)1