Search in sources :

Example 86 with RegionAttributes

use of org.apache.geode.cache.RegionAttributes in project geode by apache.

the class DistributedAckRegionCompressionDUnitTest method getRegionAttributes.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected RegionAttributes getRegionAttributes(String type) {
    Compressor compressor = null;
    try {
        compressor = SnappyCompressor.getDefaultInstance();
    } catch (Throwable t) {
        // Not a supported OS
        return super.getRegionAttributes(type);
    }
    RegionAttributes ra = super.getRegionAttributes(type);
    AttributesFactory factory = new AttributesFactory(ra);
    if (!ra.getDataPolicy().isEmpty()) {
        factory.setCompressor(compressor);
    }
    return factory.create();
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) Compressor(org.apache.geode.compression.Compressor) SnappyCompressor(org.apache.geode.compression.SnappyCompressor)

Example 87 with RegionAttributes

use of org.apache.geode.cache.RegionAttributes in project geode by apache.

the class DistributedNoAckRegionCCEDUnitTest method getRegionAttributes.

protected RegionAttributes getRegionAttributes(String type) {
    RegionAttributes ra = getCache().getRegionAttributes(type);
    if (ra == null) {
        throw new IllegalStateException("The region shortcut " + type + " has been removed.");
    }
    AttributesFactory factory = new AttributesFactory(ra);
    factory.setScope(Scope.DISTRIBUTED_NO_ACK);
    factory.setConcurrencyChecksEnabled(true);
    return factory.create();
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes)

Example 88 with RegionAttributes

use of org.apache.geode.cache.RegionAttributes in project geode by apache.

the class DistributedNoAckRegionCCEOffHeapDUnitTest method getRegionAttributes.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected RegionAttributes getRegionAttributes(String type) {
    RegionAttributes ra = super.getRegionAttributes(type);
    AttributesFactory factory = new AttributesFactory(ra);
    if (!ra.getDataPolicy().isEmpty()) {
        factory.setOffHeap(true);
    }
    return factory.create();
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes)

Example 89 with RegionAttributes

use of org.apache.geode.cache.RegionAttributes in project geode by apache.

the class DistributedNoAckRegionCCEOffHeapDUnitTest method getRegionAttributes.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected RegionAttributes getRegionAttributes() {
    RegionAttributes attrs = super.getRegionAttributes();
    AttributesFactory factory = new AttributesFactory(attrs);
    factory.setOffHeap(true);
    return factory.create();
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes)

Example 90 with RegionAttributes

use of org.apache.geode.cache.RegionAttributes in project geode by apache.

the class DistributedAckRegionOffHeapDUnitTest method getRegionAttributes.

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected RegionAttributes getRegionAttributes(String type) {
    RegionAttributes ra = super.getRegionAttributes(type);
    AttributesFactory factory = new AttributesFactory(ra);
    if (!ra.getDataPolicy().isEmpty()) {
        factory.setOffHeap(true);
    }
    return factory.create();
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes)

Aggregations

RegionAttributes (org.apache.geode.cache.RegionAttributes)590 AttributesFactory (org.apache.geode.cache.AttributesFactory)471 Region (org.apache.geode.cache.Region)256 Test (org.junit.Test)251 Properties (java.util.Properties)158 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)128 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)126 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)118 LocalRegion (org.apache.geode.internal.cache.LocalRegion)112 Cache (org.apache.geode.cache.Cache)99 VM (org.apache.geode.test.dunit.VM)93 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)93 Host (org.apache.geode.test.dunit.Host)89 HashSet (java.util.HashSet)80 CacheException (org.apache.geode.cache.CacheException)65 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)62 CacheServer (org.apache.geode.cache.server.CacheServer)60 SerializableCallable (org.apache.geode.test.dunit.SerializableCallable)59 ArrayList (java.util.ArrayList)57 PartitionAttributesImpl (org.apache.geode.internal.cache.PartitionAttributesImpl)56