Java 类javax.sql.rowset.serial.SerialArray 实例源码

项目:jdk8u-jdk    文件:BaseRowSetTests.java   
@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}
    };
}
项目:jdk8u-jdk    文件:SQLOutputImplTests.java   
@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()));
}
项目:openjdk-jdk10    文件:BaseRowSetTests.java   
@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}
    };
}
项目:openjdk-jdk10    文件:SQLOutputImplTests.java   
@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()));
}
项目:openjdk9    文件:BaseRowSetTests.java   
@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}
    };
}
项目:openjdk9    文件:SQLOutputImplTests.java   
@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()));
}
项目:jdk8u_jdk    文件:BaseRowSetTests.java   
@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}
    };
}
项目:jdk8u_jdk    文件:SQLOutputImplTests.java   
@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()));
}
项目:lookaside_java-1.8.0-openjdk    文件:BaseRowSetTests.java   
@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}
    };
}
项目:lookaside_java-1.8.0-openjdk    文件:SQLOutputImplTests.java   
@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()));
}
项目:teiid    文件:PreparedStatementImpl.java   
public void setArray(int parameterIndex, Array x) throws SQLException {
    if (x instanceof ArrayImpl) {
        setObject(parameterIndex, x);
    } else {
        setObject(parameterIndex, new SerialArray(x));
    }
}
项目:cn1    文件:BaseRowSet.java   
public void setArray(int parameterIndex, Array array) throws SQLException {
    if (parameterIndex < 1) {
        throw new SQLException();
    }
    if (params == null) {
        throw new SQLException();
    }
    params.put(Integer.valueOf(parameterIndex - 1), new SerialArray(array));
}
项目:cn1    文件:BaseRowSetTest.java   
public void testSetArray() throws SQLException {
    BaseRowSetImpl brs = new BaseRowSetImpl();
    brs.initParams();
    Array a = new MockArray();
    brs.setArray(1, a);
    Object[] params = brs.getParams();
    assertNotNull(params);
    assertEquals(1, params.length);
    assertTrue("Should have stored a SerialArray",
            params[0] instanceof SerialArray);
}
项目:cn1    文件:SQLOutputImplTest.java   
/**
 * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeArray(Array)}
 */
public void test_writeArrayLjava_sql_Array() throws SQLException {
    Array array = new MockArray();
    impl.writeArray(array);
    assertEquals(1, attr.size());
    assertTrue(attr.get(0) instanceof SerialArray);

    impl.writeArray(null);
    assertNull(attr.get(1));
}
项目:cn1    文件:SerialArrayTest.java   
@Override
protected void setUp() throws Exception {
    super.setUp();
    testElements = new Object[4];
    testElements[0] = "test1";
    testElements[1] = "test2";
    testElements[2] = new SQLException();
    testElements[3] = new HashMap();
    sa = new SerialArray(mock);
    map = new HashMap<String, Class<?>>();
    map.put("String", MockStringSQLData.class);
    map.put("Object", null);
    badmap = new HashMap<String, Class<?>>();
    badmap.put("Something", HashMap.class);
}
项目:freeVM    文件:BaseRowSet.java   
public void setArray(int parameterIndex, Array array) throws SQLException {
    if (parameterIndex < 1) {
        throw new SQLException();
    }
    if (params == null) {
        throw new SQLException();
    }
    params.put(Integer.valueOf(parameterIndex - 1), new SerialArray(array));
}
项目:freeVM    文件:BaseRowSetTest.java   
public void testSetArray() throws SQLException {
    BaseRowSetImpl brs = new BaseRowSetImpl();
    brs.initParams();
    Array a = new MockArray();
    brs.setArray(1, a);
    Object[] params = brs.getParams();
    assertNotNull(params);
    assertEquals(1, params.length);
    assertTrue("Should have stored a SerialArray",
            params[0] instanceof SerialArray);
}
项目:freeVM    文件:SQLOutputImplTest.java   
/**
 * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeArray(Array)}
 */
public void test_writeArrayLjava_sql_Array() throws SQLException {
    Array array = new MockArray();
    impl.writeArray(array);
    assertEquals(1, attr.size());
    assertTrue(attr.get(0) instanceof SerialArray);

    impl.writeArray(null);
    assertNull(attr.get(1));
}
项目:freeVM    文件:SerialArrayTest.java   
@Override
protected void setUp() throws Exception {
    super.setUp();
    testElements = new Object[4];
    testElements[0] = "test1";
    testElements[1] = "test2";
    testElements[2] = new SQLException();
    testElements[3] = new HashMap();
    sa = new SerialArray(mock);
    map = new HashMap<String, Class<?>>();
    map.put("String", MockStringSQLData.class);
    map.put("Object", null);
    badmap = new HashMap<String, Class<?>>();
    badmap.put("Something", HashMap.class);
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test
public void test01() throws Exception {
    SerialArray sa = new SerialArray(a);
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SQLException.class)
public void test02() throws Exception {
    SerialArray sa = new SerialArray(a, null);
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test03() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet();
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test04() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet(null);
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test05() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet(1, 1);
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test06() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet(1, 1, null);
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test07() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getArray();
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test08() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getArray(map);
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test09() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getArray(1, 1, map);
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test10() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getArray(1, 1);
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test11() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getBaseType();
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test12() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getBaseTypeName();
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test
public void test13() throws Exception {
    SerialArray sa = new SerialArray(a);
    Object[] o = (Object[]) sa.getArray();
    assertTrue(Arrays.equals(o, coffees));
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test
public void test14() throws Exception {
    SerialArray sa = new SerialArray(a);
    Object[] o = (Object[]) sa.getArray(map);
    assertTrue(Arrays.equals(o, coffees));
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@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)));
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@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)));
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test
public void test17() throws Exception {
    SerialArray sa = new SerialArray(a);
    SerialArray sa1 = (SerialArray) sa.clone();
    assertTrue(sa.equals(sa1));
}
项目:jdk8u-jdk    文件:SerialArrayTests.java   
@Test
public void test18() throws Exception {
    SerialArray sa = new SerialArray(a);
    SerialArray sa1 = serializeDeserializeObject(sa);;
    assertTrue(sa.equals(sa1));
}
项目:openjdk-jdk10    文件:SerialArrayTests.java   
@Test
public void test01() throws Exception {
    SerialArray sa = new SerialArray(a);
}
项目:openjdk-jdk10    文件:SerialArrayTests.java   
@Test(expectedExceptions = SQLException.class)
public void test02() throws Exception {
    SerialArray sa = new SerialArray(a, null);
}
项目:openjdk-jdk10    文件:SerialArrayTests.java   
@Test(expectedExceptions = SerialException.class)
public void test03() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.getResultSet();
}