Skip to content

Commit

Permalink
chore: sync with main (#941)
Browse files Browse the repository at this point in the history
* chore: upgrade native image checks to graalvm-22.3.0  (#1718) (#926)

chore: upgrade native image checks to graalvm-22.3.0
Source-Link: googleapis/synthtool@5e52896
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:27b1b1884dce60460d7521b23c2a73376cba90c0ef3d9f0d32e4bdb786959cfd

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* chore: add new branch to sync-repo-settings (#927)

* fix: #355 Explicitly passing --project argument when starting emulator (#923)

* Running gcloud datastore emulator with --project argument

* Allow user to pass a custom project id when creating a new LocalDatastoreHelper instance

* Creating a local variable to increase the readability and emphasizing on the fact that project id not nullable now

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.5.5 (#929)

* deps: update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 (#931)

* deps: update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 (#930)

* deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 (#932)

* chore(main): release 2.13.0 (#921)

:robot: I have created a release *beep* *boop*
---


## [2.13.0](https://togithub.com/googleapis/java-datastore/compare/v2.12.5...v2.13.0) (2022-12-06)


### Features

* Next release from main branch is 2.13.0 ([#917](https://togithub.com/googleapis/java-datastore/issues/917)) ([1f12435](https://togithub.com/googleapis/java-datastore/commit/1f1243577cbdc206b6a0bfcde818411eb1b806ad))


### Bug Fixes

* [#355](https://togithub.com/googleapis/java-datastore/issues/355) Explicitly passing --project argument when starting emulator ([#923](https://togithub.com/googleapis/java-datastore/issues/923)) ([ef4065d](https://togithub.com/googleapis/java-datastore/commit/ef4065d233b968f58a34673aa53d39f60a013e2d))


### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 ([#932](https://togithub.com/googleapis/java-datastore/issues/932)) ([1dbcea7](https://togithub.com/googleapis/java-datastore/commit/1dbcea73827961148800c1ec8e87065dbceb6c88))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.18 ([#924](https://togithub.com/googleapis/java-datastore/issues/924)) ([625e896](https://togithub.com/googleapis/java-datastore/commit/625e89685172ae546a813f5f7184223d01fbb0ac))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 ([#930](https://togithub.com/googleapis/java-datastore/issues/930)) ([77285be](https://togithub.com/googleapis/java-datastore/commit/77285be97fbd6bca1ada35202842238e306dd8dc))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.18 ([#925](https://togithub.com/googleapis/java-datastore/issues/925)) ([0c7539d](https://togithub.com/googleapis/java-datastore/commit/0c7539d736ec993d7bb0531d7cd4dab1b08487a0))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 ([#931](https://togithub.com/googleapis/java-datastore/issues/931)) ([40b4011](https://togithub.com/googleapis/java-datastore/commit/40b4011e3a826a91e33541efdecb05f0e129f87c))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).

* chore(deps): update dependency com.google.cloud:google-cloud-datastore to v2.13.0 (#935)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-datastore](https://togithub.com/googleapis/java-datastore) | `2.12.5` -> `2.13.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/compatibility-slim/2.12.5)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-datastore/2.13.0/confidence-slim/2.12.5)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-datastore</summary>

### [`v2.13.0`](https://togithub.com/googleapis/java-datastore/blob/HEAD/CHANGELOG.md#&#8203;2130-httpsgithubcomgoogleapisjava-datastorecomparev2125v2130-2022-12-06)

[Compare Source](https://togithub.com/googleapis/java-datastore/compare/v2.12.5...v2.13.0)

##### Features

-   Next release from main branch is 2.13.0 ([#&#8203;917](https://togithub.com/googleapis/java-datastore/issues/917)) ([1f12435](https://togithub.com/googleapis/java-datastore/commit/1f1243577cbdc206b6a0bfcde818411eb1b806ad))

##### Bug Fixes

-   [#&#8203;355](https://togithub.com/googleapis/java-datastore/issues/355) Explicitly passing --project argument when starting emulator ([#&#8203;923](https://togithub.com/googleapis/java-datastore/issues/923)) ([ef4065d](https://togithub.com/googleapis/java-datastore/commit/ef4065d233b968f58a34673aa53d39f60a013e2d))

##### Dependencies

-   Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 ([#&#8203;932](https://togithub.com/googleapis/java-datastore/issues/932)) ([1dbcea7](https://togithub.com/googleapis/java-datastore/commit/1dbcea73827961148800c1ec8e87065dbceb6c88))
-   Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.18 ([#&#8203;924](https://togithub.com/googleapis/java-datastore/issues/924)) ([625e896](https://togithub.com/googleapis/java-datastore/commit/625e89685172ae546a813f5f7184223d01fbb0ac))
-   Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 ([#&#8203;930](https://togithub.com/googleapis/java-datastore/issues/930)) ([77285be](https://togithub.com/googleapis/java-datastore/commit/77285be97fbd6bca1ada35202842238e306dd8dc))
-   Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.18 ([#&#8203;925](https://togithub.com/googleapis/java-datastore/issues/925)) ([0c7539d](https://togithub.com/googleapis/java-datastore/commit/0c7539d736ec993d7bb0531d7cd4dab1b08487a0))
-   Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 ([#&#8203;931](https://togithub.com/googleapis/java-datastore/issues/931)) ([40b4011](https://togithub.com/googleapis/java-datastore/commit/40b4011e3a826a91e33541efdecb05f0e129f87c))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-datastore).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->

* chore(main): release 2.13.1-SNAPSHOT (#934)

:robot: I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).

* chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport (#933)

* chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport

chore: disallow "transport=rest" for services where numeric enums are not confirmed to be supported (except in PHP and Java)
PiperOrigin-RevId: 493113566

Source-Link: googleapis/googleapis@758f0d1

Source-Link: googleapis/googleapis-gen@78bd8f0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzhiZDhmMDVlMTI3NjM2M2ViMTRlYWU3MGU5MWZlNGJjMjA3MDNhYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* build(deps): bump certifi from 2022.9.24 to 2022.12.7 in /synthtool/gcp/templates/java_library/.kokoro (#1732) (#937)

build(deps): bump certifi

Bumps [certifi](https://togithub.com/certifi/python-certifi) from 2022.9.24 to 2022.12.7.
- [Release notes](https://togithub.com/certifi/python-certifi/releases)
- [Commits](https://togithub.com/certifi/python-certifi/compare/2022.09.24...2022.12.07)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jeff Ching <chingor@google.com>
Source-Link: https://togithub.com/googleapis/synthtool/commit/ae0d43e5f17972981fe501ecf5a5d20055128bea
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:9de537d592b60e5eac73b374a28263969bae91ecdb29b445e894576fbf54851c

* chore(deps): update dependency com.google.cloud:libraries-bom to v26.2.0 (#938)

* chore(deps): update dependency com.google.cloud:libraries-bom to v26.2.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Prateek <jainsahab@google.com>
Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jeff Ching <chingor@google.com>
  • Loading branch information
8 people authored Dec 19, 2022
1 parent dee8cb4 commit 26e6733
Show file tree
Hide file tree
Showing 23 changed files with 113 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
digest: sha256:e76136cc48f90aa19ba29cdfbd4002111467e44a1c9d905867d98dafafbd03bb
digest: sha256:9de537d592b60e5eac73b374a28263969bae91ecdb29b445e894576fbf54851c
17 changes: 17 additions & 0 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ branchProtectionRules:
- OwlBot Post Processor
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- pattern: multi-db
isAdminEnforced: true
requiredApprovingReviewCount: 1
requiresCodeOwnerReviews: true
requiresStrictStatusChecks: false
requiredStatusCheckContexts:
- dependencies (8)
- dependencies (11)
- lint
- clirr
- units (8)
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- OwlBot Post Processor
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
permissionRules:
- team: yoshi-admins
permission: admin
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native-17.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17"
value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17:22.3.0"
}

env_vars: {
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/graalvm"
value: "gcr.io/cloud-devrel-kokoro-resources/graalvm:22.3.0"
}

env_vars: {
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pycparser==2.21
pyperclip==1.8.2
python-dateutil==2.8.2
requests==2.27.1
certifi==2022.9.24
certifi==2022.12.7
importlib-metadata==4.8.3
zipp==3.6.0
google_api_core==2.8.2
Expand Down
6 changes: 3 additions & 3 deletions .kokoro/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ cachetools==4.2.4 \
# via
# -r requirements.in
# google-auth
certifi==2022.9.24 \
--hash=sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14 \
--hash=sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382
certifi==2022.12.7 \
--hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \
--hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18
# via
# -r requirements.in
# requests
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## [2.13.0](https://github.com/googleapis/java-datastore/compare/v2.12.5...v2.13.0) (2022-12-06)


### Features

* Next release from main branch is 2.13.0 ([#917](https://github.com/googleapis/java-datastore/issues/917)) ([1f12435](https://github.com/googleapis/java-datastore/commit/1f1243577cbdc206b6a0bfcde818411eb1b806ad))


### Bug Fixes

* [#355](https://github.com/googleapis/java-datastore/issues/355) Explicitly passing --project argument when starting emulator ([#923](https://github.com/googleapis/java-datastore/issues/923)) ([ef4065d](https://github.com/googleapis/java-datastore/commit/ef4065d233b968f58a34673aa53d39f60a013e2d))


### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 ([#932](https://github.com/googleapis/java-datastore/issues/932)) ([1dbcea7](https://github.com/googleapis/java-datastore/commit/1dbcea73827961148800c1ec8e87065dbceb6c88))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.18 ([#924](https://github.com/googleapis/java-datastore/issues/924)) ([625e896](https://github.com/googleapis/java-datastore/commit/625e89685172ae546a813f5f7184223d01fbb0ac))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 ([#930](https://github.com/googleapis/java-datastore/issues/930)) ([77285be](https://github.com/googleapis/java-datastore/commit/77285be97fbd6bca1ada35202842238e306dd8dc))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.18 ([#925](https://github.com/googleapis/java-datastore/issues/925)) ([0c7539d](https://github.com/googleapis/java-datastore/commit/0c7539d736ec993d7bb0531d7cd4dab1b08487a0))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 ([#931](https://github.com/googleapis/java-datastore/issues/931)) ([40b4011](https://github.com/googleapis/java-datastore/commit/40b4011e3a826a91e33541efdecb05f0e129f87c))

## [2.12.5](https://github.com/googleapis/java-datastore/compare/v2.12.4...v2.12.5) (2022-11-08)


Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.1.5</version>
<version>26.2.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -41,7 +41,7 @@ If you are using Maven without BOM, add this to your dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore</artifactId>
<version>2.12.5</version>
<version>2.13.0</version>
</dependency>

```
Expand Down
4 changes: 2 additions & 2 deletions datastore-v1-proto-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud.datastore</groupId>
<artifactId>datastore-v1-proto-client</artifactId>
<version>2.12.6-SNAPSHOT</version><!-- {x-version-update:datastore-v1-proto-client:current} -->
<version>2.13.1-SNAPSHOT</version><!-- {x-version-update:datastore-v1-proto-client:current} -->

<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore-parent</artifactId>
<version>2.12.6-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
<version>2.13.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
</parent>

<packaging>jar</packaging>
Expand Down
12 changes: 6 additions & 6 deletions google-cloud-datastore-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore-bom</artifactId>
<version>2.12.6-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore-bom:current} -->
<version>2.13.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore-bom:current} -->
<packaging>pom</packaging>
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-shared-config</artifactId>
<version>1.5.4</version>
<version>1.5.5</version>
</parent>

<name>Google Cloud datastore BOM</name>
Expand Down Expand Up @@ -52,22 +52,22 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore</artifactId>
<version>2.12.6-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
<version>2.13.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-datastore-admin-v1</artifactId>
<version>2.12.6-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-datastore-admin-v1:current} -->
<version>2.13.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-datastore-admin-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-datastore-v1</artifactId>
<version>0.103.6-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
<version>0.104.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-datastore-admin-v1</artifactId>
<version>2.12.6-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-admin-v1:current} -->
<version>2.13.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-admin-v1:current} -->
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
4 changes: 2 additions & 2 deletions google-cloud-datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>google-cloud-datastore</artifactId>
<version>2.12.6-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
<version>2.13.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
<packaging>jar</packaging>
<name>Google Cloud Datastore</name>
<url>https://github.com/googleapis/java-datastore</url>
Expand All @@ -12,7 +12,7 @@
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore-parent</artifactId>
<version>2.12.6-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
<version>2.13.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
</parent>
<properties>
<site.installationModule>google-cloud-datastore</site.installationModule>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,13 @@ public class HttpJsonDatastoreAdminStub extends DatastoreAdminStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<ExportEntitiesRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearProjectId().build(), false))
.toBody("*", request.toBuilder().clearProjectId().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
Expand Down Expand Up @@ -136,12 +137,13 @@ public class HttpJsonDatastoreAdminStub extends DatastoreAdminStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<ImportEntitiesRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().clearProjectId().build(), false))
.toBody("*", request.toBuilder().clearProjectId().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
Expand Down Expand Up @@ -175,12 +177,13 @@ public class HttpJsonDatastoreAdminStub extends DatastoreAdminStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<CreateIndexRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("index", request.getIndex(), false))
.toBody("index", request.getIndex(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
Expand Down Expand Up @@ -215,6 +218,7 @@ public class HttpJsonDatastoreAdminStub extends DatastoreAdminStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<DeleteIndexRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -251,6 +255,7 @@ public class HttpJsonDatastoreAdminStub extends DatastoreAdminStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<GetIndexRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -287,6 +292,7 @@ public class HttpJsonDatastoreAdminStub extends DatastoreAdminStub {
serializer.putQueryParam(fields, "filter", request.getFilter());
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.google.cloud.datastore.testing;

import static com.google.common.base.MoreObjects.firstNonNull;

import com.google.api.core.InternalApi;
import com.google.cloud.NoCredentials;
import com.google.cloud.ServiceOptions;
Expand Down Expand Up @@ -69,7 +71,9 @@ public class LocalDatastoreHelper extends BaseEmulatorHelper<DatastoreOptions> {

// Common settings
private static final String CONSISTENCY_FLAG = "--consistency=";
private static final String PROJECT_FLAG = "--project=";
private static final double DEFAULT_CONSISTENCY = 0.9;
private static final String DEFAULT_PROJECT_ID = PROJECT_ID_PREFIX + UUID.randomUUID();

private static final Logger LOGGER = Logger.getLogger(LocalDatastoreHelper.class.getName());

Expand Down Expand Up @@ -98,6 +102,7 @@ public static class Builder {
private int port;
private Path dataDir;
private boolean storeOnDisk = true;
private String projectId;

private Builder() {}

Expand All @@ -117,6 +122,11 @@ public Builder setPort(int port) {
return this;
}

public Builder setProjectId(String projectId) {
this.projectId = projectId;
return this;
}

public Builder setDataDir(Path dataDir) {
this.dataDir = dataDir;
return this;
Expand All @@ -137,7 +147,8 @@ private LocalDatastoreHelper(Builder builder) {
super(
"datastore",
builder.port > 0 ? builder.port : BaseEmulatorHelper.findAvailablePort(DEFAULT_PORT),
PROJECT_ID_PREFIX + UUID.randomUUID().toString());
firstNonNull(builder.projectId, DEFAULT_PROJECT_ID));
String projectId = firstNonNull(builder.projectId, DEFAULT_PROJECT_ID);
this.consistency = builder.consistency > 0 ? builder.consistency : DEFAULT_CONSISTENCY;
this.gcdPath = builder.dataDir;
this.storeOnDisk = builder.storeOnDisk;
Expand All @@ -148,6 +159,7 @@ private LocalDatastoreHelper(Builder builder) {
List<String> gcloudCommand = new ArrayList<>(Arrays.asList(GCLOUD_CMD_TEXT.split(" ")));
gcloudCommand.add(GCLOUD_CMD_PORT_FLAG + "localhost:" + getPort());
gcloudCommand.add(CONSISTENCY_FLAG + builder.consistency);
gcloudCommand.add(PROJECT_FLAG + projectId);
if (!builder.storeOnDisk) {
gcloudCommand.add("--no-store-on-disk");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ public void testCreateWithBuilder() {
assertTrue(incompleteHelper.getProjectId().startsWith(PROJECT_ID_PREFIX));
}

@Test
public void testCreateWithCustomProjectId() {
String customProjectId = "custom-project-id";
LocalDatastoreHelper helper =
LocalDatastoreHelper.newBuilder().setProjectId(customProjectId).build();
assertEquals(customProjectId, helper.getProjectId());
}

@Test
public void testCreateWithToBuilder() throws IOException {
LocalDatastoreHelper helper =
Expand Down
4 changes: 2 additions & 2 deletions grpc-google-cloud-datastore-admin-v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-datastore-admin-v1</artifactId>
<version>2.12.6-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-datastore-admin-v1:current} -->
<version>2.13.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-datastore-admin-v1:current} -->
<name>grpc-google-cloud-datastore-admin-v1</name>
<description>GRPC library for google-cloud-datastore</description>
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore-parent</artifactId>
<version>2.12.6-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
<version>2.13.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
</parent>
<dependencies>
<dependency>
Expand Down
Loading

0 comments on commit 26e6733

Please sign in to comment.