Search in sources :

Example 6 with SerialBlob

use of javax.sql.rowset.serial.SerialBlob in project jdk8u_jdk by JetBrains.

the class SerialBlobTests method test25.

/*
     * Validate getBinaryStream returns the correct bytes
     */
@Test
public void test25() throws Exception {
    byte[] expected = bytes;
    SerialBlob sb = new SerialBlob(bytes);
    InputStream is = sb.getBinaryStream();
    for (byte b : expected) {
        byte val = (byte) is.read();
        assertTrue(b == val, val + " does not match " + b);
    }
}
Also used : InputStream(java.io.InputStream) SerialBlob(javax.sql.rowset.serial.SerialBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 7 with SerialBlob

use of javax.sql.rowset.serial.SerialBlob in project jdk8u_jdk by JetBrains.

the class SerialBlobTests method test08.

/*
     * Validate calling free() after calling setBytes() throws an
     * SerialException
     */
@Test(expectedExceptions = SerialException.class)
public void test08() throws Exception {
    SerialBlob sb = new SerialBlob(new StubBlob());
    sb.free();
    sb.setBytes(1, new byte[5]);
}
Also used : SerialBlob(javax.sql.rowset.serial.SerialBlob) StubBlob(util.StubBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 8 with SerialBlob

use of javax.sql.rowset.serial.SerialBlob in project jdk8u_jdk by JetBrains.

the class SerialBlobTests method test16.

/*
     * Validate a SerialException is thrown if length > byte array length
     */
@Test(expectedExceptions = SerialException.class)
public void test16() throws Exception {
    SerialBlob sb = new SerialBlob(bytes);
    InputStream is = sb.getBinaryStream(1, 6);
}
Also used : InputStream(java.io.InputStream) SerialBlob(javax.sql.rowset.serial.SerialBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 9 with SerialBlob

use of javax.sql.rowset.serial.SerialBlob in project jdk8u_jdk by JetBrains.

the class SerialBlobTests method test04.

/*
     * Validate calling getLength() after calling free() throws an
     * SerialException
     */
@Test(expectedExceptions = SerialException.class)
public void test04() throws Exception {
    SerialBlob sb = new SerialBlob(new StubBlob());
    sb.free();
    sb.length();
}
Also used : SerialBlob(javax.sql.rowset.serial.SerialBlob) StubBlob(util.StubBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 10 with SerialBlob

use of javax.sql.rowset.serial.SerialBlob in project jdk8u_jdk by JetBrains.

the class SerialBlobTests method test10.

/*
     * Validate calling truncate() after calling free() throws an
     * SerialException
     */
@Test(expectedExceptions = SerialException.class)
public void test10() throws Exception {
    SerialBlob sb = new SerialBlob(new StubBlob());
    sb.free();
    sb.truncate(1);
}
Also used : SerialBlob(javax.sql.rowset.serial.SerialBlob) StubBlob(util.StubBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

SerialBlob (javax.sql.rowset.serial.SerialBlob)54 Test (org.testng.annotations.Test)32 BaseTest (util.BaseTest)32 StubBlob (util.StubBlob)16 InputStream (java.io.InputStream)11 SQLException (java.sql.SQLException)8 SerialClob (javax.sql.rowset.serial.SerialClob)8 Test (org.junit.Test)8 IOException (java.io.IOException)7 Blob (java.sql.Blob)7 BlobType (org.teiid.core.types.BlobType)7 Clob (java.sql.Clob)6 BigDecimal (java.math.BigDecimal)3 BlobImpl (org.teiid.core.types.BlobImpl)3 FileNotFoundException (java.io.FileNotFoundException)2 OutputStream (java.io.OutputStream)2 Reader (java.io.Reader)2 SQLXML (java.sql.SQLXML)2 Time (java.sql.Time)2 Timestamp (java.sql.Timestamp)2