Search in sources :

Example 1 with HAContainerRegion

use of org.apache.geode.internal.cache.ha.HAContainerRegion in project geode by apache.

the class CacheClientNotifierDUnitTest method checkCacheServer.

private void checkCacheServer(VM vm, final int serverPort, final boolean withCSC, final int capacity) {
    SerializableRunnable checkCacheServer = new SerializableRunnable() {

        @Override
        public void run() throws Exception {
            List<CacheServer> cacheServers = ((GemFireCacheImpl) cache).getCacheServersAndGatewayReceiver();
            CacheServerImpl server = null;
            for (CacheServer cs : cacheServers) {
                if (cs.getPort() == serverPort) {
                    server = (CacheServerImpl) cs;
                    break;
                }
            }
            assertNotNull(server);
            CacheClientNotifier ccn = server.getAcceptor().getCacheClientNotifier();
            HAContainerRegion haContainer = (HAContainerRegion) ccn.getHaContainer();
            if (server.getAcceptor().isGatewayReceiver()) {
                assertNull(haContainer);
                return;
            }
            Region internalRegion = haContainer.getMapForTest();
            RegionAttributes ra = internalRegion.getAttributes();
            EvictionAttributes ea = ra.getEvictionAttributes();
            if (withCSC) {
                assertNotNull(ea);
                assertEquals(capacity, ea.getMaximum());
                assertEquals(EvictionAction.OVERFLOW_TO_DISK, ea.getAction());
            } else {
                assertNull(ea);
            }
        }
    };
    vm.invoke(checkCacheServer);
}
Also used : EvictionAttributes(org.apache.geode.cache.EvictionAttributes) CacheClientNotifier(org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier) RegionAttributes(org.apache.geode.cache.RegionAttributes) HAContainerRegion(org.apache.geode.internal.cache.ha.HAContainerRegion) SerializableRunnable(org.apache.geode.test.dunit.SerializableRunnable) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) CacheServer(org.apache.geode.cache.server.CacheServer) Region(org.apache.geode.cache.Region) HAContainerRegion(org.apache.geode.internal.cache.ha.HAContainerRegion) CacheServerImpl(org.apache.geode.internal.cache.CacheServerImpl)

Aggregations

EvictionAttributes (org.apache.geode.cache.EvictionAttributes)1 Region (org.apache.geode.cache.Region)1 RegionAttributes (org.apache.geode.cache.RegionAttributes)1 CacheServer (org.apache.geode.cache.server.CacheServer)1 CacheServerImpl (org.apache.geode.internal.cache.CacheServerImpl)1 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)1 HAContainerRegion (org.apache.geode.internal.cache.ha.HAContainerRegion)1 CacheClientNotifier (org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier)1 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)1