Skip to content

Commit dd34db3

Browse files
committed
Adding integration tests
1 parent 22b0fc5 commit dd34db3

File tree

8 files changed

+271
-22
lines changed

8 files changed

+271
-22
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalDocumentsView.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@
4848
* in remoteDocumentCache or local mutations for the document). The view is computed by applying the
4949
* mutations in the MutationQueue to the RemoteDocumentCache.
5050
*/
51-
class LocalDocumentsView {
51+
public class LocalDocumentsView {
5252

5353
private final RemoteDocumentCache remoteDocumentCache;
5454
private final MutationQueue mutationQueue;
5555
private final DocumentOverlayCache documentOverlayCache;
5656
private final IndexManager indexManager;
5757

58-
LocalDocumentsView(
58+
protected LocalDocumentsView(
5959
RemoteDocumentCache remoteDocumentCache,
6060
MutationQueue mutationQueue,
6161
DocumentOverlayCache documentOverlayCache,
@@ -276,7 +276,7 @@ ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
276276
}
277277
}
278278

279-
ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
279+
protected ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
280280
Query query, IndexOffset offset) {
281281
return getDocumentsMatchingQuery(query, offset, new QueryContext());
282282
}

firebase-firestore/src/main/java/com/google/firebase/firestore/local/MemoryPersistence.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private void setReferenceDelegate(ReferenceDelegate delegate) {
9494
}
9595

9696
@Override
97-
MutationQueue getMutationQueue(User user, IndexManager indexManager) {
97+
public MutationQueue getMutationQueue(User user, IndexManager indexManager) {
9898
MemoryMutationQueue queue = mutationQueues.get(user);
9999
if (queue == null) {
100100
queue = new MemoryMutationQueue(this, user);
@@ -113,12 +113,12 @@ MemoryTargetCache getTargetCache() {
113113
}
114114

115115
@Override
116-
MemoryRemoteDocumentCache getRemoteDocumentCache() {
116+
public MemoryRemoteDocumentCache getRemoteDocumentCache() {
117117
return remoteDocumentCache;
118118
}
119119

120120
@Override
121-
MemoryIndexManager getIndexManager(User user) {
121+
public MemoryIndexManager getIndexManager(User user) {
122122
// We do not currently support indices for memory persistence, so we can return the same shared
123123
// instance of the memory index manager.
124124
return indexManager;
@@ -130,7 +130,7 @@ BundleCache getBundleCache() {
130130
}
131131

132132
@Override
133-
DocumentOverlayCache getDocumentOverlayCache(User user) {
133+
public DocumentOverlayCache getDocumentOverlayCache(User user) {
134134
MemoryDocumentOverlayCache overlay = overlays.get(user);
135135
if (overlay == null) {
136136
overlay = new MemoryDocumentOverlayCache();
@@ -145,7 +145,7 @@ OverlayMigrationManager getOverlayMigrationManager() {
145145
}
146146

147147
@Override
148-
void runTransaction(String action, Runnable operation) {
148+
public void runTransaction(String action, Runnable operation) {
149149
referenceDelegate.onTransactionStarted();
150150
try {
151151
operation.run();

firebase-firestore/src/main/java/com/google/firebase/firestore/local/MutationQueue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import java.util.List;
2525

2626
/** A queue of mutations to apply to the remote store. */
27-
interface MutationQueue {
27+
public interface MutationQueue {
2828
/**
2929
* Starts the mutation queue, performing any initial reads that might be required to establish
3030
* invariants, etc.

firebase-firestore/src/main/java/com/google/firebase/firestore/local/Persistence.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,22 @@ public abstract class Persistence {
7878
* implementation to the extent possible (e.g. in the case of uid switching from
7979
* sally=>jack=>sally, sally's mutation queue will be preserved).
8080
*/
81-
abstract MutationQueue getMutationQueue(User user, IndexManager indexManager);
81+
public abstract MutationQueue getMutationQueue(User user, IndexManager indexManager);
8282

8383
/** Creates a TargetCache representing the persisted cache of queries. */
8484
abstract TargetCache getTargetCache();
8585

8686
/** Creates a RemoteDocumentCache representing the persisted cache of remote documents. */
87-
abstract RemoteDocumentCache getRemoteDocumentCache();
87+
public abstract RemoteDocumentCache getRemoteDocumentCache();
8888

8989
/** Creates an IndexManager that manages our persisted query indexes. */
90-
abstract IndexManager getIndexManager(User user);
90+
public abstract IndexManager getIndexManager(User user);
9191

9292
/** Returns a BundleCache representing the persisted cache of loaded bundles. */
9393
abstract BundleCache getBundleCache();
9494

9595
/** Returns a DocumentOverlayCache representing the documents that are mutated locally. */
96-
abstract DocumentOverlayCache getDocumentOverlayCache(User user);
96+
public abstract DocumentOverlayCache getDocumentOverlayCache(User user);
9797

9898
/** Returns a OverlayMigrationManager that runs any pending data migration required by SDK. */
9999
abstract OverlayMigrationManager getOverlayMigrationManager();
@@ -106,7 +106,7 @@ public abstract class Persistence {
106106
* @param action A description of the action performed by this transaction, used for logging.
107107
* @param operation The operation to run inside a transaction.
108108
*/
109-
abstract void runTransaction(String action, Runnable operation);
109+
public abstract void runTransaction(String action, Runnable operation);
110110

111111
/**
112112
* Performs an operation inside a persistence transaction. Any reads or writes against persistence

firebase-firestore/src/main/java/com/google/firebase/firestore/local/QueryContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
package com.google.firebase.firestore.local;
1616

1717
public class QueryContext {
18-
QueryContext() {}
18+
public QueryContext() {}
1919

20-
int fullScanCount = 0;
20+
public int fullScanCount = 0;
2121
}

firebase-firestore/src/main/java/com/google/firebase/firestore/local/RemoteDocumentCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* meaning we can cache both Document instances (an actual document with data) as well as NoDocument
3232
* instances (indicating that the document is known to not exist).
3333
*/
34-
interface RemoteDocumentCache {
34+
public interface RemoteDocumentCache {
3535

3636
/** Sets the index manager to use for managing the collectionGroup index. */
3737
void setIndexManager(IndexManager indexManager);

firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLitePersistence.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public SQLiteLruReferenceDelegate getReferenceDelegate() {
171171
}
172172

173173
@Override
174-
MutationQueue getMutationQueue(User user, IndexManager indexManager) {
174+
public MutationQueue getMutationQueue(User user, IndexManager indexManager) {
175175
return new SQLiteMutationQueue(this, serializer, user, indexManager);
176176
}
177177

@@ -181,7 +181,7 @@ SQLiteTargetCache getTargetCache() {
181181
}
182182

183183
@Override
184-
IndexManager getIndexManager(User user) {
184+
public IndexManager getIndexManager(User user) {
185185
return new SQLiteIndexManager(this, serializer, user);
186186
}
187187

@@ -191,7 +191,7 @@ BundleCache getBundleCache() {
191191
}
192192

193193
@Override
194-
DocumentOverlayCache getDocumentOverlayCache(User user) {
194+
public DocumentOverlayCache getDocumentOverlayCache(User user) {
195195
return new SQLiteDocumentOverlayCache(this, this.serializer, user);
196196
}
197197

@@ -201,12 +201,12 @@ OverlayMigrationManager getOverlayMigrationManager() {
201201
}
202202

203203
@Override
204-
RemoteDocumentCache getRemoteDocumentCache() {
204+
public RemoteDocumentCache getRemoteDocumentCache() {
205205
return remoteDocumentCache;
206206
}
207207

208208
@Override
209-
void runTransaction(String action, Runnable operation) {
209+
public void runTransaction(String action, Runnable operation) {
210210
Logger.debug(TAG, "Starting transaction: %s", action);
211211
db.beginTransactionWithListener(transactionListener);
212212
try {

0 commit comments

Comments
 (0)