use of org.apache.geode.compression.SnappyCompressor in project geode by apache.
the class CompressionRegionConfigDUnitTest method testPartitionedPersistentRegion.
/**
* Sanity check for two peers hosting a persistent partitioned region.
*/
@Test
public void testPartitionedPersistentRegion() {
Compressor compressor = new SnappyCompressor();
assertTrue(createCompressedRegionOnVm(getVM(0), REGION_NAME, DataPolicy.PERSISTENT_PARTITION, compressor, DISK_STORE));
assertTrue(createCompressedRegionOnVm(getVM(1), REGION_NAME, DataPolicy.PERSISTENT_PARTITION, compressor));
assertNull(putUsingVM(getVM(0), KEY_1, VALUE_1));
waitOnPut(getVM(1), KEY_1);
flushDiskStoreOnVM(getVM(0), DISK_STORE);
closeRegionOnVM(getVM(1), REGION_NAME);
assertTrue(createCompressedRegionOnVm(getVM(1), REGION_NAME, DataPolicy.PERSISTENT_PARTITION, compressor));
assertEquals(VALUE_1, getUsingVM(getVM(1), KEY_1));
cleanup(getVM(0));
}
use of org.apache.geode.compression.SnappyCompressor in project geode by apache.
the class CompressionRegionConfigDUnitTest method testPartitionedRegion.
/**
* Sanity check for two peers hosting a partitioned region.
*/
@Test
public void testPartitionedRegion() {
Compressor compressor = new SnappyCompressor();
assertTrue(createCompressedRegionOnVm(getVM(0), REGION_NAME, DataPolicy.PARTITION, compressor));
assertTrue(createCompressedRegionOnVm(getVM(1), REGION_NAME, DataPolicy.PARTITION, 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));
}
use of org.apache.geode.compression.SnappyCompressor in project geode by apache.
the class SnappyCompressorJUnitTest method testCompressByteArray.
/**
* Tests {@link Compressor#compress(byte[])} and {@link Compressor#decompress(byte[])} using the
* Snappy compressor.
*/
@Test
public void testCompressByteArray() throws Exception {
String compressMe = "Hello, how are you?";
byte[] compressMeData = new SnappyCompressor().compress(compressMe.getBytes());
String uncompressedMe = new String(SnappyCompressor.getDefaultInstance().decompress(compressMeData));
assertEquals(compressMe, uncompressedMe);
}
use of org.apache.geode.compression.SnappyCompressor in project geode by apache.
the class CompressionRegionConfigDUnitTest method testCachingClientProxyRegion.
/**
* Sanity check for a caching client and a cache server.
*/
@Test
public void testCachingClientProxyRegion() {
Compressor compressor = new SnappyCompressor();
assertTrue(createCompressedServerRegionOnVm(getVM(0), REGION_NAME, DataPolicy.REPLICATE, compressor));
assertTrue(createCompressedClientRegionOnVm(getVM(1), REGION_NAME, compressor, ClientRegionShortcut.CACHING_PROXY));
assertNull(putUsingClientVM(getVM(1), KEY_1, VALUE_1));
assertEquals(VALUE_1, getUsingClientVM(getVM(1), KEY_1));
assertEquals(VALUE_1, getUsingVM(getVM(0), KEY_1));
cleanupClient(getVM(1));
cleanup(getVM(0));
}
use of org.apache.geode.compression.SnappyCompressor in project geode by apache.
the class CompressionRegionConfigDUnitTest method testClientProxyRegion.
/**
* Sanity check for a non caching client and a cache server.
*/
@Test
public void testClientProxyRegion() {
Compressor compressor = new SnappyCompressor();
assertTrue(createCompressedServerRegionOnVm(getVM(0), REGION_NAME, DataPolicy.REPLICATE, compressor));
assertTrue(createCompressedClientRegionOnVm(getVM(1), REGION_NAME, compressor, ClientRegionShortcut.PROXY));
assertNull(putUsingClientVM(getVM(1), KEY_1, VALUE_1));
assertEquals(VALUE_1, getUsingClientVM(getVM(1), KEY_1));
assertEquals(VALUE_1, getUsingVM(getVM(0), KEY_1));
cleanupClient(getVM(1));
cleanup(getVM(0));
}
Aggregations