Skip to content

Firestore: Port @DocumentId to server SDK - #5743

Merged
BenWhitehead merged 7 commits into
masterfrom
unknown repository
Jul 18, 2019
Merged

Firestore: Port @DocumentId to server SDK#5743
BenWhitehead merged 7 commits into
masterfrom
unknown repository

Conversation

@ghost

Copy link
Copy Markdown

Also add MapperTests.

@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 15, 2019
@chingor13chingor13 changed the title Port @DocumentId to server SDKFirestore: Port @DocumentId to server SDKJul 17, 2019

@BenWhiteheadBenWhitehead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small questions, nothing major.

I assume this is being ported from the android SDK, is there a bread crumb we can to that implementation for a record of where this code is coming from?

return data == null ? null : CustomClassMapper.convertToCustomClass(getData(), valueType);
return data == null
? null
: CustomClassMapper.convertToCustomClass(getData(), valueType, docRef);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it valid to pass data in here, rather than calling getData() again?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes,

import java.util.Map;

/** A set of utilities for tests */
public class TestUtil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be package local since it's only used for firestore tests?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
<scope>test</scope>
</dependency>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate dependency declaration, and formatting in consistent with the rest of the file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

}

/** Holds information a deserialization operation needs to complete the job. */
static class DeserializeContext {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this is package-private instead of private?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@codecov

codecovBot commented Jul 17, 2019

Copy link
Copy Markdown

Codecov Report

Merging #5743 into master will increase coverage by 0.75%.
The diff coverage is 77.77%.

Impacted file tree graph

@@ Coverage Diff @@## master #5743 +/- ##
============================================
+ Coverage 46.42% 47.17% +0.75% - Complexity 23633 25115 +1482 
============================================
Files 2389 2389 Lines 254506 259831 +5325 Branches 28467 29420 +953 ============================================
+ Hits 118144 122582 +4438 - Misses 127547 128321 +774 - Partials 8815 8928 +113
Impacted FilesCoverage ΔComplexity Δ
...a/com/google/cloud/firestore/DocumentSnapshot.java85.71% <0%> (ø)55 <0> (ø)⬇️
...java/com/google/cloud/firestore/QuerySnapshot.java68.51% <100%> (+1.21%)9 <0> (ø)⬇️
.../com/google/cloud/firestore/CustomClassMapper.java77.29% <77.87%> (+36.54%)102 <1> (+47)⬆️
...re/src/main/java/com/google/cloud/BaseService.java55.55% <0%> (-6.95%)2% <0%> (ø)
...re/src/main/java/com/google/cloud/RetryHelper.java50% <0%> (-3.85%)2% <0%> (ø)
...le/cloud/compute/deprecated/DeprecationStatus.java88.63% <0%> (-3.13%)20% <0%> (ø)
...m/google/cloud/tasks/v2beta3/CloudTasksClient.java57.43% <0%> (-2.68%)67% <0%> (+16%)
...va/com/google/cloud/tasks/v2/CloudTasksClient.java57.43% <0%> (-2.68%)67% <0%> (+16%)
...m/google/cloud/tasks/v2beta2/CloudTasksClient.java57.14% <0%> (-2.39%)79% <0%> (+19%)
...oogle/cloud/firestore/v1/FirestoreAdminClient.java59.84% <0%> (-2.23%)38% <0%> (+8%)
... and 649 more

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 41551f5...e6af407. Read the comment docs.

@ghostghost left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The best doc i can find explaining this is https://docs.google.com/document/d/1seUfCzHSv7WXJgoJrtVMCh36HTco7lIrMHZlwCErs40/edit?usp=sharing

Requires corp account to view.

<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
<scope>test</scope>
</dependency>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

return data == null ? null : CustomClassMapper.convertToCustomClass(getData(), valueType);
return data == null
? null
: CustomClassMapper.convertToCustomClass(getData(), valueType, docRef);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes,

import java.util.Map;

/** A set of utilities for tests */
public class TestUtil {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

/** Holds information a deserialization operation needs to complete the job. */
static class DeserializeContext {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@BenWhitehead

Copy link
Copy Markdown
Contributor

Thanks for addressing my comments and adding the link to the doc @hui-wu.

Can you run the code formatter again, that is one of the builds that are currently failing.

import java.util.Map;

/** A set of utilities for tests */
class TestUtil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@schmidt-sebastianschmidt-sebastian left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please merge the two TestUtil classes.

@BenWhitehead
BenWhitehead merged commit 2b28ae1 into googleapis:masterJul 18, 2019
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@BenWhitehead@schmidt-sebastian@googlebot@wu-hui