use of javax.sql.rowset.WebRowSet in project jdk8u_jdk by JetBrains.
the class CommonWebRowSetTests method writeWebRowSetWithOutputStream.
/*
* Utility method to write a WebRowSet XML file via an OutputStream
* and populating the WebRowSet via a ResultSet
*/
protected ByteArrayOutputStream writeWebRowSetWithOutputStream(ResultSet rs) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
WebRowSet wrs = rsf.createWebRowSet();
wrs.writeXml(rs, oos);
}
return baos;
}
use of javax.sql.rowset.WebRowSet in project jdk8u_jdk by JetBrains.
the class CommonWebRowSetTests method readWebRowSetWithOInputStreamWithReader.
/*
* Utility method to popoulate a WebRowSet via a Readar
*/
protected WebRowSet readWebRowSetWithOInputStreamWithReader(ByteArrayOutputStream baos) throws Exception {
WebRowSet wrs1 = rsf.createWebRowSet();
InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(baos.toByteArray()));
wrs1.readXml(isr);
return wrs1;
}
use of javax.sql.rowset.WebRowSet in project jdk8u_jdk by JetBrains.
the class CommonWebRowSetTests method WebRowSetTest0005.
/*
* Write a WebRowSet via writeXML(Writer), read it
* back via readXML(Reader) and validate the primary keys
* are the same
*/
@Test(dataProvider = "rowsetUsingCoffees")
public void WebRowSetTest0005(WebRowSet wrs) throws Exception {
ByteArrayOutputStream baos = writeWebRowSetWithOutputStreamWithWriter(wrs);
try (WebRowSet wrs1 = readWebRowSetWithOInputStreamWithReader(baos)) {
assertEquals(getPrimaryKeys(wrs1), COFFEES_PRIMARY_KEYS);
assertEquals(wrs1.size(), COFFEES_ROWS);
}
}
Aggregations