Skip to content

Index-Free (1/6): Adding LocalStoreTestHelper for NO_CHANGE event #614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 22, 2019

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Jul 15, 2019

This is the first of 6 PRs for "index-free" querying.

This PR just adds a test helper to send a resume token (for LocalStoreTest). As part of this, I had to move TestTargetMetadataProvider to a different TestUtil.java (on a related note, we have too many of those...)

@schmidt-sebastian schmidt-sebastian changed the title Adding LocalStoreTestHelper for NO_CHANGE event Index-Free (1/6): Adding LocalStoreTestHelper for NO_CHANGE event Jul 15, 2019
Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

All the instances you've replaced are WatchTargetChangeType.Current not WatchTargetChangeType.NoChange. This doesn't seem right.

* `TargetMetadataProvider` callbacks. Any target accessed via these callbacks must be registered
* beforehand via `setSyncedKeys()`.
*/
public static class TestTargetMetadataProvider
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider making this just a top-level class (i.e. in its own source file).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -138,36 +138,6 @@ public static QuerySnapshot querySnapshot(
return new QuerySnapshot(query(path), viewSnapshot, FIRESTORE);
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for doing this. At some point we should probably cut these down to the minimum, given the assumption there's no reasonable way to share with the main Firestore testutil.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FWIW, only half of the methods are currently used, but it doesn't seem trivial to just put them in the test class (so I refrained from doing this for now).

WatchChangeAggregator aggregator = new WatchChangeAggregator(testTargetMetadataProvider);

WatchTargetChange watchChange =
new WatchTargetChange(WatchTargetChangeType.Current, asList(targetId), resumeToken);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a current change, not a no-change. Why are these are substitutable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since works because we persist the resume token for both NO_CHANGE and CURRENT:


@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff Jul 18, 2019
Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

LGTM

@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff Jul 20, 2019
@schmidt-sebastian schmidt-sebastian merged commit 725bd2f into master Jul 22, 2019
@firebase firebase locked and limited conversation to collaborators Oct 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants