Skip to content

Commit 062afab

Browse files
gremi64sduskis
authored andcommitted
---
yaml --- r: 13623 b: refs/heads/autosynth-dlp c: 64f3b2b h: refs/heads/master i: 13621: a01dd74 13619: 17aac4a 13615: a4ae685
1 parent 541e874 commit 062afab

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ refs/tags/v0.60.0: 4cd518d0612329f8a8e53484eef4cd1651e32855
104104
refs/tags/v0.61.0: e4b526656bb1bf5eefd0ee578b7405147821225e
105105
refs/tags/v0.62.0: bbede7385d48ba08f487bdd29ec10668ace96396
106106
refs/heads/0.60.0-alpha: 10939381ffe0b8da32db4fe3087c86e3aa7f3e55
107-
refs/heads/autosynth-dlp: bb2bb7cff5766d2070a8421d902e4af1c9c18bac
107+
refs/heads/autosynth-dlp: 64f3b2be23eab15df420e5890f14409fa52c8411
108108
refs/heads/autosynth-logging: f8794c50a64f62b167cddf42513d133547679e01
109109
refs/heads/dupes: 3478c5d81fd242d0e985656645a679420a2060c2
110110
refs/tags/v0.63.0: 94f19b71d40f46b36120e7b9d78a1a3d41bfcbd6

branches/autosynth-dlp/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,4 +664,9 @@ public List<WriteResult> apply(CommitResponse commitResponse) {
664664
boolean isEmpty() {
665665
return mutations.isEmpty();
666666
}
667+
668+
/** Get the number of mutations. */
669+
public int getMutationsSize() {
670+
return mutations.size();
671+
}
667672
}

branches/autosynth-dlp/google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/WriteBatchTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public void updateDocument() throws Exception {
9191
batch.update(documentReference, updateTime, "foo", "bar");
9292
batch.update(documentReference, LocalFirestoreHelper.SINGLE_FIELD_MAP, updateTime);
9393

94+
assertEquals(4, batch.getMutationsSize());
95+
9496
List<WriteResult> writeResults = batch.commit().get();
9597
List<Write> writes = new ArrayList<>();
9698

@@ -126,6 +128,8 @@ public void setDocument() throws Exception {
126128
writes.add(set(LocalFirestoreHelper.SINGLE_FIELD_PROTO, Arrays.asList("foo")));
127129
writes.add(set(LocalFirestoreHelper.SINGLE_FIELD_PROTO, Arrays.asList("foo")));
128130

131+
assertEquals(4, batch.getMutationsSize());
132+
129133
List<WriteResult> writeResults = batch.commit().get();
130134
for (int i = 0; i < writeResults.size(); ++i) {
131135
assertEquals(Timestamp.ofTimeSecondsAndNanos(i, i), writeResults.get(i).getUpdateTime());
@@ -144,6 +148,8 @@ public void omitWriteResultForDocumentTransforms() throws Exception {
144148

145149
batch.set(documentReference, map("time", FieldValue.serverTimestamp()));
146150

151+
assertEquals(1, batch.getMutationsSize());
152+
147153
List<WriteResult> writeResults = batch.commit().get();
148154
assertEquals(1, writeResults.size());
149155
}
@@ -159,6 +165,8 @@ public void createDocument() throws Exception {
159165
.create(documentReference, LocalFirestoreHelper.SINGLE_FIELD_MAP)
160166
.create(documentReference, LocalFirestoreHelper.SINGLE_FIELD_OBJECT);
161167

168+
assertEquals(2, batch.getMutationsSize());
169+
162170
List<WriteResult> writeResults = batch.commit().get();
163171
List<Write> writes = new ArrayList<>();
164172

@@ -188,6 +196,8 @@ public void deleteDocument() throws Exception {
188196
precondition.getUpdateTimeBuilder().setSeconds(1).setNanos(2);
189197
writes.add(delete(precondition.build()));
190198

199+
assertEquals(2, batch.getMutationsSize());
200+
191201
List<WriteResult> writeResults = batch.commit().get();
192202

193203
for (int i = 0; i < writeResults.size(); ++i) {

0 commit comments

Comments
 (0)