diff --git a/.circleci/config.yml b/.circleci/config.yml index 403835e47841..3eb5baf1d881 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,6 +92,18 @@ jobs: name: Run integration tests for google-cloud-bigtable command: ./utilities/verify_single_it.sh google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.table=projects/gcloud-devel/instances/google-cloud-bigtable/tables/integration-tests + bigtableadmin_it: + working_directory: ~/googleapis + <<: *anchor_docker + <<: *anchor_auth_vars + steps: + - checkout + - run: + <<: *anchor_run_decrypt + - run: + name: Run integration tests for google-cloud-bigtable-admin + command: ./utilities/verify_single_it.sh google-cloud-clients/google-cloud-bigtable-admin -Dbigtable.instance=projects/gcloud-devel/instances/google-cloud-bigtable + compute_it: working_directory: ~/googleapis <<: *anchor_docker diff --git a/README.md b/README.md index ae5516067647..e77fc5f6c6c9 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ This library supports the following Google Cloud Platform services with clients This library supports the following Google Cloud Platform services with clients at an [Alpha](#versioning) quality level: - [Cloud Bigtable](google-cloud-clients/google-cloud-bigtable) (Alpha) +- [Cloud Bigtable Admin](google-cloud-clients/google-cloud-bigtable-admin) (Alpha) - [Cloud Compute](google-cloud-clients/google-cloud-compute) (Alpha) - [Cloud Dataproc](google-cloud-clients/google-cloud-dataproc) (Alpha) - [Cloud DNS](google-cloud-clients/google-cloud-dns) (Alpha) diff --git a/TESTING.md b/TESTING.md index ce8a7f2641f8..926159f84672 100644 --- a/TESTING.md +++ b/TESTING.md @@ -64,6 +64,21 @@ To use the `prod` environment: -Dbigtable.table=projects/my-project/instances/my-instance/tables/my-table ``` +### Testing code that uses Bigtable Admin + +Bigtable Admin integration tests are run against a real Bigtable instance. + +To run the tests: +1. Set up the target table using `google-cloud-bigtable/scripts/setup-test-table.sh` +2. Download the [JSON service account credentials file][create-service-account] from the Google + Developer's Console. +3. Set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to the path of the credentials file +4. Set the system property `bigtable.instance` to the full instance name you + created earlier. Example: + ```shell + mvn verify -am -pl google-cloud-bigtable-admin \ + -Dbigtable.instance=projects/my-project/instances/my-instance + ``` ### Testing code that uses Compute diff --git a/google-cloud-bom/pom.xml b/google-cloud-bom/pom.xml index 3cdaaba872eb..93ca0f8eb072 100644 --- a/google-cloud-bom/pom.xml +++ b/google-cloud-bom/pom.xml @@ -256,6 +256,17 @@ grpc-google-cloud-bigtable-v2 0.20.2-SNAPSHOT + + com.google.cloud + google-cloud-bigtable-admin + 0.55.2-alpha-SNAPSHOT + + + com.google.cloud + google-cloud-bigtable-admin + 0.55.2-alpha-SNAPSHOT + test-jar + com.google.api.grpc proto-google-cloud-bigtable-admin-v2 diff --git a/google-cloud-clients/google-cloud-bigtable-admin/README.md b/google-cloud-clients/google-cloud-bigtable-admin/README.md new file mode 100644 index 000000000000..5462acd31cdb --- /dev/null +++ b/google-cloud-clients/google-cloud-bigtable-admin/README.md @@ -0,0 +1,134 @@ +# Google Cloud Java Client for Bigtable Admin + +Java idiomatic client for [Cloud Bigtable Admin][cloud-bigtable]. Please note that this client is under +heavy development and is not ready for production use. Please continue to use the +[HBase API client](https://github.com/GoogleCloudPlatform/cloud-bigtable-client) for production. + +[[![CircleCI](https://circleci.com/gh/GoogleCloudPlatform/google-cloud-java/tree/master.svg?style=shield)](https://circleci.com/gh/GoogleCloudPlatform/google-cloud-java/tree/master) +[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/google-cloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/google-cloud-java?branch=master) +[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigtable.svg)](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigtable-admin.svg) +[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/google-cloud-java) +[![Dependency Status](https://www.versioneye.com/user/projects/58fe4c8d6ac171426c414772/badge.svg?style=flat)](https://www.versioneye.com/user/projects/58fe4c8d6ac171426c414772) + +- [Product Documentation][bigtable-product-docs] +- [Client Library Documentation][bigtable-admin-client-lib-docs] + +> Note: This client is under heavy development and should not be used in production. + +## Quickstart + +[//]: # ({x-version-update-start:google-cloud-bigtable-admin:released}) +If you are using Maven, add this to your pom.xml file +```xml + + com.google.cloud + google-cloud-bigtable-admin + 0.55.1-alpha + +``` +If you are using Gradle, add this to your dependencies +```Groovy +compile 'com.google.cloud:google-cloud-bigtable-admin:0.55.1-alpha' +``` +If you are using SBT, add this to your dependencies +```Scala +libraryDependencies += "com.google.cloud" % "google-cloud-bigtable-admin" % "0.55.1-alpha" +``` +[//]: # ({x-version-update-end}) + +## Authentication + +See the +[Authentication](https://github.com/GoogleCloudPlatform/google-cloud-java#authentication) +section in the base directory's README. + +## About Cloud Bigtable Admin + +[Cloud Bigtable][cloud-bigtable] is Google's NoSQL Big Data database service. It's +the same database that powers many core Google services, including Search, Analytics, Maps, and +Gmail. The API is split into the data api and the admin api. This client targets the admin api. + +Be sure to activate the Cloud Bigtable Admin API on the Developer's Console to use Cloud Bigtable +from your project. + +See the [Bigtable Amin client lib docs][bigtable-admin-client-lib-docs] to learn how to +interact with Cloud Bigtable Admin API using this Client Library. + +## Getting Started +#### Prerequisites +For this tutorial, you will need a +[Google Developers Console](https://console.developers.google.com/) project with the Cloud Bigtable +API enabled. You will need to +[enable billing](https://support.google.com/cloud/answer/6158867?hl=en) to use Google Cloud Bigtable. +[Follow these instructions](https://cloud.google.com/docs/authentication#preparation) to get your +project set up. You will also need to set up the local development environment by [installing the +Google Cloud SDK](https://cloud.google.com/sdk/) and running the following commands in command line: +`gcloud auth login`. + +#### Calling Cloud Bigtable + +The Cloud Bigtable API is split into 2 parts: Data API, Instance Admin API and Table Admin API. + +Here is a code snippet showing simple usage of the Table API. Add the following imports +at the top of your file: + + +```java +import com.google.bigtable.admin.v2.ColumnFamily; +import com.google.bigtable.admin.v2.InstanceName; +import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient; +``` + +Then, to create a table, use the following code: +```java +InstanceName instanceName = InstanceName.of("my-project", "my-instance"); + +TableAdminClient tableAdminClient = TableAdminClient.create(instanceName); + +try { + CreateTable createTableReq = TableAdminRequests.createTable("tableId") + .addFamily("cf2", GCRULES.maxVersions(10)); + client.createTable(createTableReq); + +} finally { + tableAdminClient.close(); +} +``` + +## Troubleshooting + +To get help, follow the instructions in the [shared Troubleshooting +document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/troubleshooting/readme.md#troubleshooting). + +Transport +--------- +Bigtable uses gRPC for the transport layer. + +## Java Versions + +Java 7 or above is required for using this client. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + +It is currently in major version zero (`0.y.z`), which means that anything may +change at any time and the public API should not be considered stable. + +## Contributing + +Contributions to this library are always welcome and highly encouraged. + +See [CONTRIBUTING] for more information on how to get started and [DEVELOPING] for a layout of the +codebase. + +## License + +Apache 2.0 - See [LICENSE] for more information. + +[CONTRIBUTING]:https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/CONTRIBUTING.md +[LICENSE]: https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/LICENSE +[cloud-platform]: https://cloud.google.com/ +[cloud-bigtable]: https://cloud.google.com/bigtable/ +[bigtable-product-docs]: https://cloud.google.com/bigtable/docs/ +[bigtable-admin-client-lib-docs]: https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/index.html?com/google/cloud/bigtable/admin/v2/package-summary.html diff --git a/google-cloud-clients/google-cloud-bigtable-admin/pom.xml b/google-cloud-clients/google-cloud-bigtable-admin/pom.xml new file mode 100644 index 000000000000..5754b319013c --- /dev/null +++ b/google-cloud-clients/google-cloud-bigtable-admin/pom.xml @@ -0,0 +1,125 @@ + + + 4.0.0 + google-cloud-bigtable-admin + 0.55.2-alpha-SNAPSHOT + jar + Google Cloud Bigtable Admin + https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-bigtable + + Java idiomatic client for Google Cloud Bigtable Admin API. + + + com.google.cloud + google-cloud-clients + 0.55.2-alpha-SNAPSHOT + + + google-cloud-bigtable-admin + + + + ${project.groupId} + google-cloud-core + + + ${project.groupId} + google-cloud-core-grpc + + + com.google.api.grpc + proto-google-cloud-bigtable-admin-v2 + + + com.google.api.grpc + grpc-google-cloud-bigtable-admin-v2 + test + + + io.grpc + grpc-netty-shaded + + + io.grpc + grpc-stub + + + io.grpc + grpc-auth + + + + com.google.auto.value + auto-value + provided + + + + + ${project.groupId} + google-cloud-core + test-jar + test + + + junit + junit + test + + + org.mockito + mockito-all + test + + + com.google.truth + truth + test + + + com.google.api + gax-grpc + testlib + test + + + io.grpc + grpc-testing + test + + + + + doclint-java8-disable + + [1.8,) + + + + -Xdoclint:none + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.19.1 + + + + integration-test + verify + + + + + classes + true + 2 + + + + + diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettings.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettings.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettings.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettings.java diff --git a/google-cloud-clients/google-cloud-bigtable/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 similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettings.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettings.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettings.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettings.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/TableAdminClient.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/TableAdminClient.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/TableAdminClient.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/TableAdminClient.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/GCRules.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/models/GCRules.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/GCRules.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/models/GCRules.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/TableAdminRequests.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/models/TableAdminRequests.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/TableAdminRequests.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/models/TableAdminRequests.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/TableAdminResponses.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/models/TableAdminResponses.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/TableAdminResponses.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/models/TableAdminResponses.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/package-info.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/package-info.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/package-info.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/package-info.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStubSettings.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStubSettings.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStubSettings.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStubSettings.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStubSettings.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStubSettings.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStubSettings.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStubSettings.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java b/google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTest.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTest.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTest.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTest.java diff --git a/google-cloud-clients/google-cloud-bigtable/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 similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTest.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTest.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdmin.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdmin.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdmin.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdmin.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdminImpl.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdminImpl.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdminImpl.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdminImpl.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdmin.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdmin.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdmin.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdmin.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdminImpl.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdminImpl.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdminImpl.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdminImpl.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/TableAdminClientTest.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/TableAdminClientTest.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/TableAdminClientTest.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/TableAdminClientTest.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java similarity index 92% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java index c593dec8be15..33195f282062 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java +++ b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/it/TableAdminClientIT.java @@ -44,22 +44,20 @@ import org.threeten.bp.Duration; public class TableAdminClientIT { - // TODO(igorbernstein2): remove these properties once admin is split from data client - private static final String ENV_PROPERTY = "bigtable.env"; - private static final String TABLE_PROPERTY_NAME = "bigtable.table"; + private static final String INSTANCE_PROPERTY_NAME = "bigtable.instance"; - static TableAdminClient tableAdmin; + private static TableAdminClient tableAdmin; @BeforeClass public static void createClient() throws IOException { - if (!"prod".equals(System.getProperty(ENV_PROPERTY))) { + String targetInstance = System.getProperty(INSTANCE_PROPERTY_NAME); + + if (targetInstance == null) { tableAdmin = null; return; } - TableName tableName = TableName.parse(System.getProperty(TABLE_PROPERTY_NAME)); - InstanceName instanceName = InstanceName.of(tableName.getProject(), tableName.getInstance()); - + InstanceName instanceName = InstanceName.parse(targetInstance); tableAdmin = TableAdminClient.create(instanceName); } @@ -72,9 +70,9 @@ public static void closeClient() { @Before public void setup() { - // TODO(igorbernstein2): remove this check once admin is split if (tableAdmin == null) { - throw new AssumptionViolatedException("Tests can only run against prod environment"); + throw new AssumptionViolatedException( + INSTANCE_PROPERTY_NAME + " property is not set, skipping integration tests."); } } diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/GCRulesTest.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/models/GCRulesTest.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/GCRulesTest.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/models/GCRulesTest.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/TableAdminRequestsTest.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/models/TableAdminRequestsTest.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/TableAdminRequestsTest.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/models/TableAdminRequestsTest.java diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/TableAdminResponsesTest.java b/google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/models/TableAdminResponsesTest.java similarity index 100% rename from google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/TableAdminResponsesTest.java rename to google-cloud-clients/google-cloud-bigtable-admin/src/test/java/com/google/cloud/bigtable/admin/v2/models/TableAdminResponsesTest.java diff --git a/google-cloud-clients/google-cloud-bigtable/pom.xml b/google-cloud-clients/google-cloud-bigtable/pom.xml index 9500d9296634..80f79859294f 100644 --- a/google-cloud-clients/google-cloud-bigtable/pom.xml +++ b/google-cloud-clients/google-cloud-bigtable/pom.xml @@ -70,6 +70,11 @@ test-jar test + + com.google.api.grpc + grpc-google-cloud-bigtable-admin-v2 + test + junit junit diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/Emulator.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/Emulator.java index 476fe8974b51..55ad55f7a57e 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/Emulator.java +++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/Emulator.java @@ -19,16 +19,15 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.rpc.ClientSettings; import com.google.api.gax.rpc.FixedTransportChannelProvider; -import com.google.cloud.bigtable.data.v2.models.InstanceName; -import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient; -import com.google.cloud.bigtable.admin.v2.BigtableTableAdminSettings; +import com.google.bigtable.admin.v2.BigtableTableAdminGrpc; +import com.google.bigtable.admin.v2.BigtableTableAdminGrpc.BigtableTableAdminBlockingStub; import com.google.cloud.bigtable.data.v2.BigtableDataClient; import com.google.cloud.bigtable.data.v2.BigtableDataSettings; +import com.google.cloud.bigtable.data.v2.models.InstanceName; import com.google.common.io.CharStreams; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; import java.io.BufferedReader; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -38,7 +37,6 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; @@ -56,7 +54,7 @@ class Emulator { private Process process; private boolean isStopped = true; private ManagedChannel channel; - private BigtableTableAdminClient tableAdminClient; + private BigtableTableAdminBlockingStub tableAdminClient; private BigtableDataClient dataClient; private static final InstanceName INSTANCE_NAME = @@ -99,9 +97,9 @@ void start() throws Exception { channel = createChannel(availablePort); - tableAdminClient = - BigtableTableAdminClient.create( - configureClient(BigtableTableAdminSettings.newBuilder()).build()); + tableAdminClient = BigtableTableAdminGrpc.newBlockingStub( + channel + ); dataClient = BigtableDataClient.create( @@ -124,7 +122,6 @@ public void run() { void stop() throws Exception { try { dataClient.close(); - tableAdminClient.close(); channel.shutdownNow(); channel.awaitTermination(1, TimeUnit.MINUTES); } finally { @@ -137,7 +134,7 @@ BigtableDataClient getDataClient() { return dataClient; } - BigtableTableAdminClient getTableAdminClient() { + BigtableTableAdminBlockingStub getTableAdminClient() { return tableAdminClient; } diff --git a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/EmulatorEnv.java b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/EmulatorEnv.java index 4181adc16ce1..3776865944bc 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/EmulatorEnv.java +++ b/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/env/EmulatorEnv.java @@ -21,8 +21,6 @@ import com.google.bigtable.admin.v2.Table; import com.google.bigtable.v2.TableName; import com.google.cloud.bigtable.data.v2.BigtableDataClient; -import java.io.IOException; -import java.util.concurrent.TimeoutException; public class EmulatorEnv implements TestEnv { private static final InstanceName INSTANCE_NAME = diff --git a/google-cloud-clients/pom.xml b/google-cloud-clients/pom.xml index 1f556b7e6b9f..e5a0477d9e36 100644 --- a/google-cloud-clients/pom.xml +++ b/google-cloud-clients/pom.xml @@ -414,6 +414,7 @@ google-cloud-automl google-cloud-bigtable + google-cloud-bigtable-admin google-cloud-bigquery google-cloud-bigquerydatatransfer google-cloud-compute diff --git a/utilities/generate_api.py b/utilities/generate_api.py index dd5fa49f34d6..fc195fe21458 100644 --- a/utilities/generate_api.py +++ b/utilities/generate_api.py @@ -30,7 +30,6 @@ dir_overrides = { - 'bigtable-admin': 'google-cloud-bigtable', 'error-reporting': 'google-cloud-errorreporting', 'spanner-admin-instance': 'google-cloud-spanner', 'spanner-admin-database': 'google-cloud-spanner' diff --git a/versions.txt b/versions.txt index 389b48e46aac..4f206c84c4c8 100644 --- a/versions.txt +++ b/versions.txt @@ -106,6 +106,7 @@ google-cloud-automl:0.55.1-beta:0.55.2-beta-SNAPSHOT google-cloud-bigquery:1.37.1:1.37.2-SNAPSHOT google-cloud-bigquerydatatransfer:0.55.1-beta:0.55.2-beta-SNAPSHOT google-cloud-bigtable:0.55.1-alpha:0.55.2-alpha-SNAPSHOT +google-cloud-bigtable-admin:0.55.1-alpha:0.55.2-alpha-SNAPSHOT google-cloud-bom:0.55.1-alpha:0.55.2-alpha-SNAPSHOT google-cloud-compat-checker:0.55.1-alpha:0.55.2-alpha-SNAPSHOT google-cloud-compute:0.55.1-alpha:0.55.2-alpha-SNAPSHOT