Search in sources :

Example 76 with RegionAttributes

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

the class InterestListEndpointDUnitTest method createClientCache.

public static void createClientCache(String host, Integer port1, Integer port2) throws Exception {
    CacheServerTestUtil.disableShufflingOfEndpoints();
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    new InterestListEndpointDUnitTest().createCache(props);
    Pool p;
    try {
        p = PoolManager.createFactory().addServer(host, port1.intValue()).addServer(host, port2.intValue()).setSubscriptionEnabled(true).setSubscriptionRedundancy(-1).setMinConnections(6).setSocketBufferSize(32768).setReadTimeout(2000).create("InterestListEndpointDUnitTestPool");
    } finally {
        CacheServerTestUtil.enableShufflingOfEndpoints();
    }
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setPoolName(p.getName());
    RegionAttributes attrs = factory.create();
    cache.createRegion(REGION_NAME, attrs);
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) Pool(org.apache.geode.cache.client.Pool) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties)

Example 77 with RegionAttributes

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

the class InterestListRecoveryDUnitTest method createClientCache.

public static void createClientCache(String host, Integer port1, Integer port2) throws Exception {
    InterestListRecoveryDUnitTest test = new InterestListRecoveryDUnitTest();
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    cache = test.createCache(props);
    PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, port1.intValue()).addServer(host, port2.intValue()).setSubscriptionEnabled(true).setSubscriptionRedundancy(-1).setReadTimeout(250).setThreadLocalConnections(true).setSocketBufferSize(32768).setMinConnections(4).create("InterestListRecoveryDUnitTestPool");
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setPoolName(p.getName());
    RegionAttributes attrs = factory.create();
    cache.createRegion(REGION_NAME, attrs);
    pool = p;
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) PoolImpl(org.apache.geode.cache.client.internal.PoolImpl)

Example 78 with RegionAttributes

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

the class InterestListDUnitTest method addReplicatedRegion.

private static void addReplicatedRegion() {
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setEnableSubscriptionConflation(true);
    factory.setDataPolicy(DataPolicy.REPLICATE);
    RegionAttributes attrs = factory.create();
    cache.createRegion(REGION_NAME, attrs);
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes)

Example 79 with RegionAttributes

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

the class InterestListDUnitTest method createClientCache.

private static DistributedMember createClientCache(String host, int port, int port2) throws Exception {
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    props.setProperty(DELTA_PROPAGATION, "false");
    new InterestListDUnitTest().createCache(props);
    PoolFactory pfactory = PoolManager.createFactory().addServer(host, port).setThreadLocalConnections(true).setMinConnections(3).setSubscriptionEnabled(true).setSubscriptionRedundancy(-1).setReadTimeout(10000).setSocketBufferSize(32768);
    // .setRetryAttempts(5)
    if (port2 > 0) {
        pfactory.addServer(host, port2);
    }
    Pool p = pfactory.create("InterestListDUnitTestPool");
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setPoolName(p.getName());
    RegionAttributes attrs = factory.create();
    cache.createRegion(REGION_NAME, attrs);
    return cache.getDistributedSystem().getDistributedMember();
}
Also used : PoolFactory(org.apache.geode.cache.client.PoolFactory) AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) Pool(org.apache.geode.cache.client.Pool) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties)

Example 80 with RegionAttributes

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

the class TestObject20 method createServerCache.

public static Integer createServerCache(Integer maxThreads) throws Exception {
    new InstantiatorPropagationDUnitTest().createCache(new Properties());
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setMirrorType(MirrorType.KEYS_VALUES);
    RegionAttributes attrs = factory.create();
    cache.createRegion(REGION_NAME, attrs);
    int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
    CacheServer server1 = cache.addCacheServer();
    server1.setPort(port);
    server1.setMaxThreads(maxThreads.intValue());
    server1.start();
    return new Integer(port);
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) CacheServer(org.apache.geode.cache.server.CacheServer) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties)

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