コード例 #1
0
  public void testRemove() throws BackingStoreException {
    assertNull(storage.toFolder());
    assertNull(storage.toPropertiesFile());

    pref.put("key", "value");
    pref.flush();
    assertNotNull(storage.toPropertiesFile());
    pref.remove("key");
    assertTrue(pref.properties.isEmpty());
    pref.flush();
    assertNull(storage.toPropertiesFile());
  }
コード例 #2
0
  public void testClear() throws BackingStoreException {
    assertNull(storage.toFolder());
    assertNull(storage.toPropertiesFile());
    pref.put("key", "value");
    pref.put("key1", "value");
    pref.put("key2", "value");
    pref.put("key3", "value");
    pref.put("key5", "value");
    pref.flush();
    assertNotNull(storage.toPropertiesFile());

    pref.clear();
    pref.flush();
    assertNull(storage.toPropertiesFile());
  }
コード例 #3
0
  @RandomlyFails // FSException: Invalid lock (from flush)
  public void testRemoveNode() throws BackingStoreException {
    assertNull(storage.toFolder());
    assertNull(storage.toPropertiesFile());

    pref.put("key", "value");
    pref.node("subnode").put("key", "value");
    pref.flush();
    assertNotNull(storage.toPropertiesFile());
    assertNotNull(storage.toFolder());
    pref.removeNode();
    pref.flush();
    assertNull(storage.toPropertiesFile());
    assertNull(storage.toFolder());
    assertFalse(storage.existsNode());
    pref.sync();
  }
コード例 #4
0
  public void testRemoveParentNode() throws BackingStoreException {
    assertNull(storage.toFolder());
    assertNull(storage.toPropertiesFile());

    Preferences subnode = pref.node("subnode");
    assertNull(storage.toFolder());
    assertNull(storage.toPropertiesFile());
    subnode.put("key", "value");
    subnode.flush();
    assertNotNull(storage.toFolder());
    assertNull(storage.toPropertiesFile());
    subnode.removeNode();
    pref.flush();
    assertNull(storage.toPropertiesFile());
    assertNull(storage.toFolder());
    assertFalse(storage.existsNode());
  }
コード例 #5
0
 private void storeEntry(String keyName, String oldValue) throws BackingStoreException {
   pref.put(keyName, oldValue);
   pref.flush();
 }
コード例 #6
0
 public void testNode2() throws BackingStoreException {
   testNode();
   pref.flush();
   assertNotNull(storage.toPropertiesFile());
 }