@Test public void testPartialResults() throws Exception { when(mockBigtableApi.getDataClient()).thenReturn(mockDataClientWrapper); when(mockDataClientWrapper.createBulkRead(isA(String.class))).thenReturn(mockBulkRead); byte[] key1 = randomBytes(8); byte[] key2 = randomBytes(8); Result expected = Result.create( ImmutableList.<org.apache.hadoop.hbase.Cell>of( new RowCell( key1, Bytes.toBytes("cf"), Bytes.toBytes(""), 10, Bytes.toBytes("hi!"), ImmutableList.<String>of()))); RuntimeException exception = new RuntimeException("Something bad happened"); when(mockBulkRead.add(any(ByteString.class), any(Filters.Filter.class))) .thenReturn(ApiFutures.immediateFuture(expected)) .thenReturn(ApiFutures.<Result>immediateFailedFuture(exception)); List<Get> gets = Arrays.asList(new Get(key1), new Get(key2)); Object[] results = new Object[2]; try { createExecutor().batch(gets, results); } catch (RetriesExhaustedWithDetailsException ignored) { } assertTrue("first result is a result", results[0] instanceof Result); assertTrue(matchesRow(expected).matches(results[0])); Assert.assertEquals(exception, results[1]); }
public void batch(List<? extends Row> actions, @Nullable Object[] results) throws IOException, InterruptedException { batchCallback(actions, results, null); }
BatchExecutor { public void batch(List<? extends Row> actions, @Nullable Object[] results) throws IOException, InterruptedException { batchCallback(actions, results, null); } }
BatchExecutor { public void batch(List<? extends Row> actions, @Nullable Object[] results) throws IOException, InterruptedException { batchCallback(actions, results, null); } BatchExecutor(
      BigtableApi bigtableApi, BigtableHBaseSettings settings, HBaseRequestAdapter adapter); }
BatchExecutor { public void batch(List<? extends Row> actions, @Nullable Object[] results) throws IOException, InterruptedException { batchCallback(actions, results, null); } BatchExecutor(
      BigtableApi bigtableApi, BigtableHBaseSettings settings, HBaseRequestAdapter adapter); void batch(List<? extends Row> actions, @Nullable Object[] results); List<ApiFuture<?>> issueAsyncRowRequests(
      List<? extends Row> actions, Object[] results, Batch.Callback<R> callback); Result[] batch(List<? extends Row> actions); void batchCallback(
      List<? extends Row> actions, Object[] results, Batch.Callback<R> callback); boolean[] exists(List<Get> gets); }
BatchExecutor { public void batch(List<? extends Row> actions, @Nullable Object[] results) throws IOException, InterruptedException { batchCallback(actions, results, null); } BatchExecutor(
      BigtableApi bigtableApi, BigtableHBaseSettings settings, HBaseRequestAdapter adapter); void batch(List<? extends Row> actions, @Nullable Object[] results); List<ApiFuture<?>> issueAsyncRowRequests(
      List<? extends Row> actions, Object[] results, Batch.Callback<R> callback); Result[] batch(List<? extends Row> actions); void batchCallback(
      List<? extends Row> actions, Object[] results, Batch.Callback<R> callback); boolean[] exists(List<Get> gets); static final byte[] NO_REGION; }