Search in sources :

Example 71 with PropertiesProvider

use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.

the class IndexResourceTest method test_no_auth_get_forward_request_to_elastic.

@Test
public void test_no_auth_get_forward_request_to_elastic() {
    configure(routes -> routes.add(new IndexResource(indexer)).filter(new LocalUserFilter(new PropertiesProvider(new HashMap<String, String>() {

        {
            put("defaultUserName", "test");
        }
    }))));
    get("/api/index/search/test-datashare/_search").should().respond(200).contain("\"successful\":1");
}
Also used : PropertiesProvider(org.icij.datashare.PropertiesProvider) LocalUserFilter(org.icij.datashare.session.LocalUserFilter) HashMap(java.util.HashMap) AbstractProdWebServerTest(org.icij.datashare.web.testhelpers.AbstractProdWebServerTest) Test(org.junit.Test)

Example 72 with PropertiesProvider

use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.

the class ProjectResourceTest method setUp.

@Before
public void setUp() {
    initMocks(this);
    configure(routes -> routes.add(new ProjectResource(repository, indexer)).filter(new LocalUserFilter(new PropertiesProvider())));
}
Also used : PropertiesProvider(org.icij.datashare.PropertiesProvider) LocalUserFilter(org.icij.datashare.session.LocalUserFilter) Before(org.junit.Before)

Example 73 with PropertiesProvider

use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.

the class StatusResourceTest method test_get_queue_with_io_exception.

@Test
public void test_get_queue_with_io_exception() {
    DocumentQueue mockQueue = mock(DocumentQueue.class);
    when(mockQueue.size()).thenThrow(new RuntimeException("test"));
    when(documentCollectionFactory.createQueue(any(), eq(new PropertiesProvider().get(PropertiesProvider.QUEUE_NAME_OPTION).orElse("extract:queue")))).thenReturn(mockQueue);
    configure(routes -> routes.add(new StatusResource(new PropertiesProvider(), repository, indexer, dataBus, documentCollectionFactory)));
    get("/api/status").should().respond(200).contain("\"document_queue_status\":false");
}
Also used : PropertiesProvider(org.icij.datashare.PropertiesProvider) DocumentQueue(org.icij.extract.queue.DocumentQueue) AbstractProdWebServerTest(org.icij.datashare.web.testhelpers.AbstractProdWebServerTest) Test(org.junit.Test)

Aggregations

PropertiesProvider (org.icij.datashare.PropertiesProvider)73 Test (org.junit.Test)44 HashMap (java.util.HashMap)27 Document (org.icij.datashare.text.Document)18 BatchSearch (org.icij.datashare.batch.BatchSearch)17 LocalUserFilter (org.icij.datashare.session.LocalUserFilter)15 AbstractProdWebServerTest (org.icij.datashare.web.testhelpers.AbstractProdWebServerTest)15 Path (java.nio.file.Path)11 Before (org.junit.Before)10 BatchDownload (org.icij.datashare.batch.BatchDownload)9 Publisher (org.icij.datashare.com.Publisher)8 Indexer (org.icij.datashare.text.indexing.Indexer)7 User (org.icij.datashare.user.User)7 Date (java.util.Date)6 Properties (java.util.Properties)6 RestAssert (net.codestory.rest.RestAssert)5 PipelineRegistry (org.icij.datashare.extension.PipelineRegistry)5 DocumentFactory (org.icij.extract.document.DocumentFactory)5 TikaDocument (org.icij.extract.document.TikaDocument)5 FieldNames (org.icij.spewer.FieldNames)5