@Test public void testReadModifyWriteAsyncWithEmptyCell() throws Exception { ReadModifyWriteRow readModify = ReadModifyWriteRow.create(TABLE_ID, "test-key"); ReadModifyWriteRowRequest request = readModify.toProto(REQUEST_CONTEXT); ReadModifyWriteRowResponse response = ReadModifyWriteRowResponse.newBuilder() .setRow(Row.newBuilder().setKey(ROW_KEY).build()) .build(); ListenableFuture<ReadModifyWriteRowResponse> listenableResponse = Futures.immediateFuture(response); when(delegate.readModifyWriteRowAsync(request)).thenReturn(listenableResponse); Result actualResult = dataClientWrapper.readModifyWriteRowAsync(readModify).get(); assertNull(actualResult.getRow()); assertEquals(0, actualResult.rawCells().length); verify(delegate).readModifyWriteRowAsync(request); }
@Override public ApiFuture<Result> readModifyWriteRowAsync(ReadModifyWriteRow readModifyWriteRow) { ListenableFuture<ReadModifyWriteRowResponse> response = delegate.readModifyWriteRowAsync(readModifyWriteRow.toProto(requestContext)); return ApiFutureUtil.transformAndAdapt( response, new Function<ReadModifyWriteRowResponse, Result>() { @Override public Result apply(ReadModifyWriteRowResponse response) { return transformRowToResult(response.getRow()); } }); }
DataClientClassicApi implements DataClientWrapper { @Override public ApiFuture<Result> readModifyWriteRowAsync(ReadModifyWriteRow readModifyWriteRow) { ListenableFuture<ReadModifyWriteRowResponse> response = delegate.readModifyWriteRowAsync(readModifyWriteRow.toProto(requestContext)); return ApiFutureUtil.transformAndAdapt( response, new Function<ReadModifyWriteRowResponse, Result>() { @Override public Result apply(ReadModifyWriteRowResponse response) { return transformRowToResult(response.getRow()); } }); } }
DataClientClassicApi implements DataClientWrapper { @Override public ApiFuture<Result> readModifyWriteRowAsync(ReadModifyWriteRow readModifyWriteRow) { ListenableFuture<ReadModifyWriteRowResponse> response = delegate.readModifyWriteRowAsync(readModifyWriteRow.toProto(requestContext)); return ApiFutureUtil.transformAndAdapt( response, new Function<ReadModifyWriteRowResponse, Result>() { @Override public Result apply(ReadModifyWriteRowResponse response) { return transformRowToResult(response.getRow()); } }); } DataClientClassicApi(BigtableSession session, RequestContext requestContext); }
DataClientClassicApi implements DataClientWrapper { @Override public ApiFuture<Result> readModifyWriteRowAsync(ReadModifyWriteRow readModifyWriteRow) { ListenableFuture<ReadModifyWriteRowResponse> response = delegate.readModifyWriteRowAsync(readModifyWriteRow.toProto(requestContext)); return ApiFutureUtil.transformAndAdapt( response, new Function<ReadModifyWriteRowResponse, Result>() { @Override public Result apply(ReadModifyWriteRowResponse response) { return transformRowToResult(response.getRow()); } }); } DataClientClassicApi(BigtableSession session, RequestContext requestContext); @Override BulkMutationWrapper createBulkMutation(String tableId); @Override BulkReadWrapper createBulkRead(String tableId); @Override ApiFuture<Void> mutateRowAsync(RowMutation rowMutation); @Override ApiFuture<Result> readModifyWriteRowAsync(ReadModifyWriteRow readModifyWriteRow); @Override ApiFuture<Boolean> checkAndMutateRowAsync(ConditionalRowMutation conditionalRowMutation); @Override ApiFuture<List<KeyOffset>> sampleRowKeysAsync(String tableId); @Override ApiFuture<Result> readRowAsync(String tableId, ByteString rowKey, Filters.Filter filter); @Override org.apache.hadoop.hbase.client.ResultScanner readRows(Query request); @Override ApiFuture<List<Result>> readRowsAsync(Query request); @Override void readRowsAsync(Query request, final StreamObserver<Result> observer); @Override void close(); }
DataClientClassicApi implements DataClientWrapper { @Override public ApiFuture<Result> readModifyWriteRowAsync(ReadModifyWriteRow readModifyWriteRow) { ListenableFuture<ReadModifyWriteRowResponse> response = delegate.readModifyWriteRowAsync(readModifyWriteRow.toProto(requestContext)); return ApiFutureUtil.transformAndAdapt( response, new Function<ReadModifyWriteRowResponse, Result>() { @Override public Result apply(ReadModifyWriteRowResponse response) { return transformRowToResult(response.getRow()); } }); } DataClientClassicApi(BigtableSession session, RequestContext requestContext); @Override BulkMutationWrapper createBulkMutation(String tableId); @Override BulkReadWrapper createBulkRead(String tableId); @Override ApiFuture<Void> mutateRowAsync(RowMutation rowMutation); @Override ApiFuture<Result> readModifyWriteRowAsync(ReadModifyWriteRow readModifyWriteRow); @Override ApiFuture<Boolean> checkAndMutateRowAsync(ConditionalRowMutation conditionalRowMutation); @Override ApiFuture<List<KeyOffset>> sampleRowKeysAsync(String tableId); @Override ApiFuture<Result> readRowAsync(String tableId, ByteString rowKey, Filters.Filter filter); @Override org.apache.hadoop.hbase.client.ResultScanner readRows(Query request); @Override ApiFuture<List<Result>> readRowsAsync(Query request); @Override void readRowsAsync(Query request, final StreamObserver<Result> observer); @Override void close();  }