Search in sources :

Example 6 with StubBlob

use of util.StubBlob in project jdk8u_jdk by JetBrains.

the class SerialBlobTests method test03.

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

Example 7 with StubBlob

use of util.StubBlob in project jdk8u_jdk by JetBrains.

the class SerialBlobTests method test07.

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

Example 8 with StubBlob

use of util.StubBlob in project jdk8u_jdk by JetBrains.

the class SerialBlobTests method test30.

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

Example 9 with StubBlob

use of util.StubBlob in project jdk8u_jdk by JetBrains.

the class BaseRowSetTests method testAdvancedParameters.

/*
     * DataProvider used to set advanced parameters for types that are supported
     */
@DataProvider(name = "testAdvancedParameters")
private Object[][] testAdvancedParameters() throws SQLException {
    byte[] bytes = new byte[10];
    Ref aRef = new SerialRef(new StubRef("INTEGER", query));
    Array aArray = new SerialArray(new StubArray("INTEGER", new Object[1]));
    Blob aBlob = new SerialBlob(new StubBlob());
    Clob aClob = new SerialClob(new StubClob());
    Reader rdr = new StringReader(query);
    InputStream is = new StringBufferInputStream(query);
    ;
    brs = new StubBaseRowSet();
    brs.setBytes(1, bytes);
    brs.setAsciiStream(2, is, query.length());
    brs.setRef(3, aRef);
    brs.setArray(4, aArray);
    brs.setBlob(5, aBlob);
    brs.setClob(6, aClob);
    brs.setBinaryStream(7, is, query.length());
    brs.setUnicodeStream(8, is, query.length());
    brs.setCharacterStream(9, rdr, query.length());
    return new Object[][] { { 1, bytes }, { 2, is }, { 3, aRef }, { 4, aArray }, { 5, aBlob }, { 6, aClob }, { 7, is }, { 8, is }, { 9, rdr } };
}
Also used : SerialArray(javax.sql.rowset.serial.SerialArray) StubBlob(util.StubBlob) SerialBlob(javax.sql.rowset.serial.SerialBlob) Blob(java.sql.Blob) StringBufferInputStream(java.io.StringBufferInputStream) InputStream(java.io.InputStream) Reader(java.io.Reader) StringReader(java.io.StringReader) SerialBlob(javax.sql.rowset.serial.SerialBlob) StubClob(util.StubClob) StubBlob(util.StubBlob) SerialClob(javax.sql.rowset.serial.SerialClob) StubRef(util.StubRef) StubArray(util.StubArray) Array(java.sql.Array) SerialArray(javax.sql.rowset.serial.SerialArray) StubRef(util.StubRef) SerialRef(javax.sql.rowset.serial.SerialRef) Ref(java.sql.Ref) StringBufferInputStream(java.io.StringBufferInputStream) StringReader(java.io.StringReader) StubBaseRowSet(util.StubBaseRowSet) SerialRef(javax.sql.rowset.serial.SerialRef) Clob(java.sql.Clob) StubClob(util.StubClob) SerialClob(javax.sql.rowset.serial.SerialClob) StubArray(util.StubArray) DataProvider(org.testng.annotations.DataProvider)

Example 10 with StubBlob

use of util.StubBlob in project jdk8u_jdk by JetBrains.

the class SQLOutputImplTests method test05.

/*
     * Validate a Blob can be written and returned
     */
@Test(enabled = true)
public void test05() throws Exception {
    Blob b = new StubBlob();
    outImpl.writeBlob(b);
    SerialBlob sb = (SerialBlob) results.get(0);
    assertTrue(Arrays.equals(b.getBytes(1, (int) b.length()), sb.getBytes(1, (int) sb.length())));
}
Also used : StubBlob(util.StubBlob) SerialBlob(javax.sql.rowset.serial.SerialBlob) Blob(java.sql.Blob) SerialBlob(javax.sql.rowset.serial.SerialBlob) StubBlob(util.StubBlob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

StubBlob (util.StubBlob)17 SerialBlob (javax.sql.rowset.serial.SerialBlob)16 Test (org.testng.annotations.Test)16 BaseTest (util.BaseTest)16 Blob (java.sql.Blob)3 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 Reader (java.io.Reader)1 StringBufferInputStream (java.io.StringBufferInputStream)1 StringReader (java.io.StringReader)1 Array (java.sql.Array)1 Clob (java.sql.Clob)1 Ref (java.sql.Ref)1 SQLInputImpl (javax.sql.rowset.serial.SQLInputImpl)1 SerialArray (javax.sql.rowset.serial.SerialArray)1 SerialClob (javax.sql.rowset.serial.SerialClob)1 SerialRef (javax.sql.rowset.serial.SerialRef)1 DataProvider (org.testng.annotations.DataProvider)1 StubArray (util.StubArray)1 StubBaseRowSet (util.StubBaseRowSet)1