Package com.gemstone.gemfire.cache

Examples of com.gemstone.gemfire.cache.Region


  }

  @Test
  @SuppressWarnings("unchecked")
  public void testMixedNestedRegions() {
    Region parent = context.getBean("replicatedParent", Region.class);
    Region child = context.getBean("/replicatedParent/replicatedChild", Region.class);
    Region grandchild = context.getBean("/replicatedParent/replicatedChild/partitionedGrandchild", Region.class);

    assertNotNull(child);
    assertEquals("/replicatedParent/replicatedChild", child.getFullPath());
    assertEquals(child, parent.getSubregion("replicatedChild"));
    assertNotNull(grandchild);
    assertEquals("/replicatedParent/replicatedChild/partitionedGrandchild", grandchild.getFullPath());
    assertSame(grandchild, child.getSubregion("partitionedGrandchild"));
  }
View Full Code Here


    assertSame(grandchild, child.getSubregion("partitionedGrandchild"));
  }

  @Test
  public void testNestedRegionsWithSiblings() {
    Region parent = context.getBean("parentWithSiblings", Region.class);
    Region child1 = context.getBean("/parentWithSiblings/child1", Region.class);
    assertEquals("/parentWithSiblings/child1", child1.getFullPath());
    Region child2 = context.getBean("/parentWithSiblings/child2", Region.class);
    assertEquals("/parentWithSiblings/child2", child2.getFullPath());
    assertSame(child1, parent.getSubregion("child1"));
    assertSame(child2, parent.getSubregion("child2"));
    Region grandchild1 = context.getBean("/parentWithSiblings/child1/grandChild11", Region.class);
    assertEquals("/parentWithSiblings/child1/grandChild11", grandchild1.getFullPath());
  }
View Full Code Here

  }

  @Test
  @SuppressWarnings("unused" )
  public void testComplexNestedRegions() throws Exception {
    Region parent = context.getBean("complexNested", Region.class);
    Region child1 = context.getBean("/complexNested/child1", Region.class);
    Region child2 = context.getBean("/complexNested/child2", Region.class);
    Region grandchild11 = context.getBean("/complexNested/child1/grandChild11", Region.class);

    ReplicatedRegionFactoryBean grandchild11FactoryBean = context.getBean("&/complexNested/child1/grandChild11",
      ReplicatedRegionFactoryBean.class);

    assertNotNull(grandchild11FactoryBean);

    CacheLoader expectedCacheLoader = TestUtils.readField("cacheLoader", grandchild11FactoryBean);

    assertNotNull(expectedCacheLoader);

    CacheLoader actualCacheLoader = grandchild11.getAttributes().getCacheLoader();

    assertSame(expectedCacheLoader, actualCacheLoader);
  }
View Full Code Here

  @Test
  @SuppressWarnings({ "deprecation", "rawtypes" })
  public void testPersistentClientRegion() throws Exception {
    assertTrue(context.containsBean("persistent"));

    Region persistent = context.getBean("persistent", Region.class);

    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

    Cache cache2 = context2.getBean(Cache.class);

    assertNotNull(cache1);
    assertSame(cache1, cache2);

    Region region1 = context1.getBean(Region.class);
    Region region2 = context2.getBean(Region.class);

    assertNotNull(region1);
    assertSame(region1, region2);
    assertFalse(cache1.isClosed());
    assertFalse(region1.isDestroyed());
View Full Code Here

    assertEquals(DataPolicy.REPLICATE, replicatedDataRegionFactoryBean.getDataPolicy());
    assertFalse(replicatedDataRegionFactoryBean.getDataPolicy().withPersistence());
    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());
View Full Code Here

  @Test
  @SuppressWarnings("rawtypes")
  public void testLocalWithAttributes() throws Exception {
    assertTrue(context.containsBean("local-with-attributes"));

    Region region = context.getBean("local-with-attributes", Region.class);

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

  @Test
  @SuppressWarnings("rawtypes")
  public void testRegionLookup() throws Exception {
    Cache cache = context.getBean(Cache.class);
    Region existing = cache.createRegionFactory().create("existing");

    assertTrue(context.containsBean("lookup"));

    RegionLookupFactoryBean localRegionFactoryBean = context.getBean("&lookup", RegionLookupFactoryBean.class);
View Full Code Here

  }
 
  @Test
  @SuppressWarnings("rawtypes")
  public void testLocalPersistent() {
    Region persistentLocalRegion = context.getBean("persistent", Region.class);

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

    RegionAttributes persistentRegionAttributes = persistentLocalRegion.getAttributes();

    assertNotNull(persistentRegionAttributes);
    assertTrue(persistentRegionAttributes.getDataPolicy().withPersistence());
  }
View Full Code Here

      expectedRegionPath, region.getFullPath());
  }

  @Test
  public void testDirectLookup() {
    Region accounts = context.getBean("/Customers/Accounts", Region.class);

    assertRegionExists("Accounts", "/Customers/Accounts", accounts);
    assertFalse(context.containsBean("Customers/Accounts"));
    assertFalse(context.containsBean("/Customers"));
    assertFalse(context.containsBean("Customers"));

    Region items = context.getBean("Customers/Accounts/Orders/Items", Region.class);

    assertRegionExists("Items", "/Customers/Accounts/Orders/Items", items);
    assertFalse(context.containsBean("/Customers/Accounts/Orders/Items"));
    assertFalse(context.containsBean("/Customers/Accounts/Orders"));
    assertFalse(context.containsBean("Customers/Accounts/Orders"));
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.