Search in sources :

Example 71 with PoolImpl

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

the class UnregisterInterestDUnitTest method timedWaitForInvalidates.

public static void timedWaitForInvalidates(Integer invalidates) {
    final int inv = invalidates;
    final PoolImpl pool = (PoolImpl) PoolManager.find(cache.getRegion(regionname));
    WaitCriterion wc = new WaitCriterion() {

        @Override
        public boolean done() {
            // Client region listeners are not invoked for invalidates that create entries.
            return pool.getInvalidateCount() == inv;
        }

        @Override
        public String description() {
            return "Expected to receive " + inv + " invalidates but received " + pool.getInvalidateCount();
        }
    };
    Wait.waitForCriterion(wc, 10000, 100, true);
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) PoolImpl(org.apache.geode.cache.client.internal.PoolImpl)

Example 72 with PoolImpl

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

the class RedundancyLevelTestBase method createClientCache.

public static void createClientCache(String host, int port1, int port2, int port3, int port4, int redundancy, int socketReadTimeout, int retryInterval) throws Exception {
    if (!FailOverDetectionByCCU) {
        oldBo = ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {

            public void beforeFailoverByCacheClientUpdater(ServerLocation epFailed) {
                try {
                    Thread.sleep(300000);
                } catch (InterruptedException ie) {
                    // expected - test will shut down the cache which will interrupt
                    // the CacheClientUpdater thread that invoked this method
                    Thread.currentThread().interrupt();
                }
            }
        });
    }
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    new RedundancyLevelTestBase().createCache(props);
    PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, PORT1).addServer(host, PORT2).addServer(host, PORT3).addServer(host, PORT4).setSubscriptionEnabled(true).setReadTimeout(socketReadTimeout).setSocketBufferSize(32768).setMinConnections(8).setSubscriptionRedundancy(redundancy).setRetryAttempts(5).setPingInterval(retryInterval).create("DurableClientReconnectDUnitTestPool");
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setPoolName(p.getName());
    RegionAttributes attrs = factory.createRegionAttributes();
    cache.createRegion(REGION_NAME, attrs);
    pool = p;
    createEntriesK1andK2();
    registerK1AndK2();
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) ServerLocation(org.apache.geode.distributed.internal.ServerLocation) RegionAttributes(org.apache.geode.cache.RegionAttributes) ClientServerObserverAdapter(org.apache.geode.internal.cache.ClientServerObserverAdapter) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) PoolImpl(org.apache.geode.cache.client.internal.PoolImpl)

Example 73 with PoolImpl

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

the class CacheServerTestUtil method createPool.

public static void createPool(PoolAttributes poolAttr) throws Exception {
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    DistributedSystem ds = new CacheServerTestUtil().getSystem(props);
    ;
    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();
    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) DistributedSystem(org.apache.geode.distributed.DistributedSystem) PoolFactoryImpl(org.apache.geode.internal.cache.PoolFactoryImpl)

Example 74 with PoolImpl

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

the class Bug36805DUnitTest method createClientCache.

public static void createClientCache(String host, Integer port1, Integer port2) throws Exception {
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    new Bug36805DUnitTest().createCache(props);
    PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, port1.intValue()).addServer(host, port2.intValue()).setSubscriptionEnabled(true).setMinConnections(4).create("Bug36805UnitTestPool");
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setPoolName(p.getName());
    RegionAttributes attrs = factory.create();
    cache.createRegion(regionName, 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 75 with PoolImpl

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

the class Bug36995DUnitTest method createClientCache.

public static void createClientCache(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).setSubscriptionEnabled(true).setSubscriptionRedundancy(-1).setSubscriptionMessageTrackingTimeout(54321).setIdleTimeout(-1).setPingInterval(200).create("Bug36995UnitTestPool1");
        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)

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