diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java index 0b55cb6ed4b0..8fa5813be340 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java +++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java @@ -40,7 +40,7 @@ import com.google.bigtable.v2.RowFilter; import com.google.bigtable.v2.SampleRowKeysRequest; import com.google.bigtable.v2.SampleRowKeysResponse; -import com.google.cloud.bigtable.data.v2.internal.NameUtil; +import com.google.bigtable.v2.TableName; import com.google.protobuf.ByteString; import com.google.protobuf.GeneratedMessageV3; import io.grpc.Status; @@ -101,8 +101,9 @@ public void readRowsTest() throws Exception { ReadRowsResponse expectedResponse = ReadRowsResponse.newBuilder().setLastScannedRowKey(lastScannedRowKey).build(); mockBigtable.addResponse(expectedResponse); - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); - ReadRowsRequest request = ReadRowsRequest.newBuilder().setTableName(tableName).build(); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + ReadRowsRequest request = + ReadRowsRequest.newBuilder().setTableName(tableName.toString()).build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -119,8 +120,9 @@ public void readRowsTest() throws Exception { public void readRowsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockBigtable.addException(exception); - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); - ReadRowsRequest request = ReadRowsRequest.newBuilder().setTableName(tableName).build(); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + ReadRowsRequest request = + ReadRowsRequest.newBuilder().setTableName(tableName.toString()).build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -145,9 +147,9 @@ public void sampleRowKeysTest() throws Exception { SampleRowKeysResponse expectedResponse = SampleRowKeysResponse.newBuilder().setRowKey(rowKey).setOffsetBytes(offsetBytes).build(); mockBigtable.addResponse(expectedResponse); - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); SampleRowKeysRequest request = - SampleRowKeysRequest.newBuilder().setTableName(tableName).build(); + SampleRowKeysRequest.newBuilder().setTableName(tableName.toString()).build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -165,9 +167,9 @@ public void sampleRowKeysTest() throws Exception { public void sampleRowKeysExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockBigtable.addException(exception); - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); SampleRowKeysRequest request = - SampleRowKeysRequest.newBuilder().setTableName(tableName).build(); + SampleRowKeysRequest.newBuilder().setTableName(tableName.toString()).build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -191,7 +193,7 @@ public void mutateRowTest() { MutateRowResponse expectedResponse = MutateRowResponse.newBuilder().build(); mockBigtable.addResponse(expectedResponse); - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); ByteString rowKey = ByteString.copyFromUtf8("122"); List mutations = new ArrayList<>(); @@ -202,7 +204,7 @@ public void mutateRowTest() { Assert.assertEquals(1, actualRequests.size()); MutateRowRequest actualRequest = (MutateRowRequest) actualRequests.get(0); - Assert.assertEquals(tableName, actualRequest.getTableName()); + Assert.assertEquals(tableName, TableName.parse(actualRequest.getTableName())); Assert.assertEquals(rowKey, actualRequest.getRowKey()); Assert.assertEquals(mutations, actualRequest.getMutationsList()); Assert.assertTrue( @@ -218,7 +220,7 @@ public void mutateRowExceptionTest() throws Exception { mockBigtable.addException(exception); try { - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); ByteString rowKey = ByteString.copyFromUtf8("122"); List mutations = new ArrayList<>(); @@ -234,10 +236,13 @@ public void mutateRowExceptionTest() throws Exception { public void mutateRowsTest() throws Exception { MutateRowsResponse expectedResponse = MutateRowsResponse.newBuilder().build(); mockBigtable.addResponse(expectedResponse); - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); List entries = new ArrayList<>(); MutateRowsRequest request = - MutateRowsRequest.newBuilder().setTableName(tableName).addAllEntries(entries).build(); + MutateRowsRequest.newBuilder() + .setTableName(tableName.toString()) + .addAllEntries(entries) + .build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -255,10 +260,13 @@ public void mutateRowsTest() throws Exception { public void mutateRowsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockBigtable.addException(exception); - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); List entries = new ArrayList<>(); MutateRowsRequest request = - MutateRowsRequest.newBuilder().setTableName(tableName).addAllEntries(entries).build(); + MutateRowsRequest.newBuilder() + .setTableName(tableName.toString()) + .addAllEntries(entries) + .build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -284,7 +292,7 @@ public void checkAndMutateRowTest() { CheckAndMutateRowResponse.newBuilder().setPredicateMatched(predicateMatched).build(); mockBigtable.addResponse(expectedResponse); - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); ByteString rowKey = ByteString.copyFromUtf8("122"); RowFilter predicateFilter = RowFilter.newBuilder().build(); List trueMutations = new ArrayList<>(); @@ -298,7 +306,7 @@ public void checkAndMutateRowTest() { Assert.assertEquals(1, actualRequests.size()); CheckAndMutateRowRequest actualRequest = (CheckAndMutateRowRequest) actualRequests.get(0); - Assert.assertEquals(tableName, actualRequest.getTableName()); + Assert.assertEquals(tableName, TableName.parse(actualRequest.getTableName())); Assert.assertEquals(rowKey, actualRequest.getRowKey()); Assert.assertEquals(predicateFilter, actualRequest.getPredicateFilter()); Assert.assertEquals(trueMutations, actualRequest.getTrueMutationsList()); @@ -316,7 +324,7 @@ public void checkAndMutateRowExceptionTest() throws Exception { mockBigtable.addException(exception); try { - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); ByteString rowKey = ByteString.copyFromUtf8("122"); RowFilter predicateFilter = RowFilter.newBuilder().build(); List trueMutations = new ArrayList<>(); @@ -335,7 +343,7 @@ public void readModifyWriteRowTest() { ReadModifyWriteRowResponse expectedResponse = ReadModifyWriteRowResponse.newBuilder().build(); mockBigtable.addResponse(expectedResponse); - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); ByteString rowKey = ByteString.copyFromUtf8("122"); List rules = new ArrayList<>(); @@ -346,7 +354,7 @@ public void readModifyWriteRowTest() { Assert.assertEquals(1, actualRequests.size()); ReadModifyWriteRowRequest actualRequest = (ReadModifyWriteRowRequest) actualRequests.get(0); - Assert.assertEquals(tableName, actualRequest.getTableName()); + Assert.assertEquals(tableName, TableName.parse(actualRequest.getTableName())); Assert.assertEquals(rowKey, actualRequest.getRowKey()); Assert.assertEquals(rules, actualRequest.getRulesList()); Assert.assertTrue( @@ -362,7 +370,7 @@ public void readModifyWriteRowExceptionTest() throws Exception { mockBigtable.addException(exception); try { - String tableName = NameUtil.formatTableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); + TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); ByteString rowKey = ByteString.copyFromUtf8("122"); List rules = new ArrayList<>(); diff --git a/google-cloud-clients/google-cloud-bigtable/synth.metadata b/google-cloud-clients/google-cloud-bigtable/synth.metadata index 2bd4f07a69a5..383ad4e0b4d6 100644 --- a/google-cloud-clients/google-cloud-bigtable/synth.metadata +++ b/google-cloud-clients/google-cloud-bigtable/synth.metadata @@ -1,27 +1,42 @@ { + "updateTime": "2019-01-10T08:35:06.355856Z", "sources": [ + { + "generator": { + "name": "artman", + "version": "0.16.5", + "dockerImage": "googleapis/artman@sha256:5a96c2c5c6f9570cc9556b63dc9ce1838777fd9166b5b64e43ad8e0ecee2fe2c" + } + }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5a57f0c13a358b2b15452bf2d67453774a5f6d4f", - "internalRef": "221837528" + "sha": "fb44301b2b667c56a0f2a361a5a7d3709d5f6a69", + "internalRef": "228622745" } - }, + } + ], + "destinations": [ { - "git": { - "name": "googleapis-private", - "remote": "https://github.com/googleapis/googleapis-private.git", - "sha": "6aa8e1a447bb8d0367150356a28cb4d3f2332641", - "internalRef": "221340946" + "client": { + "source": "googleapis", + "apiName": "bigtable", + "apiVersion": "v2", + "language": "java", + "generator": "gapic", + "config": "google/bigtable/artman_bigtable.yaml" } }, { - "generator": { - "name": "artman", - "version": "0.16.0", - "dockerImage": "googleapis/artman@sha256:90f9d15e9bad675aeecd586725bce48f5667ffe7d5fc4d1e96d51ff34304815b" + "client": { + "source": "googleapis", + "apiName": "bigtable-admin", + "apiVersion": "v2", + "language": "java", + "generator": "gapic", + "config": "google/bigtable/admin/artman_bigtableadmin.yaml" } } ] -} +} \ No newline at end of file