use of com.swiftmq.impl.routing.single.smqpr.v942.CommitRequest in project java-firestore by googleapis.
the class DocumentReferenceTest method setWithArrayUnion.
@Test
public void setWithArrayUnion() throws Exception {
doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE).when(firestoreMock).sendRequest(commitCapture.capture(), Matchers.<UnaryCallable<CommitRequest, CommitResponse>>any());
documentReference.set(map("foo", FieldValue.arrayUnion("bar", map("foo", "baz")))).get();
CommitRequest set = commit(set(Collections.emptyMap()), transform("foo", arrayUnion(string("bar"), object("foo", string("baz")))));
CommitRequest commitRequest = commitCapture.getValue();
assertCommitEquals(set, commitRequest);
}
use of com.swiftmq.impl.routing.single.smqpr.v942.CommitRequest in project java-firestore by googleapis.
the class DocumentReferenceTest method createWithServerTimestamp.
@Test
public void createWithServerTimestamp() throws Exception {
doReturn(SINGLE_WRITE_COMMIT_RESPONSE).when(firestoreMock).sendRequest(commitCapture.capture(), Matchers.<UnaryCallable<CommitRequest, CommitResponse>>any());
documentReference.create(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP).get();
documentReference.create(LocalFirestoreHelper.SERVER_TIMESTAMP_OBJECT).get();
CommitRequest create = commit(create(Collections.emptyMap()), transform("foo", serverTimestamp(), "inner.bar", serverTimestamp()));
List<CommitRequest> commitRequests = commitCapture.getAllValues();
assertCommitEquals(create, commitRequests.get(0));
assertCommitEquals(create, commitRequests.get(1));
}
use of com.swiftmq.impl.routing.single.smqpr.v942.CommitRequest in project java-firestore by googleapis.
the class DocumentReferenceTest method mergeWithServerTimestamps.
@Test
public void mergeWithServerTimestamps() throws Exception {
doReturn(SINGLE_WRITE_COMMIT_RESPONSE).when(firestoreMock).sendRequest(commitCapture.capture(), Matchers.<UnaryCallable<CommitRequest, CommitResponse>>any());
documentReference.set(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP, SetOptions.mergeFields("inner.bar")).get();
documentReference.set(LocalFirestoreHelper.SERVER_TIMESTAMP_OBJECT, SetOptions.mergeFields("inner.bar")).get();
CommitRequest set = commit(set(SERVER_TIMESTAMP_PROTO, new ArrayList<>()), transform("inner.bar", serverTimestamp()));
List<CommitRequest> commitRequests = commitCapture.getAllValues();
assertCommitEquals(set, commitRequests.get(0));
assertCommitEquals(set, commitRequests.get(1));
}
use of com.swiftmq.impl.routing.single.smqpr.v942.CommitRequest in project java-firestore by googleapis.
the class DocumentReferenceTest method setWithIncrement.
@Test
public void setWithIncrement() throws Exception {
doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE).when(firestoreMock).sendRequest(commitCapture.capture(), Matchers.<UnaryCallable<CommitRequest, CommitResponse>>any());
documentReference.set(map("integer", FieldValue.increment(1), "double", FieldValue.increment(1.1))).get();
CommitRequest set = commit(set(Collections.emptyMap()), transform("integer", increment(Value.newBuilder().setIntegerValue(1).build()), "double", increment(Value.newBuilder().setDoubleValue(1.1).build())));
CommitRequest commitRequest = commitCapture.getValue();
assertCommitEquals(set, commitRequest);
}
use of com.swiftmq.impl.routing.single.smqpr.v942.CommitRequest in project java-firestore by googleapis.
the class DocumentReferenceTest method setWithServerTimestamp.
@Test
public void setWithServerTimestamp() throws Exception {
doReturn(FIELD_TRANSFORM_COMMIT_RESPONSE).when(firestoreMock).sendRequest(commitCapture.capture(), Matchers.<UnaryCallable<CommitRequest, CommitResponse>>any());
documentReference.set(LocalFirestoreHelper.SERVER_TIMESTAMP_MAP).get();
documentReference.set(LocalFirestoreHelper.SERVER_TIMESTAMP_OBJECT).get();
CommitRequest set = commit(set(SERVER_TIMESTAMP_PROTO), transform("foo", serverTimestamp(), "inner.bar", serverTimestamp()));
List<CommitRequest> commitRequests = commitCapture.getAllValues();
assertCommitEquals(set, commitRequests.get(0));
assertCommitEquals(set, commitRequests.get(1));
}
Aggregations