Search in sources :

Example 11 with SQLTransientConnectionException

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

the class SQLTransientConnectionExceptionTests method test3.

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

Example 12 with SQLTransientConnectionException

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

the class SQLTransientConnectionExceptionTests method test6.

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

Example 13 with SQLTransientConnectionException

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

the class SQLTransientConnectionExceptionTests method test5.

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

Example 14 with SQLTransientConnectionException

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

the class SQLTransientConnectionExceptionTests method test10.

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

Example 15 with SQLTransientConnectionException

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

the class SQLTransientConnectionExceptionTests method test9.

/**
     * Create SQLTransientConnectionException with Throwable
     */
@Test
public void test9() {
    SQLTransientConnectionException ex = new SQLTransientConnectionException(t);
    assertTrue(ex.getMessage().equals(cause) && 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)

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