本文整理汇总了Java中java.sql.SQLRecoverableException类的典型用法代码示例。如果您正苦于以下问题:Java SQLRecoverableException类的具体用法?Java SQLRecoverableException怎么用?Java SQLRecoverableException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SQLRecoverableException类属于java.sql包,在下文中一共展示了SQLRecoverableException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test12
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* Validate that the ordering of the returned Exceptions is correct
* using traditional while loop
*/
@Test
public void test12() {
SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1);
SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2");
SQLRecoverableException ex2 = new SQLRecoverableException("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();
}
}
示例2: statementErrorOccurred
import java.sql.SQLRecoverableException; //导入依赖的package包/类
void statementErrorOccurred(CassandraPreparedStatement preparedStatement, SQLException sqlException)
{
StatementEvent event = new StatementEvent(this, preparedStatement, sqlException);
for (StatementEventListener listener : statementEventListeners)
{
listener.statementErrorOccurred(event);
}
String cql = preparedStatement.getCql();
Set<CassandraPreparedStatement> usedStatements = usedPreparedStatements.get(cql);
if (!(event.getSQLException() instanceof SQLRecoverableException))
{
preparedStatement.close();
usedStatements.remove(preparedStatement);
}
}
示例3: test_Constructor_LThrowable
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(Throwable)
*/
public void test_Constructor_LThrowable() {
Throwable cause = new Exception("MYTHROWABLE");
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
cause);
assertNotNull(sQLRecoverableException);
assertEquals(
"The reason of SQLRecoverableException should be equals to cause.toString()",
"java.lang.Exception: MYTHROWABLE", sQLRecoverableException
.getMessage());
assertNull("The SQLState of SQLRecoverableException should be null",
sQLRecoverableException.getSQLState());
assertEquals("The error code of SQLRecoverableException should be 0",
sQLRecoverableException.getErrorCode(), 0);
assertEquals(
"The cause of SQLRecoverableException set and get should be equivalent",
cause, sQLRecoverableException.getCause());
}
示例4: test_Constructor_LStringLThrowable
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, Throwable)
*/
public void test_Constructor_LStringLThrowable() {
Throwable cause = new Exception("MYTHROWABLE");
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
"MYTESTSTRING", cause);
assertNotNull(sQLRecoverableException);
assertEquals(
"The reason of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING", sQLRecoverableException.getMessage());
assertNull("The SQLState of SQLRecoverableException should be null",
sQLRecoverableException.getSQLState());
assertEquals("The error code of SQLRecoverableException should be 0",
sQLRecoverableException.getErrorCode(), 0);
assertEquals(
"The cause of SQLRecoverableException set and get should be equivalent",
cause, sQLRecoverableException.getCause());
}
示例5: test_Constructor_LStringLStringLThrowable
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, Throwable)
*/
public void test_Constructor_LStringLStringLThrowable() {
Throwable cause = new Exception("MYTHROWABLE");
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
"MYTESTSTRING1", "MYTESTSTRING2", cause);
assertNotNull(sQLRecoverableException);
assertEquals(
"The SQLState of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING2", sQLRecoverableException.getSQLState());
assertEquals(
"The reason of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING1", sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be 0",
sQLRecoverableException.getErrorCode(), 0);
assertEquals(
"The cause of SQLRecoverableException set and get should be equivalent",
cause, sQLRecoverableException.getCause());
}
示例6: test_Constructor_LStringLStringLThrowable_1
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, Throwable)
*/
public void test_Constructor_LStringLStringLThrowable_1() {
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
"MYTESTSTRING1", "MYTESTSTRING2", null);
assertNotNull(sQLRecoverableException);
assertEquals(
"The SQLState of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING2", sQLRecoverableException.getSQLState());
assertEquals(
"The reason of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING1", sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be 0",
sQLRecoverableException.getErrorCode(), 0);
assertNull("The cause of SQLRecoverableException should be null",
sQLRecoverableException.getCause());
}
示例7: test_Constructor_LStringLStringLThrowable_2
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, Throwable)
*/
public void test_Constructor_LStringLStringLThrowable_2() {
Throwable cause = new Exception("MYTHROWABLE");
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
"MYTESTSTRING", null, cause);
assertNotNull(sQLRecoverableException);
assertNull("The SQLState of SQLRecoverableException should be null",
sQLRecoverableException.getSQLState());
assertEquals(
"The reason of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING", sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be 0",
sQLRecoverableException.getErrorCode(), 0);
assertEquals(
"The cause of SQLRecoverableException set and get should be equivalent",
cause, sQLRecoverableException.getCause());
}
示例8: test_Constructor_LStringLStringLThrowable_4
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, Throwable)
*/
public void test_Constructor_LStringLStringLThrowable_4() {
Throwable cause = new Exception("MYTHROWABLE");
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
null, "MYTESTSTRING", cause);
assertNotNull(sQLRecoverableException);
assertEquals(
"The SQLState of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING", sQLRecoverableException.getSQLState());
assertNull("The reason of SQLRecoverableException should be null",
sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be 0",
sQLRecoverableException.getErrorCode(), 0);
assertEquals(
"The cause of SQLRecoverableException set and get should be equivalent",
cause, sQLRecoverableException.getCause());
}
示例9: test_Constructor_LStringLStringLThrowable_6
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, Throwable)
*/
public void test_Constructor_LStringLStringLThrowable_6() {
Throwable cause = new Exception("MYTHROWABLE");
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
null, null, cause);
assertNotNull(sQLRecoverableException);
assertNull("The SQLState of SQLRecoverableException should be null",
sQLRecoverableException.getSQLState());
assertNull("The reason of SQLRecoverableException should be null",
sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be 0",
sQLRecoverableException.getErrorCode(), 0);
assertEquals(
"The cause of SQLRecoverableException set and get should be equivalent",
cause, sQLRecoverableException.getCause());
}
示例10: test_Constructor_LStringLStringILThrowable
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, int, Throwable)
*/
public void test_Constructor_LStringLStringILThrowable() {
Throwable cause = new Exception("MYTHROWABLE");
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
"MYTESTSTRING1", "MYTESTSTRING2", 1, cause);
assertNotNull(sQLRecoverableException);
assertEquals(
"The SQLState of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING2", sQLRecoverableException.getSQLState());
assertEquals(
"The reason of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING1", sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be 1",
sQLRecoverableException.getErrorCode(), 1);
assertEquals(
"The cause of SQLRecoverableException set and get should be equivalent",
cause, sQLRecoverableException.getCause());
}
示例11: test_Constructor_LStringLStringILThrowable_1
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, int, Throwable)
*/
public void test_Constructor_LStringLStringILThrowable_1() {
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
"MYTESTSTRING1", "MYTESTSTRING2", 1, null);
assertNotNull(sQLRecoverableException);
assertEquals(
"The SQLState of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING2", sQLRecoverableException.getSQLState());
assertEquals(
"The reason of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING1", sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be 1",
sQLRecoverableException.getErrorCode(), 1);
assertNull("The cause of SQLRecoverableException should be null",
sQLRecoverableException.getCause());
}
示例12: test_Constructor_LStringLStringILThrowable_2
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, int, Throwable)
*/
public void test_Constructor_LStringLStringILThrowable_2() {
Throwable cause = new Exception("MYTHROWABLE");
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
"MYTESTSTRING1", "MYTESTSTRING2", 0, cause);
assertNotNull(sQLRecoverableException);
assertEquals(
"The SQLState of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING2", sQLRecoverableException.getSQLState());
assertEquals(
"The reason of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING1", sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be 0",
sQLRecoverableException.getErrorCode(), 0);
assertEquals(
"The cause of SQLRecoverableException set and get should be equivalent",
cause, sQLRecoverableException.getCause());
}
示例13: test_Constructor_LStringLStringILThrowable_3
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, int, Throwable)
*/
public void test_Constructor_LStringLStringILThrowable_3() {
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
"MYTESTSTRING1", "MYTESTSTRING2", 0, null);
assertNotNull(sQLRecoverableException);
assertEquals(
"The SQLState of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING2", sQLRecoverableException.getSQLState());
assertEquals(
"The reason of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING1", sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be 0",
sQLRecoverableException.getErrorCode(), 0);
assertNull("The cause of SQLRecoverableException should be null",
sQLRecoverableException.getCause());
}
示例14: test_Constructor_LStringLStringILThrowable_4
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, int, Throwable)
*/
public void test_Constructor_LStringLStringILThrowable_4() {
Throwable cause = new Exception("MYTHROWABLE");
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
"MYTESTSTRING1", "MYTESTSTRING2", -1, cause);
assertNotNull(sQLRecoverableException);
assertEquals(
"The SQLState of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING2", sQLRecoverableException.getSQLState());
assertEquals(
"The reason of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING1", sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be -1",
sQLRecoverableException.getErrorCode(), -1);
assertEquals(
"The cause of SQLRecoverableException set and get should be equivalent",
cause, sQLRecoverableException.getCause());
}
示例15: test_Constructor_LStringLStringILThrowable_5
import java.sql.SQLRecoverableException; //导入依赖的package包/类
/**
* @test java.sql.SQLRecoverableException(String, String, int, Throwable)
*/
public void test_Constructor_LStringLStringILThrowable_5() {
SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
"MYTESTSTRING1", "MYTESTSTRING2", -1, null);
assertNotNull(sQLRecoverableException);
assertEquals(
"The SQLState of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING2", sQLRecoverableException.getSQLState());
assertEquals(
"The reason of SQLRecoverableException set and get should be equivalent",
"MYTESTSTRING1", sQLRecoverableException.getMessage());
assertEquals("The error code of SQLRecoverableException should be -1",
sQLRecoverableException.getErrorCode(), -1);
assertNull("The cause of SQLRecoverableException should be null",
sQLRecoverableException.getCause());
}