use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class HAClearDUnitTest method clearRegionFromServer.
// function to perform clear operation from server.
private CacheSerializableRunnable clearRegionFromServer() {
CacheSerializableRunnable clearFromServer = new CacheSerializableRunnable("clearFromServer") {
public void run2() {
LocalRegion region = (LocalRegion) cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertNotNull(region);
region.clear();
}
};
return clearFromServer;
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class PersistentRecoveryOrderDUnitTest method getRVV.
protected RegionVersionVector getRVV(VM vm) throws IOException, ClassNotFoundException {
SerializableCallable createData = new SerializableCallable("getRVV") {
public Object call() throws Exception {
Cache cache = getCache();
LocalRegion region = (LocalRegion) cache.getRegion(REGION_NAME);
RegionVersionVector rvv = region.getVersionVector();
rvv = rvv.getCloneForTransmission();
HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
// Using gemfire serialization because
// RegionVersionVector is not java serializable
DataSerializer.writeObject(rvv, hdos);
return hdos.toByteArray();
}
};
byte[] result = (byte[]) vm.invoke(createData);
ByteArrayInputStream bais = new ByteArrayInputStream(result);
return DataSerializer.readObject(new DataInputStream(bais));
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class VerifyUpdatesFromNonInterestEndPointDUnitTest method createEntries.
public static void createEntries() {
try {
LocalRegion r1 = (LocalRegion) cache.getRegion(Region.SEPARATOR + REGION_NAME);
if (!r1.containsKey("key-1")) {
r1.create("key-1", "key-1");
}
if (!r1.containsKey("key-2")) {
r1.create("key-2", "key-2");
}
assertEquals(r1.getEntry("key-1").getValue(), "key-1");
assertEquals(r1.getEntry("key-2").getValue(), "key-2");
} catch (Exception ex) {
Assert.fail("failed while createEntries()", ex);
}
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class CompressionStatsDUnitTest method getTotalDecompressions.
/**
* Returns the number of decompressions stat for a region.
*
* @param regionName a region.
*/
private long getTotalDecompressions(String regionName) {
LocalRegion region = (LocalRegion) getCache().getRegion(regionName);
assertNotNull(region);
return region.getCachePerfStats().getTotalDecompressions();
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class CompressionStatsDUnitTest method getTotalCompressionTime.
/**
* Returns the total compression time stat for a region.
*
* @param regionName a region.
*/
private long getTotalCompressionTime(String regionName) {
LocalRegion region = (LocalRegion) getCache().getRegion(regionName);
assertNotNull(region);
return region.getCachePerfStats().getTotalCompressionTime();
}
Aggregations