Search in sources :

Example 26 with SerialClob

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

the class SerialClobTests method test15.

/*
     * Test that SerialException is thrown if pos = 0 on a call to
     * getCharacterStream
     */
@Test(expectedExceptions = SerialException.class)
public void test15() throws Exception {
    SerialClob sc = new SerialClob(chars);
    sc.getCharacterStream(0, 5);
}
Also used : SerialClob(javax.sql.rowset.serial.SerialClob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 27 with SerialClob

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

the class SerialClobTests method test32.

/*
     * Check that setString() updates the appropriate characters in the
     * SerialClob
     */
@Test(enabled = false)
public void test32() throws Exception {
    int expectedWritten = 9;
    String val = "Hi, I am Catwoman!!!!!!";
    String val1 = "Hahaha the Joker, who are you?!";
    String expected = "Hi, I am the Joker!";
    SerialClob sc = new SerialClob(val.toCharArray());
    int written = sc.setString(10, val1, 8, expectedWritten + 1);
    assertEquals(written, expectedWritten);
}
Also used : SerialClob(javax.sql.rowset.serial.SerialClob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 28 with SerialClob

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

the class SerialClobTests method test27.

/*
     * Validate that position() returned is -1 when an the search string is not
     * part of the SerialClob
     */
@Test
public void test27() throws Exception {
    long expectedPos = -1;
    SerialClob sc = new SerialClob(new StubClob());
    String expected = "I am Batman";
    long pos = sc.position(expected, 2);
    assertEquals(expectedPos, pos);
}
Also used : StubClob(util.StubClob) SerialClob(javax.sql.rowset.serial.SerialClob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 29 with SerialClob

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

the class SerialClobTests method test10.

/*
     * Validate calling setAsciiStream() after calling free() throws an
     * SerialException
     */
@Test(expectedExceptions = SerialException.class)
public void test10() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.setAsciiStream(5);
}
Also used : StubClob(util.StubClob) SerialClob(javax.sql.rowset.serial.SerialClob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 30 with SerialClob

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

the class SerialClobTests method test37.

/*
     * Check that getCharacterStream() returns a Reader and that the char[] that
     * was specified to create the SerialClob can be returned via the Reader
     */
@Test(enabled = false)
public void test37() throws Exception {
    SerialClob sc = new SerialClob(chars);
    String expected = "ello w";
    Reader r = sc.getCharacterStream(2, 6);
    for (char c : expected.toCharArray()) {
        char val = (char) r.read();
        assertTrue(c == val, val + " does not match " + c);
    }
}
Also used : Reader(java.io.Reader) SerialClob(javax.sql.rowset.serial.SerialClob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

SerialClob (javax.sql.rowset.serial.SerialClob)43 Test (org.testng.annotations.Test)40 BaseTest (util.BaseTest)40 StubClob (util.StubClob)24 Reader (java.io.Reader)5 InputStream (java.io.InputStream)2 Clob (java.sql.Clob)2 SerialArray (javax.sql.rowset.serial.SerialArray)2 SerialBlob (javax.sql.rowset.serial.SerialBlob)2 OutputStream (java.io.OutputStream)1 StringBufferInputStream (java.io.StringBufferInputStream)1 StringReader (java.io.StringReader)1 Writer (java.io.Writer)1 BigDecimal (java.math.BigDecimal)1 Array (java.sql.Array)1 Blob (java.sql.Blob)1 Ref (java.sql.Ref)1 SQLException (java.sql.SQLException)1 SQLInputImpl (javax.sql.rowset.serial.SQLInputImpl)1 SerialRef (javax.sql.rowset.serial.SerialRef)1