Java 类java.sql.DataTruncation 实例源码

项目:the-vigilantes    文件:StatementRegressionTest.java   
/**
 * Tests fix for BUG#3804, data truncation on server should throw
 * DataTruncation exception.
 * 
 * @throws Exception
 *             if the test fails
 */
public void testBug3804() throws Exception {
    if (versionMeetsMinimum(4, 1)) {
        try {
            this.stmt.executeUpdate("DROP TABLE IF EXISTS testBug3804");
            this.stmt.executeUpdate("CREATE TABLE testBug3804 (field1 VARCHAR(5))");

            boolean caughtTruncation = false;

            try {
                this.stmt.executeUpdate("INSERT INTO testBug3804 VALUES ('1234567')");
            } catch (DataTruncation truncationEx) {
                caughtTruncation = true;
                System.out.println(truncationEx);
            }

            assertTrue("Data truncation exception should've been thrown", caughtTruncation);
        } finally {
            this.stmt.executeUpdate("DROP TABLE IF EXISTS testBug3804");
        }
    }
}
项目:OpenVertretung    文件:StatementRegressionTest.java   
/**
 * Tests fix for BUG#3804, data truncation on server should throw
 * DataTruncation exception.
 * 
 * @throws Exception
 *             if the test fails
 */
public void testBug3804() throws Exception {
    if (versionMeetsMinimum(4, 1)) {
        try {
            this.stmt.executeUpdate("DROP TABLE IF EXISTS testBug3804");
            this.stmt.executeUpdate("CREATE TABLE testBug3804 (field1 VARCHAR(5))");

            boolean caughtTruncation = false;

            try {
                this.stmt.executeUpdate("INSERT INTO testBug3804 VALUES ('1234567')");
            } catch (DataTruncation truncationEx) {
                caughtTruncation = true;
                System.out.println(truncationEx);
            }

            assertTrue("Data truncation exception should've been thrown", caughtTruncation);
        } finally {
            this.stmt.executeUpdate("DROP TABLE IF EXISTS testBug3804");
        }
    }
}
项目:ProyectoPacientes    文件:StatementRegressionTest.java   
/**
 * Tests fix for BUG#3804, data truncation on server should throw
 * DataTruncation exception.
 * 
 * @throws Exception
 *             if the test fails
 */
public void testBug3804() throws Exception {
    if (versionMeetsMinimum(4, 1)) {
        try {
            this.stmt.executeUpdate("DROP TABLE IF EXISTS testBug3804");
            this.stmt.executeUpdate("CREATE TABLE testBug3804 (field1 VARCHAR(5))");

            boolean caughtTruncation = false;

            try {
                this.stmt.executeUpdate("INSERT INTO testBug3804 VALUES ('1234567')");
            } catch (DataTruncation truncationEx) {
                caughtTruncation = true;
                System.out.println(truncationEx);
            }

            assertTrue("Data truncation exception should've been thrown", caughtTruncation);
        } finally {
            this.stmt.executeUpdate("DROP TABLE IF EXISTS testBug3804");
        }
    }
}
项目:BibliotecaPS    文件:StatementRegressionTest.java   
/**
 * Tests fix for BUG#3804, data truncation on server should throw
 * DataTruncation exception.
 * 
 * @throws Exception
 *             if the test fails
 */
public void testBug3804() throws Exception {
    if (versionMeetsMinimum(4, 1)) {
        try {
            this.stmt.executeUpdate("DROP TABLE IF EXISTS testBug3804");
            this.stmt.executeUpdate("CREATE TABLE testBug3804 (field1 VARCHAR(5))");

            boolean caughtTruncation = false;

            try {
                this.stmt.executeUpdate("INSERT INTO testBug3804 VALUES ('1234567')");
            } catch (DataTruncation truncationEx) {
                caughtTruncation = true;
                System.out.println(truncationEx);
            }

            assertTrue("Data truncation exception should've been thrown", caughtTruncation);
        } finally {
            this.stmt.executeUpdate("DROP TABLE IF EXISTS testBug3804");
        }
    }
}
项目:jdk8u-jdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read
 */
@Test
public void test() {
    onRead = true;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:jdk8u-jdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on write
 */
@Test
public void test1() {
    onRead = false;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(WRITE_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:jdk8u-jdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read with a
 * Throwable
 */
@Test
public void test2() {
    onRead = true;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && cause.equals(e.getCause().toString())
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:jdk8u-jdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read with null
 * specified for the Throwable
 */
@Test
public void test3() {
    onRead = true;;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, null);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:jdk8u-jdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read and you can
 * pass a -1 for the index
 */
@Test
public void test4() {
    onRead = true;
    int negIndex = -1;
    DataTruncation e = new DataTruncation(negIndex, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == negIndex);
}
项目:jdk8u-jdk    文件:DataTruncationTests.java   
/**
 * Serialize a DataTruncation and make sure you can read it back properly
 */
@Test
public void test5() throws Exception {
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex1 = createSerializedException(e);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:jdk8u-jdk    文件:DataTruncationTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    DataTruncation ex = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t1);
    DataTruncation ex1 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex2 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(dtmsgs[num++].equals(e.getMessage()));
    }
}
项目:jdk8u-jdk    文件:DataTruncationTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    DataTruncation ex = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t1);
    DataTruncation ex1 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex2 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(dtmsgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(dtmsgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:openjdk-jdk10    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read
 */
@Test
public void test() {
    onRead = true;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:openjdk-jdk10    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on write
 */
@Test
public void test1() {
    onRead = false;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(WRITE_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:openjdk-jdk10    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read with a
 * Throwable
 */
@Test
public void test2() {
    onRead = true;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && cause.equals(e.getCause().toString())
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:openjdk-jdk10    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read with null
 * specified for the Throwable
 */
@Test
public void test3() {
    onRead = true;;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, null);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:openjdk-jdk10    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read and you can
 * pass a -1 for the index
 */
@Test
public void test4() {
    onRead = true;
    int negIndex = -1;
    DataTruncation e = new DataTruncation(negIndex, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == negIndex);
}
项目:openjdk-jdk10    文件:DataTruncationTests.java   
/**
 * Serialize a DataTruncation and make sure you can read it back properly
 */
@Test
public void test5() throws Exception {
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex1 = createSerializedException(e);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:openjdk-jdk10    文件:DataTruncationTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    DataTruncation ex = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t1);
    DataTruncation ex1 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex2 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(dtmsgs[num++].equals(e.getMessage()));
    }
}
项目:openjdk-jdk10    文件:DataTruncationTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    DataTruncation ex = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t1);
    DataTruncation ex1 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex2 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(dtmsgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(dtmsgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:openjdk9    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read
 */
@Test
public void test() {
    onRead = true;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:openjdk9    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on write
 */
@Test
public void test1() {
    onRead = false;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(WRITE_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:openjdk9    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read with a
 * Throwable
 */
@Test
public void test2() {
    onRead = true;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && cause.equals(e.getCause().toString())
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:openjdk9    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read with null
 * specified for the Throwable
 */
@Test
public void test3() {
    onRead = true;;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, null);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:openjdk9    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read and you can
 * pass a -1 for the index
 */
@Test
public void test4() {
    onRead = true;
    int negIndex = -1;
    DataTruncation e = new DataTruncation(negIndex, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == negIndex);
}
项目:openjdk9    文件:DataTruncationTests.java   
/**
 * Serialize a DataTruncation and make sure you can read it back properly
 */
@Test
public void test5() throws Exception {
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex1 = createSerializedException(e);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:openjdk9    文件:DataTruncationTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    DataTruncation ex = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t1);
    DataTruncation ex1 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex2 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(dtmsgs[num++].equals(e.getMessage()));
    }
}
项目:openjdk9    文件:DataTruncationTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    DataTruncation ex = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t1);
    DataTruncation ex1 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex2 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(dtmsgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(dtmsgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:jdk8u_jdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read
 */
@Test
public void test() {
    onRead = true;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:jdk8u_jdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on write
 */
@Test
public void test1() {
    onRead = false;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(WRITE_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:jdk8u_jdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read with a
 * Throwable
 */
@Test
public void test2() {
    onRead = true;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && cause.equals(e.getCause().toString())
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:jdk8u_jdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read with null
 * specified for the Throwable
 */
@Test
public void test3() {
    onRead = true;;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, null);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:jdk8u_jdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read and you can
 * pass a -1 for the index
 */
@Test
public void test4() {
    onRead = true;
    int negIndex = -1;
    DataTruncation e = new DataTruncation(negIndex, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == negIndex);
}
项目:jdk8u_jdk    文件:DataTruncationTests.java   
/**
 * Serialize a DataTruncation and make sure you can read it back properly
 */
@Test
public void test5() throws Exception {
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex1 = createSerializedException(e);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:jdk8u_jdk    文件:DataTruncationTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    DataTruncation ex = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t1);
    DataTruncation ex1 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex2 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(dtmsgs[num++].equals(e.getMessage()));
    }
}
项目:jdk8u_jdk    文件:DataTruncationTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    DataTruncation ex = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t1);
    DataTruncation ex1 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    DataTruncation ex2 = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(dtmsgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(dtmsgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read
 */
@Test
public void test() {
    onRead = true;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:lookaside_java-1.8.0-openjdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on write
 */
@Test
public void test1() {
    onRead = false;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(WRITE_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:lookaside_java-1.8.0-openjdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read with a
 * Throwable
 */
@Test
public void test2() {
    onRead = true;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, t);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && cause.equals(e.getCause().toString())
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}
项目:lookaside_java-1.8.0-openjdk    文件:DataTruncationTests.java   
/**
 * Create DataTruncation object indicating a truncation on read with null
 * specified for the Throwable
 */
@Test
public void test3() {
    onRead = true;;
    DataTruncation e = new DataTruncation(index, parameter, onRead,
            dataSize, transferSize, null);
    assertTrue(e.getMessage().equals(dtReason)
            && e.getSQLState().equals(READ_TRUNCATION)
            && e.getCause() == null
            && e.getErrorCode() == dterrorCode
            && e.getParameter() == parameter
            && e.getRead() == onRead
            && e.getDataSize() == dataSize
            && e.getTransferSize() == transferSize
            && e.getIndex() == index);
}