Search in sources :

Example 21 with SerialClob

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

the class SerialClobTests method test31.

/*
     * Check that setString() updates the appropriate characters in the
     * SerialClob
     */
@Test
public void test31() throws Exception {
    String val = "Hello, I am Bruce Wayne";
    String val1 = "the Batman!";
    String expected = "Hello, I am the Batman!";
    SerialClob sc = new SerialClob(val.toCharArray());
    int written = sc.setString(13, val1);
    assertEquals(val1.length(), written);
    assertTrue(expected.equals(sc.getSubString(1, (int) sc.length())));
}
Also used : SerialClob(javax.sql.rowset.serial.SerialClob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 22 with SerialClob

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

the class SerialClobTests method test14.

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

Example 23 with SerialClob

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

the class SerialClobTests method test18.

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

Example 24 with SerialClob

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

the class SerialClobTests method test30.

/*
     * Validate that position() returns the correct value when a SerialClob is
     * used for the search argument
     */
@Test
public void test30() throws Exception {
    long expectedPos = 17;
    String expected = "012";
    SerialClob sc = new SerialClob(expected.toCharArray());
    SerialClob sc1 = new SerialClob(new StubClob());
    long pos = sc1.position(sc, 1);
    assertEquals(expectedPos, pos);
}
Also used : StubClob(util.StubClob) SerialClob(javax.sql.rowset.serial.SerialClob) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 25 with SerialClob

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

the class SerialClobTests method test34.

/*
     * Check that setAsciiStream() returns a non-null OutputStream for an SerialClob
     * created from a Clob
     */
@Test
public void test34() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    OutputStream os = sc.setAsciiStream(1);
    assertTrue(os != null);
}
Also used : OutputStream(java.io.OutputStream) StubClob(util.StubClob) 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