Search in sources :

Example 6 with LogContext

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

the class StudyImporterForGoMexSI2IT method importWithCommit.

protected StudyImporterForGoMexSI2 importWithCommit(String baseUrlLastCommit) throws StudyImporterException, IOException {
    StudyImporterForGoMexSI2 importer = new StudyImporterForGoMexSI2(new ParserFactoryLocal(), nodeFactory);
    final List<String> msgs = new ArrayList<String>();
    importer.setLogger(new ImportLogger() {

        @Override
        public void warn(LogContext study, String message) {
            LOG.warn(message);
            msgs.add("warn: " + message);
        }

        @Override
        public void info(LogContext study, String message) {
            LOG.info(message);
            msgs.add("info: " + message);
        }

        @Override
        public void severe(LogContext study, String message) {
            LOG.error(message);
            msgs.add("severe: " + message);
        }
    });
    JsonNode config = new ObjectMapper().readTree("{ \n" + "  \"citation\": \"testing source citation\",\n" + "  \"format\": \"gomexsi\"\n" + "}");
    DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create(baseUrlLastCommit));
    importer.setDataset(dataset);
    dataset.setConfig(config);
    importStudy(importer);
    return importer;
}
Also used : ArrayList(java.util.ArrayList) LogContext(org.eol.globi.domain.LogContext) JsonNode(org.codehaus.jackson.JsonNode) DatasetImpl(org.eol.globi.service.DatasetImpl) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Aggregations

LogContext (org.eol.globi.domain.LogContext)6 Study (org.eol.globi.domain.Study)5 Test (org.junit.Test)5 Relationship (org.neo4j.graphdb.Relationship)4 ArrayList (java.util.ArrayList)3 JsonNode (org.codehaus.jackson.JsonNode)3 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)3 DatasetImpl (org.eol.globi.service.DatasetImpl)3 HashMap (java.util.HashMap)2 SpecimenNode (org.eol.globi.domain.SpecimenNode)2 JUnitMatchers.containsString (org.junit.matchers.JUnitMatchers.containsString)2 ExecutionEngine (org.neo4j.cypher.javacompat.ExecutionEngine)2 ExecutionResult (org.neo4j.cypher.javacompat.ExecutionResult)2 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Taxon (org.eol.globi.domain.Taxon)1 TaxonNode (org.eol.globi.domain.TaxonNode)1 Dataset (org.eol.globi.service.Dataset)1 DatasetLocal (org.eol.globi.service.DatasetLocal)1