Search in sources :

Example 1 with SerialBlob

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

the class SerialBlobTests method test20.

/*
     * Validate that a SerialBlob that is serialized & deserialized is equal to
     * itself
     */
@Test
public void test20() throws Exception {
    SerialBlob sb = new SerialBlob(bytes);
    SerialBlob sb2 = serializeDeserializeObject(sb);
    assertTrue(sb.equals(sb2), "SerialBlob not equal");
}
Also used : SerialBlob(javax.sql.rowset.serial.SerialBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 2 with SerialBlob

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

the class SerialBlobTests method test.

/*
     * Validate calling free() does not throw an Exception
     */
@Test
public void test() throws Exception {
    SerialBlob sb = new SerialBlob(new StubBlob());
    sb.free();
}
Also used : SerialBlob(javax.sql.rowset.serial.SerialBlob) StubBlob(util.StubBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 3 with SerialBlob

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

the class SerialBlobTests method test29.

/*
     * Validate that position returns the correct starting location for a
     * pattern in the SerialBlob
     */
@Test
public void test29() throws Exception {
    // starting offset is 1 vs 0
    long expectedPos = 2;
    byte[] pattern = new byte[] { 4, 6 };
    SerialBlob sb = new SerialBlob(new StubBlob());
    long pos = sb.position(pattern, 1);
    assertEquals(pos, expectedPos);
}
Also used : SerialBlob(javax.sql.rowset.serial.SerialBlob) StubBlob(util.StubBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 4 with SerialBlob

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

the class SerialBlobTests method test18.

/*
     * Validate that a cloned SerializedBlob bytes match the original
     */
@Test
public void test18() throws Exception {
    SerialBlob sb = new SerialBlob(bytes);
    SerialBlob sb2 = (SerialBlob) sb.clone();
    assertTrue(Arrays.equals(sb.getBytes(1, (int) sb.length()), sb2.getBytes(1, (int) sb2.length())), "arrays do not match ");
}
Also used : SerialBlob(javax.sql.rowset.serial.SerialBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 5 with SerialBlob

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

the class SerialBlobTests method test19.

/*
     * Test clone after free has been called that the clone is not accessible
     */
@Test(expectedExceptions = SerialException.class)
public void test19() throws Exception {
    SerialBlob sb = new SerialBlob(bytes);
    sb.free();
    SerialBlob sb2 = (SerialBlob) sb.clone();
    InputStream is = sb2.getBinaryStream(1, 3);
}
Also used : InputStream(java.io.InputStream) 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