Package com.gemstone.gemfire.cache

Examples of com.gemstone.gemfire.cache.Region


    assertFalse(context.containsBean("Customers/Accounts/Orders"));
  }

  @Test
  public void testNestedLookup() {
    Region parent = context.getBean("Parent", Region.class);

    assertRegionExists("Parent", "/Parent", parent);
    assertFalse(context.containsBean("/Parent"));

    Region child = context.getBean("/Parent/Child", Region.class);

    assertRegionExists("Child", "/Parent/Child", child);
    assertFalse(context.containsBean("Parent/Child"));

    Region grandchild = context.getBean("/Parent/Child/Grandchild", Region.class);

    assertRegionExists("Grandchild", "/Parent/Child/Grandchild", grandchild);
    assertFalse(context.containsBean("Parent/Child/Grandchild"));
  }
View Full Code Here


    regionFactory.setCache(cache);
    regionFactory.setName("Outer");
    regionFactory.afterPropertiesSet();

    Region outer = regionFactory.getObject();

    assertNotNull(outer);
    assertEquals("Outer", outer.getName());
    assertEquals("/Outer", outer.getFullPath());
    assertSame(outer, cache.getRegion("/Outer"));

    RegionFactoryBean subRegionFactory = new RegionFactoryBean();

    subRegionFactory.setCache(cache);
    subRegionFactory.setParent(outer);
    subRegionFactory.setName("/Outer/Inner");
    subRegionFactory.setRegionName("Inner");
    subRegionFactory.afterPropertiesSet();

    Region inner = subRegionFactory.getObject();

    assertNotNull(inner);
    assertSame(inner, outer.getSubregion("Inner"));
    assertSame(inner, cache.getRegion("/Outer/Inner"));
  }
View Full Code Here

    assertSame(inner, cache.getRegion("/Outer/Inner"));
  }

  @SuppressWarnings("rawtypes")
  private void testContext() throws Exception {
    Region parent = ctx.getBean("parent", Region.class);
    Region child = ctx.getBean("/parent/child", Region.class);
    assertNotNull(parent.getSubregion("child"));
    assertSame(child, parent.getSubregion("child"));
    assertEquals("/parent/child", child.getFullPath());
  }
View Full Code Here

    assertEquals("/parent/child", child.getFullPath());
  }

  @SuppressWarnings("rawtypes")
  public void testChildOnly() throws Exception {
    Region child = ctx.getBean("/parent/child", Region.class);
    assertEquals("/parent/child", child.getFullPath());
  }
View Full Code Here

    if (instance == null) {
      DistributedSystem ds = DistributedSystem.connect(new Properties());
      instance = CacheFactory.create(ds);
    }

    Region region = instance.getRegion(CACHE_NAME);

    if (region == null) {
      region = instance.createRegion(CACHE_NAME, new com.gemstone.gemfire.cache.AttributesFactory().create());
    }
View Full Code Here

  @Test
  public void testGemFireSubRegionCreationConfiguration() {
    assertNotNull("The Client Cache was not properly initialized!", clientCache);

    Region parent = clientCache.getRegion("Parent");

    assertNotNull(parent);
    assertEquals("Parent", parent.getName());
    assertEquals("/Parent", parent.getFullPath());

    Region child = parent.getSubregion("Child");

    assertNotNull(child);
    assertEquals("Child", child.getName());
    assertEquals("/Parent/Child", child.getFullPath());

    Region clientCacheChild = clientCache.getRegion("/Parent/Child");

    assertSame(child, clientCacheChild);
  }
View Full Code Here

  private ApplicationContext ctx;

 
  @Test
  public void testBasicRegion() throws Exception {
    @SuppressWarnings("rawtypes")
    Region region = ctx.getBean("basic", Region.class);
    assertEquals("basic", region.getName());
  }
View Full Code Here

    assertEquals("basic", region.getName());
  }

  @Test
  public void testExistingRegion() throws Exception {
    @SuppressWarnings("rawtypes")
    Region region = ctx.getBean("root", Region.class);
    // the name property seems to be ignored
    assertEquals("root", region.getName());
  }
View Full Code Here

  }

  @SuppressWarnings("rawtypes")
  @Test
  public void testRegionWithListeners() throws Exception {
    Region region = ctx.getBean("listeners", Region.class);
    assertEquals("listeners", region.getName());
    CacheListener[] listeners = region.getAttributes().getCacheListeners();
    assertEquals(2, listeners.length);
    assertSame(CacheList.class, listeners[0].getClass());
    assertSame(CacheLoad.class, region.getAttributes().getCacheLoader().getClass());
    assertSame(CacheWrite.class, region.getAttributes().getCacheWriter().getClass());
  }
View Full Code Here

  }

  @SuppressWarnings("rawtypes")
  @Test
  public void testRegionAttributes() throws Exception {
    Region region = ctx.getBean("attr-region", Region.class);
    assertEquals("attr-region", region.getName());
    RegionAttributes attr = region.getAttributes();
    assertEquals(1024, attr.getInitialCapacity());

    PartitionAttributes pa = attr.getPartitionAttributes();
    assertEquals(512, pa.getLocalMaxMemory());
    assertEquals(1, pa.getRedundantCopies());
View Full Code Here

TOP

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

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.