@Test public void testListTablesAsync() throws Exception { ImmutableList<String> tableIdList = ImmutableList.of("test-table-1", "test-table-2", "test-table-3"); ListTablesRequest request = ListTablesRequest.newBuilder().setParent(INSTANCE_NAME.toString()).build(); ListTablesResponse.Builder builder = ListTablesResponse.newBuilder(); builder.addTablesBuilder().setName(INSTANCE_NAME.toTableNameStr("test-table-1")).build(); builder.addTablesBuilder().setName(INSTANCE_NAME.toTableNameStr("test-table-2")).build(); builder.addTablesBuilder().setName(INSTANCE_NAME.toTableNameStr("test-table-3")).build(); when(delegate.listTablesAsync(request)).thenReturn(immediateFuture(builder.build())); assertEquals(tableIdList, adminClientWrapper.listTablesAsync().get()); verify(delegate).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(); } }); }
AdminClientClassicApi implements AdminClientWrapper { @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(); } }); } }
AdminClientClassicApi implements AdminClientWrapper { @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(); } }); } AdminClientClassicApi(
      @Nonnull BigtableTableAdminClient delegate, @Nonnull BigtableInstanceName instanceName); }
AdminClientClassicApi implements AdminClientWrapper { @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(); } }); } AdminClientClassicApi(
      @Nonnull BigtableTableAdminClient delegate, @Nonnull BigtableInstanceName instanceName); @Override ApiFuture<Table> createTableAsync(CreateTableRequest request); @Override ApiFuture<Table> getTableAsync(String tableId); @Override ApiFuture<List<String>> listTablesAsync(); @Override ApiFuture<Void> deleteTableAsync(String tableId); @Override ApiFuture<Table> modifyFamiliesAsync(ModifyColumnFamiliesRequest request); @Override ApiFuture<Void> dropRowRangeAsync(String tableId, ByteString rowKeyPrefix); @Override ApiFuture<Void> dropAllRowsAsync(String tableId); @Override void close(); }
AdminClientClassicApi implements AdminClientWrapper { @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(); } }); } AdminClientClassicApi(
      @Nonnull BigtableTableAdminClient delegate, @Nonnull BigtableInstanceName instanceName); @Override ApiFuture<Table> createTableAsync(CreateTableRequest request); @Override ApiFuture<Table> getTableAsync(String tableId); @Override ApiFuture<List<String>> listTablesAsync(); @Override ApiFuture<Void> deleteTableAsync(String tableId); @Override ApiFuture<Table> modifyFamiliesAsync(ModifyColumnFamiliesRequest request); @Override ApiFuture<Void> dropRowRangeAsync(String tableId, ByteString rowKeyPrefix); @Override ApiFuture<Void> dropAllRowsAsync(String tableId); @Override void close();  }