Code example for AccountManager

Methods: setUserData

0
  /** 
   * Write a complete set of unversioned Account data suitable for testing forward migration. 
   * @throws Exception 
   */ 
  public void populateAccountData(final AccountManager accountManager, final Account account) throws Exception {
    accountManager.setUserData(account, "account.guid", TEST_GUID);
    accountManager.setUserData(account, "account.clientName", TEST_CLIENT_NAME);
    accountManager.setUserData(account, "account.numClients", new Long(TEST_NUM_CLIENTS).toString());
  } 
 
  public void testMigrateGlobals0and1() throws Exception { 
    final SharedPreferences v0a = new MockSharedPreferences();
    final SharedPreferences v1a = new MockSharedPreferences();
    final SharedPreferences v0b = new MockSharedPreferences();
    final SharedPreferences v1b = new MockSharedPreferences();
 
    populateGlobalSharedPrefs(v0a);
 
    final int NUM_GLOBALS = 2;
    assertEquals(NUM_GLOBALS, v0a.getAll().size());
    assertEquals(NUM_GLOBALS, PublicMigrator.upgradeGlobals0to1(v0a, v1a));