use of junitparams.Parameters in project geode by apache.
the class LuceneIndexCreationDUnitTest method verifyDifferentFieldAnalyzersFails2.
@Test
@Parameters({ "PARTITION" })
public void verifyDifferentFieldAnalyzersFails2(RegionTestableType regionType) {
SerializableRunnableIF createIndex1 = getAnalyzersIndexWithNullField1();
dataStore1.invoke(() -> initDataStore(createIndex1, regionType));
SerializableRunnableIF createIndex2 = getAnalyzersIndexWithNullField2();
dataStore2.invoke(() -> initDataStore(createIndex2, regionType, CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_ANALYZERS));
}
use of junitparams.Parameters in project geode by apache.
the class LuceneIndexCreationDUnitTest method verifyDifferentIndexNamesFails.
@Test
@Parameters({ "PARTITION" })
public void verifyDifferentIndexNamesFails(RegionTestableType regionType) {
SerializableRunnableIF createIndex1 = () -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
luceneService.createIndexFactory().addField("field1").create(INDEX_NAME + "1", REGION_NAME);
};
dataStore1.invoke(() -> initDataStore(createIndex1, regionType));
SerializableRunnableIF createIndex2 = () -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
luceneService.createIndexFactory().addField("field1").create(INDEX_NAME + "2", REGION_NAME);
};
dataStore2.invoke(() -> initDataStore(createIndex2, regionType, CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_NAMES));
}
use of junitparams.Parameters in project geode by apache.
the class LuceneIndexCreationIntegrationTest method shouldUseRedundancyForInternalRegionsWhenUserRegionHasRedundancy.
@Test
@Parameters({ "0", "1", "2" })
public void shouldUseRedundancyForInternalRegionsWhenUserRegionHasRedundancy(int redundancy) {
createIndex("text");
PartitionAttributesFactory paf = new PartitionAttributesFactory();
paf.setRedundantCopies(redundancy);
cache.createRegionFactory(RegionShortcut.PARTITION_REDUNDANT).setPartitionAttributes(paf.create()).create(REGION_NAME);
verifyInternalRegions(region -> {
assertEquals(redundancy, region.getAttributes().getPartitionAttributes().getRedundantCopies());
});
}
use of junitparams.Parameters in project geode by apache.
the class LuceneIndexDestroyDUnitTest method verifyDestroyAllIndexesWhileDoingPuts.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void verifyDestroyAllIndexesWhileDoingPuts(RegionTestableType regionType) throws Exception {
// Add ignored exceptions to ignore RegionDestroyExceptions
IgnoredException.addIgnoredException(RegionDestroyedException.class.getSimpleName());
// Create indexes and region
dataStore1.invoke(() -> initDataStore(createIndexes(), regionType));
dataStore2.invoke(() -> initDataStore(createIndexes(), regionType));
// Verify indexes created
dataStore1.invoke(() -> verifyIndexesCreated());
dataStore2.invoke(() -> verifyIndexesCreated());
// Start puts
AsyncInvocation putter = dataStore1.invokeAsync(() -> doPutsUntilStopped());
// Wait until puts have started
dataStore1.invoke(() -> waitUntilPutsHaveStarted());
// Destroy indexes (only needs to be done on one member)
dataStore1.invoke(() -> destroyIndexes());
// Verify indexes destroyed
dataStore1.invoke(() -> verifyIndexesDestroyed());
dataStore2.invoke(() -> verifyIndexesDestroyed());
// End puts
dataStore1.invoke(() -> stopPuts());
// Wait for the putter to complete and verify no unexpected exception has occurred
ThreadUtils.join(putter, 60 * 1000);
if (putter.exceptionOccurred()) {
fail(putter.getException());
}
// Verify region size
dataStore1.invoke(() -> verifyRegionSize());
}
use of junitparams.Parameters in project geode by apache.
the class LuceneQueriesDUnitTest method canQueryWithCustomLuceneQueryObject.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void canQueryWithCustomLuceneQueryObject(RegionTestableType regionTestType) {
SerializableRunnableIF createIndex = () -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
luceneService.createIndexFactory().addField("text").create(INDEX_NAME, REGION_NAME);
};
dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
accessor.invoke(() -> initAccessor(createIndex, regionTestType));
putDataInRegion(accessor);
assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
// Execute a query with a custom lucene query object
accessor.invoke(() -> {
Cache cache = getCache();
LuceneService service = LuceneServiceProvider.get(cache);
LuceneQuery query = service.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, index -> {
return new TermQuery(new Term("text", "world"));
});
final PageableLuceneQueryResults results = query.findPages();
assertEquals(3, results.size());
});
}
Aggregations