Search in sources :

Example 61 with StudyImpl

use of org.eol.globi.domain.StudyImpl in project eol-globi-data by jhpoelen.

the class ExporterTaxaDistinctTest method excludeNoMatchNames.

@Test
public void excludeNoMatchNames() throws NodeFactoryException, IOException {
    Study study = nodeFactory.createStudy(new StudyImpl("bla", null, null, null));
    Specimen predator = nodeFactory.createSpecimen(study, new TaxonImpl(PropertyAndValueDictionary.NO_MATCH, "EOL:1234"));
    Specimen prey = nodeFactory.createSpecimen(study, new TaxonImpl(PropertyAndValueDictionary.NO_MATCH, "EOL:122"));
    predator.ate(prey);
    assertThat(exportStudy(study), not(containsString(PropertyAndValueDictionary.NO_MATCH)));
}
Also used : Study(org.eol.globi.domain.Study) Specimen(org.eol.globi.domain.Specimen) TaxonImpl(org.eol.globi.domain.TaxonImpl) StudyImpl(org.eol.globi.domain.StudyImpl) Test(org.junit.Test)

Example 62 with StudyImpl

use of org.eol.globi.domain.StudyImpl in project eol-globi-data by jhpoelen.

the class ExporterSiteMapForCitationsTest method writeSiteMapWithCitations.

@Test
public void writeSiteMapWithCitations() throws StudyImporterException, IOException {
    final Study study = nodeFactory.getOrCreateStudy(new StudyImpl("title", "source", "doi:some/doi", "citation123&bla"));
    assertThat(study.getExternalId(), is("http://dx.doi.org/some/doi"));
    final File baseDirCitations = createBaseDir("target/sitemap/citations");
    final GraphExporter siteMapForCitationsExporter = new ExporterSiteMapForCitations();
    siteMapForCitationsExporter.export(getGraphDb(), baseDirCitations.getAbsolutePath());
    final String substring = "http://www.globalbioticinteractions.org/?accordingTo=" + "http://dx.doi.org/some/doi";
    assertSiteMap(baseDirCitations, substring, "https://depot.globalbioticinteractions.org/snapshot/target/data/sitemap/citations/sitemap.xml.gz");
}
Also used : Study(org.eol.globi.domain.Study) StudyImpl(org.eol.globi.domain.StudyImpl) File(java.io.File) Test(org.junit.Test)

Example 63 with StudyImpl

use of org.eol.globi.domain.StudyImpl in project eol-globi-data by jhpoelen.

the class ExporterReferencesTest method exportReference.

@Test
public void exportReference() throws IOException, NodeFactoryException, ParseException {
    StudyImpl myStudy1 = new StudyImpl("myStudy", "a source", "doi:1234", ExternalIdUtil.toCitation("John Doe", "description study 1", "1927"));
    myStudy1.setExternalId("GAME:444");
    Study myStudy = nodeFactory.getOrCreateStudy(myStudy1);
    StringWriter row = new StringWriter();
    new ExporterReferences().exportStudy(myStudy, row, true);
    assertThat(row.getBuffer().toString(), equalTo(getExpectedData()));
    row = new StringWriter();
    new ExporterReferences().exportStudy(myStudy, row, false);
    assertThat(row.getBuffer().toString(), equalTo(getExpectedRow()));
}
Also used : Study(org.eol.globi.domain.Study) StringWriter(java.io.StringWriter) StudyImpl(org.eol.globi.domain.StudyImpl) Test(org.junit.Test)

Example 64 with StudyImpl

use of org.eol.globi.domain.StudyImpl in project eol-globi-data by jhpoelen.

the class ExporterReferencesTest method exportReferenceNoDescription.

@Test
public void exportReferenceNoDescription() throws IOException, NodeFactoryException, ParseException {
    Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, null, null));
    StringWriter row = new StringWriter();
    new ExporterReferences().exportStudy(myStudy, row, false);
    assertThat(row.getBuffer().toString(), equalTo("\nglobi:ref:1\t\tmyStudy\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"));
}
Also used : Study(org.eol.globi.domain.Study) StringWriter(java.io.StringWriter) StudyImpl(org.eol.globi.domain.StudyImpl) Test(org.junit.Test)

Example 65 with StudyImpl

use of org.eol.globi.domain.StudyImpl in project eol-globi-data by jhpoelen.

the class ExporterReferencesTest method exportReferenceEscapeCharacters.

@Test
public void exportReferenceEscapeCharacters() throws IOException, NodeFactoryException, ParseException {
    Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, "doi:some/doi", "bla \"one\""));
    StringWriter row = new StringWriter();
    new ExporterReferences().exportStudy(myStudy, row, false);
    assertThat(row.getBuffer().toString(), equalTo("\nglobi:ref:1\t\tbla \"one\"\t\t\t\t\t\t\t\t\t\t\t\t\thttp://dx.doi.org/some/doi\tdoi:some/doi\t"));
}
Also used : Study(org.eol.globi.domain.Study) StringWriter(java.io.StringWriter) StudyImpl(org.eol.globi.domain.StudyImpl) Test(org.junit.Test)

Aggregations

StudyImpl (org.eol.globi.domain.StudyImpl)82 Study (org.eol.globi.domain.Study)60 Test (org.junit.Test)40 Specimen (org.eol.globi.domain.Specimen)33 TaxonImpl (org.eol.globi.domain.TaxonImpl)33 IOException (java.io.IOException)20 LabeledCSVParser (com.Ostermiller.util.LabeledCSVParser)17 Location (org.eol.globi.domain.Location)15 StringWriter (java.io.StringWriter)12 LocationImpl (org.eol.globi.domain.LocationImpl)12 Date (java.util.Date)9 HashMap (java.util.HashMap)9 Taxon (org.eol.globi.domain.Taxon)9 StudyNode (org.eol.globi.domain.StudyNode)7 Node (org.neo4j.graphdb.Node)7 File (java.io.File)6 TermImpl (org.eol.globi.domain.TermImpl)6 DatasetImpl (org.eol.globi.service.DatasetImpl)6 InteractType (org.eol.globi.domain.InteractType)5 NonResolvingTaxonIndex (org.eol.globi.taxon.NonResolvingTaxonIndex)5