use of junitparams.Parameters in project geode by apache.
the class LuceneIndexCreationPersistenceIntegrationTest method aeqShouldAlwaysBeDiskSynchronousWhenUserRegionIsEither.
@Test
@Parameters({ "true", "false" })
public void aeqShouldAlwaysBeDiskSynchronousWhenUserRegionIsEither(boolean synchronous) {
createIndex(cache, "text");
cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT).setDiskSynchronous(synchronous).create(REGION_NAME);
verifyInternalRegions(region -> {
assertTrue(region.getDataPolicy().withPersistence());
assertTrue(region.isDiskSynchronous());
});
AsyncEventQueue queue = getIndexQueue(cache);
assertTrue(queue.isDiskSynchronous());
assertEquals(true, queue.isPersistent());
}
use of junitparams.Parameters in project geode by apache.
the class LuceneIndexDestroyDUnitTest method verifyDestroyAllIndexesWhileDoingQueries.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void verifyDestroyAllIndexesWhileDoingQueries(RegionTestableType regionType) throws Exception {
// Create indexes and region
SerializableRunnableIF createIndexes = createIndexes();
dataStore1.invoke(() -> initDataStore(createIndexes, regionType));
dataStore2.invoke(() -> initDataStore(createIndexes, regionType));
accessor.invoke(() -> initAccessor(createIndexes, regionType));
// Verify indexes created
dataStore1.invoke(() -> verifyIndexesCreated());
dataStore2.invoke(() -> verifyIndexesCreated());
accessor.invoke(() -> verifyIndexesCreated());
// Do puts
int numPuts = 100;
accessor.invoke(() -> doPuts(numPuts));
// Wait until queues are flushed
accessor.invoke(() -> waitUntilFlushed(INDEX1_NAME));
accessor.invoke(() -> waitUntilFlushed(INDEX2_NAME));
// Start queries
AsyncInvocation querier = accessor.invokeAsync(() -> doQueriesUntilException(INDEX1_NAME, "field1Value", "field1", numPuts));
// Wait until queries have started
accessor.invoke(() -> waitUntilQueriesHaveStarted());
// Destroy indexes (only needs to be done on one member)
accessor.invoke(() -> destroyIndexes());
// Verify indexes destroyed
dataStore1.invoke(() -> verifyIndexesDestroyed());
dataStore2.invoke(() -> verifyIndexesDestroyed());
accessor.invoke(() -> verifyIndexesDestroyed());
// Wait for the querier to complete and verify no unexpected exception has occurred
ThreadUtils.join(querier, 60 * 1000);
if (querier.exceptionOccurred()) {
fail(querier.getException());
}
}
use of junitparams.Parameters in project geode by apache.
the class MixedObjectIndexDUnitTest method luceneMustIndexFieldsWithTheSameNameInARegionWithMixedObjects.
@Test
@Parameters(method = "getPartitionRegionTypes")
public void luceneMustIndexFieldsWithTheSameNameInARegionWithMixedObjects(RegionTestableType regionTestableType) {
SerializableRunnableIF createIndexOnTextField = getSerializableRunnableIFCreateIndexOnFieldText();
dataStore1.invoke(() -> initDataStore(createIndexOnTextField, regionTestableType));
dataStore2.invoke(() -> initDataStore(createIndexOnTextField, regionTestableType));
accessor.invoke(() -> initDataStore(createIndexOnTextField, regionTestableType));
accessor.invoke(() -> {
Region region = getCache().getRegion(REGION_NAME);
IntStream.range(0, NUM_BUCKETS).forEach(i -> region.put(i, new TestObject("hello world")));
IntStream.range(NUM_BUCKETS, 2 * NUM_BUCKETS).forEach(i -> region.put(i, new TestObjectWithSameFieldName("hello world")));
IntStream.range(2 * NUM_BUCKETS, 3 * NUM_BUCKETS).forEach(i -> region.put(i, new TestObjectWithNoCommonField("hello world")));
});
waitForFlushBeforeExecuteTextSearch(accessor, 60000);
accessor.invoke(() -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
LuceneQuery luceneQueryForTextField = luceneService.createLuceneQueryFactory().setLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
List luceneResults = luceneQueryForTextField.findResults();
validateObjectResultCounts(luceneResults, TestObject.class, NUM_BUCKETS, TestObjectWithSameFieldName.class, NUM_BUCKETS, TestObjectWithNoCommonField.class, 0);
});
}
use of junitparams.Parameters in project geode by apache.
the class PaginationDUnitTest method partitionedRegionStorageExceptionWhenAllDataStoreAreClosedWhilePagination.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void partitionedRegionStorageExceptionWhenAllDataStoreAreClosedWhilePagination(RegionTestableType regionTestType) {
SerializableRunnableIF createIndex = () -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
luceneService.createIndexFactory().setFields("text").create(INDEX_NAME, REGION_NAME);
};
dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
accessor.invoke(() -> initAccessor(createIndex, regionTestType));
putEntryInEachBucket();
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, FLUSH_WAIT_TIME_MS));
accessor.invoke(() -> {
Cache cache = getCache();
LuceneService service = LuceneServiceProvider.get(cache);
LuceneQuery<Integer, TestObject> query;
query = service.createLuceneQueryFactory().setLimit(1000).setPageSize(PAGE_SIZE).create(INDEX_NAME, REGION_NAME, "world", "text");
PageableLuceneQueryResults<Integer, TestObject> pages = query.findPages();
assertTrue(pages.hasNext());
List<LuceneResultStruct<Integer, TestObject>> page = pages.next();
assertEquals(page.size(), PAGE_SIZE, page.size());
dataStore1.invoke(() -> closeCache());
try {
page = pages.next();
fail();
} catch (Exception e) {
Assert.assertEquals("Expected Exception = PartitionedRegionStorageException but hit " + e.toString(), true, e instanceof PartitionedRegionStorageException);
}
});
}
use of junitparams.Parameters in project geode by apache.
the class RebalanceDUnitTest method returnCorrectResultsWhenMoveBucketHappensOnIndexUpdate.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void returnCorrectResultsWhenMoveBucketHappensOnIndexUpdate(RegionTestableType regionTestType) throws InterruptedException {
final DistributedMember member2 = dataStore2.invoke(() -> getCache().getDistributedSystem().getDistributedMember());
addCallbackToMoveBucket(dataStore1, member2);
putEntriesAndValidateQueryResults(regionTestType);
}
Aggregations