Search in sources :

Example 41 with PoolImpl

use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.

the class Bug36995DUnitTest method createClientCacheWithDefaultMessageTrackingTimeout.

public static void createClientCacheWithDefaultMessageTrackingTimeout(String host, int port1, int port2, int port3) {
    try {
        Properties props = new Properties();
        props.setProperty(MCAST_PORT, "0");
        props.setProperty(LOCATORS, "");
        new Bug36995DUnitTest().createCache(props);
        PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, port1).addServer(host, port2).addServer(host, port3).create("Bug36995UnitTestPool2");
        AttributesFactory factory = new AttributesFactory();
        factory.setPoolName(p.getName());
        RegionAttributes attrs = factory.create();
        cache.createRegion(regionName, attrs);
        pool = p;
    } catch (Exception e) {
        fail("Test failed due to ", e);
    }
}
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) IgnoredException(org.apache.geode.test.dunit.IgnoredException)

Example 42 with PoolImpl

use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.

the class CacheServerTestUtil method createCacheClient.

public static void createCacheClient(Pool poolAttr, String regionName1, String regionName2) throws Exception {
    new CacheServerTestUtil().createCache(getClientProperties());
    PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory();
    pf.init(poolAttr);
    PoolImpl p = (PoolImpl) pf.create("CacheServerTestUtil");
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.LOCAL);
    factory.setPoolName(p.getName());
    RegionAttributes attrs = factory.create();
    cache.createRegion(regionName1, attrs);
    cache.createRegion(regionName2, attrs);
    pool = p;
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) PoolImpl(org.apache.geode.cache.client.internal.PoolImpl) PoolFactoryImpl(org.apache.geode.internal.cache.PoolFactoryImpl)

Example 43 with PoolImpl

use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.

the class HAStartupAndFailoverDUnitTest method createClientCache.

public static void createClientCache(String testName, String host) throws Exception {
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    new HAStartupAndFailoverDUnitTest().createCache(props);
    PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, PORT1.intValue()).addServer(host, PORT2.intValue()).addServer(host, PORT3.intValue()).setSubscriptionEnabled(true).setSubscriptionRedundancy(-1).setReadTimeout(10000).create("HAStartupAndFailoverDUnitTestPool");
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.LOCAL);
    factory.setPoolName(p.getName());
    RegionAttributes attrs = factory.create();
    cache.createRegion(REGION_NAME, attrs);
    pool = p;
    conn = pool.acquireConnection();
    assertNotNull(conn);
}
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 44 with PoolImpl

use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.

the class HAStartupAndFailoverDUnitTest method createClientCacheWithIncorrectPrimary.

public static void createClientCacheWithIncorrectPrimary(String testName, String host) throws Exception {
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    new HAStartupAndFailoverDUnitTest().createCache(props);
    final int INCORRECT_PORT = 1;
    PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, INCORRECT_PORT).addServer(host, PORT2.intValue()).addServer(host, PORT3.intValue()).setSubscriptionEnabled(true).setSubscriptionRedundancy(-1).setReadTimeout(10000).create("HAStartupAndFailoverDUnitTestPool");
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.LOCAL);
    factory.setPoolName(p.getName());
    RegionAttributes attrs = factory.create();
    cache.createRegion(REGION_NAME, attrs);
    pool = p;
    conn = pool.acquireConnection();
    assertNotNull(conn);
}
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 45 with PoolImpl

use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.

the class HAInterestTestCase method createClientPoolCache.

public static void createClientPoolCache(String testName, String host) throws Exception {
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    new HAInterestTestCase().createCache(props);
    CacheServerTestUtil.disableShufflingOfEndpoints();
    PoolImpl p;
    try {
        p = (PoolImpl) PoolManager.createFactory().addServer(host, PORT1).addServer(host, PORT2).addServer(host, PORT3).setSubscriptionEnabled(true).setSubscriptionRedundancy(-1).setReadTimeout(10000).setPingInterval(1000).create("HAInterestBaseTestPool");
    } finally {
        CacheServerTestUtil.enableShufflingOfEndpoints();
    }
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.LOCAL);
    factory.setConcurrencyChecksEnabled(true);
    factory.setPoolName(p.getName());
    cache.createRegion(REGION_NAME, factory.create());
    pool = p;
    conn = pool.acquireConnection();
    assertNotNull(conn);
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) PoolImpl(org.apache.geode.cache.client.internal.PoolImpl)

Aggregations

PoolImpl (org.apache.geode.cache.client.internal.PoolImpl)91 Properties (java.util.Properties)43 AttributesFactory (org.apache.geode.cache.AttributesFactory)40 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)39 Region (org.apache.geode.cache.Region)30 RegionAttributes (org.apache.geode.cache.RegionAttributes)29 Test (org.junit.Test)17 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)16 IOException (java.io.IOException)14 Pool (org.apache.geode.cache.client.Pool)14 VM (org.apache.geode.test.dunit.VM)14 Host (org.apache.geode.test.dunit.Host)13 CacheSerializableRunnable (org.apache.geode.cache30.CacheSerializableRunnable)12 LocalRegion (org.apache.geode.internal.cache.LocalRegion)11 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)11 CacheException (org.apache.geode.cache.CacheException)10 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)9 ClientSubscriptionTest (org.apache.geode.test.junit.categories.ClientSubscriptionTest)9 NoAvailableServersException (org.apache.geode.cache.client.NoAvailableServersException)8 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)8