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

The following examples show how to use javax.sql.rowset.serial.SerialArray. 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
@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 2
@Test(enabled = true)
public void test04() throws Exception {
    Object[] coffees = new Object[]{"Espresso", "Colombian", "French Roast",
        "Cappuccino"};
    Array a = new StubArray("VARCHAR", coffees);
    outImpl.writeArray(a);
    SerialArray sa = (SerialArray) results.get(0);
    assertTrue(Arrays.equals(coffees, (Object[]) sa.getArray()));
    assertTrue(a.getBaseTypeName().equals(sa.getBaseTypeName()));
}
 
Example 3
@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 4
@Test(enabled = true)
public void test04() throws Exception {
    Object[] coffees = new Object[]{"Espresso", "Colombian", "French Roast",
        "Cappuccino"};
    Array a = new StubArray("VARCHAR", coffees);
    outImpl.writeArray(a);
    SerialArray sa = (SerialArray) results.get(0);
    assertTrue(Arrays.equals(coffees, (Object[]) sa.getArray()));
    assertTrue(a.getBaseTypeName().equals(sa.getBaseTypeName()));
}
 
Example 5
Source Project: openjdk-jdk9   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 6
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 test04() throws Exception {
    Object[] coffees = new Object[]{"Espresso", "Colombian", "French Roast",
        "Cappuccino"};
    Array a = new StubArray("VARCHAR", coffees);
    outImpl.writeArray(a);
    SerialArray sa = (SerialArray) results.get(0);
    assertTrue(Arrays.equals(coffees, (Object[]) sa.getArray()));
    assertTrue(a.getBaseTypeName().equals(sa.getBaseTypeName()));
}
 
Example 7
Source Project: hottub   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: 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 9
Source Project: hottub   Source File: SQLOutputImplTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test(enabled = true)
public void test04() throws Exception {
    Object[] coffees = new Object[]{"Espresso", "Colombian", "French Roast",
        "Cappuccino"};
    Array a = new StubArray("VARCHAR", coffees);
    outImpl.writeArray(a);
    SerialArray sa = (SerialArray) results.get(0);
    assertTrue(Arrays.equals(coffees, (Object[]) sa.getArray()));
    assertTrue(a.getBaseTypeName().equals(sa.getBaseTypeName()));
}
 
Example 10
Source Project: jdk8u_jdk   Source File: SerialArrayTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test14() throws Exception {
    SerialArray sa = new SerialArray(a);
    Object[] o = (Object[]) sa.getArray(map);
    assertTrue(Arrays.equals(o, coffees));
}
 
Example 11
@Test
public void test15() throws Exception {
    SerialArray sa = new SerialArray(a);
    Object[] o = (Object[]) sa.getArray(1, 2);
    assertTrue(Arrays.equals(o, Arrays.copyOfRange(coffees, 1, 3)));
}
 
Example 12
@Test(expectedExceptions = SQLException.class)
public void test02() throws Exception {
    SerialArray sa = new SerialArray(a, null);
}
 
Example 13
@Test(expectedExceptions = SerialException.class)
public void test03() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet();
}
 
Example 14
Source Project: hottub   Source File: SerialArrayTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test04() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet(null);
}
 
Example 15
@Test(expectedExceptions = SerialException.class)
public void test06() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet(1, 1, null);
}
 
Example 16
Source Project: hottub   Source File: SerialArrayTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SQLException.class)
public void test02() throws Exception {
    SerialArray sa = new SerialArray(a, null);
}
 
Example 17
@Test(expectedExceptions = SerialException.class)
public void test08() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getArray(map);
}
 
Example 18
@Test(expectedExceptions = SerialException.class)
public void test09() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getArray(1, 1, map);
}
 
Example 19
@Test(expectedExceptions = SerialException.class)
public void test10() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getArray(1, 1);
}
 
Example 20
Source Project: hottub   Source File: SerialArrayTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test05() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet(1, 1);
}
 
Example 21
@Test
public void test18() throws Exception {
    SerialArray sa = new SerialArray(a);
    SerialArray sa1 = serializeDeserializeObject(sa);;
    assertTrue(sa.equals(sa1));
}
 
Example 22
@Test
public void test16() throws Exception {
    SerialArray sa = new SerialArray(a);
    Object[] o = (Object[]) sa.getArray(1, 2, map);
    assertTrue(Arrays.equals(o, Arrays.copyOfRange(coffees, 1, 3)));
}
 
Example 23
@Test
public void test14() throws Exception {
    SerialArray sa = new SerialArray(a);
    Object[] o = (Object[]) sa.getArray(map);
    assertTrue(Arrays.equals(o, coffees));
}
 
Example 24
@Test
public void test01() throws Exception {
    SerialArray sa = new SerialArray(a);
}
 
Example 25
Source Project: jdk8u-jdk   Source File: SerialArrayTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test08() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getArray(map);
}
 
Example 26
@Test(expectedExceptions = SerialException.class)
public void test10() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getArray(1, 1);
}
 
Example 27
Source Project: jdk8u_jdk   Source File: SerialArrayTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test04() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet(null);
}
 
Example 28
@Test(expectedExceptions = SerialException.class)
public void test06() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet(1, 1, null);
}
 
Example 29
Source Project: hottub   Source File: SerialArrayTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test03() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet();
}
 
Example 30
@Test(expectedExceptions = SerialException.class)
public void test03() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet();
}