use of org.apache.geode.compression.SnappyCompressor in project geode by apache.
the class OffHeapRegionBase method testPersistentCompressorChange.
@Test
public void testPersistentCompressorChange() {
GemFireCacheImpl gfc = createCache(true);
Region<Object, Object> r = null;
String value = "value1";
String key = "key";
try {
r = gfc.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT).setOffHeap(true).setCompressor(new SnappyCompressor()).create("region1");
r.put(key, value);
} finally {
closeCache(gfc, false);
}
gfc = createCache(true);
try {
r = gfc.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT).setOffHeap(true).setCompressor(null).create("region1");
assertEquals(true, r.containsKey(key));
MemoryAllocatorImpl mai = MemoryAllocatorImpl.getAllocator();
List<OffHeapStoredObject> orphans = mai.getLostChunks();
if (orphans.size() > 0) {
fail("expected no orphan detected, but gets orphan size " + orphans.size());
}
assertEquals(value, r.get(key));
} finally {
if (r != null && !r.isDestroyed()) {
r.destroyRegion();
}
closeCache(gfc, false);
}
}
use of org.apache.geode.compression.SnappyCompressor in project geode by apache.
the class CompressionRegionOperationsDUnitTest method createRegion.
protected void createRegion() {
Compressor compressor = new SnappyCompressor();
createCompressedRegionOnVm(getVM(TEST_VM), REGION_NAME, compressor);
}
use of org.apache.geode.compression.SnappyCompressor in project geode by apache.
the class CompressionRegionOperationsOffHeapDUnitTest method createRegion.
@Override
protected void createRegion() {
Compressor compressor = new SnappyCompressor();
createCompressedRegionOnVm(getVM(TEST_VM), REGION_NAME, compressor, true);
}
use of org.apache.geode.compression.SnappyCompressor in project geode by apache.
the class CompressionCacheConfigDUnitTest method testCreateCacheWithGoodCompressor.
/**
* Asserts that a member is successfully initialized with a compressed region when a compressor is
* included in the region attributes.
*/
@Test
public void testCreateCacheWithGoodCompressor() throws Exception {
File cacheXml = createCacheXml(GOOD_COMPRESSOR);
assertTrue(createCacheOnVM(getVM(0), cacheXml.getCanonicalPath()));
assertCompressorOnVM(getVM(0), new SnappyCompressor(), REGION_NAME);
cleanup(getVM(0));
cacheXml.delete();
}
use of org.apache.geode.compression.SnappyCompressor in project geode by apache.
the class CompressionRegionConfigDUnitTest method testReplicateRegion.
/**
* Sanity check using two peers sharing a replicated region.
*
* @throws Exception
*/
@Test
public void testReplicateRegion() throws Exception {
Compressor compressor = new SnappyCompressor();
assertTrue(createCompressedRegionOnVm(getVM(0), REGION_NAME, DataPolicy.REPLICATE, compressor));
assertTrue(createCompressedRegionOnVm(getVM(1), REGION_NAME, DataPolicy.REPLICATE, compressor));
assertNull(putUsingVM(getVM(0), KEY_1, VALUE_1));
waitOnPut(getVM(1), KEY_1);
assertEquals(VALUE_1, getUsingVM(getVM(1), KEY_1));
cleanup(getVM(0));
}
Aggregations