Search in sources :

Example 91 with RegionAttributes

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

the class DistributedAckOverflowRegionCCEOffHeapDUnitTest 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 92 with RegionAttributes

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

the class DistributedAckOverflowRegionCCEOffHeapDUnitTest 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 93 with RegionAttributes

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

the class DistributedAckPersistentRegionCCEOffHeapDUnitTest 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 94 with RegionAttributes

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

the class DistAckMapMethodsDUnitTest method createRegionToTestRemove.

public static void createRegionToTestRemove() {
    try {
        AttributesFactory factory2 = new AttributesFactory();
        factory2.setScope(Scope.DISTRIBUTED_ACK);
        CacheWriter cacheWriter = new RemoveCacheWriter();
        CacheListener cacheListener = new RemoveCacheListener();
        factory2.setCacheWriter(cacheWriter);
        factory2.setCacheListener(cacheListener);
        RegionAttributes attr2 = factory2.create();
        remRegion = cache.createRegion("remove", attr2);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) CacheWriter(org.apache.geode.cache.CacheWriter) CacheListener(org.apache.geode.cache.CacheListener) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) CacheException(org.apache.geode.cache.CacheException)

Example 95 with RegionAttributes

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

the class RegionReliabilityTestCase method testFullAccessWithLocalRegionExpiration.

/**
   * Tests affect of FULL_ACCESS on local region expiration actions.
   */
@Test
public void testFullAccessWithLocalRegionExpiration() throws Exception {
    final String name = this.getUniqueName();
    final String roleA = name + "-A";
    final String[] requiredRoles = { roleA };
    Set requiredRolesSet = new HashSet();
    for (int i = 0; i < requiredRoles.length; i++) {
        requiredRolesSet.add(InternalRole.getRole(requiredRoles[i]));
    }
    assertEquals(requiredRoles.length, requiredRolesSet.size());
    // connect controller to system...
    Properties config = new Properties();
    config.setProperty(ROLES, "");
    getSystem(config);
    getCache();
    // create region in controller...
    MembershipAttributes ra = new MembershipAttributes(requiredRoles, LossAction.FULL_ACCESS, ResumptionAction.NONE);
    AttributesFactory fac = new AttributesFactory();
    fac.setMembershipAttributes(ra);
    fac.setScope(getRegionScope());
    fac.setStatisticsEnabled(true);
    RegionAttributes attr = fac.create();
    final Region region = createExpiryRootRegion(name, attr);
    // wait for memberTimeout to expire
    waitForMemberTimeout();
    AttributesMutator mutator = region.getAttributesMutator();
    mutator.setRegionTimeToLive(new ExpirationAttributes(1, ExpirationAction.LOCAL_DESTROY));
    waitForRegionDestroy(region);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) AbstractRegion(org.apache.geode.internal.cache.AbstractRegion) LocalRegion(org.apache.geode.internal.cache.LocalRegion) Region(org.apache.geode.cache.Region) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) ExpirationAttributes(org.apache.geode.cache.ExpirationAttributes) HashSet(java.util.HashSet) MembershipAttributes(org.apache.geode.cache.MembershipAttributes) AttributesMutator(org.apache.geode.cache.AttributesMutator) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test)

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