use of org.apache.geode.internal.cache.InitialImageOperation.GIITestHook in project geode by apache.
the class RebalanceWithRedundancyDUnitTest method returnCorrectResultsWhenIndexUpdateHappensIntheMiddleofGII.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void returnCorrectResultsWhenIndexUpdateHappensIntheMiddleofGII(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(() -> {
InitialImageOperation.setGIITestHook(new GIITestHook(GIITestHookType.AfterSentRequestImage, "Do puts during request") {
@Override
public void reset() {
}
@Override
public String getRegionName() {
return "_B__index#__region.files_0";
}
@Override
public void run() {
dataStore1.invoke(() -> LuceneTestUtilities.resumeSender(getCache()));
waitForFlushBeforeExecuteTextSearch(dataStore1, 30000);
}
});
});
dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 30000));
dataStore2.invoke(() -> {
PartitionedRegion region = (PartitionedRegion) getCache().getRegion(REGION_NAME);
Awaitility.await().atMost(1, TimeUnit.MINUTES).until(() -> assertEquals(0, region.getPrStats().getLowRedundancyBucketCount()));
});
dataStore1.invoke(() -> getCache().close());
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore2, 30000));
executeTextSearch(accessor, "world", "text", NUM_BUCKETS);
}
use of org.apache.geode.internal.cache.InitialImageOperation.GIITestHook in project geode by apache.
the class GIIDeltaDUnitTest method waitForCallbackStarted.
public void waitForCallbackStarted(final VM vm, final GIITestHookType callbacktype) {
SerializableRunnable waitForCallbackStarted = new SerializableRunnable() {
public void run() {
final GIITestHook callback = InitialImageOperation.getGIITestHookForCheckingPurpose(callbacktype);
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return (callback != null && callback.isRunning);
}
public String description() {
return null;
}
};
Wait.waitForCriterion(ev, 30000, 200, true);
if (callback == null || !callback.isRunning) {
fail("GII tesk hook is not started yet");
}
}
};
vm.invoke(waitForCallbackStarted);
}
Aggregations