PurgeFedoraObject { public void delete(String pid, boolean hierarchy, String message) throws PurgeException { process(Collections.singletonList(pid), hierarchy, true, false, message); } PurgeFedoraObject(RemoteStorage storage); void delete(String pid, boolean hierarchy, String message); void delete(List<String> pids, boolean hierarchy, String message); void purge(String pid, boolean hierarchy, String message); void purge(List<String> pids, boolean hierarchy, String message); void restore(String pid, String message); void restore(List<String> pids, String message);  }
@Test public void testDeleteTheWholeTree() throws Exception { String pid = "uuid:tree1"; boolean hierarchy = true; PurgeFedoraObject purge = new PurgeFedoraObject(support.getRemoteStorage()); purge.delete(pid, hierarchy, "junit"); String[] pids = { "uuid:tree1", "uuid:tree1-child1", "uuid:tree1-child1-child1", "uuid:tree1-child1-child1-child1", "uuid:tree1-child1-child1-child2", "uuid:tree1-child2", "uuid:tree1-child2-child1", "uuid:tree1-child2-child1-child1" }; List<Item> found = support.getRemoteStorage().getSearch().find(false, pids); FedoraTestSupport.assertItem(found, pids); for (Item item : found) { assertEquals(item.getPid(), "fedora-system:def/model#Deleted", item.getState()); } found = support.getRemoteStorage().getSearch().find(pids); assertTrue(found.isEmpty()); }