Skip to content

Commit

Permalink
fix: ParseCorePluginsTest.testQueryControllerDefaultImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
abubkr-hago committed Aug 19, 2024
1 parent 4249904 commit e0fbb52
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion parse/src/main/java/com/parse/ParseCorePlugins.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public ParseQueryController getQueryController() {
new NetworkQueryController(ParsePlugins.get().restClient());
ParseQueryController controller;
// TODO(grantland): Do not rely on Parse global
if (Parse.isLocalDatastoreEnabled()) {
if (ParsePlugins.get().isLocalDatastoreEnabled()) {
controller =
new OfflineQueryController(Parse.getLocalDatastore(), networkController);
} else {
Expand Down
4 changes: 4 additions & 0 deletions parse/src/main/java/com/parse/ParsePlugins.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ Context applicationContext() {
return applicationContext;
}

boolean isLocalDatastoreEnabled() {
return configuration.localDataStoreEnabled;
}

ParseHttpClient fileClient() {
synchronized (lock) {
if (fileClient == null) {
Expand Down
1 change: 1 addition & 0 deletions parse/src/test/java/com/parse/EventuallyPinTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void testFailingFindAllPinned() throws Exception {
ParsePlugins plugins = mock(ParsePlugins.class);
ParsePlugins.set(plugins);
when(plugins.restClient()).thenReturn(ParseHttpClient.createClient(null));
when(plugins.isLocalDatastoreEnabled()).thenReturn(true);

thrown.expect(SQLiteException.class);

Expand Down
1 change: 1 addition & 0 deletions parse/src/test/java/com/parse/ParseUserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,7 @@ public void testSaveEventuallyWhenServerError() throws Exception {
ParseHttpClient restClient =
ParseTestUtils.mockParseHttpClientWithResponse(mockResponse, 200, "OK");
when(plugins.restClient()).thenReturn(restClient);
when(plugins.isLocalDatastoreEnabled()).thenReturn(true);
Parse.initialize(configuration, plugins);

ParseUser user = ParseUser.logIn("username", "password");
Expand Down

0 comments on commit e0fbb52

Please sign in to comment.