微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.sql.SQLTransactionRollbackException的实例源码

项目:jdk8u-jdk    文件sqlTransactionRollbackExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    sqlTransactionRollbackException ex =
            new sqlTransactionRollbackException("Exception 1",t1);
    sqlTransactionRollbackException ex1 =
            new sqlTransactionRollbackException("Exception 2");
    sqlTransactionRollbackException ex2 =
            new sqlTransactionRollbackException("Exception 3",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:jdk8u-jdk    文件sqlTransactionRollbackExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using Traditional while loop
 */
@Test
public void test12() {
    sqlTransactionRollbackException ex =
            new sqlTransactionRollbackException("Exception 1",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();
    }
}
项目:openjdk-jdk10    文件sqlTransactionRollbackExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    sqlTransactionRollbackException ex =
            new sqlTransactionRollbackException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:openjdk-jdk10    文件sqlTransactionRollbackExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using Traditional while loop
 */
@Test
public void test12() {
    sqlTransactionRollbackException ex =
            new sqlTransactionRollbackException("Exception 1",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();
    }
}
项目:openjdk9    文件sqlTransactionRollbackExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    sqlTransactionRollbackException ex =
            new sqlTransactionRollbackException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:openjdk9    文件sqlTransactionRollbackExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using Traditional while loop
 */
@Test
public void test12() {
    sqlTransactionRollbackException ex =
            new sqlTransactionRollbackException("Exception 1",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();
    }
}
项目:gemfirexd-oss    文件TestJDBC40Exception.java   
public void testTimeout() throws sqlException {
    Connection con1 = openDefaultConnection();
    Connection con2 = openDefaultConnection();
    con1.setAutoCommit(false);
    con2.setAutoCommit(false);
    con1.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
    con2.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
    con1.createStatement().execute(
        "select * from EXCEPTION_TABLE1 for update");
    try {
        con2.createStatement().execute(
            "select * from EXCEPTION_TABLE1 for update");
        fail("Statement didn't fail.");
    } catch (sqlTransactionRollbackException e) {
        assertTrue("Unexpected sql State: " + e.getsqlState(),e.getsqlState().startsWith("40"));
    }
    con1.rollback();
    con1.close();
    con2.rollback();
    con2.close();
}
项目:vortex    文件HsqlDBStorageEngine2.java   
@Override
public Cluster[] loadClustersForClusterSet(ClusterSet cs) throws sqlException {
    PreparedStatement st = con.prepareStatement("select distinct id from vss.clusters where cs_id = ?");
    st.setInt(1,cs.getID());
    List<Cluster> list;
    try (ResultSet rs = st.executeQuery()) {
        list = new LinkedList<>();
        while (rs.next()) {
            list.add(loadCluster(rs.getInt(1),cs));
        }

        Collections.sort(list,new Comparator<Cluster>() {
            @Override
            public int compare(Cluster o1,Cluster o2) {
                return o2.size() - o1.size();
            }
        });

        return list.toArray(new Cluster[list.size()]);
    } catch (sqlTransactionRollbackException e) {
        logger.showException(e);
        return new Cluster[0];
    }

}
项目:vortex    文件HsqlDBStorageEngine.java   
@Override
public Cluster[] loadClustersForClusterSet(ClusterSet cs) throws sqlException {
    PreparedStatement st = con.prepareStatement("select distinct id from vss.clusters where cs_id = ?");
    st.setInt(1,Cluster o2) {
                return o2.size() - o1.size();
            }
        });

        return list.toArray(new Cluster[list.size()]);
    } catch (sqlTransactionRollbackException e) {
        logger.showException(e);
        return new Cluster[0];
    }

}
项目:jdk8u_jdk    文件sqlTransactionRollbackExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    sqlTransactionRollbackException ex =
            new sqlTransactionRollbackException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:jdk8u_jdk    文件sqlTransactionRollbackExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using Traditional while loop
 */
@Test
public void test12() {
    sqlTransactionRollbackException ex =
            new sqlTransactionRollbackException("Exception 1",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();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件sqlTransactionRollbackExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    sqlTransactionRollbackException ex =
            new sqlTransactionRollbackException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:lookaside_java-1.8.0-openjdk    文件sqlTransactionRollbackExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using Traditional while loop
 */
@Test
public void test12() {
    sqlTransactionRollbackException ex =
            new sqlTransactionRollbackException("Exception 1",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();
    }
}
项目:cn1    文件sqlTransactionRollbackExceptionTest.java   
/**
 * @test java.sql.sqlTransactionRollbackException(String,String)
 */
public void test_Constructor_LStringLString() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING1","MYTESTSTRING2");
    assertNotNull(sqlTransactionRollbackException);
    assertEquals(
            "The sqlState of sqlTransactionRollbackException set and get should be equivalent","MYTESTSTRING2",sqlTransactionRollbackException.getsqlState());
    assertEquals(
            "The reason of sqlTransactionRollbackException set and get should be equivalent","MYTESTSTRING1",sqlTransactionRollbackException.getMessage());
    assertEquals(
            "The error code of sqlTransactionRollbackException should be 0",sqlTransactionRollbackException.getErrorCode(),0);

}
项目:cn1    文件sqlTransactionRollbackExceptionTest.java   
/**
 * @test java.sql.sqlTransactionRollbackException(Throwable)
 */
public void test_Constructor_LThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            cause);
    assertNotNull(sqlTransactionRollbackException);
    assertEquals(
            "The reason of sqlTransactionRollbackException should be equals to cause.toString()","java.lang.Exception: MYTHROWABLE",sqlTransactionRollbackException.getMessage());
    assertNull(
            "The sqlState of sqlTransactionRollbackException should be null",sqlTransactionRollbackException.getsqlState());
    assertEquals(
            "The error code of sqlTransactionRollbackException should be 0",0);
    assertEquals(
            "The cause of sqlTransactionRollbackException set and get should be equivalent",cause,sqlTransactionRollbackException.getCause());
}
项目:cn1    文件sqlTransactionRollbackExceptionTest.java   
/**
 * @test java.sql.sqlTransactionRollbackException(Throwable)
 */
public void test_Constructor_LThrowable_1() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            (Throwable) null);
    assertNotNull(sqlTransactionRollbackException);
    assertNull(
            "The sqlState of sqlTransactionRollbackException should be null",sqlTransactionRollbackException.getsqlState());
    assertNull(
            "The reason of sqlTransactionRollbackException should be null",0);
    assertNull(
            "The cause of sqlTransactionRollbackException should be null",sqlTransactionRollbackException.getCause());
}
项目:cn1    文件sqlTransactionRollbackExceptionTest.java   
/**
 * @test java.sql.sqlTransactionRollbackException(String,Throwable)
 */
public void test_Constructor_LStringLThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING",cause);
    assertNotNull(sqlTransactionRollbackException);
    assertEquals(
            "The reason of sqlTransactionRollbackException set and get should be equivalent","MYTESTSTRING",Throwable)
 */
public void test_Constructor_LStringLThrowable_1() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING",(Throwable) null);
    assertNotNull(sqlTransactionRollbackException);
    assertEquals(
            "The reason of sqlTransactionRollbackException set and get should be equivalent",Throwable)
 */
public void test_Constructor_LStringLThrowable_2() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            null,cause);
    assertNotNull(sqlTransactionRollbackException);
    assertNull(
            "The reason of sqlTransactionRollbackException should be null",0);
}
项目:cn1    文件sqlTransactionRollbackExceptionTest.java   
/**
 * @test java.sql.sqlTransactionRollbackException(String,Throwable)
 */
public void test_Constructor_LStringLThrowable_3() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            (String) null,(Throwable) null);
    assertNotNull(sqlTransactionRollbackException);
    assertNull(
            "The sqlState of sqlTransactionRollbackException should be null",String,Throwable)
 */
public void test_Constructor_LStringLStringLThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING1",cause);
    assertNotNull(sqlTransactionRollbackException);
    assertEquals(
            "The sqlState of sqlTransactionRollbackException set and get should be equivalent",Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_1() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING1",null);
    assertNotNull(sqlTransactionRollbackException);
    assertEquals(
            "The sqlState of sqlTransactionRollbackException set and get should be equivalent",Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_2() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING",null,cause);
    assertNotNull(sqlTransactionRollbackException);
    assertNull(
            "The sqlState of sqlTransactionRollbackException should be null",Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_3() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING",null);
    assertNotNull(sqlTransactionRollbackException);
    assertNull(
            "The sqlState of sqlTransactionRollbackException should be null",Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_4() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            null,Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_5() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            null,Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_6() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            null,Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_7() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            null,int,*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING1",1,sqlTransactionRollbackException.getMessage());
    assertEquals(
            "The error code of sqlTransactionRollbackException should be 1",1);
    assertEquals(
            "The cause of sqlTransactionRollbackException set and get should be equivalent",*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_1() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING1",1);
    assertNull(
            "The cause of sqlTransactionRollbackException should be null",*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_2() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING1",*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_3() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING1",*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_4() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING1",-1,sqlTransactionRollbackException.getMessage());
    assertEquals(
            "The error code of sqlTransactionRollbackException should be -1",-1);
    assertEquals(
            "The cause of sqlTransactionRollbackException set and get should be equivalent",*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_5() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING1",-1);
    assertNull(
            "The cause of sqlTransactionRollbackException should be null",sqlTransactionRollbackException.getCause());

}
项目:cn1    文件sqlTransactionRollbackExceptionTest.java   
/**
 * @test java.sql.sqlTransactionRollbackException(String,*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_6() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING",*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_7() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING",null);
    assertNotNull(sqlTransactionRollbackException);
    assertNotNull(sqlTransactionRollbackException);
    assertNull(
            "The sqlState of sqlTransactionRollbackException should be null",*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_8() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING",*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_9() {
    sqlTransactionRollbackException sqlTransactionRollbackException = new sqlTransactionRollbackException(
            "MYTESTSTRING",sqlTransactionRollbackException.getCause());
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。