Skip to content

Commit

Permalink
Adding integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cherylEnkidu committed Jun 13, 2023
1 parent 22b0fc5 commit dd34db3
Show file tree
Hide file tree
Showing 8 changed files with 271 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
* in remoteDocumentCache or local mutations for the document). The view is computed by applying the
* mutations in the MutationQueue to the RemoteDocumentCache.
*/
class LocalDocumentsView {
public class LocalDocumentsView {

private final RemoteDocumentCache remoteDocumentCache;
private final MutationQueue mutationQueue;
private final DocumentOverlayCache documentOverlayCache;
private final IndexManager indexManager;

LocalDocumentsView(
protected LocalDocumentsView(
RemoteDocumentCache remoteDocumentCache,
MutationQueue mutationQueue,
DocumentOverlayCache documentOverlayCache,
Expand Down Expand Up @@ -276,7 +276,7 @@ ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
}
}

ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
protected ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
Query query, IndexOffset offset) {
return getDocumentsMatchingQuery(query, offset, new QueryContext());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void setReferenceDelegate(ReferenceDelegate delegate) {
}

@Override
MutationQueue getMutationQueue(User user, IndexManager indexManager) {
public MutationQueue getMutationQueue(User user, IndexManager indexManager) {
MemoryMutationQueue queue = mutationQueues.get(user);
if (queue == null) {
queue = new MemoryMutationQueue(this, user);
Expand All @@ -113,12 +113,12 @@ MemoryTargetCache getTargetCache() {
}

@Override
MemoryRemoteDocumentCache getRemoteDocumentCache() {
public MemoryRemoteDocumentCache getRemoteDocumentCache() {
return remoteDocumentCache;
}

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

@Override
DocumentOverlayCache getDocumentOverlayCache(User user) {
public DocumentOverlayCache getDocumentOverlayCache(User user) {
MemoryDocumentOverlayCache overlay = overlays.get(user);
if (overlay == null) {
overlay = new MemoryDocumentOverlayCache();
Expand All @@ -145,7 +145,7 @@ OverlayMigrationManager getOverlayMigrationManager() {
}

@Override
void runTransaction(String action, Runnable operation) {
public void runTransaction(String action, Runnable operation) {
referenceDelegate.onTransactionStarted();
try {
operation.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.List;

/** A queue of mutations to apply to the remote store. */
interface MutationQueue {
public interface MutationQueue {
/**
* Starts the mutation queue, performing any initial reads that might be required to establish
* invariants, etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,22 @@ public abstract class Persistence {
* implementation to the extent possible (e.g. in the case of uid switching from
* sally=>jack=>sally, sally's mutation queue will be preserved).
*/
abstract MutationQueue getMutationQueue(User user, IndexManager indexManager);
public abstract MutationQueue getMutationQueue(User user, IndexManager indexManager);

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

/** Creates a RemoteDocumentCache representing the persisted cache of remote documents. */
abstract RemoteDocumentCache getRemoteDocumentCache();
public abstract RemoteDocumentCache getRemoteDocumentCache();

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

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

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

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

/**
* Performs an operation inside a persistence transaction. Any reads or writes against persistence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package com.google.firebase.firestore.local;

public class QueryContext {
QueryContext() {}
public QueryContext() {}

int fullScanCount = 0;
public int fullScanCount = 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* meaning we can cache both Document instances (an actual document with data) as well as NoDocument
* instances (indicating that the document is known to not exist).
*/
interface RemoteDocumentCache {
public interface RemoteDocumentCache {

/** Sets the index manager to use for managing the collectionGroup index. */
void setIndexManager(IndexManager indexManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public SQLiteLruReferenceDelegate getReferenceDelegate() {
}

@Override
MutationQueue getMutationQueue(User user, IndexManager indexManager) {
public MutationQueue getMutationQueue(User user, IndexManager indexManager) {
return new SQLiteMutationQueue(this, serializer, user, indexManager);
}

Expand All @@ -181,7 +181,7 @@ SQLiteTargetCache getTargetCache() {
}

@Override
IndexManager getIndexManager(User user) {
public IndexManager getIndexManager(User user) {
return new SQLiteIndexManager(this, serializer, user);
}

Expand All @@ -191,7 +191,7 @@ BundleCache getBundleCache() {
}

@Override
DocumentOverlayCache getDocumentOverlayCache(User user) {
public DocumentOverlayCache getDocumentOverlayCache(User user) {
return new SQLiteDocumentOverlayCache(this, this.serializer, user);
}

Expand All @@ -201,12 +201,12 @@ OverlayMigrationManager getOverlayMigrationManager() {
}

@Override
RemoteDocumentCache getRemoteDocumentCache() {
public RemoteDocumentCache getRemoteDocumentCache() {
return remoteDocumentCache;
}

@Override
void runTransaction(String action, Runnable operation) {
public void runTransaction(String action, Runnable operation) {
Logger.debug(TAG, "Starting transaction: %s", action);
db.beginTransactionWithListener(transactionListener);
try {
Expand Down
Loading

0 comments on commit dd34db3

Please sign in to comment.