@Test public void testListTablesAsync() throws Exception { ImmutableList<String> tableIdList = ImmutableList.of(TEST_TABLE_ID_1, TEST_TABLE_ID_2, TEST_TABLE_ID_3); ListTablesRequest request = ListTablesRequest.newBuilder().setParent(INSTANCE_NAME.toString()).build(); ListTablesResponse.Builder builder = ListTablesResponse.newBuilder(); builder.addTablesBuilder().setName(INSTANCE_NAME.toTableNameStr(TEST_TABLE_ID_1)).build(); builder.addTablesBuilder().setName(INSTANCE_NAME.toTableNameStr(TEST_TABLE_ID_2)).build(); builder.addTablesBuilder().setName(INSTANCE_NAME.toTableNameStr(TEST_TABLE_ID_3)).build(); when(mockAdminClient.listTablesAsync(request)).thenReturn(immediateFuture(builder.build())); Future<List<String>> actualResponse = clientWrapper.listTablesAsync(); assertEquals(tableIdList, actualResponse.get()); verify(mockAdminClient).listTablesAsync(request); }
@Override public ApiFuture<List<String>> listTablesAsync() { ListTablesRequest request = ListTablesRequest.newBuilder().setParent(instanceName.toString()).build(); ListenableFuture<ListTablesResponse> response = delegate.listTablesAsync(request); return ApiFutureUtil.transformAndAdapt( response, new Function<ListTablesResponse, List<String>>() { @Override public List<String> apply(ListTablesResponse input) { ImmutableList.Builder<String> tableIdsBuilder = ImmutableList.builder(); for (com.google.bigtable.admin.v2.Table tableProto : input.getTablesList()) { tableIdsBuilder.add(instanceName.toTableId(tableProto.getName())); } return tableIdsBuilder.build(); } }); }
BigtableTableAdminClientWrapper implements IBigtableTableAdminClient { @Override public ApiFuture<List<String>> listTablesAsync() { ListTablesRequest request = ListTablesRequest.newBuilder().setParent(instanceName.toString()).build(); ListenableFuture<ListTablesResponse> response = delegate.listTablesAsync(request); return ApiFutureUtil.transformAndAdapt( response, new Function<ListTablesResponse, List<String>>() { @Override public List<String> apply(ListTablesResponse input) { ImmutableList.Builder<String> tableIdsBuilder = ImmutableList.builder(); for (com.google.bigtable.admin.v2.Table tableProto : input.getTablesList()) { tableIdsBuilder.add(instanceName.toTableId(tableProto.getName())); } return tableIdsBuilder.build(); } }); } }
BigtableTableAdminClientWrapper implements IBigtableTableAdminClient { @Override public ApiFuture<List<String>> listTablesAsync() { ListTablesRequest request = ListTablesRequest.newBuilder().setParent(instanceName.toString()).build(); ListenableFuture<ListTablesResponse> response = delegate.listTablesAsync(request); return ApiFutureUtil.transformAndAdapt( response, new Function<ListTablesResponse, List<String>>() { @Override public List<String> apply(ListTablesResponse input) { ImmutableList.Builder<String> tableIdsBuilder = ImmutableList.builder(); for (com.google.bigtable.admin.v2.Table tableProto : input.getTablesList()) { tableIdsBuilder.add(instanceName.toTableId(tableProto.getName())); } return tableIdsBuilder.build(); } }); } BigtableTableAdminClientWrapper(
      @Nonnull BigtableTableAdminClient adminClient, @Nonnull BigtableOptions options); }
BigtableTableAdminClientWrapper implements IBigtableTableAdminClient { @Override public ApiFuture<List<String>> listTablesAsync() { ListTablesRequest request = ListTablesRequest.newBuilder().setParent(instanceName.toString()).build(); ListenableFuture<ListTablesResponse> response = delegate.listTablesAsync(request); return ApiFutureUtil.transformAndAdapt( response, new Function<ListTablesResponse, List<String>>() { @Override public List<String> apply(ListTablesResponse input) { ImmutableList.Builder<String> tableIdsBuilder = ImmutableList.builder(); for (com.google.bigtable.admin.v2.Table tableProto : input.getTablesList()) { tableIdsBuilder.add(instanceName.toTableId(tableProto.getName())); } return tableIdsBuilder.build(); } }); } BigtableTableAdminClientWrapper(
      @Nonnull BigtableTableAdminClient adminClient, @Nonnull BigtableOptions options); @Override Table createTable(CreateTableRequest request); @Override ApiFuture<Table> createTableAsync(CreateTableRequest request); @Override Table getTable(String tableId); @Override ApiFuture<Table> getTableAsync(String tableId); @Override List<String> listTables(); @Override ApiFuture<List<String>> listTablesAsync(); @Override void deleteTable(String tableId); @Override ApiFuture<Void> deleteTableAsync(String tableId); @Override Table modifyFamilies(ModifyColumnFamiliesRequest request); @Override ApiFuture<Table> modifyFamiliesAsync(ModifyColumnFamiliesRequest request); @Override void dropRowRange(String tableId, String rowKeyPrefix); @Override void dropRowRange(String tableId, ByteString rowKeyPrefix); @Override ApiFuture<Void> dropRowRangeAsync(String tableId, String rowKeyPrefix); @Override ApiFuture<Void> dropRowRangeAsync(String tableId, ByteString rowKeyPrefix); @Override void dropAllRows(String tableId); @Override ApiFuture<Void> dropAllRowsAsync(String tableId); @Override ApiFuture<Operation> snapshotTableAsync(SnapshotTableRequest request); @Override ApiFuture<Snapshot> getSnapshotAsync(GetSnapshotRequest request); @Override ApiFuture<ListSnapshotsResponse> listSnapshotsAsync(ListSnapshotsRequest request); @Override ApiFuture<Void> deleteSnapshotAsync(DeleteSnapshotRequest request); @Override ApiFuture<Operation> createTableFromSnapshotAsync(CreateTableFromSnapshotRequest request); }
BigtableTableAdminClientWrapper implements IBigtableTableAdminClient { @Override public ApiFuture<List<String>> listTablesAsync() { ListTablesRequest request = ListTablesRequest.newBuilder().setParent(instanceName.toString()).build(); ListenableFuture<ListTablesResponse> response = delegate.listTablesAsync(request); return ApiFutureUtil.transformAndAdapt( response, new Function<ListTablesResponse, List<String>>() { @Override public List<String> apply(ListTablesResponse input) { ImmutableList.Builder<String> tableIdsBuilder = ImmutableList.builder(); for (com.google.bigtable.admin.v2.Table tableProto : input.getTablesList()) { tableIdsBuilder.add(instanceName.toTableId(tableProto.getName())); } return tableIdsBuilder.build(); } }); } BigtableTableAdminClientWrapper(
      @Nonnull BigtableTableAdminClient adminClient, @Nonnull BigtableOptions options); @Override Table createTable(CreateTableRequest request); @Override ApiFuture<Table> createTableAsync(CreateTableRequest request); @Override Table getTable(String tableId); @Override ApiFuture<Table> getTableAsync(String tableId); @Override List<String> listTables(); @Override ApiFuture<List<String>> listTablesAsync(); @Override void deleteTable(String tableId); @Override ApiFuture<Void> deleteTableAsync(String tableId); @Override Table modifyFamilies(ModifyColumnFamiliesRequest request); @Override ApiFuture<Table> modifyFamiliesAsync(ModifyColumnFamiliesRequest request); @Override void dropRowRange(String tableId, String rowKeyPrefix); @Override void dropRowRange(String tableId, ByteString rowKeyPrefix); @Override ApiFuture<Void> dropRowRangeAsync(String tableId, String rowKeyPrefix); @Override ApiFuture<Void> dropRowRangeAsync(String tableId, ByteString rowKeyPrefix); @Override void dropAllRows(String tableId); @Override ApiFuture<Void> dropAllRowsAsync(String tableId); @Override ApiFuture<Operation> snapshotTableAsync(SnapshotTableRequest request); @Override ApiFuture<Snapshot> getSnapshotAsync(GetSnapshotRequest request); @Override ApiFuture<ListSnapshotsResponse> listSnapshotsAsync(ListSnapshotsRequest request); @Override ApiFuture<Void> deleteSnapshotAsync(DeleteSnapshotRequest request); @Override ApiFuture<Operation> createTableFromSnapshotAsync(CreateTableFromSnapshotRequest request);  }