Search in sources :

Example 16 with LuceneIndex

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" });
}
Also used : LuceneIndex(org.apache.geode.cache.lucene.LuceneIndex) CacheFactory(org.apache.geode.cache.CacheFactory) Cache(org.apache.geode.cache.Cache) LuceneService(org.apache.geode.cache.lucene.LuceneService) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

LuceneIndex (org.apache.geode.cache.lucene.LuceneIndex)16 LuceneService (org.apache.geode.cache.lucene.LuceneService)10 Test (org.junit.Test)10 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)6 LuceneIndexImpl (org.apache.geode.cache.lucene.internal.LuceneIndexImpl)4 CommandStringBuilder (org.apache.geode.management.internal.cli.util.CommandStringBuilder)4 VM (org.apache.geode.test.dunit.VM)4 ArrayList (java.util.ArrayList)3 Cache (org.apache.geode.cache.Cache)3 LuceneServiceImpl (org.apache.geode.cache.lucene.internal.LuceneServiceImpl)3 LuceneIndexDetails (org.apache.geode.cache.lucene.internal.cli.LuceneIndexDetails)3 Analyzer (org.apache.lucene.analysis.Analyzer)3 KeywordAnalyzer (org.apache.lucene.analysis.core.KeywordAnalyzer)3 StandardAnalyzer (org.apache.lucene.analysis.standard.StandardAnalyzer)3 HashSet (java.util.HashSet)2 CacheFactory (org.apache.geode.cache.CacheFactory)2 LuceneIndexCreationProfile (org.apache.geode.cache.lucene.internal.LuceneIndexCreationProfile)2 MemberVM (org.apache.geode.test.dunit.rules.MemberVM)2 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)2 UnitTest (org.apache.geode.test.junit.categories.UnitTest)2