use of dk.dbc.pgqueue.PreparedQueueSupplier in project solr-document-store by DBCDK.
the class WorkerIT method testQueueWorkerConsumes.
@Test(timeout = 5000L)
public void testQueueWorkerConsumes() throws Exception {
System.out.println("testQueueWorkerConsumes");
SolrClient solrClient = SolrApi.makeSolrClient(solrUrl);
try (Connection connection = dataSource.getConnection()) {
Requests.load("test1-part1", solrDocStoreUrl);
long count = solrClient.query(new SolrQuery("*:*")).getResults().getNumFound();
assertEquals("After delete sorl document count: ", 0, count);
PreparedQueueSupplier supplier = new QueueSupplier<>(QueueJob.STORAGE_ABSTRACTION).preparedSupplier(connection);
supplier.enqueue("test", new QueueJob(300000, "clazzifier", "23645564"));
int maxRuns = 2500 / 50;
while (solrClient.query(new SolrQuery("*:*")).getResults().getNumFound() == 0) {
Thread.sleep(50L);
solrClient.commit(true, true);
if (maxRuns-- <= 0) {
break;
}
}
worker.destroy();
count = solrClient.query(new SolrQuery("*:*")).getResults().getNumFound();
assertEquals("After dequeue - sorl document count: ", 3, count);
}
}
Aggregations