use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.
the class NoteResourceTest method setUp.
@Before
public void setUp() {
initMocks(this);
configure(routes -> routes.add(new NoteResource(repository)).filter(new LocalUserFilter(new PropertiesProvider())));
}
use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.
the class ProjectResourceTest method test_delete_project_with_unauthorized_user.
@Test
public void test_delete_project_with_unauthorized_user() {
configure(routes -> routes.add(new ProjectResource(repository, indexer)).filter(new YesBasicAuthFilter(new PropertiesProvider())));
when(repository.deleteAll("projectId")).thenReturn(true);
delete("/api/project/hacker-datashare").withPreemptiveAuthentication("hacker", "pass").should().respond(401);
delete("/api/project/projectId").should().respond(401);
}
use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.
the class StatusResourceTest method setUp.
@Before
public void setUp() {
initMocks(this);
when(documentCollectionFactory.createQueue(any(), eq(new PropertiesProvider().get(PropertiesProvider.QUEUE_NAME_OPTION).orElse("extract:queue")))).thenReturn(mock(DocumentQueue.class));
configure(routes -> routes.add(new StatusResource(new PropertiesProvider(), repository, indexer, dataBus, documentCollectionFactory)));
}
use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.
the class BatchSearchRunnerTest method test_run_batch_search_with_throttle.
@Test
public void test_run_batch_search_with_throttle() throws Exception {
mockSearch.willReturn(1, createDoc("doc").build());
BatchSearch batchSearch = new BatchSearch("uuid1", project("test-datashare"), "name1", "desc1", asSet("query1", "query2"), new Date(), BatchSearch.State.QUEUED, local());
Date beforeBatch = timeRule.now;
new BatchSearchRunner(indexer, new PropertiesProvider(new HashMap<String, String>() {
{
put(BATCH_THROTTLE, "1000");
}
}), batchSearch, resultConsumer).call();
assertThat(timeRule.now().getTime() - beforeBatch.getTime()).isEqualTo(1000);
}
use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.
the class BatchSearchRunnerTest method test_run_batch_search.
@Test
public void test_run_batch_search() throws Exception {
Document[] documents = { createDoc("doc1").build(), createDoc("doc2").build() };
mockSearch.willReturn(1, documents);
BatchSearch search = new BatchSearch("uuid1", project("test-datashare"), "name1", "desc1", asSet("query1", "query2"), new Date(), BatchSearch.State.QUEUED, User.local());
assertThat(new BatchSearchRunner(indexer, new PropertiesProvider(), search, resultConsumer).call()).isEqualTo(2);
verify(resultConsumer).apply("uuid1", "query1", asList(documents));
}
Aggregations