javax.sql.rowset.serial.SerialClob Java Examples

The following examples show how to use javax.sql.rowset.serial.SerialClob. 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 File: SerialClobTests.java    From jdk8u-jdk with 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 #2
Source File: SerialClobTests.java    From jdk8u-jdk with 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
Source File: SerialClobTests.java    From jdk8u_jdk with 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 #4
Source File: SerialClobTests.java    From openjdk-jdk8u with 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 #5
Source File: SQLOutputImplTests.java    From jdk8u-jdk with 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 #6
Source File: BaseRowSetTests.java    From jdk8u_jdk with 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 #7
Source File: SerialClobTests.java    From openjdk-jdk9 with 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 #8
Source File: SerialClobTests.java    From jdk8u_jdk with 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 #9
Source File: SerialClobTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@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 #10
Source File: SerialClobTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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 #11
Source File: SerialClobTests.java    From jdk8u60 with 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 #12
Source File: SerialClobTests.java    From openjdk-jdk8u-backup with 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 #13
Source File: SerialClobTests.java    From hottub with 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 #14
Source File: SQLOutputImplTests.java    From jdk8u60 with 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 #15
Source File: SerialClobTests.java    From jdk8u60 with 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 #16
Source File: SerialClobTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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 #17
Source File: SetCharacterStream.java    From openjdk-jdk8u with 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 #18
Source File: SerialClobTests.java    From dragonwell8_jdk with 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 #19
Source File: SetCharacterStream.java    From jdk8u-jdk with 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 #20
Source File: SetAsciiStream.java    From jdk8u-jdk with 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 #21
Source File: SerialClobTests.java    From jdk8u-jdk with 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 #22
Source File: SerialClobTests.java    From dragonwell8_jdk with 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 #23
Source File: SerialClobTests.java    From jdk8u60 with 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 #24
Source File: BaseRowSetTests.java    From jdk8u-jdk with 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 #25
Source File: SerialClobTests.java    From jdk8u60 with 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 #26
Source File: SerialClobTests.java    From openjdk-jdk9 with 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 #27
Source File: BaseRowSetTests.java    From jdk8u60 with 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 File: SerialClobTests.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test17() throws Exception {
    SerialClob sc = new SerialClob(chars);
    sc.getCharacterStream(1, 0);
}
 
Example #29
Source File: SerialClobTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test15() throws Exception {
    SerialClob sc = new SerialClob(chars);
    sc.getCharacterStream(0, 5);
}
 
Example #30
Source File: SerialClobTests.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test06() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.getAsciiStream();
}