Java Code Examples for javax.sql.rowset.serial.SerialClob

The following examples show how to use javax.sql.rowset.serial.SerialClob. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: jdk8u_jdk   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test28() throws Exception {
    long expectedPos = 2;
    SerialClob sc = new SerialClob(chars);
    String expected = "ello";
    long pos = sc.position(expected, 1);
    assertEquals(expectedPos, pos);
}
 
Example 2
Source Project: jdk8u-jdk   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example 3
@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);
}
 
Example 4
Source Project: jdk8u-jdk   Source File: SQLOutputImplTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test(enabled = true)
public void test06() throws Exception {
    Clob c = new StubClob();
    outImpl.writeClob(c);
    SerialClob sc = (SerialClob) results.get(0);
    assertTrue(c.getSubString(1,
            (int) c.length()).equals(sc.getSubString(1, (int) sc.length())));
}
 
Example 5
Source Project: jdk8u60   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test26() throws Exception {
    long expectedPos = -1;
    SerialClob sc = new SerialClob(chars);
    String expected = "test string";
    long pos = sc.position(expected, 1);
    assertEquals(expectedPos, pos);
}
 
Example 6
Source Project: jdk8u60   Source File: SQLOutputImplTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test(enabled = true)
public void test06() throws Exception {
    Clob c = new StubClob();
    outImpl.writeClob(c);
    SerialClob sc = (SerialClob) results.get(0);
    assertTrue(c.getSubString(1,
            (int) c.length()).equals(sc.getSubString(1, (int) sc.length())));
}
 
Example 7
Source Project: jdk8u60   Source File: BaseRowSetTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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}
    };
}
 
Example 8
Source Project: jdk8u60   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example 9
@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);
}
 
Example 10
public static void main(String[] args) throws Exception {
    SerialClob clob = new SerialClob(new char[0]);
    try {
        clob.setCharacterStream(0);
    } catch (SerialException e) {
         System.out.println("Test PASSED");
    }
}
 
Example 11
@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);
}
 
Example 12
Source Project: jdk8u-jdk   Source File: SetCharacterStream.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    SerialClob clob = new SerialClob(new char[0]);
    try {
        clob.setCharacterStream(0);
    } catch (SerialException e) {
         System.out.println("Test PASSED");
    }
}
 
Example 13
Source Project: jdk8u-jdk   Source File: SetAsciiStream.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    SerialClob clob = new SerialClob(new char[0]);
    try {
        clob.setAsciiStream(0);
    } catch (SerialException e) {
         System.out.println("Test PASSED");
    }
}
 
Example 14
Source Project: jdk8u-jdk   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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())));
}
 
Example 15
@Test
public void test36() throws Exception {
    SerialClob sc = new SerialClob(chars);
    Reader r = sc.getCharacterStream();
    for (char c : chars) {
        char val = (char) r.read();
        assertTrue(c == val, val + " does not match " + c);
    }
}
 
Example 16
Source Project: jdk8u60   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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);
    }
}
 
Example 17
Source Project: jdk8u-jdk   Source File: BaseRowSetTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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}
    };
}
 
Example 18
Source Project: jdk8u60   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test36() throws Exception {
    SerialClob sc = new SerialClob(chars);
    Reader r = sc.getCharacterStream();
    for (char c : chars) {
        char val = (char) r.read();
        assertTrue(c == val, val + " does not match " + c);
    }
}
 
Example 19
Source Project: jdk8u-jdk   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test26() throws Exception {
    long expectedPos = -1;
    SerialClob sc = new SerialClob(chars);
    String expected = "test string";
    long pos = sc.position(expected, 1);
    assertEquals(expectedPos, pos);
}
 
Example 20
Source Project: openjdk-jdk9   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example 21
Source Project: hottub   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test28() throws Exception {
    long expectedPos = 2;
    SerialClob sc = new SerialClob(chars);
    String expected = "ello";
    long pos = sc.position(expected, 1);
    assertEquals(expectedPos, pos);
}
 
Example 22
@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);
}
 
Example 23
Source Project: openjdk-jdk9   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test26() throws Exception {
    long expectedPos = -1;
    SerialClob sc = new SerialClob(chars);
    String expected = "test string";
    long pos = sc.position(expected, 1);
    assertEquals(expectedPos, pos);
}
 
Example 24
@Test
public void test28() throws Exception {
    long expectedPos = 2;
    SerialClob sc = new SerialClob(chars);
    String expected = "ello";
    long pos = sc.position(expected, 1);
    assertEquals(expectedPos, pos);
}
 
Example 25
@Test
public void test29() throws Exception {
    long expectedPos = 21;
    String expected = "Batman";
    String buf = "I am Joker, not the Batman, hahaha";
    SerialClob sc = new SerialClob(expected.toCharArray());
    SerialClob sc1 = new SerialClob(buf.toCharArray());
    long pos = sc1.position(sc, 1);
    assertEquals(expectedPos, pos);
}
 
Example 26
Source Project: jdk8u_jdk   Source File: SerialClobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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);
    }
}
 
Example 27
Source Project: jdk8u_jdk   Source File: BaseRowSetTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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}
    };
}
 
Example 28
Source Project: hottub   Source File: SerialClobTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test13() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.setString(1, "hello", 0, 5);
}
 
Example 29
Source Project: jdk8u60   Source File: SerialClobTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test19() throws Exception {
    SerialClob sc = new SerialClob(chars);
    SerialClob sc1 = (SerialClob) sc.clone();
    assertTrue(sc.equals(sc1), "SerialClobs not equal");
}
 
Example 30
@Test(expectedExceptions = SerialException.class)
public void test16() throws Exception {
    SerialClob sc = new SerialClob(chars);
    sc.getCharacterStream(1, 100);
}