KEMBAR78
feat: add method to set emulator host programmatically (#319) by Gerschtli · Pull Request #336 · googleapis/java-firestore · GitHub
Skip to content

Conversation

@Gerschtli
Copy link
Contributor

See for initial discussion: #319

Fixes #319, #210.
Relates to #190.
Similar issues in other SDKs: googleapis/google-cloud-go#1978, firebase/firebase-admin-node#776.

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 15, 2020
@codecov
Copy link

codecov bot commented Aug 15, 2020

Codecov Report

Merging #336 into master will decrease coverage by 0.10%.
The diff coverage is 37.50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #336      +/-   ##
============================================
- Coverage     72.75%   72.64%   -0.11%     
- Complexity     1044     1047       +3     
============================================
  Files            64       64              
  Lines          5512     5535      +23     
  Branches        681      686       +5     
============================================
+ Hits           4010     4021      +11     
- Misses         1289     1301      +12     
  Partials        213      213              
Impacted Files Coverage Δ Complexity Δ
...a/com/google/cloud/firestore/FirestoreOptions.java 35.89% <37.50%> (-0.47%) 7.00 <0.00> (ø)
.../com/google/cloud/firestore/CustomClassMapper.java 76.84% <0.00%> (-0.73%) 111.00% <0.00%> (+2.00%) ⬇️
...in/java/com/google/cloud/firestore/BulkWriter.java 71.49% <0.00%> (+0.46%) 29.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 56331bf...e1e3886. Read the comment docs.

@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/java-firestore API. label Aug 21, 2020
@BenWhitehead
Copy link
Collaborator

Apologies on the delayed review, one small request in the javadoc comment but other than it looks good.

@Gerschtli Gerschtli force-pushed the add-set-emulator-host branch from f0f80c4 to e1e3886 Compare August 27, 2020 21:28
@Gerschtli
Copy link
Contributor Author

Thank you for your input. Updated the JavaDoc.

@BenWhitehead
Copy link
Collaborator

Thanks for adding this @Gerschtli!

I was successfully able to use it in a testing project by doing the following:

    final Firestore ds = FirestoreOptions.getDefaultInstance().toBuilder()
        .setEmulatorHost("localhost:8081")
        .setCredentials(new FirestoreOptions.EmulatorCredentials())
        .setProjectId("testing")
        .build()
        .getService();

@BenWhitehead BenWhitehead added kokoro:run Add this label to force Kokoro to re-run the tests. automerge Merge the pull request once unit tests and other checks pass. labels Aug 27, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 27, 2020
@Gerschtli
Copy link
Contributor Author

In fact you should be able to drop the line .setCredentials(new FirestoreOptions.EmulatorCredentials()).

@gcf-merge-on-green gcf-merge-on-green bot merged commit 97037f4 into googleapis:master Aug 27, 2020
@BenWhitehead
Copy link
Collaborator

The credentials line is necessary for some admin related operations, so I always include it.

@Gerschtli Gerschtli deleted the add-set-emulator-host branch August 28, 2020 05:24
@Gerschtli
Copy link
Contributor Author

But the credentials will be overridden in the build method via this.setCredentialsProvider(FixedCredentialsProvider.create(new EmulatorCredentials()));. This should be the same as your credentials or did I miss something?

gcf-merge-on-green bot pushed a commit that referenced this pull request Sep 15, 2020
🤖 I have created a release \*beep\* \*boop\* 
---
## [2.1.0](https://www.github.com/googleapis/java-firestore/compare/v2.0.0...v2.1.0) (2020-09-10)


### Features

* add method to set emulator host programmatically ([#319](https://www.github.com/googleapis/java-firestore/issues/319)) ([#336](https://www.github.com/googleapis/java-firestore/issues/336)) ([97037f4](https://www.github.com/googleapis/java-firestore/commit/97037f42f76e9df3ae458d4e2b04336e64b834c3)), closes [#210](https://www.github.com/googleapis/java-firestore/issues/210) [#190](https://www.github.com/googleapis/java-firestore/issues/190)
* add opencensus tracing support ([#360](https://www.github.com/googleapis/java-firestore/issues/360)) ([edaa539](https://www.github.com/googleapis/java-firestore/commit/edaa5395be0353fb261d954429c624623bc4e346))
* add support for != and NOT_IN queries ([#350](https://www.github.com/googleapis/java-firestore/issues/350)) ([68aff5b](https://www.github.com/googleapis/java-firestore/commit/68aff5b406fb2732951750f3d5f9768df6ee12b5))
* generate protos to add NOT_EQUAL, NOT_IN, IS_NOT_NAN, IS_NOT_NULL query operators ([#343](https://www.github.com/googleapis/java-firestore/issues/343)) ([3fb1b63](https://www.github.com/googleapis/java-firestore/commit/3fb1b631f8dd087f0f3e1c43363e9642f497993a))


### Bug Fixes

* **samples:** re-add maven exec config for Quickstart sample ([#347](https://www.github.com/googleapis/java-firestore/issues/347)) ([4c2329b](https://www.github.com/googleapis/java-firestore/commit/4c2329bf89ffab4bd3060e16e1cf231b7caf4653))
* add support to deserialize to custom Lists and Maps ([#337](https://www.github.com/googleapis/java-firestore/issues/337)) ([dc897e0](https://www.github.com/googleapis/java-firestore/commit/dc897e00a85e745f57f615460b29d17b7dd247c6))


### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.9.0 ([#352](https://www.github.com/googleapis/java-firestore/issues/352)) ([783d41e](https://www.github.com/googleapis/java-firestore/commit/783d41e167c7c79957faeeebd7a76ab72b5b157d))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: firestore Issues related to the googleapis/java-firestore API. automerge Merge the pull request once unit tests and other checks pass. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a setter for emulator host

3 participants