Search in sources :

Example 1 with SnappyCompressor

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));
}
Also used : SnappyCompressor(org.apache.geode.compression.SnappyCompressor) Compressor(org.apache.geode.compression.Compressor) SnappyCompressor(org.apache.geode.compression.SnappyCompressor) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 2 with SnappyCompressor

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));
}
Also used : SnappyCompressor(org.apache.geode.compression.SnappyCompressor) Compressor(org.apache.geode.compression.Compressor) SnappyCompressor(org.apache.geode.compression.SnappyCompressor) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 3 with SnappyCompressor

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);
}
Also used : SnappyCompressor(org.apache.geode.compression.SnappyCompressor) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 4 with SnappyCompressor

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));
}
Also used : SnappyCompressor(org.apache.geode.compression.SnappyCompressor) Compressor(org.apache.geode.compression.Compressor) SnappyCompressor(org.apache.geode.compression.SnappyCompressor) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 5 with SnappyCompressor

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));
}
Also used : SnappyCompressor(org.apache.geode.compression.SnappyCompressor) Compressor(org.apache.geode.compression.Compressor) SnappyCompressor(org.apache.geode.compression.SnappyCompressor) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Aggregations

SnappyCompressor (org.apache.geode.compression.SnappyCompressor)11 Test (org.junit.Test)9 Compressor (org.apache.geode.compression.Compressor)8 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)7 File (java.io.File)1 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)1