use of org.icij.datashare.tasks.BatchSearchLoop in project datashare by ICIJ.
the class BatchSearchLoopTestInt method test_queued_batch_search_requeueing.
@Test
public void test_queued_batch_search_requeueing() throws Exception {
when(repository.getQueued()).thenReturn(asList("uuid1", "uuid2"));
BatchSearchLoop app = new BatchSearchLoop(repository, batchSearchQueue, factory);
assertThat(app.requeueDatabaseBatches()).isEqualTo(2);
app.enqueuePoison();
app.run();
verify(batchSearchRunner, times(2)).call();
}
use of org.icij.datashare.tasks.BatchSearchLoop in project datashare by ICIJ.
the class BatchSearchLoopTestInt method test_main_loop.
@Test
public void test_main_loop() {
BatchSearchLoop app = new BatchSearchLoop(repository, batchSearchQueue, factory);
batchSearchQueue.add(batchSearch.uuid);
app.enqueuePoison();
app.run();
verify(batchSearchRunner).call();
verify(repository).setState(batchSearch.uuid, BatchSearch.State.RUNNING);
verify(repository).setState(batchSearch.uuid, BatchSearch.State.SUCCESS);
}
use of org.icij.datashare.tasks.BatchSearchLoop in project datashare by ICIJ.
the class BatchSearchApp method start.
public static void start(Properties properties) throws Exception {
Injector injector = createInjector(CommonMode.create(properties));
BatchSearchLoop batchSearchLoop = injector.getInstance(TaskFactory.class).createBatchSearchLoop();
batchSearchLoop.requeueDatabaseBatches();
batchSearchLoop.run();
batchSearchLoop.close();
// to avoid being blocked
injector.getInstance(Indexer.class).close();
}
Aggregations