Search in sources :

Example 6 with SnappyCompressor

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

Example 7 with SnappyCompressor

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

Example 8 with SnappyCompressor

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

Example 9 with SnappyCompressor

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

Example 10 with SnappyCompressor

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));
}
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