| 338 | class cb implements Callback<Object, ArrayList<ArrayList<KeyValue>>> { |
| 339 | private int n = 15; |
| 340 | public Object call(final ArrayList<ArrayList<KeyValue>> rows) { |
| 341 | if (rows == null) { |
| 342 | return null; |
| 343 | } |
| 344 | |
| 345 | try { |
| 346 | assertSizeIs(5, rows); |
| 347 | final ArrayList<KeyValue> kvs = rows.get(0); |
| 348 | final KeyValue kv = kvs.get(0); |
| 349 | assertSizeIs(1, kvs); |
| 350 | assertEq(String.format("s%02d", n), kv.key()); |
| 351 | assertEq("q" + n, kv.qualifier()); |
| 352 | assertEq("v" + n, kv.value()); |
| 353 | n += 5; |
| 354 | return scanner.nextRows(5).addCallback(this); |
| 355 | } catch (AssertionError e) { |
| 356 | // Deferred doesn't catch Errors on purpose, so transform any |
| 357 | // assertion failure into an Exception. |
| 358 | throw new RuntimeException("Asynchronous failure", e); |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | try { |