private void verifyBank(String table, Connector conn, String row, int numAccts)
throws TableNotFoundException, Exception {
log.debug("Verifying bank " + row);
int count = 0;
int sum = 0;
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
try (Scanner scanner = new IsolatedScanner(conn.createScanner(table, Authorizations.EMPTY))) {
scanner.setRange(new Range(row));
IteratorSetting iterConf = new IteratorSetting(100, "cqsl", ColumnSliceFilter.class);
ColumnSliceFilter.setSlice(iterConf, "bal", true, "bal", true);
scanner.clearScanIterators();
scanner.addScanIterator(iterConf);
for (Entry<Key,Value> entry : scanner) {
int bal = Integer.parseInt(entry.getValue().toString());
sum += bal;
if (bal > max)
max = bal;
if (bal < min)
min = bal;
count++;
}
}
if (count > 0 && sum != numAccts * 100) {
throw new Exception("Sum is off " + sum);
}
log.debug("Verified " + row + " count = " + count + " sum = " + sum + " min = " + min
+ " max = " + max);
}