Search in sources :

Example 36 with Timestamp

use of com.google.firebase.Timestamp in project firebase-android-sdk by firebase.

the class MutationTest method verifyOverlayRoundTrips.

private void verifyOverlayRoundTrips(MutableDocument doc, Mutation... mutations) {
    MutableDocument docForMutations = doc.mutableCopy();
    MutableDocument docForOverlay = doc.mutableCopy();
    Timestamp now = Timestamp.now();
    FieldMask mask = null;
    for (Mutation m : mutations) {
        mask = m.applyToLocalView(docForMutations, mask, now);
    }
    Mutation overlay = calculateOverlayMutation(docForMutations, mask);
    if (overlay != null) {
        overlay.applyToLocalView(docForOverlay, /* previousMask= */
        null, now);
    }
    assertEquals(getDescription(doc, Arrays.asList(mutations), overlay), docForOverlay, docForMutations);
}
Also used : MutableDocument(com.google.firebase.firestore.model.MutableDocument) TestUtil.deleteMutation(com.google.firebase.firestore.testutil.TestUtil.deleteMutation) TestUtil.setMutation(com.google.firebase.firestore.testutil.TestUtil.setMutation) TestUtil.patchMutation(com.google.firebase.firestore.testutil.TestUtil.patchMutation) TestUtil.mergeMutation(com.google.firebase.firestore.testutil.TestUtil.mergeMutation) Mutation.calculateOverlayMutation(com.google.firebase.firestore.model.mutation.Mutation.calculateOverlayMutation) Timestamp(com.google.firebase.Timestamp)

Aggregations

Timestamp (com.google.firebase.Timestamp)36 Test (org.junit.Test)18 MutableDocument (com.google.firebase.firestore.model.MutableDocument)7 Date (java.util.Date)6 DocumentKey (com.google.firebase.firestore.model.DocumentKey)5 SnapshotVersion (com.google.firebase.firestore.model.SnapshotVersion)5 ArrayList (java.util.ArrayList)5 GeoPoint (com.google.firebase.firestore.GeoPoint)4 ObjectValue (com.google.firebase.firestore.model.ObjectValue)4 TestUtil.wrapObject (com.google.firebase.firestore.testutil.TestUtil.wrapObject)4 Mutation (com.google.firebase.firestore.model.mutation.Mutation)3 Mutation.calculateOverlayMutation (com.google.firebase.firestore.model.mutation.Mutation.calculateOverlayMutation)3 TestUtil.deleteMutation (com.google.firebase.firestore.testutil.TestUtil.deleteMutation)3 TestUtil.mergeMutation (com.google.firebase.firestore.testutil.TestUtil.mergeMutation)3 TestUtil.patchMutation (com.google.firebase.firestore.testutil.TestUtil.patchMutation)3 TestUtil.setMutation (com.google.firebase.firestore.testutil.TestUtil.setMutation)3 Value (com.google.firestore.v1.Value)3 HashMap (java.util.HashMap)3 FieldValue (com.google.firebase.firestore.FieldValue)2 Query (com.google.firebase.firestore.core.Query)2