@Test
 public void testFindByName()
 	throws Exception
 {
  Logger log = log();
  FileDAO fileDAO = db.findDAO(FileDAO.class);
  VersionDAO versionDAO = db.findDAO(VersionDAO.class);
  int deletedCount = 0;
  int currentCount = 0;
  for (Map.Entry<File, NodeNameDTO> entry : files.entrySet())
  {
   File file = entry.getKey();
   NodeNameDTO node = entry.getValue();
   FileDTO current = versionDAO.findExistingFile(node);
   if (null != current)
    currentCount++;
// else
// log.finer("No current file entry for " + entry.getKey() + ", perhaps it's marked deleted ...");
   Cursor<FileDTO> all = fileDAO.findFilesByName(node);
   try
   {
    int deletedHere = 0;
    int currentHere = 0;
    for (FileDTO rec; null != (rec = all.next());)
    {
     VersionDTO currentVersion = versionDAO.findCurrentVersion(rec);
     if (!currentVersion.isDeletionMark())
     {
      assertEquals("Duplicate current file " + file, 0, currentHere++);
      assertNotNull("findFile(" + node + ") returned null ignoring " + rec, current);
     }
     else
     {
      assertEquals("More than one deleted file " + file, 0, deletedHere++);
      deletedCount++;
     }
    }
    if (null == current && 0 == deletedHere)
     fail("No records found for file " + file + ", " + node);
   }
   finally
   {
    try
    {
     all.close();
    }
    catch (Exception e)
    {
     log.log(Level.WARNING, "Cursor close failed for " + file, e);
    }
   }
  }
  int expectedTotal = files.size();
  log.fine("Iterated " + expectedTotal + " node(s)");
  log.fine("Found " + deletedCount + " deleted file record(s)");
  log.fine("Found " + currentCount + " current file record(s)");
  assertEquals("Number of current records", expectedTotal - expectedTotal / 10, currentCount);
  assertEquals("Number of deleted records", expectedTotal / 5, deletedCount);
 }