XmiFileTreeCorpusDAO implements CorpusDAO { @Override public Set<String> getAnnotatorIds(URI docURI) throws FileNotFoundException { if (annotatorsByDocument.containsKey(docURI)) { return annotatorsByDocument.get(docURI); } else { throw new FileNotFoundException(); } } XmiFileTreeCorpusDAO(String corpusPathString); @Override Set<URI> getDocuments(); @Override Set<String> getAnnotatorIds(URI docURI); @Override void getDocumentCas(URI docURI, String annotatorId, CAS aCAS); @Override boolean hasDocument(URI docURI, String annotatorId); @Override void persist(URI docUri, String annotatorId, CAS cas); static TypeSystemDescription getTypeSystem(String corpusPathString); static final String XMI_FILE_EXTENSION; }
@Test public void testGetAnnotatorIds() throws URISyntaxException, IOException { assertEquals(Sets.newHashSet("1", "5"), corpusDAO.getAnnotatorIds(new URI("62007.txt"))); assertEquals(Sets.newHashSet("1"), corpusDAO.getAnnotatorIds(new URI("65801.txt"))); assertEquals(Sets.newHashSet("5"), corpusDAO.getAnnotatorIds(new URI("75788.txt"))); }
@Test(expected = FileNotFoundException.class) public void testGetAnnotatorIdsForNonexistingDocument() throws URISyntaxException, IOException { corpusDAO.getAnnotatorIds(new URI("49580.txt")); }