use of org.apache.geode.cache.lucene.LuceneService in project geode by apache.
the class LuceneIndexCommandsDUnitTest method putEntries.
private void putEntries(final VM vm1, Map<String, TestObject> entries, int countOfDocuments) {
Cache cache = getCache();
vm1.invoke(() -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
Region region = getCache().getRegion(REGION_NAME);
region.putAll(entries);
luceneService.waitUntilFlushed(INDEX_NAME, REGION_NAME, 60000, TimeUnit.MILLISECONDS);
LuceneIndexImpl index = (LuceneIndexImpl) luceneService.getIndex(INDEX_NAME, REGION_NAME);
Awaitility.await().atMost(65, TimeUnit.SECONDS).until(() -> assertEquals(countOfDocuments, index.getIndexStats().getDocuments()));
});
}
use of org.apache.geode.cache.lucene.LuceneService in project geode by apache.
the class LuceneServiceImplIntegrationTest method getCacheShouldReturnTheCorrectCache.
@Test
public void getCacheShouldReturnTheCorrectCache() {
cache = getCache();
new LuceneServiceImpl().init(cache);
LuceneService service = LuceneServiceProvider.get(cache);
assertTrue(service.getCache().equals(cache));
}
use of org.apache.geode.cache.lucene.LuceneService in project geode by apache.
the class LuceneIndexXmlParserIntegrationJUnitTest method createIndex.
/**
* Test that the Index creation objects get appropriately translated into a real index.
*
* @throws FileNotFoundException
*/
@Test
public void createIndex() throws FileNotFoundException {
CacheFactory cf = new CacheFactory();
cf.set(MCAST_PORT, "0");
cf.set(CACHE_XML_FILE, getXmlFileForTest());
Cache cache = cf.create();
LuceneService service = LuceneServiceProvider.get(cache);
assertEquals(3, service.getAllIndexes().size());
LuceneIndex index1 = service.getIndex("index1", "/region");
LuceneIndex index2 = service.getIndex("index2", "/region");
LuceneIndex index3 = service.getIndex("index3", "/region");
assertArrayEquals(index1.getFieldNames(), new String[] { "a", "b", "c", "d" });
assertArrayEquals(index2.getFieldNames(), new String[] { "f", "g" });
assertArrayEquals(index3.getFieldNames(), new String[] { "h", "i", "j" });
}
Aggregations