From 98e5ed4411344fa5e3735e59b1d6a4da7333f241 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 19 Sep 2018 20:59:43 -0700 Subject: [PATCH] Add ArrayUnion/ArrayRemove conformance tests --- .../cloud/firestore/ConformanceTest.java | 16 ++++++++++++---- .../src/test/resources/test-suite.binproto | Bin 37901 -> 54051 bytes 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java b/google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java index 2d3b118a5bdb..8b9be3395ce3 100644 --- a/google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java +++ b/google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/ConformanceTest.java @@ -331,11 +331,19 @@ public int compare(QueryDocumentSnapshot o1, QueryDocumentSnapshot o2) { } /** Helper function to convert test values in a list to Firestore API types. */ - private List convertArray(List list) { - for (int i = 0; i < list.size(); ++i) { - list.set(i, convertValue(list.get(i))); + private Object convertArray(List list) { + if (!list.isEmpty() && list.get(0).equals("ArrayUnion")) { + return FieldValue.arrayUnion( + ((List) convertArray(list.subList(1, list.size()))).toArray()); + } else if (!list.isEmpty() && list.get(0).equals("ArrayRemove")) { + return FieldValue.arrayRemove( + ((List) convertArray(list.subList(1, list.size()))).toArray()); + } else { + for (int i = 0; i < list.size(); ++i) { + list.set(i, convertValue(list.get(i))); + } + return list; } - return list; } /** Reads the test definition from the Proto file. */ diff --git a/google-cloud-clients/google-cloud-firestore/src/test/resources/test-suite.binproto b/google-cloud-clients/google-cloud-firestore/src/test/resources/test-suite.binproto index c3a4962d0cf41125163a5b1ebd0ae28198d7b229..1bfc0ca48f1273d4a3b933f1b5b00abd83e40747 100644 GIT binary patch delta 7531 zcmb`Me{3AZ6~{HZwqs8SiqEO-Z2V(Av7PhAKe%;bJLiPdMkd6La|tE=pYA$oQlP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