Search in sources :

Example 31 with SerialBlob

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

the class SerialBlobTests method test14.

/*
     * Validate a SerialException is thrown if len > the length of the stream
     * for getBinaryStream
     */
@Test(expectedExceptions = SerialException.class)
public void test14() throws Exception {
    SerialBlob sb = new SerialBlob(bytes);
    InputStream is = sb.getBinaryStream(0, 3);
}
Also used : InputStream(java.io.InputStream) SerialBlob(javax.sql.rowset.serial.SerialBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 32 with SerialBlob

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

the class SerialBlobTests method test17.

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

Example 33 with SerialBlob

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

the class SerialBlobTests method test06.

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

Example 34 with SerialBlob

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

the class SerialBlobTests method test05.

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

Example 35 with SerialBlob

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

the class SerialBlobTests method test23.

/*
     * Validate that setBytes will properly write a set of bytes to the
     * specified location in the SerialBlob and the correct count is returned
     * for bytes written
     */
@Test
public void test23() throws Exception {
    int bytesToWrite = 3;
    byte[] diff = new byte[] { 7, 8, 9, 0 };
    byte[] expected = new byte[] { 1, 8, 9, 0, 5 };
    SerialBlob sb = new SerialBlob(bytes);
    int written = sb.setBytes(2, diff, 1, bytesToWrite);
    assertEquals(written, bytesToWrite);
    assertTrue(Arrays.equals(sb.getBytes(1, (int) sb.length()), expected), "arrays do not match ");
}
Also used : SerialBlob(javax.sql.rowset.serial.SerialBlob) 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