|
32 | 32 | import static java.util.Collections.emptyList;
|
33 | 33 | import static java.util.Collections.singletonList;
|
34 | 34 |
|
35 |
| -import com.google.firebase.Timestamp; |
36 | 35 | import com.google.firebase.firestore.FieldValue;
|
37 | 36 | import com.google.firebase.firestore.core.Query;
|
38 |
| -import com.google.firebase.firestore.model.DocumentKey; |
39 | 37 | import com.google.firebase.firestore.model.FieldIndex;
|
40 |
| -import com.google.firebase.firestore.model.FieldPath; |
41 |
| -import com.google.firebase.firestore.model.ObjectValue; |
42 |
| -import com.google.firebase.firestore.model.ServerTimestamps; |
43 |
| -import com.google.firebase.firestore.model.mutation.FieldMask; |
44 |
| -import com.google.firebase.firestore.model.mutation.FieldTransform; |
45 |
| -import com.google.firebase.firestore.model.mutation.PatchMutation; |
46 |
| -import com.google.firebase.firestore.model.mutation.Precondition; |
47 |
| -import com.google.firebase.firestore.model.mutation.ServerTimestampOperation; |
48 |
| -import com.google.firestore.v1.Value; |
49 |
| -import java.util.ArrayList; |
50 | 38 | import java.util.Arrays;
|
51 | 39 | import java.util.Collection;
|
52 | 40 | import java.util.Collections;
|
53 |
| -import java.util.HashMap; |
54 |
| -import java.util.HashSet; |
55 |
| -import java.util.List; |
56 |
| -import java.util.Map; |
57 |
| -import java.util.concurrent.atomic.AtomicReference; |
58 | 41 | import org.junit.Test;
|
59 | 42 | import org.junit.runner.RunWith;
|
60 | 43 | import org.robolectric.RobolectricTestRunner;
|
@@ -307,60 +290,4 @@ public void testIndexesServerTimestamps() {
|
307 | 290 | assertOverlayTypes(keyMap("coll/a", CountingQueryEngine.OverlayType.Set));
|
308 | 291 | assertQueryReturned("coll/a");
|
309 | 292 | }
|
310 |
| - |
311 |
| - @Test |
312 |
| - public void testDeeplyNestedServerTimestamps() { |
313 |
| - Timestamp timestamp = Timestamp.now(); |
314 |
| - Value initialServerTimestamp = ServerTimestamps.valueOf(timestamp, null); |
315 |
| - Map<String, Value> fields = |
316 |
| - new HashMap<String, Value>() { |
317 |
| - { |
318 |
| - put("timestamp", ServerTimestamps.valueOf(timestamp, initialServerTimestamp)); |
319 |
| - } |
320 |
| - }; |
321 |
| - FieldPath path = FieldPath.fromSingleSegment("timestamp"); |
322 |
| - FieldMask mask = |
323 |
| - FieldMask.fromSet( |
324 |
| - new HashSet<FieldPath>() { |
325 |
| - { |
326 |
| - add(path); |
327 |
| - } |
328 |
| - }); |
329 |
| - FieldTransform fieldTransform = |
330 |
| - new FieldTransform(path, ServerTimestampOperation.getInstance()); |
331 |
| - List<FieldTransform> fieldTransforms = |
332 |
| - new ArrayList<FieldTransform>() { |
333 |
| - { |
334 |
| - add(fieldTransform); |
335 |
| - } |
336 |
| - }; |
337 |
| - AtomicReference<Throwable> error = new AtomicReference<>(); |
338 |
| - Thread thread = |
339 |
| - new Thread( |
340 |
| - Thread.currentThread().getThreadGroup(), |
341 |
| - () -> { |
342 |
| - try { |
343 |
| - for (int i = 0; i < 1000; ++i) { |
344 |
| - writeMutation( |
345 |
| - new PatchMutation( |
346 |
| - DocumentKey.fromPathString("some/object/for/test"), |
347 |
| - ObjectValue.fromMap(fields), |
348 |
| - mask, |
349 |
| - Precondition.NONE, |
350 |
| - fieldTransforms)); |
351 |
| - } |
352 |
| - } catch (Throwable e) { |
353 |
| - error.set(e); |
354 |
| - } |
355 |
| - }, |
356 |
| - "test", |
357 |
| - 1024 * 1024); |
358 |
| - try { |
359 |
| - thread.start(); |
360 |
| - thread.join(); |
361 |
| - } catch (InterruptedException e) { |
362 |
| - throw new AssertionError(e); |
363 |
| - } |
364 |
| - assertThat(error.get()).isNull(); |
365 |
| - } |
366 | 293 | }
|
0 commit comments