public void testDeleteKey() throws Exception {

    // default setup already includes a custom key; therefore, let's
    // grab the initial size
    DataResult initialKeys = SystemManager.listDataKeys(admin);

    handler.createKey(admin, "testlabel", "test description");
    DataResult result = SystemManager.listDataKeys(admin);
    assertEquals(initialKeys.size() + 1, result.size());

    boolean foundKey = false;
    for (Iterator itr = result.iterator(); itr.hasNext(); ) {
      CustomDataKeyOverview key = (CustomDataKeyOverview) itr.next();
      if (key.getLabel().equals("testlabel") && key.getDescription().equals("test description")) {
        foundKey = true;
        break;
      }
    }
    assertTrue(foundKey);

    handler.deleteKey(admin, "testlabel");
    result = SystemManager.listDataKeys(admin);
    assertEquals(initialKeys.size(), result.size());

    foundKey = false;
    for (Iterator itr = result.iterator(); itr.hasNext(); ) {
      CustomDataKeyOverview key = (CustomDataKeyOverview) itr.next();
      if (key.getLabel().equals("testlabel") && key.getDescription().equals("test description")) {
        foundKey = true;
        break;
      }
    }
    assertFalse(foundKey);
  }
  public void testListAllKeys() throws Exception {

    // default setup already includes a custom key; therefore, we don't
    // need to add any as part of this test.

    Object[] keys = handler.listAllKeys(admin);

    assertEquals(SystemManager.listDataKeys(admin).size(), keys.length);
  }