Search in sources :

Example 1 with SQLNonTransientConnectionException

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

the class SQLNonTransientConnectionExceptionTests method test3.

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

Example 2 with SQLNonTransientConnectionException

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

the class SQLNonTransientConnectionExceptionTests method test5.

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

Example 3 with SQLNonTransientConnectionException

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

the class SQLNonTransientConnectionExceptionTests method test10.

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

Example 4 with SQLNonTransientConnectionException

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

the class SQLNonTransientConnectionExceptionTests method test1.

/**
     * Create SQLNonTransientConnectionException with no-arg constructor
     */
@Test
public void test1() {
    SQLNonTransientConnectionException ex = new SQLNonTransientConnectionException();
    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 5 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)

Aggregations

SQLNonTransientConnectionException (java.sql.SQLNonTransientConnectionException)22 Test (org.testng.annotations.Test)14 BaseTest (util.BaseTest)14 SQLException (java.sql.SQLException)6 PreparedStatement (java.sql.PreparedStatement)4 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)2 StatementEvent (javax.sql.StatementEvent)2 StatementEventListener (javax.sql.StatementEventListener)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 SQLDataException (java.sql.SQLDataException)1 SQLIntegrityConstraintViolationException (java.sql.SQLIntegrityConstraintViolationException)1 SQLInvalidAuthorizationSpecException (java.sql.SQLInvalidAuthorizationSpecException)1 SQLNonTransientException (java.sql.SQLNonTransientException)1 SQLSyntaxErrorException (java.sql.SQLSyntaxErrorException)1 SQLTimeoutException (java.sql.SQLTimeoutException)1 SQLTransactionRollbackException (java.sql.SQLTransactionRollbackException)1 Statement (java.sql.Statement)1