diff --git a/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java
index cfd358c994bb..f760e21bd4b7 100644
--- a/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java
+++ b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java
@@ -388,38 +388,37 @@ public ApiFuture
getTableAsync(String tableId) {
}
/**
- * Lists all TableNames in the instance.
+ * Lists all table ids in the instance.
*
* Sample code:
*
*
{@code
- * List tableNames = client.listTables();
- * for(TableName name : tableNames) {
+ * List tableIds = client.listTables();
+ * for(String tableId: tableIds) {
* System.out.println(name.getTable());
* }
* }
*/
- // TODO(igorbernstein2): consider changing this method to use relative table ids.
@SuppressWarnings("WeakerAccess")
- public List listTables() {
+ public List listTables() {
return awaitFuture(listTablesAsync());
}
/**
- * Asynchronously lists all TableNames in the instance.
+ * Asynchronously lists all table ids in the instance.
*
* Sample code:
*
*
{@code
- * ApiFuture> listFuture = client.listTables();
+ * ApiFuture> listFuture = client.listTables();
*
* ApiFutures.addCallback(
* listFuture,
- * new ApiFutureCallback>() {
- * public void onSuccess(List tableNames) {
+ * new ApiFutureCallback>() {
+ * public void onSuccess(List tableIds) {
* System.out.println("Got list of tables:");
- * for (TableName name : tableNames) {
- * System.out.println(name.getTable());
+ * for (String tableId : tableIds) {
+ * System.out.println(tableId);
* }
* }
*
@@ -431,9 +430,8 @@ public List listTables() {
* );
* }
*/
- // TODO(igorbernstein2): consider changing this method to use relative table ids.
@SuppressWarnings("WeakerAccess")
- public ApiFuture> listTablesAsync() {
+ public ApiFuture> listTablesAsync() {
ListTablesRequest request = ListTablesRequest.newBuilder().setParent(instanceName.toString())
.build();
@@ -484,12 +482,12 @@ public ApiFuture> apply(
// Wrap all of the accumulated protos.
return ApiFutures.transform(allProtos,
- new ApiFunction, List>() {
+ new ApiFunction, List>() {
@Override
- public List apply(List protos) {
- List results = Lists.newArrayListWithCapacity(protos.size());
+ public List apply(List protos) {
+ List results = Lists.newArrayListWithCapacity(protos.size());
for (com.google.bigtable.admin.v2.Table proto : protos) {
- results.add(TableName.parse(proto.getName()));
+ results.add(TableName.parse(proto.getName()).getTable());
}
return results;
}
diff --git a/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTest.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTest.java
index 86d52f1cceb3..7d0fc0bc67cf 100644
--- a/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTest.java
+++ b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTest.java
@@ -39,7 +39,6 @@
import com.google.cloud.bigtable.admin.v2.models.CreateTableRequest;
import com.google.cloud.bigtable.admin.v2.models.ModifyColumnFamiliesRequest;
import com.google.cloud.bigtable.admin.v2.models.Table;
-import com.google.cloud.bigtable.admin.v2.stub.BigtableTableAdminStub;
import com.google.cloud.bigtable.admin.v2.stub.EnhancedBigtableTableAdminStub;
import com.google.common.collect.Lists;
import com.google.protobuf.ByteString;
@@ -255,12 +254,12 @@ public void testListTables() {
);
// Execute
- List actualResults = adminClient.listTables();
+ List actualResults = adminClient.listTables();
// Verify
- List expectedResults = Lists.newArrayList();
+ List expectedResults = Lists.newArrayList();
for (com.google.bigtable.admin.v2.Table expectedProto : expectedProtos) {
- expectedResults.add(TableName.parse(expectedProto.getName()));
+ expectedResults.add(TableName.parse(expectedProto.getName()).getTable());
}
assertThat(actualResults).containsExactlyElementsIn(expectedResults);
diff --git a/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableTableAdminClientIT.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableTableAdminClientIT.java
index 63bc060bb1f6..5c15952c693a 100644
--- a/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableTableAdminClientIT.java
+++ b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableTableAdminClientIT.java
@@ -16,22 +16,22 @@
package com.google.cloud.bigtable.admin.v2.it;
import static com.google.cloud.bigtable.admin.v2.models.GCRules.GCRULES;
+import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import com.google.bigtable.admin.v2.InstanceName;
-import com.google.bigtable.admin.v2.TableName;
import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient;
import com.google.cloud.bigtable.admin.v2.models.ColumnFamily;
+import com.google.cloud.bigtable.admin.v2.models.ConsistencyToken;
+import com.google.cloud.bigtable.admin.v2.models.CreateTableRequest;
import com.google.cloud.bigtable.admin.v2.models.GCRules.DurationRule;
import com.google.cloud.bigtable.admin.v2.models.GCRules.IntersectionRule;
import com.google.cloud.bigtable.admin.v2.models.GCRules.UnionRule;
import com.google.cloud.bigtable.admin.v2.models.GCRules.VersionRule;
-import com.google.cloud.bigtable.admin.v2.models.CreateTableRequest;
import com.google.cloud.bigtable.admin.v2.models.ModifyColumnFamiliesRequest;
-import com.google.cloud.bigtable.admin.v2.models.ConsistencyToken;
import com.google.cloud.bigtable.admin.v2.models.Table;
import com.google.common.collect.Maps;
import com.google.protobuf.ByteString;
@@ -205,7 +205,7 @@ public void listTables() {
try {
tableAdmin.createTable(CreateTableRequest.of(tableId));
- List tables = tableAdmin.listTables();
+ List tables = tableAdmin.listTables();
assertNotNull(tables);
assertFalse("List tables did not return any tables", tables.isEmpty());
} finally {
@@ -219,7 +219,7 @@ public void listTablesAsync() throws Exception {
try {
tableAdmin.createTable(CreateTableRequest.of(tableId));
- List tables = tableAdmin.listTablesAsync().get();
+ List tables = tableAdmin.listTablesAsync().get();
assertNotNull(tables);
assertFalse("List tables did not return any tables", tables.isEmpty());
} finally {