use of org.icij.datashare.batch.BatchDownload in project datashare by ICIJ.
the class BatchDownloadRunnerIntTest method test_two_files_one_result.
@Test
public void test_two_files_one_result() throws Exception {
new IndexerHelper(es.client).indexFile("doc1.txt", "The quick brown fox jumps over the lazy dog", fs);
new IndexerHelper(es.client).indexFile("doc2.txt", "Portez ce vieux whisky au juge blond qui fume", fs);
BatchDownload bd = createBatchDownload("juge");
new BatchDownloadRunner(indexer, createProvider(), bd, updateCallback).call();
assertThat(bd.filename.toFile()).isFile();
assertThat(new ZipFile(bd.filename.toFile()).size()).isEqualTo(1);
}
use of org.icij.datashare.batch.BatchDownload in project datashare by ICIJ.
the class BatchDownloadLoopTestInt method test_batch_download_task_view_properties.
@Test(timeout = 1000)
public void test_batch_download_task_view_properties() {
TaskFactory factory = mock(TaskFactory.class);
when(factory.createDownloadRunner(any(), any())).thenReturn(mock(BatchDownloadRunner.class));
BatchDownloadLoop batchDownloadLoop = new BatchDownloadLoop(new PropertiesProvider(), batchDownloadQueue, factory, taskManager);
batchDownloadQueue.add(new BatchDownload(Project.project("prj"), User.local(), "foo"));
batchDownloadLoop.enqueuePoison();
batchDownloadLoop.run();
assertThat(taskManager.get()).hasSize(1);
assertThat(taskManager.get().get(0).properties).hasSize(1);
}
use of org.icij.datashare.batch.BatchDownload in project datashare by ICIJ.
the class BatchDownloadRunnerIntTest method test_one_result_with_json_query.
@Test
public void test_one_result_with_json_query() throws Exception {
String content = "The quick brown fox jumps over the lazy dog";
new IndexerHelper(es.client).indexFile("mydoc.txt", content, fs);
BatchDownload bd = createBatchDownload("{\"match_all\":{}}");
new BatchDownloadRunner(indexer, createProvider(), bd, updateCallback).call();
assertThat(bd.filename.toFile()).isFile();
assertThat(new ZipFile(bd.filename.toFile()).size()).isEqualTo(1);
}
use of org.icij.datashare.batch.BatchDownload in project datashare by ICIJ.
the class BatchDownloadRunnerIntTest method test_to_string_contains_batch_download_uuid.
@Test
public void test_to_string_contains_batch_download_uuid() {
BatchDownload batchDownload = createBatchDownload("*");
BatchDownloadRunner batchDownloadRunner = new BatchDownloadRunner(indexer, createProvider(), batchDownload, updateCallback);
assertThat(batchDownloadRunner.toString()).startsWith("org.icij.datashare.tasks.BatchDownloadRunner@");
assertThat(batchDownloadRunner.toString()).contains(batchDownload.uuid);
}
use of org.icij.datashare.batch.BatchDownload in project datashare by ICIJ.
the class BatchDownloadRunnerIntTest method test_update_batch_download_zip_size.
@Test
public void test_update_batch_download_zip_size() throws Exception {
new IndexerHelper(es.client).indexFile("doc1.txt", "The quick brown fox jumps over the lazy dog", fs);
new IndexerHelper(es.client).indexFile("doc2.txt", "Portez ce vieux whisky au juge blond qui fume", fs);
BatchDownload bd = createBatchDownload("*");
long sizeAtCreation = bd.zipSize;
new BatchDownloadRunner(indexer, createProvider(), bd, updateCallback).call();
assertThat(bd.zipSize).isGreaterThan(sizeAtCreation);
}
Aggregations