use of org.apache.geode.test.dunit.SerializableRunnableIF 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 org.apache.geode.test.dunit.SerializableRunnableIF in project geode by apache.
the class RebalanceDUnitTest method putEntriesAndValidateQueryResults.
protected void putEntriesAndValidateQueryResults(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));
dataStore1.invoke(() -> LuceneTestUtilities.pauseSender(getCache()));
putEntryInEachBucket();
dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
dataStore1.invoke(() -> LuceneTestUtilities.resumeSender(getCache()));
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
// dataStore3.invoke(() -> initDataStore(create, regionType));
executeTextSearch(accessor, "world", "text", NUM_BUCKETS);
}
use of org.apache.geode.test.dunit.SerializableRunnableIF in project geode by apache.
the class PartitionedRegionQueryDUnitTest method tesRangeIndexDoesNotDeserializePdxObjects.
@Test
public void tesRangeIndexDoesNotDeserializePdxObjects() {
SerializableRunnableIF createIndex = () -> {
Cache cache = getCache();
cache.getQueryService().createIndex("ContractDocumentIndex", "ref", "/region r, r.references ref");
};
String queryString = "select r.assetId,r.document from /region r, r.references ref where ref='B_2' limit 1000";
PdxAssetFactory value = i -> new PdxNotDeserializableAsset(i, Integer.toString(i));
createIndexDoesNotDerializePdxObjects(createIndex, queryString, value);
}
use of org.apache.geode.test.dunit.SerializableRunnableIF in project geode by apache.
the class PartitionedRegionQueryDUnitTest method tesRangeIndexWithPdxObjects.
@Test
public void tesRangeIndexWithPdxObjects() {
SerializableRunnableIF createIndex = () -> {
Cache cache = getCache();
cache.getQueryService().createIndex("ContractDocumentIndex", "ref", "/region r, r.references ref");
};
String queryString = "select r from /region r, r.references ref where ref='B_2' limit 1000";
PdxAssetFactory value = i -> new PdxAsset(i, Integer.toString(i));
createIndexDoesNotDerializePdxObjects(createIndex, queryString, value);
}
Aggregations