Scanner scanner = getConnector().createScanner("foo", new Authorizations());
setupIter(scanner);
verify(scanner, 1, 999);
BatchScanner bscanner = getConnector().createBatchScanner("foo", new Authorizations(), 3);
bscanner.setRanges(Collections.singleton(new Range((Key) null, null)));
setupIter(bscanner);
verify(bscanner, 1, 999);
ArrayList<Range> ranges = new ArrayList<Range>();
ranges.add(new Range(new Text(String.format("%06d", 1))));
ranges.add(new Range(new Text(String.format("%06d", 6)), new Text(String.format("%06d", 16))));
ranges.add(new Range(new Text(String.format("%06d", 20))));
ranges.add(new Range(new Text(String.format("%06d", 23))));
ranges.add(new Range(new Text(String.format("%06d", 56)), new Text(String.format("%06d", 61))));
ranges.add(new Range(new Text(String.format("%06d", 501)), new Text(String.format("%06d", 504))));
ranges.add(new Range(new Text(String.format("%06d", 998)), new Text(String.format("%06d", 1000))));
HashSet<Integer> got = new HashSet<Integer>();
HashSet<Integer> expected = new HashSet<Integer>();
for (int i : new int[] {1, 7, 9, 11, 13, 15, 23, 57, 59, 61, 501, 503, 999}) {
expected.add(i);
}
bscanner.setRanges(ranges);
for (Entry<Key,Value> entry : bscanner) {
got.add(Integer.parseInt(entry.getKey().getRow().toString()));
}
System.out.println("got : " + got);
if (!got.equals(expected)) {
throw new Exception(got + " != " + expected);
}
bscanner.close();
}