use of javax.sql.rowset.CachedRowSet in project jdk8u_jdk by JetBrains.
the class CommonCachedRowSetTests method commonCachedRowSetTest0038.
/*
* Validate that createCopyNoConstraints() returns the proper values
* and getMatchColumnIndexes should throw a SQLException. This test
* specifies setMatchColumn(int)
*/
@Test(dataProvider = "rowsetUsingCoffeeHouses")
public void commonCachedRowSetTest0038(CachedRowSet rs) throws Exception {
rs.setMatchColumn(1);
try (CachedRowSet crs1 = rs.createCopyNoConstraints()) {
assertTrue(crs1.size() == COFFEE_HOUSES_ROWS);
compareRowSets(rs, crs1);
boolean recievedSQE = false;
try {
int[] indexes = crs1.getMatchColumnIndexes();
} catch (SQLException e) {
recievedSQE = true;
}
assertTrue(recievedSQE);
recievedSQE = false;
try {
String[] colNames = crs1.getMatchColumnNames();
} catch (SQLException e) {
recievedSQE = true;
}
assertTrue(recievedSQE);
}
rs.close();
}
use of javax.sql.rowset.CachedRowSet in project jdk8u_jdk by JetBrains.
the class JoinRowSetTests method joinRowSetTests0003.
/*
* Join two CachedRowSets specifying a column index to join against
*/
@Test(dataProvider = "createCachedRowSetsToUse")
public void joinRowSetTests0003(CachedRowSet crs, CachedRowSet crs1) throws Exception {
try (JoinRowSet jrs = newInstance()) {
RowSet[] rowsets = { crs, crs1 };
int[] joinCols = { COFFEES_JOIN_COLUMN_INDEX, SUPPLIERS_JOIN_COLUMN_INDEX };
jrs.addRowSet(rowsets, joinCols);
validateResults(jrs);
crs.close();
crs1.close();
}
}
use of javax.sql.rowset.CachedRowSet in project jdk8u_jdk by JetBrains.
the class CommonCachedRowSetTests method commonCachedRowSetTest0035.
/*
* Validate that toCollection() returns the proper values
*/
@Test(dataProvider = "rowsetUsingCoffeeHouses")
public void commonCachedRowSetTest0035(CachedRowSet rs) throws Exception {
Collection<?> col = rs.toCollection();
assertTrue(rs.size() == col.size());
assertTrue(rs.toCollection().containsAll(col) && col.containsAll(rs.toCollection()));
try (// Validate that False is returned when compared to a different RowSet;
CachedRowSet crs1 = createCoffeesRowSet()) {
assertFalse(crs1.toCollection().containsAll(col) && col.containsAll(crs1.toCollection()));
}
rs.close();
}
use of javax.sql.rowset.CachedRowSet in project jdk8u_jdk by JetBrains.
the class CommonCachedRowSetTests method commonCachedRowSetTest0037.
/*
* Validate that createCopySchema() returns the proper values
*/
@Test(dataProvider = "rowsetUsingCoffeeHouses")
public void commonCachedRowSetTest0037(CachedRowSet rs) throws Exception {
try (CachedRowSet crs1 = rs.createCopySchema()) {
assertTrue(crs1.size() == 0);
compareMetaData(crs1.getMetaData(), rs.getMetaData());
}
rs.close();
}
use of javax.sql.rowset.CachedRowSet in project jdk8u_jdk by JetBrains.
the class CommonCachedRowSetTests method commonCachedRowSetTest0059.
/*
* Validate that restoreOrginal will restore the RowSet to its
* state prior to deleting a row
*/
@Test(dataProvider = "rowsetUsingCoffees", enabled = true)
public void commonCachedRowSetTest0059(CachedRowSet rs) throws Exception {
int rowToDelete = 2;
try (CachedRowSet crs1 = rsf.createCachedRowSet()) {
rs.beforeFirst();
crs1.populate(rs);
TestRowSetListener rsl = new TestRowSetListener();
crs1.addRowSetListener(rsl);
// Delete a row, the PK is also the absolute position as a List
// backs the RowSet
crs1.absolute(rowToDelete);
crs1.deleteRow();
assertTrue(crs1.rowDeleted());
assertFalse(findRowByPrimaryKey(crs1, rowToDelete, 1));
// Restore back to our original state and the
// previously deleted row should be there
rsl.resetFlag();
crs1.restoreOriginal();
assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED));
assertTrue(crs1.isBeforeFirst());
crs1.absolute(rowToDelete);
assertFalse(crs1.rowDeleted());
assertTrue(findRowByPrimaryKey(crs1, rowToDelete, 1));
}
rs.close();
}
Aggregations