use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.
the class UserResourceTest method setUp.
@Before
public void setUp() {
initMocks(this);
configure(routes -> routes.add(new UserResource(repository)).filter(new LocalUserFilter(new PropertiesProvider())));
}
use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.
the class RedisUserDocumentQueueTest method test_redis_queue_name_with_user_not_null_and_queue_name__user_queue_is_preferred.
@Test
public void test_redis_queue_name_with_user_not_null_and_queue_name__user_queue_is_preferred() {
RedisUserDocumentQueue queue = new RedisUserDocumentQueue(new User("foo"), new PropertiesProvider(new HashMap<String, String>() {
{
put("redisAddress", "redis://redis:6379");
put("queueName", "myqueue");
}
}));
queue.offer(get("/path/to/doc"));
assertThat(redis.keys("extract:queue_foo")).hasSize(1);
assertThat(redis.lpop("extract:queue_foo")).isEqualTo("/path/to/doc");
}
use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.
the class RedisUserDocumentQueueTest method test_redis_queue_name_with_null_user.
@Test
public void test_redis_queue_name_with_null_user() {
RedisUserDocumentQueue queue = new RedisUserDocumentQueue(nullUser(), new PropertiesProvider(new HashMap<String, String>() {
{
put("redisAddress", "redis://redis:6379");
}
}));
queue.offer(get("/path/to/doc"));
assertThat(redis.keys("extract:queue")).hasSize(1);
assertThat(redis.lpop("extract:queue")).isEqualTo("/path/to/doc");
}
use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.
the class RedisUserDocumentQueueTest method test_redis_queue_name_with_user_not_null_and_no_parameter_queue_name.
@Test
public void test_redis_queue_name_with_user_not_null_and_no_parameter_queue_name() {
RedisUserDocumentQueue queue = new RedisUserDocumentQueue(new User("foo"), new PropertiesProvider(new HashMap<String, String>() {
{
put("redisAddress", "redis://redis:6379");
}
}));
queue.offer(get("/path/to/doc"));
assertThat(redis.keys("extract:queue_foo")).hasSize(1);
assertThat(redis.lpop("extract:queue_foo")).isEqualTo("/path/to/doc");
}
use of org.icij.datashare.PropertiesProvider in project datashare by ICIJ.
the class BatchSearchRunnerTest method test_cancel_current_batch_search.
@Test
public void test_cancel_current_batch_search() throws Exception {
CountDownLatch countDownLatch = new CountDownLatch(1);
BatchSearch batchSearch = new BatchSearch("uuid1", project("test-datashare"), "name1", "desc1", asSet("query1", "query2"), new Date(), BatchSearch.State.QUEUED, local());
Document[] documents = { createDoc("doc").build() };
mockSearch.willReturn(1, documents);
BatchSearchRunner batchSearchRunner = new BatchSearchRunner(indexer, new PropertiesProvider(), batchSearch, resultConsumer, countDownLatch);
executor.submit(batchSearchRunner);
executor.shutdown();
countDownLatch.await();
batchSearchRunner.cancel();
assertThat(executor.awaitTermination(2, TimeUnit.SECONDS)).isTrue();
}
Aggregations