Search in sources :

Example 1 with InteractionValidator

use of org.eol.globi.process.InteractionValidator in project eol-globi-data by jhpoelen.

the class DatasetImporterForMangalIT method importAll.

@Test
public void importAll() throws StudyImporterException {
    AtomicInteger counter = new AtomicInteger(0);
    DatasetImporterForMangal importer = new DatasetImporterForMangal(null, null);
    importer.setDataset(new DatasetLocal(inStream -> inStream));
    importer.setInteractionListener(new InteractionValidator(new InteractionListener() {

        @Override
        public void on(Map<String, String> interaction) throws StudyImporterException {
            counter.incrementAndGet();
        }
    }, new NullImportLogger() {

        @Override
        public void warn(LogContext ctx, String message) {
            fail("unexpected warning: [" + message + "]");
        }
    }));
    importer.importStudy();
    assertThat(counter.get() > 0, Is.is(true));
}
Also used : LogContext(org.eol.globi.domain.LogContext) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) InteractionValidator(org.eol.globi.process.InteractionValidator) InteractionListener(org.eol.globi.process.InteractionListener) Test(org.junit.Test) Assert.fail(org.junit.Assert.fail) InteractionListenerImpl(org.eol.globi.process.InteractionListenerImpl) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) NullImportLogger(org.eol.globi.tool.NullImportLogger) DatasetLocal(org.eol.globi.service.DatasetLocal) Is(org.hamcrest.core.Is) NullImportLogger(org.eol.globi.tool.NullImportLogger) InteractionListener(org.eol.globi.process.InteractionListener) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) InteractionValidator(org.eol.globi.process.InteractionValidator) LogContext(org.eol.globi.domain.LogContext) DatasetLocal(org.eol.globi.service.DatasetLocal) Map(java.util.Map) Test(org.junit.Test)

Example 2 with InteractionValidator

use of org.eol.globi.process.InteractionValidator in project eol-globi-data by jhpoelen.

the class DatasetImporterForBatBaseIT method importAll.

@Test
public void importAll() throws StudyImporterException {
    AtomicInteger counter = new AtomicInteger(0);
    DatasetImporterForBatBase importer = new DatasetImporterForBatBase(null, null);
    DatasetImpl dataset = new DatasetImpl("test/batplant", URI.create("classpath:/org/eol/globi/data/batplant/"), is -> is);
    importer.setDataset(dataset);
    importer.setInteractionListener(new InteractionValidator(new InteractionListener() {

        @Override
        public void on(Map<String, String> interaction) throws StudyImporterException {
            counter.incrementAndGet();
        }
    }, new NullImportLogger() {

        @Override
        public void warn(LogContext ctx, String message) {
            fail("unexpected warning: [" + message + "]");
        }
    }));
    importer.importStudy();
    assertThat(counter.get() > 0, Is.is(true));
}
Also used : NullImportLogger(org.eol.globi.tool.NullImportLogger) InteractionListener(org.eol.globi.process.InteractionListener) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) InteractionValidator(org.eol.globi.process.InteractionValidator) LogContext(org.eol.globi.domain.LogContext) DatasetImpl(org.globalbioticinteractions.dataset.DatasetImpl) Map(java.util.Map) Test(org.junit.Test)

Aggregations

Map (java.util.Map)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 LogContext (org.eol.globi.domain.LogContext)2 InteractionListener (org.eol.globi.process.InteractionListener)2 InteractionValidator (org.eol.globi.process.InteractionValidator)2 NullImportLogger (org.eol.globi.tool.NullImportLogger)2 Test (org.junit.Test)2 InteractionListenerImpl (org.eol.globi.process.InteractionListenerImpl)1 DatasetLocal (org.eol.globi.service.DatasetLocal)1 DatasetImpl (org.globalbioticinteractions.dataset.DatasetImpl)1 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)1 Is (org.hamcrest.core.Is)1 Assert.fail (org.junit.Assert.fail)1