use of org.apache.geode.cache.lucene.LuceneIndex 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