bw.flush();
// test null end
// will remove rows 4 through 9 (6 * 5 = 30 entries)
to.deleteRows("test2", new Text("30"), null);
Scanner s = connector.createScanner("test2", Constants.NO_AUTHS);
int rowCnt = 0;
for (Entry<Key,Value> entry : s) {
String rowId = entry.getKey().getRow().toString();
Assert.assertFalse(rowId.startsWith("30"));
rowCnt++;
}
s.close();
Assert.assertEquals(120, rowCnt);
// test null start
// will remove 0-1, 10-19, 2
to.deleteRows("test2", null, new Text("2"));
s = connector.createScanner("test2", Constants.NO_AUTHS);
rowCnt = 0;
for (Entry<Key,Value> entry : s) {
char rowStart = entry.getKey().getRow().toString().charAt(0);
Assert.assertTrue(rowStart >= '2');
rowCnt++;
}
s.close();
Assert.assertEquals(55, rowCnt);
// test null start and end
// deletes everything still left
to.deleteRows("test2", null, null);
s = connector.createScanner("test2", Constants.NO_AUTHS);
rowCnt = 0;
for (@SuppressWarnings("unused")
Entry<Key,Value> entry : s) {
rowCnt++;
}
s.close();
to.delete("test2");
Assert.assertEquals(0, rowCnt);
}