Package com.gemstone.gemfire.cache

Examples of com.gemstone.gemfire.cache.EvictionAttributes


    verify(mockCache).createRegionFactory();
  }

  @Test
  public void testMergeRegionAttributes() throws Exception {
    EvictionAttributes testEvictionAttributes = EvictionAttributes.createLRUEntryAttributes();
    ExpirationAttributes testExpirationAttributes = new ExpirationAttributes(120, ExpirationAction.LOCAL_DESTROY);
    MembershipAttributes testMembershipAttributes = new MembershipAttributes();
    PartitionAttributes testPartitionAttributes = createPartitionAttributes("TestRegion", 1024000, 15000l, 0,
      45000l, 2048000000l, 97);
    SubscriptionAttributes testSubscriptionAttributes = new SubscriptionAttributes();
View Full Code Here


    assertEquals(1, regionAttributes.getCacheListeners().length);
    assertTrue(regionAttributes.getCacheListeners()[0] instanceof SimpleCacheListener);
    assertTrue(regionAttributes.getCacheLoader() instanceof SimpleCacheLoader);
    assertTrue(regionAttributes.getCacheWriter() instanceof SimpleCacheWriter);

    EvictionAttributes evictionAttributes = regionAttributes.getEvictionAttributes();

    assertNotNull(evictionAttributes);
    assertEquals(EvictionAction.OVERFLOW_TO_DISK, evictionAttributes.getAction());
    assertEquals(10000, evictionAttributes.getMaximum());

    MembershipAttributes membershipAttributes = regionAttributes.getMembershipAttributes();

    assertNotNull(membershipAttributes);
    assertNotNull(membershipAttributes.getRequiredRoles());
View Full Code Here

    RegionAttributes overflowRegionAttributes = TestUtils.readField("attributes", overflowClientRegionFactoryBean);

    assertNotNull(overflowRegionAttributes);
    assertEquals(DataPolicy.NORMAL, overflowRegionAttributes.getDataPolicy());

    EvictionAttributes overflowEvictionAttributes = overflowRegionAttributes.getEvictionAttributes();

    assertNotNull(overflowEvictionAttributes);
    assertEquals(EvictionAction.OVERFLOW_TO_DISK, overflowEvictionAttributes.getAction());
    assertEquals(EvictionAlgorithm.LRU_MEMORY, overflowEvictionAttributes.getAlgorithm());
    assertEquals(10, overflowEvictionAttributes.getMaximum());
    assertTrue(overflowEvictionAttributes.getObjectSizer() instanceof SimpleObjectSizer);
  }
View Full Code Here

    RegionAttributes replicatedDataRegionAttributes = TestUtils.readField("attributes", replicatedDataRegionFactoryBean);

    assertNotNull(replicatedDataRegionAttributes);
    assertEquals(Scope.DISTRIBUTED_NO_ACK, replicatedDataRegionAttributes.getScope());

    EvictionAttributes replicatedDataEvictionAttributes = replicatedDataRegionAttributes.getEvictionAttributes();

    assertNotNull(replicatedDataEvictionAttributes);
    assertEquals(EvictionAction.OVERFLOW_TO_DISK, replicatedDataEvictionAttributes.getAction());
    assertEquals(EvictionAlgorithm.LRU_ENTRY, replicatedDataEvictionAttributes.getAlgorithm());
    assertEquals(50, replicatedDataEvictionAttributes.getMaximum());
    assertNull(replicatedDataEvictionAttributes.getObjectSizer());
  }
View Full Code Here

    RegionFactoryBean fb = context.getBean("&partition-data", RegionFactoryBean.class);
    assertTrue(fb instanceof PartitionedRegionFactoryBean);
    assertTrue((Boolean) TestUtils.readField("persistent", fb));
    RegionAttributes attrs = TestUtils.readField("attributes", fb);

    EvictionAttributes evicAttr = attrs.getEvictionAttributes();
    assertEquals(EvictionAction.LOCAL_DESTROY, evicAttr.getAction());
    assertEquals(EvictionAlgorithm.LRU_MEMORY, evicAttr.getAlgorithm());
    // for some reason GemFire resets this to 56 on my machine (not sure
    // why)
    // assertEquals(10, evicAttr.getMaximum());
    ObjectSizer sizer = evicAttr.getObjectSizer();
    assertEquals(SimpleObjectSizer.class, sizer.getClass());
  }
View Full Code Here

    factoryBean.setObjectSizer(mockObjectSizer);
    factoryBean.setThreshold(1024);
    factoryBean.setType(EvictionType.ENTRY_COUNT);
    factoryBean.afterPropertiesSet();

    EvictionAttributes evictionAttributes = factoryBean.getObject();

    assertNotNull(evictionAttributes);
    assertEquals(EvictionAction.DEFAULT_EVICTION_ACTION, evictionAttributes.getAction());
    assertNull(evictionAttributes.getObjectSizer());
    assertEquals(1024, evictionAttributes.getMaximum());
    assertEquals(EvictionAlgorithm.LRU_ENTRY, evictionAttributes.getAlgorithm());
  }
View Full Code Here

    factoryBean.setObjectSizer(mockObjectSizer);
    factoryBean.setThreshold(null);
    factoryBean.setType(EvictionType.ENTRY_COUNT);
    factoryBean.afterPropertiesSet();

    EvictionAttributes evictionAttributes = factoryBean.getObject();

    assertNotNull(evictionAttributes);
    assertEquals(EvictionAction.NONE, evictionAttributes.getAction());
    assertNull(evictionAttributes.getObjectSizer());
    assertEquals(EvictionAttributesFactoryBean.DEFAULT_LRU_MAXIMUM_ENTRIES, evictionAttributes.getMaximum());
    assertEquals(EvictionAlgorithm.LRU_ENTRY, evictionAttributes.getAlgorithm());
  }
View Full Code Here

    factoryBean.setObjectSizer(mockObjectSizer);
    factoryBean.setThreshold(128);
    factoryBean.setType(EvictionType.ENTRY_COUNT);
    factoryBean.afterPropertiesSet();

    EvictionAttributes evictionAttributes = factoryBean.getObject();

    assertNotNull(evictionAttributes);
    assertEquals(EvictionAction.LOCAL_DESTROY, evictionAttributes.getAction());
    assertNull(evictionAttributes.getObjectSizer());
    assertEquals(128, evictionAttributes.getMaximum());
    assertEquals(EvictionAlgorithm.LRU_ENTRY, evictionAttributes.getAlgorithm());
  }
View Full Code Here

    factoryBean.setObjectSizer(mockObjectSizer);
    factoryBean.setThreshold(null);
    factoryBean.setType(EvictionType.ENTRY_COUNT);
    factoryBean.afterPropertiesSet();

    EvictionAttributes evictionAttributes = factoryBean.getObject();

    assertNotNull(evictionAttributes);
    assertEquals(EvictionAction.OVERFLOW_TO_DISK, evictionAttributes.getAction());
    assertNull(evictionAttributes.getObjectSizer());
    assertEquals(EvictionAttributesFactoryBean.DEFAULT_LRU_MAXIMUM_ENTRIES, evictionAttributes.getMaximum());
    assertEquals(EvictionAlgorithm.LRU_ENTRY, evictionAttributes.getAlgorithm());
  }
View Full Code Here

    factoryBean.setAction(null);
    factoryBean.setObjectSizer(mockObjectSizer);
    factoryBean.setType(EvictionType.HEAP_PERCENTAGE);
    factoryBean.afterPropertiesSet();

    EvictionAttributes evictionAttributes = factoryBean.getObject();

    assertNotNull(evictionAttributes);
    assertEquals(EvictionAction.DEFAULT_EVICTION_ACTION, evictionAttributes.getAction());
    assertSame(mockObjectSizer, evictionAttributes.getObjectSizer());
    assertEquals(EvictionAlgorithm.LRU_HEAP, evictionAttributes.getAlgorithm());
  }
View Full Code Here

TOP

Related Classes of com.gemstone.gemfire.cache.EvictionAttributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.