use of java.sql.SQLTransientException in project jdk8u_jdk by JetBrains.
the class SQLTransientExceptionTests method test10.
/**
* Serialize a SQLTransientException and make sure you can read it back properly
*/
@Test
public void test10() throws Exception {
SQLTransientException e = new SQLTransientException(reason, state, errorCode, t);
SQLTransientException ex1 = createSerializedException(e);
assertTrue(reason.equals(ex1.getMessage()) && ex1.getSQLState().equals(state) && cause.equals(ex1.getCause().toString()) && ex1.getErrorCode() == errorCode);
}
use of java.sql.SQLTransientException in project jdk8u_jdk by JetBrains.
the class SQLTransientExceptionTests method test12.
/**
* Validate that the ordering of the returned Exceptions is correct
* using traditional while loop
*/
@Test
public void test12() {
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;
SQLException sqe = ex;
while (sqe != null) {
assertTrue(msgs[num++].equals(sqe.getMessage()));
Throwable c = sqe.getCause();
while (c != null) {
assertTrue(msgs[num++].equals(c.getMessage()));
c = c.getCause();
}
sqe = sqe.getNextException();
}
}
use of java.sql.SQLTransientException in project jdk8u_jdk by JetBrains.
the class SQLTransientExceptionTests method test3.
/**
* Create SQLTransientException with message, and SQLState
*/
@Test
public void test3() {
SQLTransientException ex = new SQLTransientException(reason, state);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == 0);
}
use of java.sql.SQLTransientException in project jdk8u_jdk by JetBrains.
the class SQLTransientConnectionExceptionTests method test13.
/**
* Create SQLTransientConnectionException and validate it is an instance of
* SQLNonTransientException
*/
@Test
public void test13() {
Exception ex = new SQLTransientConnectionException();
assertTrue(ex instanceof SQLTransientException);
}
use of java.sql.SQLTransientException in project jdk8u_jdk by JetBrains.
the class SQLTransientExceptionTests method test9.
/**
* Create SQLTransientException with Throwable
*/
@Test
public void test9() {
SQLTransientException ex = new SQLTransientException(t);
assertTrue(ex.getMessage().equals(cause) && ex.getSQLState() == null && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
Aggregations