use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.
the class ImageLinkerIT method linkSingleImage.
@Test
public void linkSingleImage() throws NodeFactoryException {
Taxon taxon = taxonIndex.getOrCreateTaxon(new TaxonImpl("Homo sapiens", "EOL:327955"));
taxonIndex.getOrCreateTaxon(new TaxonImpl("Whatevero whateverens", "EOL:8888888888"));
assertNotNull(taxon);
new ImageLinker(getGraphDb(), System.out).link();
Taxon enrichedTaxon = taxonIndex.findTaxonById("EOL:327955");
assertThat(enrichedTaxon.getThumbnailUrl(), containsString("http://media.eol.org/content/"));
assertThat(enrichedTaxon.getExternalUrl(), is("http://eol.org/pages/327955"));
}
use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.
the class NonResolvingTaxonIndexTest method assertNotIndexed.
private final void assertNotIndexed(String magicValue) throws NodeFactoryException {
Taxon taxon1 = new TaxonImpl(magicValue, null);
taxon1.setPath(null);
TaxonNode taxon = taxonService.getOrCreateTaxon(taxon1);
assertThat(taxon, is(notNullValue()));
assertThat(taxonService.findTaxonByName(magicValue), is(nullValue()));
}
use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.
the class NonResolvingTaxonIndexTest method findCloseMatch.
@Test
public final void findCloseMatch() throws NodeFactoryException {
taxonService.getOrCreateTaxon(new TaxonImpl("Homo sapiens"));
IndexHits<Node> hits = taxonService.findCloseMatchesForTaxonName("Homo sapiens");
assertThat(hits.hasNext(), is(true));
hits.close();
hits = taxonService.findCloseMatchesForTaxonName("Homo saliens");
assertThat(hits.hasNext(), is(true));
hits = taxonService.findCloseMatchesForTaxonName("Homo");
assertThat(hits.hasNext(), is(true));
hits = taxonService.findCloseMatchesForTaxonName("homo sa");
assertThat(hits.hasNext(), is(true));
}
use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.
the class NonResolvingTaxonIndexTest method createTaxonExternalIdIndex.
@Test
public final void createTaxonExternalIdIndex() throws NodeFactoryException {
Taxon taxon1 = new TaxonImpl(null, "foo:123");
taxon1.setPath(null);
TaxonNode taxon = taxonService.getOrCreateTaxon(taxon1);
assertThat(taxon, is(notNullValue()));
assertThat(taxonService.findTaxonById("foo:123"), is(notNullValue()));
}
use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.
the class NonResolvingTaxonIndexTest method findNoMatchNoName.
@Test
public final void findNoMatchNoName() throws NodeFactoryException {
taxonService.getOrCreateTaxon(new TaxonImpl("some name", PropertyAndValueDictionary.NO_MATCH));
assertNull(taxonService.findTaxonById(PropertyAndValueDictionary.NO_MATCH));
taxonService.getOrCreateTaxon(new TaxonImpl(PropertyAndValueDictionary.NO_NAME));
assertNull(taxonService.findTaxonByName(PropertyAndValueDictionary.NO_MATCH));
assertNull(taxonService.findTaxonByName(PropertyAndValueDictionary.NO_NAME));
}
Aggregations