use of org.icij.datashare.cli.DatashareCliOptions.NLP_PARALLELISM_OPT in project datashare by ICIJ.
the class NlpAppTest method runNlpApp.
private NlpApp runNlpApp(String parallelism, int nlpProcessDelayMillis) throws InterruptedException {
Properties properties = new Properties();
properties.setProperty(NLP_PARALLELISM_OPT, parallelism);
properties.setProperty("messageBusAddress", "redis");
CountDownLatch latch = new CountDownLatch(1);
when(pipeline.process(any())).thenAnswer((Answer<List<NamedEntity>>) invocationOnMock -> {
if (nlpProcessDelayMillis > 0)
Thread.sleep(nlpProcessDelayMillis);
return emptyList();
});
NlpApp nlpApp = new NlpApp(dataBus, indexer, pipeline, properties, latch::countDown, 1, true, local());
executor.execute(nlpApp);
latch.await(2, SECONDS);
return nlpApp;
}
Aggregations