use of org.apache.geode.cache.lucene.test.TestObject in project geode by apache.
the class LuceneIndexCreationPersistenceIntegrationTest method shouldHandleMultipleIndexes.
@Test
@Parameters(method = "getRegionShortcuts")
public void shouldHandleMultipleIndexes(RegionShortcut shortcut) throws Exception {
LuceneServiceProvider.get(this.cache).createIndexFactory().setFields("field1").create(INDEX_NAME + "_1", REGION_NAME);
LuceneServiceProvider.get(this.cache).createIndexFactory().setFields("field2").create(INDEX_NAME + "_2", REGION_NAME);
Region region = cache.createRegionFactory(shortcut).create(REGION_NAME);
region.put("key1", new TestObject());
verifyQueryResultSize(INDEX_NAME + "_1", REGION_NAME, "field1:world", DEFAULT_FIELD, 1);
verifyQueryResultSize(INDEX_NAME + "_2", REGION_NAME, "field2:field", DEFAULT_FIELD, 1);
}
use of org.apache.geode.cache.lucene.test.TestObject in project geode by apache.
the class LuceneIndexCreationPersistenceIntegrationTest method shouldRecoverPersistentIndexWhenDataIsWrittenToIndex.
@Test
public void shouldRecoverPersistentIndexWhenDataIsWrittenToIndex() throws Exception {
createIndex(cache, "field1", "field2");
Region dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT).create(REGION_NAME);
dataRegion.put("A", new TestObject());
verifyIndexFinishFlushing(cache, INDEX_NAME, REGION_NAME);
cache.close();
createCache();
createIndex(cache, "field1", "field2");
dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT).create(REGION_NAME);
LuceneQuery<Object, Object> query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, "field1:world", DEFAULT_FIELD);
assertEquals(1, query.findPages().size());
}
use of org.apache.geode.cache.lucene.test.TestObject in project geode by apache.
the class LuceneIndexCreationPersistenceIntegrationTest method shouldRecoverPersistentIndexWhenDataStillInQueue.
@Test
public void shouldRecoverPersistentIndexWhenDataStillInQueue() throws Exception {
createIndex(cache, "field1", "field2");
Region dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT).create(REGION_NAME);
// Pause the sender so that the entry stays in the queue
pauseSender(cache);
dataRegion.put("A", new TestObject());
cache.close();
createCache();
createIndex(cache, "field1", "field2");
dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT).create(REGION_NAME);
verifyIndexFinishFlushing(cache, INDEX_NAME, REGION_NAME);
LuceneQuery<Object, Object> query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, "field1:world", DEFAULT_FIELD);
assertEquals(1, query.findPages().size());
}
Aggregations