Skip to content

Commit 9c8cc5d

Browse files
gremi64sduskis
authored andcommitted
---
yaml --- r: 14939 b: refs/heads/autosynth-automl c: 64f3b2b h: refs/heads/master i: 14937: 29c9e88 14935: 1d32e4c
1 parent e49aba7 commit 9c8cc5d

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
@@ -123,7 +123,7 @@ refs/heads/spanner: b01127f885b4611bf1852abb0ce481eeb7fcc131
123123
refs/tags/v0.68.0: 9cc799fcf68c82ab431d425fefa58ef615ce8e5b
124124
refs/tags/v0.69.0: 78f67a29e8b9c46ba01de566a2eae0fd1c03edea
125125
refs/heads/autosynth-asset: cd8251de8c40e239ad24dcf9ed93ea2708a3eed5
126-
refs/heads/autosynth-automl: bb2bb7cff5766d2070a8421d902e4af1c9c18bac
126+
refs/heads/autosynth-automl: 64f3b2be23eab15df420e5890f14409fa52c8411
127127
refs/heads/autosynth-bigquerydatatransfer: 2a9f3938237f85a8919602d74011326580ff387f
128128
refs/heads/autosynth-bigquerystorage: 99aee05df348f39d98b6fb23c292006f1d2a6c28
129129
refs/heads/autosynth-bigtable: fa0d1de9e264d7ecac8a3abc3de7a8364cfaf427

branches/autosynth-automl/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-automl/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)