cache = setupCache("configs/local-lru-eviction.xml");
regionManager = cache.getRegionManager();
assertEquals(5000, cache.getConfiguration().getEvictionConfig().getWakeupInterval());
Region region = regionManager.getRegion("/org/jboss/data", false);
EvictionRegionConfig evictionRegionConfig = region.getEvictionRegionConfig();
assertEquals(Fqn.fromString("/org/jboss/data/"), region.getFqn());
assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
assertEquals(5000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
assertEquals(1000000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
region = regionManager.getRegion("/org/jboss/test/data", false);
evictionRegionConfig = region.getEvictionRegionConfig();
assertEquals(Fqn.fromString("/org/jboss/test/data/"), region.getFqn());
assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
assertEquals(5, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
assertEquals(4000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
region = regionManager.getRegion("/test", true);
evictionRegionConfig = region.getEvictionRegionConfig();
assertEquals(Fqn.fromString("/test/"), region.getFqn());
assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
assertEquals(4000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
region = regionManager.getRegion("/maxAgeTest", true);
evictionRegionConfig = region.getEvictionRegionConfig();
assertEquals(Fqn.fromString("/maxAgeTest/"), region.getFqn());
assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
assertEquals(8000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxAge());
// test the default region. use a region name that isn't defined explicitly in conf file.
region = regionManager.getRegion("/a/b/c", false);
evictionRegionConfig = region.getEvictionRegionConfig();
assertEquals(Fqn.ROOT, region.getFqn());
assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
assertEquals(5000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
assertEquals(1000000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
assertEquals(-1, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxAge());
}
finally
{
TestingUtil.killCaches(cache);