use of org.icij.datashare.text.indexing.Indexer in project datashare by ICIJ.
the class BatchDownloadRunnerTest method test_max_zip_size.
@Test
public void test_max_zip_size() throws Exception {
Document[] documents = IntStream.range(0, 3).mapToObj(i -> createDoc("doc" + i).with(createFile(i)).with("hello world " + i).build()).toArray(Document[]::new);
mockSearch.willReturn(2, documents);
File zip = new BatchDownloadRunner(indexer, new PropertiesProvider(new HashMap<String, String>() {
{
put(BATCH_DOWNLOAD_MAX_SIZE, valueOf("hello world 1".getBytes(StandardCharsets.UTF_8).length * 3));
put(SCROLL_SIZE, "3");
}
}), new BatchDownload(project("test-datashare"), User.local(), "query"), updater).call();
assertThat(new ZipFile(zip).size()).isEqualTo(4);
}
use of org.icij.datashare.text.indexing.Indexer in project datashare by ICIJ.
the class BatchDownloadRunnerTest method test_max_default_results.
@Test
public void test_max_default_results() throws Exception {
Document[] documents = IntStream.range(0, 3).mapToObj(i -> createDoc("doc" + i).with(createFile(i)).build()).toArray(Document[]::new);
mockSearch.willReturn(2, documents);
File zip = new BatchDownloadRunner(indexer, new PropertiesProvider(new HashMap<String, String>() {
{
put(BATCH_DOWNLOAD_MAX_NB_FILES, "3");
put(SCROLL_SIZE, "3");
}
}), new BatchDownload(project("test-datashare"), User.local(), "query"), updater).call();
assertThat(new ZipFile(zip).size()).isEqualTo(3);
}
Aggregations