Search in sources :

Example 31 with SQLTimeoutException

use of java.sql.SQLTimeoutException 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 32 with SQLTimeoutException

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

the class SQLTimeoutExceptionTests method test9.

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

Example 33 with SQLTimeoutException

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

the class SQLTimeoutExceptionTests method test6.

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

Example 34 with SQLTimeoutException

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

the class SQLTimeoutExceptionTests method test10.

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

Example 35 with SQLTimeoutException

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

the class SQLTimeoutExceptionTests method test11.

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

Aggregations

SQLTimeoutException (java.sql.SQLTimeoutException)53 SQLException (java.sql.SQLException)36 ResultSet (java.sql.ResultSet)20 Statement (java.sql.Statement)17 Test (org.testng.annotations.Test)15 Test (org.junit.Test)14 BaseTest (util.BaseTest)14 Connection (java.sql.Connection)12 PreparedStatement (java.sql.PreparedStatement)10 JdbcTest (org.apache.drill.categories.JdbcTest)8 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)7 ArrayList (java.util.ArrayList)7 HadoopException (org.apache.ranger.plugin.client.HadoopException)6 ScreenCreator (org.apache.drill.exec.physical.impl.ScreenCreator)4 MessageEvent (org.cerberus.engine.entity.MessageEvent)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 Ignore (org.junit.Ignore)3 IOException (java.io.IOException)2 BatchUpdateException (java.sql.BatchUpdateException)2 CallableStatement (java.sql.CallableStatement)2