Search in sources :

Example 1 with TestObjectSizerImpl

use of org.apache.geode.internal.cache.TestObjectSizerImpl in project geode by apache.

the class RegionManagementDUnitTest method createDiskRegion.

private void createDiskRegion(final VM memberVM) {
    memberVM.invoke("createDiskRegion", () -> {
        AttributesFactory factory = new AttributesFactory();
        factory.setScope(Scope.LOCAL);
        factory.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(20, new TestObjectSizerImpl(), EvictionAction.LOCAL_DESTROY));
        Region region = getCache_tmp().createRegion(REGION_NAME, factory.create());
        LRUStatistics lruStats = ((AbstractRegion) region).getEvictionController().getLRUHelper().getStats();
        assertThat(lruStats).isNotNull();
        RegionMXBean regionMXBean = getManagementService_tmp().getLocalRegionMBean(REGION_PATH);
        assertThat(regionMXBean).isNotNull();
        int total;
        for (total = 0; total < 100; total++) {
            // TODO: why so many?
            int[] array = new int[250];
            array[0] = total;
            region.put(new Integer(total), array);
        }
        assertThat(regionMXBean.getEntrySize()).isGreaterThan(0);
    });
}
Also used : TestObjectSizerImpl(org.apache.geode.internal.cache.TestObjectSizerImpl) AttributesFactory(org.apache.geode.cache.AttributesFactory) PartitionAttributesFactory(org.apache.geode.cache.PartitionAttributesFactory) LRUStatistics(org.apache.geode.internal.cache.lru.LRUStatistics) AbstractRegion(org.apache.geode.internal.cache.AbstractRegion) Region(org.apache.geode.cache.Region) AbstractRegion(org.apache.geode.internal.cache.AbstractRegion)

Aggregations

AttributesFactory (org.apache.geode.cache.AttributesFactory)1 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)1 Region (org.apache.geode.cache.Region)1 AbstractRegion (org.apache.geode.internal.cache.AbstractRegion)1 TestObjectSizerImpl (org.apache.geode.internal.cache.TestObjectSizerImpl)1 LRUStatistics (org.apache.geode.internal.cache.lru.LRUStatistics)1