use of org.apache.geode.test.dunit.SerializableRunnableIF in project geode by apache.
the class RebalanceWithRedundancyDUnitTest method putEntriesAndValidateResultsWithRedundancy.
private void putEntriesAndValidateResultsWithRedundancy(RegionTestableType regionTestType) {
SerializableRunnableIF createIndex = () -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
luceneService.createIndexFactory().setFields("text").create(INDEX_NAME, REGION_NAME);
};
dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
accessor.invoke(() -> initAccessor(createIndex, regionTestType));
dataStore1.invoke(() -> LuceneTestUtilities.pauseSender(getCache()));
dataStore2.invoke(() -> LuceneTestUtilities.pauseSender(getCache()));
accessor.invoke(() -> LuceneTestUtilities.pauseSender(getCache()));
putEntryInEachBucket();
dataStore1.invoke(() -> LuceneTestUtilities.resumeSender(getCache()));
dataStore2.invoke(() -> LuceneTestUtilities.resumeSender(getCache()));
accessor.invoke(() -> LuceneTestUtilities.resumeSender(getCache()));
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore2, 60000));
executeTextSearch(accessor, "world", "text", NUM_BUCKETS);
}
use of org.apache.geode.test.dunit.SerializableRunnableIF in project geode by apache.
the class PaginationDUnitTest method noExceptionWhenOneDataStoreIsClosedButOneIsStillUpWhilePagination.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void noExceptionWhenOneDataStoreIsClosedButOneIsStillUpWhilePagination(RegionTestableType regionTestType) {
SerializableRunnableIF createIndex = () -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
luceneService.createIndexFactory().setFields("text").create(INDEX_NAME, REGION_NAME);
};
dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
accessor.invoke(() -> initAccessor(createIndex, regionTestType));
putEntryInEachBucket();
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, FLUSH_WAIT_TIME_MS));
accessor.invoke(() -> {
List<LuceneResultStruct<Integer, TestObject>> combinedResult = new ArrayList<>();
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();
combinedResult.addAll(page);
assertEquals(PAGE_SIZE, page.size());
dataStore1.invoke(() -> closeCache());
for (int i = 0; i < ((NUM_BUCKETS / PAGE_SIZE) - 1); i++) {
page = pages.next();
assertEquals(PAGE_SIZE, page.size());
combinedResult.addAll(page);
}
validateTheCombinedResult(combinedResult);
});
}
use of org.apache.geode.test.dunit.SerializableRunnableIF in project geode by apache.
the class RebalanceDUnitTest method returnCorrectResultsWhenRebalanceHappensWhileSenderIsPaused.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void returnCorrectResultsWhenRebalanceHappensWhileSenderIsPaused(RegionTestableType regionTestType) throws InterruptedException {
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));
rebalanceRegion(dataStore2);
dataStore1.invoke(() -> LuceneTestUtilities.resumeSender(getCache()));
assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
executeTextSearch(accessor, "world", "text", NUM_BUCKETS);
}
use of org.apache.geode.test.dunit.SerializableRunnableIF in project geode by apache.
the class RebalanceDUnitTest method returnCorrectResultsWhenRebalanceHappensAfterUpdates.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void returnCorrectResultsWhenRebalanceHappensAfterUpdates(RegionTestableType regionTestType) throws InterruptedException {
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();
dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
rebalanceRegion(dataStore2);
executeTextSearch(accessor, "world", "text", NUM_BUCKETS);
}
use of org.apache.geode.test.dunit.SerializableRunnableIF in project geode by apache.
the class FixedPRSinglehopDUnitTest method test_MetadataContents.
// 4 servers, 1 client connected to all 4 servers.
// Put data, get data and make the metadata stable.
// Now verify that metadata has all 8 buckets info.
// Now update and ensure the fetch service is never called.
// GEODE-1176: random ports, time sensitive, waitForCriterion
@Category(FlakyTest.class)
@Test
public void test_MetadataContents() {
final Host host = Host.getHost(0);
VM server1 = host.getVM(0);
VM server2 = host.getVM(1);
VM server3 = host.getVM(2);
VM server4 = host.getVM(3);
List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
fpaList.add(FixedPartitionAttributes.createFixedPartition("Q1", true, 3));
fpaList.add(FixedPartitionAttributes.createFixedPartition("Q2", false, 3));
Integer port1 = (Integer) server1.invoke(() -> FixedPRSinglehopDUnitTest.createServer(false, fpaList));
fpaList.clear();
fpaList.add(FixedPartitionAttributes.createFixedPartition("Q3", true, 3));
fpaList.add(FixedPartitionAttributes.createFixedPartition("Q4", false, 3));
Integer port2 = (Integer) server2.invoke(() -> FixedPRSinglehopDUnitTest.createServer(false, fpaList));
fpaList.clear();
fpaList.add(FixedPartitionAttributes.createFixedPartition("Q2", true, 3));
fpaList.add(FixedPartitionAttributes.createFixedPartition("Q3", false, 3));
Integer port3 = (Integer) server3.invoke(() -> FixedPRSinglehopDUnitTest.createServer(false, fpaList));
fpaList.clear();
fpaList.add(FixedPartitionAttributes.createFixedPartition("Q4", true, 3));
fpaList.add(FixedPartitionAttributes.createFixedPartition("Q1", false, 3));
Integer port4 = (Integer) server4.invoke(() -> FixedPRSinglehopDUnitTest.createServer(false, fpaList));
createClient(port1, port2, port3, port4);
putIntoPartitionedRegions();
getFromPartitionedRegions();
SerializableRunnableIF printView = () -> FixedPRSinglehopDUnitTest.printView();
server1.invoke(printView);
server2.invoke(printView);
server3.invoke(printView);
server4.invoke(printView);
int totalBucketOnServer = 0;
SerializableCallableIF<Integer> getBucketCount = () -> FixedPRSinglehopDUnitTest.primaryBucketsOnServer();
totalBucketOnServer += server1.invoke(getBucketCount);
totalBucketOnServer += server2.invoke(getBucketCount);
totalBucketOnServer += server3.invoke(getBucketCount);
totalBucketOnServer += server4.invoke(getBucketCount);
verifyMetadata(totalBucketOnServer, 2);
updateIntoSinglePR(true);
}
Aggregations