use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class HAInterestTestCase method stopSecondaryAndUNregisterK1.
/**
* returns the secondary that was stopped
*/
public static VM stopSecondaryAndUNregisterK1() {
LocalRegion r = (LocalRegion) cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertNotNull(r);
ServerRegionProxy srp = new ServerRegionProxy(r);
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return pool.getConnectedServerCount() == 3;
}
@Override
public String description() {
return "connected server count never became 3";
}
};
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
// close secondary EP
VM result = getBackupVM();
result.invoke(() -> HAInterestTestCase.stopServer());
List list = new ArrayList();
list.add(k1);
srp.unregisterInterest(list, InterestType.KEY, false, false);
return result;
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class ForceInvalidateEvictionDUnitTest method checkValue.
private void checkValue(VM vm, final Serializable key, final Object expected) {
final String name = getUniqueName();
vm.invoke(new SerializableRunnable() {
public void run() {
Cache cache = getCache();
final LocalRegion region = (LocalRegion) cache.getRegion(name);
Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
Object value = null;
try {
value = region.getValueInVM(key);
if (value instanceof CachedDeserializable) {
value = ((CachedDeserializable) value).getDeserializedForReading();
}
} catch (EntryNotFoundException e) {
// ok
}
return expected == null ? value == null : expected.equals(value);
}
public String description() {
return "Value did not become " + expected + " after 30s: " + region.getValueInVM(key);
}
}, 30000, 100, true);
}
});
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class RegionJUnitTest method testRegionEntryAccess.
@Test
public void testRegionEntryAccess() throws Exception {
Iterator entriesIter = region.entrySet(false).iterator();
while (entriesIter.hasNext()) {
Region.Entry entry = (Region.Entry) entriesIter.next();
RegionEntry regionEntry = null;
if (entry instanceof LocalRegion.NonTXEntry) {
regionEntry = ((LocalRegion.NonTXEntry) entry).getRegionEntry();
} else {
regionEntry = ((EntrySnapshot) entry).getRegionEntry();
}
assertNotNull(regionEntry);
}
LocalRegion lRegion = (LocalRegion) region;
Iterator keysIterator = lRegion.keys().iterator();
while (keysIterator.hasNext()) {
Object key = keysIterator.next();
Region.Entry rEntry = lRegion.getEntry(key);
RegionEntry regionEntry = null;
if (rEntry instanceof LocalRegion.NonTXEntry) {
regionEntry = ((LocalRegion.NonTXEntry) rEntry).getRegionEntry();
} else {
regionEntry = ((EntrySnapshot) rEntry).getRegionEntry();
}
assertNotNull(regionEntry);
}
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class QueryIndexUsingXMLDUnitTest method indexCreationCheck.
private CacheSerializableRunnable indexCreationCheck(final String regionName, final String indexName) {
return new CacheSerializableRunnable("IndexCreationCheck region: " + regionName + " indexName:" + indexName) {
@Override
public void run2() {
Cache cache = getCache();
LocalRegion region = (LocalRegion) cache.getRegion(regionName);
Index index = region.getIndexManager().getIndex(indexName);
assertThat(index).isNotNull();
}
};
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class QueryObserverCallbackJUnitTest method tearDown.
@After
public void tearDown() throws Exception {
CacheUtils.closeCache();
IndexManager indexManager = ((LocalRegion) region).getIndexManager();
if (indexManager != null)
indexManager.destroy();
}
Aggregations