use of com.google.refine.operations.row.RowRemovalOperation in project OpenRefine by OpenRefine.
the class CacheTests method testIssue567.
/**
* Test for issue 567. Problem doesn't seem to occur when testing
* interactively, but this demonstrates that the facet count cache
* can get stale after row removal operations
*
* @throws Exception
*/
@Test
public void testIssue567() throws Exception {
for (int i = 0; i < 5; i++) {
Row row = new Row(5);
row.setCell(0, new Cell(i < 4 ? "a" : "b", null));
project.rows.add(row);
}
engine.getAllRows().accept(project, new CountingRowVisitor(5));
engine.getAllFilteredRows().accept(project, new CountingRowVisitor(4));
Function fc = new FacetCount();
Integer count = (Integer) fc.call(bindings, new Object[] { "a", "value", "Column A" });
Assert.assertEquals(count.intValue(), 4);
EngineDependentOperation op = new RowRemovalOperation(engine_config);
op.createProcess(project, options).performImmediate();
engine.getAllRows().accept(project, new CountingRowVisitor(1));
engine.getAllFilteredRows().accept(project, new CountingRowVisitor(0));
count = (Integer) fc.call(bindings, new Object[] { "a", "value", "Column A" });
Assert.assertEquals(count.intValue(), 0);
}
Aggregations