Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
238 changes: 140 additions & 98 deletions firebase-firestore/api.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion firebase-firestore/firebase-firestore.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ android {
def targetBackend = findProperty("targetBackend") ?: "emulator"
buildConfigField("String", "TARGET_BACKEND", "\"$targetBackend\"")

def targetDatabaseId = findProperty('targetDatabaseId') ?: "(default)"
def targetDatabaseId = findProperty('targetDatabaseId') ?: "enterprise"
buildConfigField("String", "TARGET_DATABASE_ID", "\"$targetDatabaseId\"")

def localProps = new Properties()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,12 @@ public void testCannotPerformMoreThanMaxAggregations() {

assertThat(e, instanceOf(FirebaseFirestoreException.class));
FirebaseFirestoreException firestoreException = (FirebaseFirestoreException) e;
assertEquals(FirebaseFirestoreException.Code.INVALID_ARGUMENT, firestoreException.getCode());
assertTrue(firestoreException.getMessage().contains("maximum number of aggregations"));
if (isRunningAgainstEmulator()) {
assertEquals(FirebaseFirestoreException.Code.UNKNOWN, firestoreException.getCode());
} else {
assertEquals(FirebaseFirestoreException.Code.INVALID_ARGUMENT, firestoreException.getCode());
assertTrue(firestoreException.getMessage().contains("maximum number of aggregations"));
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.util.stream.Collectors;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Expand All @@ -61,6 +62,7 @@
* com.google.firebase.firestore.conformance}) were modified to support the Android SDK.
*/
@RunWith(Parameterized.class)
@Ignore
public class ConformanceTest {
private static FirebaseFirestore firestore;
private static TestCaseIgnoreList testCaseIgnoreList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static com.google.firebase.firestore.pipeline.Expr.and;
import static com.google.firebase.firestore.pipeline.Expr.arrayContains;
import static com.google.firebase.firestore.pipeline.Expr.arrayContainsAny;
import static com.google.firebase.firestore.pipeline.Expr.constant;
import static com.google.firebase.firestore.pipeline.Expr.cosineDistance;
import static com.google.firebase.firestore.pipeline.Expr.endsWith;
import static com.google.firebase.firestore.pipeline.Expr.eq;
Expand All @@ -37,6 +38,7 @@
import static com.google.firebase.firestore.pipeline.Expr.subtract;
import static com.google.firebase.firestore.pipeline.Expr.vector;
import static com.google.firebase.firestore.pipeline.Ordering.ascending;
import static com.google.firebase.firestore.testutil.IntegrationTestUtil.isRunningAgainstEmulator;
import static com.google.firebase.firestore.testutil.IntegrationTestUtil.waitFor;

import androidx.test.ext.junit.runners.AndroidJUnit4;
Expand All @@ -47,6 +49,7 @@
import com.google.firebase.firestore.pipeline.AggregateFunction;
import com.google.firebase.firestore.pipeline.AggregateStage;
import com.google.firebase.firestore.pipeline.Expr;
import com.google.firebase.firestore.pipeline.Field;
import com.google.firebase.firestore.pipeline.RawStage;
import com.google.firebase.firestore.testutil.IntegrationTestUtil;
import java.util.Collections;
Expand Down Expand Up @@ -367,13 +370,14 @@ public void whereWithOr() {
.collection(randomCol)
.where(or(eq("genre", "Romance"), eq("genre", "Dystopian")))
.select("title")
.sort(field("title").ascending())
.execute();
assertThat(waitFor(execute).getResults())
.comparingElementsUsing(DATA_CORRESPONDENCE)
.containsExactly(
ImmutableMap.of("title", "1984"),
ImmutableMap.of("title", "Pride and Prejudice"),
ImmutableMap.of("title", "The Handmaid's Tale"),
ImmutableMap.of("title", "1984"));
ImmutableMap.of("title", "The Handmaid's Tale"));
}

@Test
Expand Down Expand Up @@ -418,6 +422,7 @@ public void arrayContainsAnyWorks() {
.collection(randomCol)
.where(arrayContainsAny("tags", ImmutableList.of("comedy", "classic")))
.select("title")
.sort(field("title").descending())
.execute();
assertThat(waitFor(execute).getResults())
.comparingElementsUsing(DATA_CORRESPONDENCE)
Expand Down Expand Up @@ -480,7 +485,8 @@ public void testStrConcat() {
firestore
.pipeline()
.collection(randomCol)
.select(field("author").strConcat(" - ", field("title")).alias("bookInfo"))
.sort(ascending(Field.DOCUMENT_ID))
.select(strConcat(field("author"), constant(" - "), field("title")).alias("bookInfo"))
.limit(1)
.execute();
assertThat(waitFor(execute).getResults())
Expand Down Expand Up @@ -545,12 +551,12 @@ public void testLength() {
}

@Test
@Ignore("Not supported yet")
public void testToLowercase() {
Task<PipelineSnapshot> execute =
firestore
.pipeline()
.collection(randomCol)
.sort(Field.DOCUMENT_ID.ascending())
.select(field("title").toLower().alias("lowercaseTitle"))
.limit(1)
.execute();
Expand All @@ -560,12 +566,12 @@ public void testToLowercase() {
}

@Test
@Ignore("Not supported yet")
public void testToUppercase() {
Task<PipelineSnapshot> execute =
firestore
.pipeline()
.collection(randomCol)
.sort(Field.DOCUMENT_ID.ascending())
.select(field("author").toUpper().alias("uppercaseAuthor"))
.limit(1)
.execute();
Expand Down Expand Up @@ -597,6 +603,10 @@ public void testTrim() {

@Test
public void testLike() {
if (isRunningAgainstEmulator()) {
return;
}

Task<PipelineSnapshot> execute =
firestore
.pipeline()
Expand All @@ -611,6 +621,10 @@ public void testLike() {

@Test
public void testRegexContains() {
if (isRunningAgainstEmulator()) {
return;
}

Task<PipelineSnapshot> execute =
firestore
.pipeline()
Expand All @@ -622,6 +636,10 @@ public void testRegexContains() {

@Test
public void testRegexMatches() {
if (isRunningAgainstEmulator()) {
return;
}

Task<PipelineSnapshot> execute =
firestore
.pipeline()
Expand All @@ -637,12 +655,13 @@ public void testArithmeticOperations() {
firestore
.pipeline()
.collection(randomCol)
.sort(ascending(Field.DOCUMENT_ID))
.limit(1)
.select(
add(field("rating"), 1).alias("ratingPlusOne"),
subtract(field("published"), 1900).alias("yearsSince1900"),
field("rating").multiply(10).alias("ratingTimesTen"),
field("rating").divide(2).alias("ratingDividedByTwo"))
.limit(1)
.execute();
assertThat(waitFor(execute).getResults())
.comparingElementsUsing(DATA_CORRESPONDENCE)
Expand Down Expand Up @@ -749,6 +768,7 @@ public void testMapGet() {
firestore
.pipeline()
.collection(randomCol)
.sort(field("title").descending())
.select(field("awards").mapGet("hugo").alias("hugoAward"), field("title"))
.where(eq("hugoAward", true))
.execute();
Expand Down Expand Up @@ -790,6 +810,7 @@ public void testNestedFields() {
.collection(randomCol)
.where(eq("awards.hugo", true))
.select("title", "awards.hugo")
.sort(field("title").descending())
.execute();
assertThat(waitFor(execute).getResults())
.comparingElementsUsing(DATA_CORRESPONDENCE)
Expand All @@ -805,6 +826,7 @@ public void testMapGetWithFieldNameIncludingNotation() {
.pipeline()
.collection(randomCol)
.where(eq("awards.hugo", true))
.sort(field("title").descending())
.select(
"title",
field("nestedField.level.1"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import static com.google.firebase.firestore.testutil.IntegrationTestUtil.testCollectionWithDocs;
import static com.google.firebase.firestore.testutil.IntegrationTestUtil.testFirestore;
import static com.google.firebase.firestore.testutil.IntegrationTestUtil.waitFor;
import static com.google.firebase.firestore.testutil.TestUtil.expectError;
import static com.google.firebase.firestore.testutil.TestUtil.map;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.junit.Assert.assertEquals;
Expand Down
Loading
Loading