diff --git a/parse/src/main/java/com/parse/ParseCorePlugins.java b/parse/src/main/java/com/parse/ParseCorePlugins.java index 01d5ed54..4c3d648f 100644 --- a/parse/src/main/java/com/parse/ParseCorePlugins.java +++ b/parse/src/main/java/com/parse/ParseCorePlugins.java @@ -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 { diff --git a/parse/src/main/java/com/parse/ParsePlugins.java b/parse/src/main/java/com/parse/ParsePlugins.java index df8c1ebe..1d5e1ae2 100644 --- a/parse/src/main/java/com/parse/ParsePlugins.java +++ b/parse/src/main/java/com/parse/ParsePlugins.java @@ -93,6 +93,10 @@ Context applicationContext() { return applicationContext; } + boolean isLocalDatastoreEnabled() { + return configuration.localDataStoreEnabled; + } + ParseHttpClient fileClient() { synchronized (lock) { if (fileClient == null) { diff --git a/parse/src/test/java/com/parse/EventuallyPinTest.java b/parse/src/test/java/com/parse/EventuallyPinTest.java index 39ca2ab9..2000e083 100644 --- a/parse/src/test/java/com/parse/EventuallyPinTest.java +++ b/parse/src/test/java/com/parse/EventuallyPinTest.java @@ -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); diff --git a/parse/src/test/java/com/parse/ParseUserTest.java b/parse/src/test/java/com/parse/ParseUserTest.java index 8920e583..c9108531 100644 --- a/parse/src/test/java/com/parse/ParseUserTest.java +++ b/parse/src/test/java/com/parse/ParseUserTest.java @@ -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");