Package com.gemstone.gemfire.cache

Examples of com.gemstone.gemfire.cache.RegionAttributes


    verify(mockRegionAttributes, times(2)).getPartitionAttributes();
  }

  @Test
  public void testMergePartitionAttributes() {
    RegionAttributes mockRegionAttributes = mock(RegionAttributes.class);
    RegionFactory mockRegionFactory = createMockRegionFactory();

    when(mockRegionAttributes.getPartitionAttributes()).thenReturn(null);

    factoryBean.setShortcut(null);
    factoryBean.mergePartitionAttributes(mockRegionFactory, mockRegionAttributes);

    verify(mockRegionAttributes, times(1)).getPartitionAttributes();
View Full Code Here


  public void testPartitionDataOptions() throws Exception {
    assertTrue(context.containsBean("partition-data"));
    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());
View Full Code Here

  @Test
  @SuppressWarnings("rawtypes")
  public void testEntryTtl() throws Exception {
    assertTrue(context.containsBean("replicated-data"));
    RegionFactoryBean fb = context.getBean("&replicated-data", RegionFactoryBean.class);
    RegionAttributes attrs = TestUtils.readField("attributes", fb);

    ExpirationAttributes entryTTL = attrs.getEntryTimeToLive();
    assertEquals(100, entryTTL.getTimeout());
    assertEquals(ExpirationAction.DESTROY, entryTTL.getAction());

    ExpirationAttributes entryTTI = attrs.getEntryIdleTimeout();
    assertEquals(200, entryTTI.getTimeout());
    assertEquals(ExpirationAction.INVALIDATE, entryTTI.getAction());

    ExpirationAttributes regionTTL = attrs.getRegionTimeToLive();
    assertEquals(300, regionTTL.getTimeout());
    assertEquals(ExpirationAction.DESTROY, regionTTL.getAction());

    ExpirationAttributes regionTTI = attrs.getRegionIdleTimeout();
    assertEquals(400, regionTTI.getTimeout());
    assertEquals(ExpirationAction.INVALIDATE, regionTTI.getAction());
  }
View Full Code Here

  @Test
  @SuppressWarnings("rawtypes")
  public void testCustomExpiry() throws Exception {
    assertTrue(context.containsBean("replicated-data-custom-expiry"));
    RegionFactoryBean fb = context.getBean("&replicated-data-custom-expiry", RegionFactoryBean.class);
    RegionAttributes attrs = TestUtils.readField("attributes", fb);
   
    assertNotNull(attrs.getCustomEntryIdleTimeout());
    assertNotNull(attrs.getCustomEntryTimeToLive());
   
    assertTrue(attrs.getCustomEntryIdleTimeout() instanceof TestCustomExpiry);
    assertTrue(attrs.getCustomEntryTimeToLive() instanceof TestCustomExpiry);
  }
View Full Code Here

    assertEquals(2, cacheListeners.length);
    assertSame(cacheListeners[0], context.getBean("c-listener"));
    assertTrue(cacheListeners[1] instanceof SimpleCacheListener);
    assertNotSame(cacheListeners[0], cacheListeners[1]);

    RegionAttributes complexRegionAttributes = TestUtils.readField("attributes", complexClientRegionFactoryBean);

    assertNotNull(complexRegionAttributes);
    assertEquals(0.5f, complexRegionAttributes.getLoadFactor(), 0.001);
    assertEquals(ExpirationAction.INVALIDATE, complexRegionAttributes.getEntryTimeToLive().getAction());
    assertEquals(500, complexRegionAttributes.getEntryTimeToLive().getTimeout());
    assertEquals(5, complexRegionAttributes.getEvictionAttributes().getMaximum());
  }
View Full Code Here

    assertNotNull("The 'PersistentRegion' Region was not properly configured and initialized!", persistent);
    assertEquals("PersistentRegion", persistent.getName());
    assertEquals(Region.SEPARATOR + "PersistentRegion", persistent.getFullPath());

    RegionAttributes persistentRegionAttributes = persistent.getAttributes();

    assertEquals(DataPolicy.PERSISTENT_REPLICATE, persistentRegionAttributes.getDataPolicy());
    assertEquals("diskStore", persistentRegionAttributes.getDiskStoreName());
    assertEquals(10, persistentRegionAttributes.getDiskDirSizes()[0]);
    assertEquals("gemfire-pool", persistentRegionAttributes.getPoolName());
  }
View Full Code Here

    assertNotNull(overflowClientRegionFactoryBean);
    assertEquals("diskStore", TestUtils.readField("diskStoreName", overflowClientRegionFactoryBean));
    assertEquals("gemfire-pool", TestUtils.readField("poolName", overflowClientRegionFactoryBean));

    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());
View Full Code Here

    assertEquals("diskStore1", TestUtils.readField("diskStoreName", replicatedDataRegionFactoryBean));
    assertNull(TestUtils.readField("scope", replicatedDataRegionFactoryBean));

    Region replicatedDataRegion = context.getBean("replicated-data", Region.class);

    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());
View Full Code Here

    assertNotNull(publisherRegionFactoryBean);
    assertEquals(DataPolicy.NORMAL, TestUtils.readField("dataPolicy", publisherRegionFactoryBean));
    assertEquals("publisher", TestUtils.readField("name", publisherRegionFactoryBean));
    assertEquals(Scope.LOCAL, TestUtils.readField("scope", publisherRegionFactoryBean));

    RegionAttributes publisherRegionAttributes = TestUtils.readField("attributes", publisherRegionFactoryBean);

    assertNotNull(publisherRegionAttributes);
    assertFalse(publisherRegionAttributes.getPublisher());
  }
View Full Code Here

    assertNotNull("The 'local-with-attributes' Region was not properly configured and initialized!", region);
    assertEquals("local-with-attributes", region.getName());
    assertEquals(Region.SEPARATOR + "local-with-attributes", region.getFullPath());

    RegionAttributes localRegionAttributes = region.getAttributes();

    assertEquals(DataPolicy.PRELOADED, localRegionAttributes.getDataPolicy());
    assertTrue(localRegionAttributes.isDiskSynchronous());
    assertTrue(localRegionAttributes.getIgnoreJTA());
    assertFalse(localRegionAttributes.getIndexMaintenanceSynchronous());
    assertEquals(10, localRegionAttributes.getInitialCapacity());
    assertEquals(String.class, localRegionAttributes.getKeyConstraint());
    assertEquals("0.9", String.valueOf(localRegionAttributes.getLoadFactor()));
    assertEquals(String.class, localRegionAttributes.getValueConstraint());
  }
View Full Code Here

TOP

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

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.