/** Clears the cache and creates a new clean cache. */ private void cleanCache() { resetInMemoryCache(); // Checks to make sure SmartStore hasn't already been cleaned up. if (SmartSyncSDKManager.getInstance().hasSmartStore()) { clearAllSoups(); } }
@Override public void setUp() throws Exception { super.setUp(); targetContext = getInstrumentation().getTargetContext(); final Application app = Instrumentation.newApplication(TestForceApp.class, targetContext); getInstrumentation().callApplicationOnCreate(app); TestCredentials.init(getInstrumentation().getContext()); eq = new EventsListenerQueue(); if (SmartSyncSDKManager.getInstance() == null) { eq.waitForEvent(EventType.AppCreateComplete, 5000); } final LoginOptions loginOptions = new LoginOptions( TestCredentials.LOGIN_URL, null, TEST_CALLBACK_URL, TestCredentials.CLIENT_ID, TEST_SCOPES); final ClientManager clientManager = new ClientManager(targetContext, TestCredentials.ACCOUNT_TYPE, loginOptions, true); clientManager.createNewAccount( TestCredentials.ACCOUNT_NAME, TestCredentials.USERNAME, TestCredentials.REFRESH_TOKEN, TEST_AUTH_TOKEN, TestCredentials.INSTANCE_URL, TestCredentials.LOGIN_URL, TestCredentials.IDENTITY_URL, TestCredentials.CLIENT_ID, TestCredentials.ORG_ID, TestCredentials.USER_ID, null); MetadataManager.reset(null); CacheManager.hardReset(null); SyncManager.reset(); metadataManager = MetadataManager.getInstance(null); cacheManager = CacheManager.getInstance(null); syncManager = SyncManager.getInstance(); restClient = initRestClient(); metadataManager.setRestClient(restClient); syncManager.setRestClient(restClient); smartStore = cacheManager.getSmartStore(); }
/** * Private parameterized constructor. * * @param account User account. * @param communityId Community ID. */ private CacheManager(UserAccount account, String communityId) { smartStore = SmartSyncSDKManager.getInstance().getSmartStore(account, communityId); resetInMemoryCache(); }